From b1415b70db14b6eff8c8e513ca37f54b7fd0d212 Mon Sep 17 00:00:00 2001 From: pagefault <> Date: Wed, 20 Jun 2001 21:20:47 +0000 Subject: [PATCH] Added disable screensaver option; moved disable spc emu to sound menu --- zsnes/src/gui/gui.asm | 7 +++++-- zsnes/src/gui/guikeys.inc | 12 ++++++++---- zsnes/src/gui/guimouse.inc | 5 +++-- zsnes/src/gui/guiwindp.inc | 25 +++++++++++++++++-------- zsnes/src/win/winlink.cpp | 18 +++++++++++++++++- 5 files changed, 50 insertions(+), 17 deletions(-) diff --git a/zsnes/src/gui/gui.asm b/zsnes/src/gui/gui.asm index e63e50b0..fbefb683 100644 --- a/zsnes/src/gui/gui.asm +++ b/zsnes/src/gui/gui.asm @@ -176,6 +176,7 @@ EXTSYM numlockptr %ifdef __WIN32__ EXTSYM CheckPriority EXTSYM CheckAlwaysOnTop +EXTSYM CheckScreenSaver %endif NEWSYM GuiAsmStart @@ -584,6 +585,7 @@ NEWSYM BilinearFilter, db 0 NEWSYM TripleBufferWin, db 0 NEWSYM ExclusiveSound, db 0 +NEWSYM DisableScreenSaver, db 0 GUIsave equ $-GUIRAdd @@ -602,9 +604,9 @@ ModemOKStat db 0 ; OK is detected on modem status ; LOAD STAT INPT OPT VID SND CHT NET GMKEY GUIOP ABT RSET SRC STCN MOVE CMBO ADDO GUIwinposxo dd 0,5 ,60 ,30 ,55 ,50 ,65 ,5 ,30 ,20 ,10 ,80 ,65 ,20 ,70 ,50 ,3 ,50 -GUIwinposyo dd 0,20 ,70 ,30 ,20 ,20 ,26 ,20 ,30 ,20 ,20 ,50 ,60 ,30 ,65 ,50 ,22 ,60 +GUIwinposyo dd 0,20 ,70 ,30 ,20 ,20 ,20 ,20 ,30 ,20 ,20 ,50 ,60 ,30 ,65 ,50 ,22 ,60 GUIwinsizex dd 0,244 ,126 ,189 ,167 ,170 ,148 ,244 ,8*16,13*16,240 ,7*16,9*16,8*16,9*16,140 ,250 ,160 -GUIwinsizey dd 0,190 ,3*16,166 ,190 ,192 ,178 ,191 ,40 ,189 ,192 ,98 ,42 ,40 ,42 ,70 ,190 ,60 +GUIwinsizey dd 0,190 ,3*16,166 ,190 ,192 ,184 ,191 ,40 ,189 ,192 ,98 ,42 ,40 ,42 ,70 ,190 ,60 GUIwinptr db 0 GUItextcolor db 0,0,0,0,0 @@ -3400,6 +3402,7 @@ DisplayBoxes: %ifdef __WIN32__ pushad call CheckPriority + call CheckScreenSaver popad %endif jmp .finstuff diff --git a/zsnes/src/gui/guikeys.inc b/zsnes/src/gui/guikeys.inc index 31f3c186..54111389 100644 --- a/zsnes/src/gui/guikeys.inc +++ b/zsnes/src/gui/guikeys.inc @@ -888,11 +888,11 @@ GUIOptionKeys: jne .nosavepath xor byte[DontSavePath],1 .nosavepath - cmp dh,'I' - jne .nospcdisable - xor byte[SPCDisable],1 -.nospcdisable %ifdef __WIN32__ + cmp dh,'I' + jne .noscreensaver + xor byte[DisableScreenSaver],1 +.noscreensaver cmp dh,'S' jne .noalttimer xor byte[AlternateTimer],1 @@ -1020,6 +1020,10 @@ GUISoundKeys: jne .nocubic xor byte[UseCubicSpline],1 .nocubic + cmp dh,'D' + jne .nospcdisable + xor byte[SPCDisable],1 +.nospcdisable %ifdef __WIN32__ cmp dh,'X' jne .noexclusivesound diff --git a/zsnes/src/gui/guimouse.inc b/zsnes/src/gui/guimouse.inc index e0b50a5b..fc1b4b59 100644 --- a/zsnes/src/gui/guimouse.inc +++ b/zsnes/src/gui/guimouse.inc @@ -2119,8 +2119,8 @@ DisplayGUIOptionClick: GUIClickCButton 11,146,byte[LatestSave] GUIClickCButton 11,156,byte[AutoState] GUIClickCButton 11,166,byte[DontSavePath] - GUIClickCButton 11,176,byte[SPCDisable] %ifdef __WIN32__ + GUIClickCButton 11,176,byte[DisableScreenSaver] GUIClickCButtonat 11,186,byte[AlternateTimer] %endif ; Frameskip = 0 @@ -2249,8 +2249,9 @@ DisplayGUISoundClick: GUIClickCButton 11,141,byte[LowPassFilter] GUIClickCButton 11,151,byte[SoundBufEn] GUIClickCButton 11,161,byte[UseCubicSpline] + GUIClickCButton 11,171,byte[SPCDisable] %ifdef __WIN32__ - GUIClickCButton 11,171,byte[ExclusiveSound] + GUIClickCButton 11,181,byte[ExclusiveSound] %endif cmp eax,15 jl near .nosrate diff --git a/zsnes/src/gui/guiwindp.inc b/zsnes/src/gui/guiwindp.inc index 5a5460ce..199d5f38 100644 --- a/zsnes/src/gui/guiwindp.inc +++ b/zsnes/src/gui/guiwindp.inc @@ -1504,13 +1504,13 @@ DisplayGUIOption: mov dword[GUITemp],GUIIconDataCheckBoxC .nocheckbox13 GUIDisplayIconWin 4,11,166,[GUITemp] +%ifdef __WIN32__ mov dword[GUITemp],GUIIconDataCheckBoxUC - cmp byte[SPCDisable],0 + cmp byte[DisableScreenSaver],0 je .nocheckbox14 mov dword[GUITemp],GUIIconDataCheckBoxC .nocheckbox14 GUIDisplayIconWin 4,11,176,[GUITemp] -%ifdef __WIN32__ mov dword[GUITemp],GUIIconDataCheckBoxUC cmp byte[AlternateTimer],0 je .win323 @@ -1580,7 +1580,7 @@ GUIOptionTextG db 'OLD GFX MODE 2',0 GUIOptionTextH db 'START AT LATEST SAVE',0 GUIOptionTextI db 'AUTO STATE SAVE/LOAD',0 GUIOptionTextJ db 'DON',39,'T SAVE CURRENT PATH',0 -GUIOptionTextK db 'DISABLE SOUND CPU EMU',0 +GUIOptionTextK db 'DISABLE SCREENSAVER',0 GUIOptionTextL db 'USE ALTERNATE TIMER',0 GUIOptionText8 db '-',0 GUIOptionText9 db '+',0 @@ -2140,8 +2140,9 @@ DisplayGUISound: GUIOuttextwin2u 6,26,146,GUISoundTextK,0 GUIOuttextwin2u 6,26,156,GUISoundTextL,6 GUIOuttextwin2u 6,26,166,GUISoundTextM,0 + GUIOuttextwin2u 6,26,176,GUISoundTextN,0 %ifdef __WIN32__ - GUIOuttextwin2u 6,26,176,GUISoundTextN,1 + GUIOuttextwin2u 6,26,186,GUISoundTextO,1 %endif add byte[GUItextcolor],15 GUIOuttextwin2 6,25,25,GUISoundText1 @@ -2167,8 +2168,9 @@ DisplayGUISound: GUIOuttextwin2 6,25,145,GUISoundTextK GUIOuttextwin2 6,25,155,GUISoundTextL GUIOuttextwin2 6,25,165,GUISoundTextM -%ifdef __WIN32__ GUIOuttextwin2 6,25,175,GUISoundTextN +%ifdef __WIN32__ + GUIOuttextwin2 6,25,185,GUISoundTextO %endif mov al,[GUIWincol] mov byte[GUItextcolor],al @@ -2261,13 +2263,19 @@ DisplayGUISound: mov dword[GUITemp],GUIIconDataCheckBoxC .nocheckbox8 GUIDisplayIconWin 6,11,161,[GUITemp] -%ifdef __WIN32__ mov dword[GUITemp],GUIIconDataCheckBoxUC - cmp byte[ExclusiveSound],0 + cmp byte[SPCDisable],0 je .nocheckbox9 mov dword[GUITemp],GUIIconDataCheckBoxC .nocheckbox9 GUIDisplayIconWin 6,11,171,[GUITemp] +%ifdef __WIN32__ + mov dword[GUITemp],GUIIconDataCheckBoxUC + cmp byte[ExclusiveSound],0 + je .nocheckbox10 + mov dword[GUITemp],GUIIconDataCheckBoxC +.nocheckbox10 + GUIDisplayIconWin 6,11,181,[GUITemp] %endif DrawGUIWinBox 6,15,61,69,69,167 mov dword[GUITemp],GUISoundText7 @@ -2359,7 +2367,8 @@ GUISoundTextJ db 'SOUND INTERPOLATION',0 GUISoundTextK db 'LOW PASS FILTER',0 GUISoundTextL db 'SOUND BUFFERING',0 GUISoundTextM db 'CUBIC SPLINE INTERP',0 -GUISoundTextN db 'EXCLUSIVE MODE',0 +GUISoundTextN db 'DISABLE SPC EMU',0 +GUISoundTextO db 'EXCLUSIVE MODE',0 DisplayGUICheatConv: mov eax,[ccheatnpos] diff --git a/zsnes/src/win/winlink.cpp b/zsnes/src/win/winlink.cpp index cf1c8838..0676be49 100644 --- a/zsnes/src/win/winlink.cpp +++ b/zsnes/src/win/winlink.cpp @@ -321,6 +321,7 @@ extern BYTE AlwaysOnTop; extern BYTE SaveMainWindowPos; extern BYTE AlternateTimer; extern BYTE AllowMultipleInst; +extern BYTE DisableScreenSaver; extern signed short int MainWindowX; extern signed short int MainWindowY; extern int CurKeyPos; @@ -340,6 +341,12 @@ extern "C" void CheckAlwaysOnTop() else SetWindowPos(hMainWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } +extern "C" void CheckScreenSaver() +{ + if (DisableScreenSaver == 1 && IsActivated == 1) SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, 0, SPIF_SENDWININICHANGE); + else SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, 0, SPIF_SENDWININICHANGE); +} + extern "C" void MinimizeWindow() { ShowWindow(hMainWindow, SW_MINIMIZE); @@ -412,6 +419,8 @@ aquireagain:; void ExitFunction() { + IsActivated = 0; + CheckScreenSaver(); ReleaseDirectInput(); ReleaseDirectSound(); ReleaseDirectDraw(); @@ -530,8 +539,13 @@ LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (FirstActivate == 0) initwinvideo(); InputAcquire(); if (FirstActivate == 1) FirstActivate = 0; + CheckScreenSaver(); + } + if (LOWORD(wParam) == WA_INACTIVE) + { + IsActivated = 0; + CheckScreenSaver(); } - if (LOWORD(wParam) == WA_INACTIVE) IsActivated = 0; break; case WM_SETFOCUS: if (FullScreen == 0) ShowWindow(hMainWindow, SW_SHOWNORMAL); @@ -540,6 +554,7 @@ LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_KILLFOCUS: InputDeAcquire(); IsActivated = 0; + CheckScreenSaver(); break; case WM_DESTROY: break; @@ -1684,6 +1699,7 @@ void initwinvideo(void) CheckPriority(); CheckAlwaysOnTop(); + CheckScreenSaver(); if (!hMainWindow) {