From c60b3f4e44cc541caac468df219f669b44a45078 Mon Sep 17 00:00:00 2001 From: squall-leonhart Date: Mon, 23 Mar 2009 15:19:42 +0000 Subject: [PATCH] found some more protector code to remove, and added back in pause when inactive toggle/function. --- src/win32/MainWnd.cpp | 7 ++++++- src/win32/MainWnd.h | 2 ++ src/win32/VBA.cpp | 3 ++- src/win32/VBA.h | 16 +++------------- src/win32/VBA.rc | 1 + src/win32/resource.h | 1 + 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp index 25e6ee76..5994254a 100644 --- a/src/win32/MainWnd.cpp +++ b/src/win32/MainWnd.cpp @@ -155,6 +155,8 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd) ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_DISABLESTATUSMESSAGES, OnUpdateOptionsEmulatorDisablestatusmessages) ON_COMMAND(ID_OPTIONS_EMULATOR_SYNCHRONIZE, OnOptionsEmulatorSynchronize) ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SYNCHRONIZE, OnUpdateOptionsEmulatorSynchronize) + ON_COMMAND(ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE, OnOptionsEmulatorPausewheninactive) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE, OnUpdateOptionsEmulatorPausewheninactive) ON_COMMAND(ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE, OnOptionsEmulatorSpeeduptoggle) ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE, OnUpdateOptionsEmulatorSpeeduptoggle) ON_COMMAND(ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES, OnOptionsEmulatorAutomaticallyApplyPatchFiles) @@ -1154,8 +1156,11 @@ void MainWnd::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) } } else { theApp.wasPaused = true; - if(emulating) { + if(theApp.pauseWhenInactive) { + if(emulating) { soundPause(); + } + theApp.active = a; } theApp.active = a; diff --git a/src/win32/MainWnd.h b/src/win32/MainWnd.h index 2e7edec0..c135d5e6 100644 --- a/src/win32/MainWnd.h +++ b/src/win32/MainWnd.h @@ -158,6 +158,8 @@ protected: afx_msg void OnUpdateOptionsEmulatorDisablestatusmessages(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSynchronize(); afx_msg void OnUpdateOptionsEmulatorSynchronize(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorPausewheninactive(); + afx_msg void OnUpdateOptionsEmulatorPausewheninactive(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSpeeduptoggle(); afx_msg void OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorAutomaticallyApplyPatchFiles(); diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 3b5278c0..99428cd4 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -275,6 +275,7 @@ VBA::VBA() iconic = false; glFilter = 0; regEnabled = false; + pauseWhenInactive = true; speedupToggle = false; winGbPrinterEnabled = false; threadPriority = 2; @@ -2046,7 +2047,7 @@ bool VBA::updateRenderMethod(bool force) Sm60FPS_Init(); - if( !(this->*secondaryTrapPointer)( force ) ) { + if( !updateRenderMethod0( force ) ) { // fall back to safe configuration renderMethod = DIRECT_3D; fsAdapter = 0; diff --git a/src/win32/VBA.h b/src/win32/VBA.h index dcb98eb1..d6e5fe4e 100644 --- a/src/win32/VBA.h +++ b/src/win32/VBA.h @@ -58,9 +58,6 @@ enum AUDIO_API { class AVIWrite; class WavWriter; -typedef DWORD (WINAPI* lpGetModuleFileNameA)(HINSTANCE, LPSTR, DWORD); -typedef VOID (WINAPI* lpExitProcess)(UINT); - class VBA : public CWinApp { public: @@ -152,6 +149,7 @@ class VBA : public CWinApp bool iconic; int glFilter; bool dinputKeyFocus; + bool pauseWhenInactive; bool speedupToggle; bool winGbPrinterEnabled; int threadPriority; @@ -209,12 +207,6 @@ class VBA : public CWinApp CString wndClass; - lpGetModuleFileNameA pGetModuleFileNameA; - lpExitProcess pExitProcess; - - int securityCheck; - int securityCheck2; - public: VBA(); ~VBA(); @@ -260,14 +252,12 @@ class VBA : public CWinApp void loadSettings(); void addRecentFile(CString file); - bool trap(bool); - private: unsigned int detectCpuCores(); }; -extern VBA theApp; -extern int emulating; + extern VBA theApp; + extern int emulating; #ifdef MMX extern "C" bool cpu_mmx; diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index 39f84b34..12f82bdf 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -1860,6 +1860,7 @@ BEGIN END MENUITEM "&Remove intros (GBA)", ID_OPTIONS_EMULATOR_REMOVEINTROSGBA MENUITEM "Auto-apply IPS/UPS/PPF", ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES + MENUITEM "Pause when inactive", ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE MENUITEM "AGB Print", ID_OPTIONS_EMULATOR_AGBPRINT MENUITEM "Real Time Clock", ID_OPTIONS_EMULATOR_REALTIMECLOCK MENUITEM "&Game Overrides...", ID_OPTIONS_EMULATOR_GAMEOVERRIDES diff --git a/src/win32/resource.h b/src/win32/resource.h index 890f6914..9b5a40ea 100644 --- a/src/win32/resource.h +++ b/src/win32/resource.h @@ -674,6 +674,7 @@ #define ID_FILE_EXPORT_BATTERYFILE 40118 #define ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL 40121 #define ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL 40122 +#define ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE 40124 #define ID_OPTIONS_SOUND_STARTRECORDING 40125 #define ID_OPTIONS_SOUND_STOPRECORDING 40126 #define ID_OPTIONS_VIDEO_LAYERS_BG0 40127