From e80b91bd56c36a45fa14228116ab40bff604f1ec Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 9 May 2009 01:10:08 +0000 Subject: [PATCH] Win32 - Ramwatch - fixed AskSave() when called from main window --- desmume/src/windows/main.cpp | 4 ++-- desmume/src/windows/ram_search.cpp | 3 +++ desmume/src/windows/ramwatch.cpp | 5 ++--- desmume/src/windows/ramwatch.h | 3 +++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index c17c40357..41fd99162 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -2587,7 +2587,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_CLOSE: { NDS_Pause(); - if (AskSave()) //Ask Save comes from the Ram Watch dialog. The dialog uses .wch files and this allows asks the user if he wants to save changes first, should he cancel, closing will not happen + if (true/*AskSave()*/) //Ask Save comes from the Ram Watch dialog. The dialog uses .wch files and this allows asks the user if he wants to save changes first, should he cancel, closing will not happen { //Save window size WritePrivateProfileInt("Video","Window Size",windowSize,IniName); @@ -2812,7 +2812,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM if(SPU_user) SPU_user->ShutUp(); return 0; case IDM_QUIT: - DestroyWindow(hwnd); + if (AskSave()) DestroyWindow(hwnd); return 0; case IDM_OPEN: return OpenFile(); diff --git a/desmume/src/windows/ram_search.cpp b/desmume/src/windows/ram_search.cpp index 0ed8f6f2f..7e194e7c9 100644 --- a/desmume/src/windows/ram_search.cpp +++ b/desmume/src/windows/ram_search.cpp @@ -1,3 +1,6 @@ +//RamSearch dialog was copied and adapted from GENS11: http://code.google.com/p/gens-rerecording/ +//Authors: Upthorn, Nitsuja, adelikat + // A few notes about this implementation of a RAM search window: // // Speed of update was one of the highest priories. diff --git a/desmume/src/windows/ramwatch.cpp b/desmume/src/windows/ramwatch.cpp index b6d83be68..f41f02326 100644 --- a/desmume/src/windows/ramwatch.cpp +++ b/desmume/src/windows/ramwatch.cpp @@ -31,8 +31,6 @@ int ramw_x, ramw_y; //Used to store ramwatch dialog window positions AddressWatcher rswatches[MAX_WATCH_COUNT]; int WatchCount=0; -#define MESSAGEBOXPARENT (RamWatchHWnd ? RamWatchHWnd : MainWindow->getHWnd()) - bool QuickSaveWatches(); bool ResetWatches(); @@ -217,7 +215,8 @@ bool AskSave() //returns false only if a save was attempted but failed or was cancelled if (RWfileChanged) { - int answer = MessageBox(MESSAGEBOXPARENT, "Save Changes?", "Ram Watch", MB_YESNOCANCEL); + HWND Hwnd = GetMainHWND(); + int answer = MessageBox(Hwnd, "Save Changes?", "Ram Watch", MB_YESNOCANCEL); if(answer == IDYES) if(!QuickSaveWatches()) return false; diff --git a/desmume/src/windows/ramwatch.h b/desmume/src/windows/ramwatch.h index b8c588d23..0272b8ebb 100644 --- a/desmume/src/windows/ramwatch.h +++ b/desmume/src/windows/ramwatch.h @@ -1,3 +1,6 @@ +//RamWatch dialog was copied and adapted from GENS11: http://code.google.com/p/gens-rerecording/ +//Authors: Upthorn, Nitsuja, adelikat + #ifndef RAMWATCH_H #define RAMWATCH_H #include "windows.h"