From e306405cd1b205abaeb252a6e99f18b62e76eddc Mon Sep 17 00:00:00 2001 From: BearOso Date: Mon, 13 Mar 2023 13:57:30 -0500 Subject: [PATCH] win32: Add fullscreen on ROM open option. --- win32/rsrc/resource.h | 1 + win32/rsrc/snes9x.rc | 6 ++++-- win32/wconfig.cpp | 2 ++ win32/wsnes9x.cpp | 10 ++++++++++ win32/wsnes9x.h | 1 + 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/win32/rsrc/resource.h b/win32/rsrc/resource.h index 766b0501..085455c7 100644 --- a/win32/rsrc/resource.h +++ b/win32/rsrc/resource.h @@ -144,6 +144,7 @@ #define IDC_STRETCH 1109 #define IDC_FULLSCREEN 1110 #define IDC_EMUFULLSCREEN 1111 +#define IDC_FULLSCREEN_ON_OPEN 1112 #define IDC_TRANS 1113 #define IDC_HIRES 1114 #define IDC_CHEAT_CODE 1115 diff --git a/win32/rsrc/snes9x.rc b/win32/rsrc/snes9x.rc index dd22bb2f..c84bec31 100644 --- a/win32/rsrc/snes9x.rc +++ b/win32/rsrc/snes9x.rc @@ -132,7 +132,8 @@ BEGIN LTEXT "%",IDC_LABEL_SFXSPEED_2,156,138,131,14,SS_CENTERIMAGE CONTROL "Ask for confirmation when saving/loading",IDC_CONFIRMSAVELOAD, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,192,145,8 - CONTROL "Add Snes9x to registry for supported file types", IDC_ADD_REGISTRY, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 102, 204, 180, 8 + CONTROL "Add Snes9x to registry for supported file types",IDC_ADD_REGISTRY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,204,180,8 END IDD_OPEN_ROM DIALOGEX 0, 0, 430, 223 @@ -185,7 +186,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,240,270,48,14 PUSHBUTTON "Cancel",IDCANCEL,294,270,48,14 - COMBOBOX IDC_OUTPUTMETHOD,72,18,95,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_OUTPUTMETHOD,72,17,95,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Fullscreen",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,30,50,10 CONTROL "Emulate Fullscreen",IDC_EMUFULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,41,75,10 CONTROL "Stretch Image",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,52,60,10 @@ -231,6 +232,7 @@ BEGIN CONTROL "Scale messages with EPX if possible",IDC_MESSAGES_SCALE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,174,132,8 PUSHBUTTON "Parameters...",IDC_SHADER_GLSL_PARAMETERS,282,246,54,14,WS_DISABLED + CONTROL "Fullscreen on ROM Open",IDC_FULLSCREEN_ON_OPEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,30,97,10,WS_EX_RIGHT END IDD_CHEATER DIALOGEX 0, 0, 378, 189 diff --git a/win32/wconfig.cpp b/win32/wconfig.cpp index 2cc97685..2bba7806 100644 --- a/win32/wconfig.cpp +++ b/win32/wconfig.cpp @@ -87,6 +87,7 @@ void WinSetDefaultValues () GUI.LockDirectories = false; GUI.window_maximized = false; GUI.EmulatedFullscreen = false; + GUI.FullscreenOnOpen = false; WinDeleteRecentGamesList (); @@ -793,6 +794,7 @@ void WinRegisterConfigItems() AddUInt("Fullscreen:Depth", GUI.FullscreenMode.depth, 16); AddUInt("Fullscreen:RefreshRate", GUI.FullscreenMode.rate, 60); AddBool("Fullscreen:DoubleBuffered", GUI.DoubleBuffered, false); + AddBoolC("Fullscreen:FullscreenOnOpen", GUI.FullscreenOnOpen, false, "Change to fullscreen when opening a ROM."); AddBoolC("Fullscreen:EmulateFullscreen", GUI.EmulateFullscreen, true,"true makes snes9x create a window that spans the entire screen when going fullscreen"); AddBoolC("HideMenu", GUI.HideMenu, false, "true to auto-hide the menu bar on startup."); AddBoolC("Vsync", GUI.Vsync, false, "true to enable Vsync"); diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 9b3788c4..cc477d5a 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -4008,6 +4008,13 @@ static bool LoadROM(const TCHAR *filename, const TCHAR *filename2 /*= NULL*/) { Settings.Paused = false; S9xRestoreWindowTitle(); + if (GUI.FullscreenOnOpen) + { + if (!GUI.FullScreen && !GUI.EmulatedFullscreen) + ToggleFullScreen(); + SetMenu(GUI.hWnd, NULL); + } + return !Settings.StopEmulation; } @@ -7567,6 +7574,8 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hDlg, IDC_FULLSCREEN, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); if (GUI.EmulateFullscreen) SendDlgItemMessage(hDlg, IDC_EMUFULLSCREEN, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (GUI.FullscreenOnOpen) + SendDlgItemMessage(hDlg, IDC_FULLSCREEN_ON_OPEN, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); if (Settings.BilinearFilter) SendDlgItemMessage(hDlg, IDC_BILINEAR, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); if (Settings.DisplayFrameRate) @@ -7972,6 +7981,7 @@ updateFilterBox2: GUI.IntegerScaling = (bool)(IsDlgButtonChecked(hDlg, IDC_INTEGERSCALING) == BST_CHECKED); fullscreenWanted = (bool)(IsDlgButtonChecked(hDlg, IDC_FULLSCREEN)==BST_CHECKED); GUI.EmulateFullscreen = (bool)(IsDlgButtonChecked(hDlg, IDC_EMUFULLSCREEN)==BST_CHECKED); + GUI.FullscreenOnOpen = (bool)(IsDlgButtonChecked(hDlg, IDC_FULLSCREEN_ON_OPEN) == BST_CHECKED); Settings.DisplayFrameRate = IsDlgButtonChecked(hDlg, IDC_SHOWFPS); GUI.BlendHiRes = (bool)(IsDlgButtonChecked(hDlg, IDC_HIRESBLEND)==BST_CHECKED); diff --git a/win32/wsnes9x.h b/win32/wsnes9x.h index aac51221..d9fe640d 100644 --- a/win32/wsnes9x.h +++ b/win32/wsnes9x.h @@ -162,6 +162,7 @@ struct sGUI { bool AVIHiRes; bool DoubleBuffered; bool FullScreen; + bool FullscreenOnOpen; bool Stretch; bool HeightExtend; bool AspectRatio;