mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
add support for alt+enter in fullscreen upscaled mode
This commit is contained in:
parent
ec36b6d7bc
commit
434fb4de99
@ -10,7 +10,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];
|
||||
@ -37,6 +37,7 @@ typedef struct CNCDDRAWCONFIG
|
||||
BOOL vhack;
|
||||
char screenshot_dir[MAX_PATH];
|
||||
BOOL toggle_borderless;
|
||||
BOOL toggle_upscaled;
|
||||
|
||||
/* Compatibility settings */
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define VERSION_MAJOR 6
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_BUILD 0
|
||||
#define VERSION_REVISION 2
|
||||
#define VERSION_REVISION 3
|
||||
|
||||
#define VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION
|
||||
#define VERSION_STRING ver_str(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION)
|
||||
|
10
src/config.c
10
src/config.c
@ -23,7 +23,7 @@ static DWORD cfg_get_string(LPCSTR key, LPCSTR default_value, LPSTR out_string,
|
||||
#define GET_STRING(a,b,c,d) cfg_get_string(a, b, c, d); TRACE("%s=%s\n", a, c)
|
||||
|
||||
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()
|
||||
{
|
||||
@ -52,6 +52,7 @@ void cfg_load()
|
||||
GET_BOOL(g_config.vhack, "vhack", FALSE);
|
||||
GET_STRING("screenshotdir", ".\\Screenshots\\", g_config.screenshot_dir, sizeof(g_config.screenshot_dir));
|
||||
GET_BOOL(g_config.toggle_borderless, "toggle_borderless", FALSE);
|
||||
GET_BOOL(g_config.toggle_upscaled, "toggle_upscaled", FALSE);
|
||||
|
||||
/* Compatibility settings */
|
||||
|
||||
@ -148,9 +149,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,6 +236,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"
|
||||
|
15
src/utils.c
15
src/utils.c
@ -421,7 +421,7 @@ void util_toggle_fullscreen()
|
||||
{
|
||||
mouse_unlock();
|
||||
|
||||
g_config.borderless_state = g_config.fullscreen = TRUE;
|
||||
g_config.upscaled_state = g_config.fullscreen = TRUE;
|
||||
dd_SetDisplayMode(g_ddraw->width, g_ddraw->height, g_ddraw->bpp, 0);
|
||||
|
||||
mouse_lock();
|
||||
@ -430,7 +430,7 @@ void util_toggle_fullscreen()
|
||||
{
|
||||
mouse_unlock();
|
||||
|
||||
g_config.borderless_state = g_config.fullscreen = FALSE;
|
||||
g_config.upscaled_state = g_config.fullscreen = FALSE;
|
||||
dd_SetDisplayMode(g_ddraw->width, g_ddraw->height, g_ddraw->bpp, 0);
|
||||
|
||||
//mouse_lock();
|
||||
@ -442,6 +442,11 @@ void util_toggle_fullscreen()
|
||||
{
|
||||
mouse_unlock();
|
||||
|
||||
if (g_config.toggle_upscaled)
|
||||
{
|
||||
g_config.upscaled_state = g_config.fullscreen = TRUE;
|
||||
}
|
||||
|
||||
g_config.window_state = g_config.windowed = FALSE;
|
||||
dd_SetDisplayMode(g_ddraw->width, g_ddraw->height, g_ddraw->bpp, SDM_LEAVE_WINDOWED);
|
||||
util_update_bnet_pos(0, 0);
|
||||
@ -451,6 +456,12 @@ void util_toggle_fullscreen()
|
||||
else
|
||||
{
|
||||
mouse_unlock();
|
||||
|
||||
if (g_config.toggle_upscaled)
|
||||
{
|
||||
g_config.upscaled_state = g_config.fullscreen = FALSE;
|
||||
}
|
||||
|
||||
g_config.window_state = g_config.windowed = TRUE;
|
||||
|
||||
if (g_ddraw->renderer == d3d9_render_main && !g_config.nonexclusive)
|
||||
|
@ -691,7 +691,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
}
|
||||
case WM_TOGGLE_FULLSCREEN:
|
||||
{
|
||||
if (!g_config.fullscreen || (g_config.windowed && g_config.toggle_borderless))
|
||||
if (!g_config.fullscreen || g_config.toggle_upscaled || (g_config.windowed && g_config.toggle_borderless))
|
||||
{
|
||||
/* Check if we are fullscreen/borderless already */
|
||||
if (wParam == CNC_DDRAW_SET_FULLSCREEN && (!g_config.windowed || g_config.fullscreen))
|
||||
@ -731,7 +731,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
|
||||
if (g_config.hotkeys.toggle_fullscreen &&
|
||||
wParam == g_config.hotkeys.toggle_fullscreen &&
|
||||
(!g_config.fullscreen || (g_config.windowed && g_config.toggle_borderless)) &&
|
||||
(!g_config.fullscreen || g_config.toggle_upscaled || (g_config.windowed && g_config.toggle_borderless)) &&
|
||||
context_code &&
|
||||
!key_state)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user