make sure our custom res fits within MAXVIDMODES

33 are alot so this probably will never be the case (i hope)
This commit is contained in:
Alug committed 2025-11-09 20:21:30 +01:00
1 parent 517723f9c1
commit 48f2d0ff83
1 file changed
+11 -7
+11 -7
View File
@@ -1434,7 +1434,6 @@ void I_SetPalette(RGBA_t *palette)
}
}
// make sure the canonical resolutions are always available
static const struct {
const int w, h;
@@ -1563,13 +1562,18 @@ static void I_FillScreenResolutionsList(boolean force)
// did not find mode from list, make custom resolution if the values somewhat make sense
if (needcustom)
{
snprintf(desired_resolution, sizeof(desired_resolution), "%dx%d", custom_w, custom_h);
if (list_size < MAXWINMODES)
{
snprintf(desired_resolution, sizeof(desired_resolution), "%dx%d", custom_w, custom_h);
// [FG] if the desired resolution not in the list, append it
windowedModes[list_size].name = strdup(desired_resolution);
windowedModes[list_size].w = custom_w;
windowedModes[list_size].h = custom_h;
list_size++;
// [FG] if the desired resolution not in the list, append it
windowedModes[list_size].name = strdup(desired_resolution);
windowedModes[list_size].w = custom_w;
windowedModes[list_size].h = custom_h;
list_size++;
}
else
CONS_Alert(CONS_ERROR, "Could not set custom resolution!\n");
}
}