UI: Set 8x8 as minimum selectable resolution

Since libobs internally rounds to various powers of 2 to support SSE
functions, resolutions that are too low can get rounded to zero. libobs
will fail to startup with a zero resolution, so if a user accidentally
entered anything that rounded to zero OBS would become unusable without
manual fixing by editing the profile .ini.
This commit is contained in:
Richard Stanway committed 2020-05-24 00:48:37 +02:00
1 parent 50e1d17615
commit 0a467085d2
2 files changed
+9 -4

No files matched your search

+6 -1
View File
@@ -103,6 +103,11 @@ static inline bool ResTooHigh(uint32_t cx, uint32_t cy)
return cx > 16384 || cy > 16384;
}
static inline bool ResTooLow(uint32_t cx, uint32_t cy)
{
return cx < 8 || cy < 8;
}
/* parses "[width]x[height]", string, i.e. 1024x768 */
static bool ConvertResText(const char *res, uint32_t &cx, uint32_t &cy)
{
@@ -137,7 +142,7 @@ static bool ConvertResText(const char *res, uint32_t &cx, uint32_t &cy)
if (lexer_getbasetoken(lex, &token, IGNORE_WHITESPACE))
return false;
if (ResTooHigh(cx, cy)) {
if (ResTooHigh(cx, cy) || ResTooLow(cx, cy)) {
cx = cy = 0;
return false;
}