From b1bac119bb96d33b56d5d9586411a04c75a93179 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 14 Aug 2011 18:54:07 +0000 Subject: [PATCH] win32: make printscreen save as suspend emulation --- desmume/src/windows/hotkey.cpp | 6 ++++++ desmume/src/windows/main.cpp | 23 ++++++++++++----------- desmume/src/windows/main.h | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index fc969949c..a00da4f0d 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -100,6 +100,8 @@ void HK_SearchCheats(int, bool justPressed) } void HK_QuickScreenShot(int param, bool justPressed) { + bool unpause = NDS_Pause(false); + char buffer[MAX_PATH]; ZeroMemory(buffer, sizeof(buffer)); path.getpath(path.SCREENSHOTS, buffer); @@ -127,9 +129,13 @@ void HK_QuickScreenShot(int param, bool justPressed) } break; } + + if(unpause) NDS_UnPause(false); } void HK_PrintScreen(int param, bool justPressed) { + if(!justPressed) return; + char outFilename[MAX_PATH]; OPENFILENAME ofn; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index a03d83d06..c5d50de70 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1978,19 +1978,20 @@ DWORD WINAPI run() return 1; } -void NDS_Pause(bool showMsg) +//returns true if it just now paused +bool NDS_Pause(bool showMsg) { - if (!paused) - { - emu_halt(); - paused = TRUE; - SPU_Pause(1); - while (!paused) {} - if (showMsg) INFO("Emulation paused\n"); + if(paused) return false; - SetWindowText(MainWindow->getHWnd(), "Paused"); - MainWindowToolbar->ChangeButtonBitmap(IDM_PAUSE, IDB_PLAY); - } + emu_halt(); + paused = TRUE; + SPU_Pause(1); + while (!paused) {} + if (showMsg) INFO("Emulation paused\n"); + + SetWindowText(MainWindow->getHWnd(), "Paused"); + MainWindowToolbar->ChangeButtonBitmap(IDM_PAUSE, IDB_PLAY); + return true; } void NDS_UnPause(bool showMsg) diff --git a/desmume/src/windows/main.h b/desmume/src/windows/main.h index f5a9bcebf..28509f1a5 100644 --- a/desmume/src/windows/main.h +++ b/desmume/src/windows/main.h @@ -8,7 +8,7 @@ extern HMENU mainMenu; //Holds handle to the main DeSmuME menu extern CToolBar* MainWindowToolbar; extern volatile bool execute, paused; -void NDS_Pause(bool showMsg = true); +bool NDS_Pause(bool showMsg = true); void NDS_UnPause(bool showMsg = true); void LoadSaveStateInfo(); void Display();