Win32 - Memwatch - added Cancel option to Save Changes? message box

This commit is contained in:
adelikat 2009-02-25 18:58:50 +00:00
parent 1974deb21d
commit f26e54b4a9
4 changed files with 47 additions and 33 deletions

View File

@ -1,4 +1,5 @@
---version 2.0.4 yet to be released--- ---version 2.0.4 yet to be released---
25-feb-2009 - adelikat - 2in32 - Memwatch - added cancel to save changes? message box
22-feb-2009 - adelikat - win32 - Lua - made speedmode("turbo") turn on turbo (which employs frameskipping) rather than max speed 22-feb-2009 - adelikat - win32 - Lua - made speedmode("turbo") turn on turbo (which employs frameskipping) rather than max speed
22-feb-2009 - adelikat - Increased lua gui.text height (and DrawTextTransWH() height) 22-feb-2009 - adelikat - Increased lua gui.text height (and DrawTextTransWH() height)
21-feb-2009 - adelikat - win32 - Lua - Added -lua commandline argment, loads a lua script on startup 21-feb-2009 - adelikat - win32 - Lua - Added -lua commandline argment, loads a lua script on startup

View File

@ -379,6 +379,8 @@ void DoFCEUExit()
if(exiting) //Eh, oops. I'll need to try to fix this later. if(exiting) //Eh, oops. I'll need to try to fix this later.
return; return;
if (CloseMemoryWatch()) //If user was asked to save changes in the memory watch dialog, and chose cancel, don't close FCEUX!
{
if(goptions & GOO_CONFIRMEXIT) if(goptions & GOO_CONFIRMEXIT)
{ {
//Wolfenstein 3D had cute exit messages. //Wolfenstein 3D had cute exit messages.
@ -398,7 +400,7 @@ void DoFCEUExit()
} }
} }
CloseMemoryWatch();
KillDebugger(); //mbg merge 7/19/06 added KillDebugger(); //mbg merge 7/19/06 added
@ -408,6 +410,7 @@ void DoFCEUExit()
exiting = 1; exiting = 1;
closeGame = true;//mbg 6/30/06 - for housekeeping purposes we need to exit after the emulation cycle finishes closeGame = true;//mbg 6/30/06 - for housekeeping purposes we need to exit after the emulation cycle finishes
} }
}
void FCEUD_OnCloseGame() void FCEUD_OnCloseGame()
{ {

View File

@ -631,24 +631,34 @@ void OpenMemwatchRecentFile(int memwRFileNumber)
//TODO: Remove this file from the recent list //TODO: Remove this file from the recent list
} }
void CloseMemoryWatch() bool CloseMemoryWatch()
{ {
int result = 0; //Flag for asking to save changes
if(hwndMemWatch) if(hwndMemWatch)
{ {
SaveStrings(); SaveStrings();
if (fileChanged==true) if (fileChanged)
{ {
if(MessageBox(hwndMemWatch, "Save Changes?", "Memory Watch Settings", MB_YESNO)==IDYES) result = MessageBox(hwndMemWatch, "Save Changes?", "Memory Watch Settings", MB_YESNOCANCEL);
if (result == IDYES)
{ {
SaveMemWatch(); SaveMemWatch();
}
}
DestroyWindow(hwndMemWatch); DestroyWindow(hwndMemWatch);
hwndMemWatch=0; hwndMemWatch=0;
return true; //true = User did not choose to cancel operation
}
else if (result == IDNO)
{
DestroyWindow(hwndMemWatch);
hwndMemWatch=0;
return true; //Don't run SaveMemWatch, but return true
}
else
return false; //User requested cancel, so abort the attempt to close
}
} }
} }
//New File //New File
@ -764,7 +774,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
switch(LOWORD(wParam)) switch(LOWORD(wParam))
{ {
case MEMW_FILE_CLOSE: case MEMW_FILE_CLOSE:
CloseMemoryWatch(); if (CloseMemoryWatch())
RamChangeInitialize = false; RamChangeInitialize = false;
break; break;

View File

@ -1,6 +1,6 @@
void UpdateMemWatch(); void UpdateMemWatch();
void CreateMemWatch(); void CreateMemWatch();
void CloseMemoryWatch(); bool CloseMemoryWatch();
void AddMemWatch(char memaddress[32]); void AddMemWatch(char memaddress[32]);
void RamChange(); void RamChange();
extern char * MemWatchDir; extern char * MemWatchDir;