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---
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 - Increased lua gui.text height (and DrawTextTransWH() height)
21-feb-2009 - adelikat - win32 - Lua - Added -lua commandline argment, loads a lua script on startup

View File

@ -379,34 +379,37 @@ void DoFCEUExit()
if(exiting) //Eh, oops. I'll need to try to fix this later.
return;
if(goptions & GOO_CONFIRMEXIT)
if (CloseMemoryWatch()) //If user was asked to save changes in the memory watch dialog, and chose cancel, don't close FCEUX!
{
//Wolfenstein 3D had cute exit messages.
const char * const emsg[7]={"Are you sure you want to leave? I'll become lonely!",
"A strange game. The only winning move is not to play. How about a nice game of chess?",
"If you exit, I'll... EAT YOUR MOUSE.",
"You can never really exit, you know.",
"E.X.I.T?",
"I'm sorry, you missed your exit. There is another one in 19 miles",
"Silly Exit Message goes here"
};
if(IDYES != MessageBox(hAppWnd, emsg[rand() & 6], "Exit FCE Ultra?", MB_ICONQUESTION | MB_YESNO) )
if(goptions & GOO_CONFIRMEXIT)
{
return;
//Wolfenstein 3D had cute exit messages.
const char * const emsg[7]={"Are you sure you want to leave? I'll become lonely!",
"A strange game. The only winning move is not to play. How about a nice game of chess?",
"If you exit, I'll... EAT YOUR MOUSE.",
"You can never really exit, you know.",
"E.X.I.T?",
"I'm sorry, you missed your exit. There is another one in 19 miles",
"Silly Exit Message goes here"
};
if(IDYES != MessageBox(hAppWnd, emsg[rand() & 6], "Exit FCE Ultra?", MB_ICONQUESTION | MB_YESNO) )
{
return;
}
}
}
CloseMemoryWatch();
KillDebugger(); //mbg merge 7/19/06 added
KillDebugger(); //mbg merge 7/19/06 added
FCEUI_StopMovie();
FCEUD_AviStop();
FCEUI_StopMovie();
FCEUD_AviStop();
exiting = 1;
closeGame = true;//mbg 6/30/06 - for housekeeping purposes we need to exit after the emulation cycle finishes
exiting = 1;
closeGame = true;//mbg 6/30/06 - for housekeeping purposes we need to exit after the emulation cycle finishes
}
}
void FCEUD_OnCloseGame()

View File

@ -383,8 +383,8 @@ bool iftextchanged()
}
for(;j<LABELLENGTH;j++)
{
if(labels[i][j] != NULL)
return true;
if(labels[i][j] != NULL)
return true;
}
}
return false;
@ -631,24 +631,34 @@ void OpenMemwatchRecentFile(int memwRFileNumber)
//TODO: Remove this file from the recent list
}
void CloseMemoryWatch()
bool CloseMemoryWatch()
{
int result = 0; //Flag for asking to save changes
if(hwndMemWatch)
{
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();
DestroyWindow(hwndMemWatch);
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
}
DestroyWindow(hwndMemWatch);
hwndMemWatch=0;
}
}
//New File
@ -764,8 +774,8 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
switch(LOWORD(wParam))
{
case MEMW_FILE_CLOSE:
CloseMemoryWatch();
RamChangeInitialize = false;
if (CloseMemoryWatch())
RamChangeInitialize = false;
break;
case ACCEL_CTRL_O:

View File

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