1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

rename custom_width/height setting to inject_resolution

This commit is contained in:
FunkyFr3sh 2024-09-09 19:17:00 +02:00
parent f83baafcf6
commit e435bf65e1
3 changed files with 16 additions and 17 deletions

View File

@ -70,8 +70,7 @@ typedef struct CNCDDRAWCONFIG
BOOL no_dinput_hook;
int refresh_rate;
int anti_aliased_fonts_min_size;
int custom_width;
int custom_height;
char inject_resolution[128];
int min_font_size;
BOOL direct3d_passthrough;
BOOL center_cursor_fix;

View File

@ -84,8 +84,7 @@ void cfg_load()
GET_BOOL(g_config.no_dinput_hook, "no_dinput_hook", FALSE);
GET_INT(g_config.refresh_rate, "refresh_rate", 0);
GET_INT(g_config.anti_aliased_fonts_min_size, "anti_aliased_fonts_min_size", 13);
GET_INT(g_config.custom_width, "custom_width", 0);
GET_INT(g_config.custom_height, "custom_height", 0);
GET_STRING("inject_resolution", "", g_config.inject_resolution, sizeof(g_config.inject_resolution));
GET_INT(g_config.min_font_size, "min_font_size", 0);
GET_BOOL(g_config.direct3d_passthrough, "direct3d_passthrough", FALSE);
GET_BOOL(g_config.center_cursor_fix, "center_cursor_fix", FALSE);
@ -313,8 +312,7 @@ static void cfg_create_ini()
"rgb555=false\n"
"no_dinput_hook=false\n"
"refresh_rate=0\n"
"custom_width=0\n"
"custom_height=0\n"
";inject_resolution=960x540\n"
"direct3d_passthrough=false\n"
"center_cursor_fix=false\n"
";fake_mode=640x480x32\n"
@ -920,14 +918,12 @@ static void cfg_create_ini()
"; Jazz Jackrabbit 2 plus\n"
"[Jazz2]\n"
"keytogglefullscreen=0x08\n"
"custom_width=800\n"
"custom_height=450\n"
"inject_resolution=800x450\n"
"\n"
"; Jazz Jackrabbit 2\n"
"[Jazz2_NonPlus]\n"
"keytogglefullscreen=0x08\n"
"custom_width=800\n"
"custom_height=450\n"
"inject_resolution=800x450\n"
"\n"
"; Jungle Storm\n"
"[Jstorm]\n"
@ -974,8 +970,7 @@ static void cfg_create_ini()
"; Note: 1070x602 is the lowest possible 16:9 resolution for the Widescreen patch (600/601 height will crash)\n"
"[iwd2]\n"
"resolutions=2\n"
"custom_width=1070\n"
"custom_height=602\n"
"inject_resolution=1070x602\n"
"\n"
"; Invictus\n"
"[Invictus]\n"

View File

@ -113,6 +113,11 @@ HRESULT dd_EnumDisplayModes(
while (--max_w % 8);
}
char* ires = &g_config.inject_resolution[0];
unsigned long custom_width = strtoul(ires, &ires, 0);
unsigned long custom_height = strtoul(ires + 1, &ires, 0);
BOOL rlf = g_config.resolutions == RESLIST_FULL;
BOOL rlm = g_config.resolutions == RESLIST_MINI;
@ -149,7 +154,7 @@ HRESULT dd_EnumDisplayModes(
{ rlf ? 1720 : 0, rlf ? 720 : 0 },
{ rlf ? 2560 : 0, rlf ? 1080 : 0 },
/* Inject custom resolution */
{ g_config.custom_width, g_config.custom_height },
{ custom_width, custom_height },
{ max_w, max_h },
};
@ -228,10 +233,10 @@ HRESULT dd_EnumDisplayModes(
while (--m.dmPelsWidth % 8);
}
if (!custom_res_injected && g_config.custom_width && g_config.custom_height)
if (!custom_res_injected && custom_width && custom_height)
{
m.dmPelsWidth = g_config.custom_width;
m.dmPelsHeight = g_config.custom_height;
m.dmPelsWidth = custom_width;
m.dmPelsHeight = custom_height;
custom_res_injected = TRUE;
}
@ -347,7 +352,7 @@ HRESULT dd_EnumDisplayModes(
if (!resolutions[i].cx || !resolutions[i].cy)
continue;
if (!(resolutions[i].cx == g_config.custom_width && resolutions[i].cy == g_config.custom_height) &&
if (!(resolutions[i].cx == custom_width && resolutions[i].cy == custom_height) &&
((max_w && resolutions[i].cx > max_w) || (max_h && resolutions[i].cy > max_h)))
{
DEVMODE m;