win32: add option to confirm save/load operations (#555)

This commit is contained in:
OV2 2019-08-03 15:44:08 +02:00
parent b091b90547
commit 9377e50a7d
5 changed files with 32 additions and 6 deletions

View File

@ -96,6 +96,7 @@
#define IDC_REWIND_GRANULARITY_SPIN 1071
#define IDC_SFXSPEED 1072
#define IDC_SFXSPEED_SPIN 1073
#define IDC_CONFIRMSAVELOAD 1074
#define IDC_HOSTNAME 1086
#define IDC_PORTNUMBER 1087
#define IDC_CLEARHISTORY 1088

View File

@ -80,7 +80,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, 342, 200
IDD_EMU_SETTINGS DIALOGEX 0, 0, 343, 228
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
@ -88,7 +88,7 @@ BEGIN
EDITTEXT IDC_CUSTOM_FOLDER_FIELD,102,28,180,14,ES_AUTOHSCROLL
PUSHBUTTON "&Browse...",IDC_BROWSE,288,28,48,14
EDITTEXT IDC_AUTO_SAVE_DELAY,102,47,49,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Spin2",IDC_SRAM_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,323,51,11,13
CONTROL "Spin2",IDC_SRAM_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,324,51,11,13
EDITTEXT IDC_MAX_SKIP,102,66,49,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Spin3",IDC_SPIN_MAX_SKIP,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,309,70,11,13
EDITTEXT IDC_TURBO_SKIP,102,85,49,14,ES_AUTOHSCROLL | ES_NUMBER
@ -102,8 +102,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,234,180,48,14
PUSHBUTTON "&Cancel",IDCANCEL,288,180,48,14
DEFPUSHBUTTON "&OK",IDOK,233,205,48,14
PUSHBUTTON "&Cancel",IDCANCEL,287,205,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
@ -121,6 +121,8 @@ BEGIN
LTEXT "frames",IDC_LABEL_GRANU_TEXT,156,120,131,14,SS_CENTERIMAGE
RTEXT "SuperFX speed:",IDC_LABEL_SFXSPEED,18,138,78,14,SS_CENTERIMAGE
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
END
IDD_OPEN_ROM DIALOGEX 0, 0, 430, 223
@ -617,8 +619,8 @@ BEGIN
IDD_EMU_SETTINGS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 334
BOTTOMMARGIN, 191
RIGHTMARGIN, 335
BOTTOMMARGIN, 219
END
IDD_OPEN_ROM, DIALOG

View File

@ -809,6 +809,7 @@ void WinRegisterConfigItems()
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("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
AddBoolC("FrameAdvanceSkipsNonInput", GUI.FASkipsNonInput, false, "causes frame advance to fast-forward past frames where the game is definitely not checking input, such as during lag or loading time. EXPERIMENTAL");
AddBool("MovieDefaultClearSRAM", GUI.MovieClearSRAM, false);

View File

@ -3627,6 +3627,25 @@ void FreezeUnfreeze (const char *filename, bool8 freeze)
}
#endif
if (GUI.ConfirmSaveLoad)
{
std::string msg, title;
if (freeze)
{
msg = "Are you sure you want to SAVE to\n";
title = "Confirm SAVE";
}
else
{
msg = "Are you sure you want to LOAD from\n";
title = "Confirm LOAD";
}
msg += filename;
int res = MessageBox(GUI.hWnd, _tFromChar(msg.c_str()), _tFromChar(title.c_str()), MB_YESNO | MB_ICONQUESTION);
if (res != IDYES)
return;
}
S9xSetPause (PAUSE_FREEZE_FILE);
if (freeze)
@ -5228,6 +5247,7 @@ INT_PTR CALLBACK DlgEmulatorProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
CheckDlgButton(hDlg,IDC_INACTIVE_PAUSE,GUI.InactivePause ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg,IDC_CUSTOMROMOPEN,GUI.CustomRomOpen ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg,IDC_HIRESAVI,GUI.AVIHiRes ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_CONFIRMSAVELOAD, GUI.ConfirmSaveLoad ? BST_CHECKED : BST_UNCHECKED);
int inum = 0;
lstrcpy(paths[inum++],GUI.RomDir);
@ -5318,6 +5338,7 @@ INT_PTR CALLBACK DlgEmulatorProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
GUI.InactivePause = (BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_INACTIVE_PAUSE));
GUI.CustomRomOpen = (BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_CUSTOMROMOPEN));
GUI.AVIHiRes = (BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_HIRESAVI));
GUI.ConfirmSaveLoad = (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_CONFIRMSAVELOAD));
Settings.TurboSkipFrames=SendDlgItemMessage(hDlg, IDC_SPIN_TURBO_SKIP, UDM_GETPOS, 0,0);
Settings.AutoMaxSkipFrames=SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP, UDM_GETPOS, 0,0);

View File

@ -186,6 +186,7 @@ struct sGUI {
bool InactivePause;
bool CustomRomOpen;
bool ConfirmSaveLoad;
bool FASkipsNonInput;
bool FAMute;
int ScreenDepth;