From 19787b12f18b828cc2b95b298fd0faa249589b0f Mon Sep 17 00:00:00 2001 From: BearOso Date: Fri, 17 Feb 2023 16:57:09 -0600 Subject: [PATCH] win32: Add default option to not add entries to registry. --- win32/rsrc/resource.h | 1 + win32/rsrc/snes9x.rc | 7 ++++--- win32/wconfig.cpp | 1 + win32/wsnes9x.cpp | 10 ++++++++-- win32/wsnes9x.h | 2 ++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/win32/rsrc/resource.h b/win32/rsrc/resource.h index 657aeda9..3957bbcf 100644 --- a/win32/rsrc/resource.h +++ b/win32/rsrc/resource.h @@ -98,6 +98,7 @@ #define IDC_SFXSPEED 1072 #define IDC_SFXSPEED_SPIN 1073 #define IDC_CONFIRMSAVELOAD 1074 +#define IDC_ADD_REGISTRY 1075 #define IDC_HOSTNAME 1086 #define IDC_PORTNUMBER 1087 #define IDC_CLEARHISTORY 1088 diff --git a/win32/rsrc/snes9x.rc b/win32/rsrc/snes9x.rc index 8ff3c879..f556ba52 100644 --- a/win32/rsrc/snes9x.rc +++ b/win32/rsrc/snes9x.rc @@ -89,7 +89,7 @@ BEGIN EDITTEXT IDC_DISCLAIMER,6,6,222,148,ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL,WS_EX_STATICEDGE END -IDD_EMU_SETTINGS DIALOGEX 0, 0, 343, 228 +IDD_EMU_SETTINGS DIALOGEX 0, 0, 343, 238 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU CAPTION "APP - Emulator Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -111,8 +111,8 @@ BEGIN CONTROL "Pause When Inactive",IDC_INACTIVE_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,156,96,8 CONTROL "Custom ROM Open Dialog",IDC_CUSTOMROMOPEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,168,114,8 CONTROL "Hi-Res AVI Recording",IDC_HIRESAVI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,180,114,8 - DEFPUSHBUTTON "&OK",IDOK,233,205,48,14 - PUSHBUTTON "&Cancel",IDCANCEL,287,205,48,14 + DEFPUSHBUTTON "&OK",IDOK,233,215,48,14 + PUSHBUTTON "&Cancel",IDCANCEL,287,215,48,14 COMBOBOX IDC_DIRCOMBO,42,30,53,30,CBS_DROPDOWNLIST | WS_TABSTOP RTEXT "Directory:",IDC_LABEL_FREEZE,0,30,38,12,SS_CENTERIMAGE RTEXT "Auto-Save S-RAM",IDC_LABEL_ASRAM,12,47,84,14,SS_CENTERIMAGE @@ -132,6 +132,7 @@ 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 END IDD_OPEN_ROM DIALOGEX 0, 0, 430, 223 diff --git a/win32/wconfig.cpp b/win32/wconfig.cpp index 01422e28..2fbbb9bc 100644 --- a/win32/wconfig.cpp +++ b/win32/wconfig.cpp @@ -814,6 +814,7 @@ void WinRegisterConfigItems() AddUIntC("RewindGranularity", GUI.rewindGranularity, 1, "rewind granularity - rewind takes a snapshot each x frames"); AddBoolC("PauseWhenInactive", GUI.InactivePause, TRUE, "true to pause Snes9x when it is not the active window"); AddBoolC("CustomRomOpenDialog", GUI.CustomRomOpen, false, "false to use standard Windows open dialog for the ROM open dialog"); + AddBoolC("AddToRegistry", GUI.AddToRegistry, false, "true to add entries to registry for file type associations"); AddBoolC("AVIHiRes", GUI.AVIHiRes, false, "true to record AVI in Hi-Res scale"); AddBoolC("ConfirmSaveLoad", GUI.ConfirmSaveLoad, false, "true to ask for confirmation when saving/loading"); // AddUIntC("Language", GUI.Language, 0, "0=English, 1=Nederlands"); // NYI diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 67ee495b..3dce543a 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -5338,6 +5338,7 @@ INT_PTR CALLBACK DlgEmulatorProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar SendDlgItemMessage(hDlg, IDC_SFXSPEED_SPIN, UDM_SETPOS, 0, Settings.SuperFXClockMultiplier); CheckDlgButton(hDlg,IDC_INACTIVE_PAUSE,GUI.InactivePause ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hDlg,IDC_CUSTOMROMOPEN,GUI.CustomRomOpen ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hDlg, IDC_ADD_REGISTRY, GUI.AddToRegistry ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hDlg,IDC_HIRESAVI,GUI.AVIHiRes ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hDlg, IDC_CONFIRMSAVELOAD, GUI.ConfirmSaveLoad ? BST_CHECKED : BST_UNCHECKED); @@ -5431,6 +5432,7 @@ INT_PTR CALLBACK DlgEmulatorProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar GUI.CustomRomOpen = (BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_CUSTOMROMOPEN)); GUI.AVIHiRes = (BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_HIRESAVI)); GUI.ConfirmSaveLoad = (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_CONFIRMSAVELOAD)); + GUI.AddToRegistry = (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_ADD_REGISTRY)); Settings.TurboSkipFrames=SendDlgItemMessage(hDlg, IDC_SPIN_TURBO_SKIP, UDM_GETPOS, 0,0); Settings.AutoMaxSkipFrames=SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP, UDM_GETPOS, 0,0); @@ -7321,8 +7323,12 @@ void LoadExts(void) curr=valid_ext; valid_ext=valid_ext->next; delete curr; - RegisterProgid(); - RegisterExts(); + + if (GUI.AddToRegistry) + { + RegisterProgid(); + RegisterExts(); + } } void MakeExtFile(void) diff --git a/win32/wsnes9x.h b/win32/wsnes9x.h index ec9925f7..a3e7fb75 100644 --- a/win32/wsnes9x.h +++ b/win32/wsnes9x.h @@ -260,6 +260,8 @@ struct sGUI { // rewinding unsigned int rewindBufferSize; unsigned int rewindGranularity; + + bool AddToRegistry; }; //TURBO masks