Added suspend in background option to minimize cpu usage while not active
This commit is contained in:
@@ -581,6 +581,7 @@ NEWSYM GUIWBAdd, db 25
|
|||||||
NEWSYM BlackAndWhite, db 0
|
NEWSYM BlackAndWhite, db 0
|
||||||
NEWSYM MouseWheel, db 1
|
NEWSYM MouseWheel, db 1
|
||||||
NEWSYM AlternateTimer, db 0
|
NEWSYM AlternateTimer, db 0
|
||||||
|
NEWSYM SuspendInBackground, db 0
|
||||||
|
|
||||||
GUIsave equ $-GUIRAdd
|
GUIsave equ $-GUIRAdd
|
||||||
|
|
||||||
@@ -601,7 +602,7 @@ ModemOKStat db 0 ; OK is detected on modem status
|
|||||||
GUIwinposxo dd 0,5 ,60 ,30 ,55 ,50 ,65 ,5 ,30 ,20 ,10 ,80 ,65 ,20 ,70 ,50 ,3 ,50
|
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 ,36 ,20 ,30 ,20 ,20 ,50 ,60 ,30 ,65 ,50 ,22 ,60
|
GUIwinposyo dd 0,20 ,70 ,30 ,20 ,20 ,36 ,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,220 ,7*16,9*16,8*16,9*16,140 ,250 ,160
|
GUIwinsizex dd 0,244 ,126 ,189 ,167 ,170 ,148 ,244 ,8*16,13*16,220 ,7*16,9*16,8*16,9*16,140 ,250 ,160
|
||||||
GUIwinsizey dd 0,190 ,3*16,166 ,190 ,192 ,168 ,191 ,40 ,189 ,182 ,98 ,42 ,40 ,42 ,70 ,190 ,60
|
GUIwinsizey dd 0,190 ,3*16,166 ,190 ,192 ,168 ,191 ,40 ,189 ,192 ,98 ,42 ,40 ,42 ,70 ,190 ,60
|
||||||
GUIwinptr db 0
|
GUIwinptr db 0
|
||||||
|
|
||||||
GUItextcolor db 0,0,0,0,0
|
GUItextcolor db 0,0,0,0,0
|
||||||
|
|||||||
@@ -2634,6 +2634,7 @@ DisplayGUIOptnsClick:
|
|||||||
%ifdef __WIN32__
|
%ifdef __WIN32__
|
||||||
GUIClickCButton 12,168,byte[AlwaysOnTop]
|
GUIClickCButton 12,168,byte[AlwaysOnTop]
|
||||||
GUIClickCButton 12,178,byte[SaveMainWindowPos]
|
GUIClickCButton 12,178,byte[SaveMainWindowPos]
|
||||||
|
GUIClickCButton 12,188,byte[SuspendInBackground]
|
||||||
GUIClickCButton 124,23,byte[MouseWheel]
|
GUIClickCButton 124,23,byte[MouseWheel]
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|||||||
@@ -4758,6 +4758,12 @@ DisplayGUIOptns:
|
|||||||
mov dword[GUITemp],GUIIconDataCheckBoxC
|
mov dword[GUITemp],GUIIconDataCheckBoxC
|
||||||
.nocheck10
|
.nocheck10
|
||||||
GUIDisplayIconWin 10,12,178,[GUITemp]
|
GUIDisplayIconWin 10,12,178,[GUITemp]
|
||||||
|
mov dword[GUITemp],GUIIconDataCheckBoxUC
|
||||||
|
cmp byte[SuspendInBackground],1
|
||||||
|
jne .nocheck11
|
||||||
|
mov dword[GUITemp],GUIIconDataCheckBoxC
|
||||||
|
.nocheck11
|
||||||
|
GUIDisplayIconWin 10,12,188,[GUITemp]
|
||||||
%endif
|
%endif
|
||||||
mov al,[GUIWincol]
|
mov al,[GUIWincol]
|
||||||
mov byte[GUItextcolor],al
|
mov byte[GUItextcolor],al
|
||||||
@@ -4797,6 +4803,7 @@ DisplayGUIOptns:
|
|||||||
GUIOuttextwin2 10,26,173,GUIGUIOptnsTextE
|
GUIOuttextwin2 10,26,173,GUIGUIOptnsTextE
|
||||||
GUIOuttextwin2 10,26,183,GUIGUIOptnsTextF
|
GUIOuttextwin2 10,26,183,GUIGUIOptnsTextF
|
||||||
GUIOuttextwin2u 10,138,28,GUIGUIOptnsTextJ,1
|
GUIOuttextwin2u 10,138,28,GUIGUIOptnsTextJ,1
|
||||||
|
GUIOuttextwin2 10,26,193,GUIGUIOptnsTextK
|
||||||
%endif
|
%endif
|
||||||
mov byte[GUIGUIOptnsText6],'R'
|
mov byte[GUIGUIOptnsText6],'R'
|
||||||
GUIOuttextwin2 10,16,123,GUIGUIOptnsText6
|
GUIOuttextwin2 10,16,123,GUIGUIOptnsText6
|
||||||
@@ -4820,6 +4827,7 @@ DisplayGUIOptns:
|
|||||||
GUIOuttextwin2 10,25,172,GUIGUIOptnsTextE
|
GUIOuttextwin2 10,25,172,GUIGUIOptnsTextE
|
||||||
GUIOuttextwin2 10,25,182,GUIGUIOptnsTextF
|
GUIOuttextwin2 10,25,182,GUIGUIOptnsTextF
|
||||||
GUIOuttextwin2 10,137,27,GUIGUIOptnsTextJ
|
GUIOuttextwin2 10,137,27,GUIGUIOptnsTextJ
|
||||||
|
GUIOuttextwin2 10,25,192,GUIGUIOptnsTextK
|
||||||
%endif
|
%endif
|
||||||
mov byte[GUIGUIOptnsText6],'R'
|
mov byte[GUIGUIOptnsText6],'R'
|
||||||
GUIOuttextwin2 10,15,122,GUIGUIOptnsText6
|
GUIOuttextwin2 10,15,122,GUIGUIOptnsText6
|
||||||
@@ -4911,6 +4919,7 @@ GUIGUIOptnsTextG db 'BACK',0
|
|||||||
GUIGUIOptnsTextH db 'TITLE',0
|
GUIGUIOptnsTextH db 'TITLE',0
|
||||||
GUIGUIOptnsTextI db 'WIN',0
|
GUIGUIOptnsTextI db 'WIN',0
|
||||||
GUIGUIOptnsTextJ db 'WHEEL MOUSE',0
|
GUIGUIOptnsTextJ db 'WHEEL MOUSE',0
|
||||||
|
GUIGUIOptnsTextK db 'SUSPEND IN BACKGROUND',0
|
||||||
|
|
||||||
DisplayGUIAbout:
|
DisplayGUIAbout:
|
||||||
; cmp byte[OSPort],3
|
; cmp byte[OSPort],3
|
||||||
|
|||||||
@@ -117,6 +117,8 @@ int MouseMove2Y;
|
|||||||
DWORD SurfaceX=0;
|
DWORD SurfaceX=0;
|
||||||
DWORD SurfaceY=0;
|
DWORD SurfaceY=0;
|
||||||
|
|
||||||
|
BYTE IsActivated = 1;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
DWORD MouseButton;
|
DWORD MouseButton;
|
||||||
}
|
}
|
||||||
@@ -189,6 +191,7 @@ extern BYTE HighPriority;
|
|||||||
extern BYTE AlwaysOnTop;
|
extern BYTE AlwaysOnTop;
|
||||||
extern BYTE SaveMainWindowPos;
|
extern BYTE SaveMainWindowPos;
|
||||||
extern BYTE AlternateTimer;
|
extern BYTE AlternateTimer;
|
||||||
|
extern BYTE SuspendInBackground;
|
||||||
extern signed short int MainWindowX;
|
extern signed short int MainWindowX;
|
||||||
extern signed short int MainWindowY;
|
extern signed short int MainWindowY;
|
||||||
extern int CurKeyPos;
|
extern int CurKeyPos;
|
||||||
@@ -196,19 +199,10 @@ extern int CurKeyReadPos;
|
|||||||
extern int KeyBuffer[16];
|
extern int KeyBuffer[16];
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE IsActivated = 1;
|
|
||||||
|
|
||||||
extern "C" void CheckPriority()
|
extern "C" void CheckPriority()
|
||||||
{
|
{
|
||||||
if (IsActivated == 1)
|
if (HighPriority == 1) SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
||||||
{
|
else SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
|
||||||
if (HighPriority == 1) SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
|
||||||
else SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void CheckAlwaysOnTop()
|
extern "C" void CheckAlwaysOnTop()
|
||||||
@@ -412,7 +406,6 @@ LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
IsActivated = 1;
|
IsActivated = 1;
|
||||||
CheckPriority();
|
|
||||||
if(LOWORD(wParam)==WA_INACTIVE)
|
if(LOWORD(wParam)==WA_INACTIVE)
|
||||||
{
|
{
|
||||||
ChangeDisplaySettings(NULL,0);
|
ChangeDisplaySettings(NULL,0);
|
||||||
@@ -440,7 +433,6 @@ LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
ChangeDisplaySettings(NULL,0);
|
ChangeDisplaySettings(NULL,0);
|
||||||
InputDeAcquire();
|
InputDeAcquire();
|
||||||
IsActivated = 0;
|
IsActivated = 0;
|
||||||
CheckPriority();
|
|
||||||
break;
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
ChangeDisplaySettings(NULL,0);
|
ChangeDisplaySettings(NULL,0);
|
||||||
@@ -843,6 +835,8 @@ BOOL FAR PASCAL InitJoystickInput(LPCDIDEVICEINSTANCE pdinst, LPVOID pvRef)
|
|||||||
|
|
||||||
void endgame()
|
void endgame()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
MessageBox(NULL, "blah", "blah", MB_OK);
|
||||||
if(lpDirectSound)
|
if(lpDirectSound)
|
||||||
{
|
{
|
||||||
lpDirectSound->Release();
|
lpDirectSound->Release();
|
||||||
@@ -1594,6 +1588,9 @@ void CheckTimers(void)
|
|||||||
|
|
||||||
void UpdateVFrame(void)
|
void UpdateVFrame(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (SuspendInBackground == 1 && IsActivated == 0) WaitMessage();
|
||||||
|
|
||||||
int DataNeeded;
|
int DataNeeded;
|
||||||
int SPCSize=256;
|
int SPCSize=256;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user