From: <for...@us...> - 2004-02-07 15:44:19
|
Update of /cvsroot/vba/VisualBoyAdvance/src/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25448 Modified Files: MainWnd.cpp MainWnd.h MainWndFile.cpp VBA.cpp VBA.h Log Message: Fixed screensaver/power management code Index: MainWnd.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWnd.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MainWnd.cpp 5 Feb 2004 11:38:43 -0000 1.9 --- MainWnd.cpp 7 Feb 2004 13:55:16 -0000 1.10 *************** *** 414,417 **** --- 414,418 ---- ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_JOYPAD_AUTOFIRE_A, ID_OPTIONS_JOYPAD_AUTOFIRE_R, OnUpdateOptionsJoypadAutofire) ON_MESSAGE(VBA_CONFIRM_MODE, OnConfirmMode) + ON_MESSAGE(WM_SYSCOMMAND, OnMySysCommand) END_MESSAGE_MAP() *************** *** 422,427 **** void MainWnd::OnClose() { - theApp.enablePowerManagement(); - CWnd::OnClose(); --- 423,426 ---- *************** *** 593,598 **** theApp.rewindSaveNeeded = false; - theApp.disablePowerManagement(); - return true; } --- 592,595 ---- *************** *** 1084,1088 **** if(!theApp.paused) { if(emulating) { - theApp.disablePowerManagement(); soundResume(); } --- 1081,1084 ---- *************** *** 1092,1096 **** if(theApp.pauseWhenInactive) { if(emulating) { - theApp.enablePowerManagement(); soundPause(); } --- 1088,1091 ---- *************** *** 1140,1141 **** --- 1135,1145 ---- DragFinish(hDropInfo); } + + LRESULT MainWnd::OnMySysCommand(WPARAM wParam, LPARAM lParam) + { + if(emulating && !theApp.paused) { + if((wParam&0xFFF0) == SC_SCREENSAVE || (wParam&0xFFF0) == SC_MONITORPOWER) + return 0; + } + return Default(); + } Index: MainWnd.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWnd.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MainWnd.h 19 Jan 2004 23:52:56 -0000 1.4 --- MainWnd.h 7 Feb 2004 13:55:16 -0000 1.5 *************** *** 57,60 **** --- 57,61 ---- bool fileOpenSelect(); afx_msg LRESULT OnConfirmMode(WPARAM, LPARAM); + afx_msg LRESULT OnMySysCommand(WPARAM, LPARAM); afx_msg void OnUpdateFileLoadGameSlot(CCmdUI *pCmdUI); afx_msg void OnUpdateFileSaveGameSlot(CCmdUI *pCmdUI); Index: MainWndFile.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWndFile.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MainWndFile.cpp 28 Jan 2004 17:45:37 -0000 1.3 --- MainWndFile.cpp 7 Feb 2004 13:55:16 -0000 1.4 *************** *** 54,61 **** theApp.wasPaused = true; soundPause(); - theApp.enablePowerManagement(); } else { soundResume(); - theApp.disablePowerManagement(); } } --- 54,59 ---- *************** *** 153,158 **** RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); systemSetTitle("VisualBoyAdvance"); - - theApp.enablePowerManagement(); } --- 151,154 ---- Index: VBA.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/VBA.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** VBA.cpp 5 Feb 2004 11:38:43 -0000 1.8 --- VBA.cpp 7 Feb 2004 13:55:16 -0000 1.9 *************** *** 2170,2213 **** } - static UINT power_get[3] = { - SPI_GETSCREENSAVETIMEOUT, - SPI_GETLOWPOWERTIMEOUT, - SPI_GETPOWEROFFTIMEOUT - }; - - static UINT power_set[3] = { - SPI_SETSCREENSAVETIMEOUT, - SPI_SETLOWPOWERTIMEOUT, - SPI_SETPOWEROFFTIMEOUT - }; - - static int power[3]; - - void VBA::enablePowerManagement() - { - for(int i = 0;i < 3; i++) { - if(power[i] != -1) - SystemParametersInfo(power_set[i], - power[i], - NULL, - 0); - } - } - - void VBA::disablePowerManagement() - { - for(int i = 0;i < 3; i++) { - power[i] = -1; - if(SystemParametersInfo(power_get[i], - 0, - &power[i], - 0)) - SystemParametersInfo(power_set[i], - 0, - NULL, - 0); - } - } - void winSignal(int, int) { --- 2170,2173 ---- Index: VBA.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/VBA.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VBA.h 28 Jan 2004 17:45:37 -0000 1.4 --- VBA.h 7 Feb 2004 13:55:16 -0000 1.5 *************** *** 222,227 **** public: - void disablePowerManagement(); - void enablePowerManagement(); void saveSettings(); void movieReadNext(); --- 222,225 ---- |