mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-14 22:03:27 +01:00
disable screensaver
This commit is contained in:
parent
f5ff8a19a9
commit
48081e3f24
@ -22,7 +22,7 @@ typedef struct CNCDDRAWCONFIG
|
||||
INIFILE ini;
|
||||
BOOL d3d9on12;
|
||||
BOOL opengl_core;
|
||||
|
||||
|
||||
/* Optional settings */
|
||||
|
||||
BOOL fullscreen;
|
||||
|
@ -23,6 +23,7 @@ PVOID FakePrimarySurface;
|
||||
|
||||
|
||||
HMODULE g_ddraw_module;
|
||||
static BOOL g_screensaver_disabled;
|
||||
|
||||
BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
@ -131,6 +132,15 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
set_aware();
|
||||
}
|
||||
|
||||
BOOL screensaver_enabled = FALSE;
|
||||
SystemParametersInfoA(SPI_GETSCREENSAVEACTIVE, 0, &screensaver_enabled, 0);
|
||||
|
||||
if (screensaver_enabled)
|
||||
{
|
||||
SystemParametersInfoA(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);
|
||||
g_screensaver_disabled = TRUE;
|
||||
}
|
||||
|
||||
indeo_enable();
|
||||
timeBeginPeriod(1);
|
||||
hook_init();
|
||||
@ -151,6 +161,11 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
dinput_hook_exit();
|
||||
hook_exit();
|
||||
|
||||
if (g_screensaver_disabled)
|
||||
{
|
||||
SystemParametersInfoA(SPI_SETSCREENSAVEACTIVE, TRUE, NULL, 0);
|
||||
}
|
||||
|
||||
ULONG(WINAPI* remove_handler)(PVOID) =
|
||||
(void*)real_GetProcAddress(GetModuleHandleA("Kernel32.dll"), "RemoveVectoredExceptionHandler");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user