1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-14 22:03:27 +01:00

add support for alt+enter in fullscreen upscaled mode

This commit is contained in:
FunkyFr3sh 2024-12-04 21:57:52 +01:00
parent eeefbb9b71
commit 952fe4fe1a
4 changed files with 17 additions and 12 deletions

View File

@ -9,7 +9,7 @@ typedef struct CNCDDRAWCONFIG
{
RECT window_rect;
int window_state;
int borderless_state;
int upscaled_state;
char ini_path[MAX_PATH];
char game_path[MAX_PATH];
char process_file_name[MAX_PATH];

View File

@ -138,6 +138,7 @@ typedef struct CNCDDRAW
BOOL accurate_timers;
BOOL resizable;
BOOL toggle_borderless;
BOOL toggle_upscaled;
BOOL nonexclusive;
BOOL fixpitch;
int fixchilds;

View File

@ -16,7 +16,7 @@ static void cfg_init();
static void cfg_create_ini();
CNCDDRAWCONFIG g_config =
{ .window_rect = {.left = -32000, .top = -32000, .right = 0, .bottom = 0 }, .window_state = -1, .borderless_state = -1 };
{ .window_rect = {.left = -32000, .top = -32000, .right = 0, .bottom = 0 }, .window_state = -1, .upscaled_state = -1 };
void cfg_load()
{
@ -41,6 +41,7 @@ void cfg_load()
g_ddraw->accurate_timers = cfg_get_bool("accuratetimers", FALSE);
g_ddraw->resizable = cfg_get_bool("resizable", TRUE);
g_ddraw->toggle_borderless = cfg_get_bool("toggle_borderless", FALSE);
g_ddraw->toggle_upscaled = cfg_get_bool("toggle_upscaled", FALSE);
g_ddraw->nonexclusive = cfg_get_bool("nonexclusive", FALSE);
g_ddraw->fixpitch = cfg_get_bool("fixpitch", FALSE);
g_ddraw->fixchilds = cfg_get_int("fixchilds", FIX_CHILDS_DETECT_PAINT);
@ -231,9 +232,9 @@ void cfg_save()
WritePrivateProfileString(section, "windowed", g_config.window_state ? "true" : "false", g_config.ini_path);
}
if (g_config.borderless_state != -1)
if (g_config.upscaled_state != -1)
{
WritePrivateProfileString(section, "fullscreen", g_config.borderless_state ? "true" : "false", g_config.ini_path);
WritePrivateProfileString(section, "fullscreen", g_config.upscaled_state ? "true" : "false", g_config.ini_path);
}
}
@ -315,6 +316,9 @@ static void cfg_create_ini()
"; Switch between windowed/borderless modes with alt+enter rather than windowed/fullscreen modes\n"
"toggle_borderless=false\n"
"\n"
"; Switch between windowed/fullscreen upscaled modes with alt+enter rather than windowed/fullscreen modes\n"
"toggle_upscaled=false\n"
"\n"
"\n"
"\n"
"; ### Compatibility settings ###\n"

View File

@ -287,7 +287,7 @@ void util_toggle_fullscreen()
{
mouse_unlock();
g_config.upscaled_state = g_config.fullscreen = TRUE;
g_config.upscaled_state = g_ddraw->fullscreen = TRUE;
dd_SetDisplayMode(g_ddraw->width, g_ddraw->height, g_ddraw->bpp, 0);
mouse_lock();
@ -296,7 +296,7 @@ void util_toggle_fullscreen()
{
mouse_unlock();
g_config.upscaled_state = g_config.fullscreen = FALSE;
g_config.upscaled_state = g_ddraw->fullscreen = FALSE;
dd_SetDisplayMode(g_ddraw->width, g_ddraw->height, g_ddraw->bpp, 0);
//mouse_lock();
@ -308,12 +308,12 @@ void util_toggle_fullscreen()
{
mouse_unlock();
if (g_config.toggle_upscaled)
if (g_ddraw->toggle_upscaled)
{
g_config.upscaled_state = g_config.fullscreen = TRUE;
g_config.upscaled_state = g_ddraw->fullscreen = TRUE;
}
g_config.window_state = g_config.windowed = FALSE;
g_config.window_state = g_ddraw->windowed = FALSE;
dd_SetDisplayMode(g_ddraw->width, g_ddraw->height, g_ddraw->bpp, SDM_LEAVE_WINDOWED);
util_update_bnet_pos(0, 0);
@ -323,12 +323,12 @@ void util_toggle_fullscreen()
{
mouse_unlock();
if (g_config.toggle_upscaled)
if (g_ddraw->toggle_upscaled)
{
g_config.upscaled_state = g_config.fullscreen = FALSE;
g_config.upscaled_state = g_ddraw->fullscreen = FALSE;
}
g_config.window_state = g_config.windowed = TRUE;
g_config.window_state = g_ddraw->windowed = TRUE;
if (g_ddraw->renderer == d3d9_render_main)
{