mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 18:50:29 +00:00
(Win32) Create function pointer to PowerSetRequest
This commit is contained in:
parent
f4a5cbbe5b
commit
756b3de315
@ -275,13 +275,16 @@ bool win32_suppress_screensaver(void *data, bool enable)
|
|||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
|
typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
|
||||||
|
typedef BOOL (WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest, POWER_REQUEST_TYPE RequestType);
|
||||||
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
|
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
|
||||||
PowerCreateRequestPtr powerCreateRequest =
|
PowerCreateRequestPtr powerCreateRequest =
|
||||||
(PowerCreateRequestPtr)GetProcAddress(kernel32, "PowerCreateRequest");
|
(PowerCreateRequestPtr)GetProcAddress(kernel32, "PowerCreateRequest");
|
||||||
|
PowerSetRequestPtr powerSetRequest =
|
||||||
|
(PowerSetRequestPtr)GetProcAddress(kernel32, "PowerSetRequest");
|
||||||
|
|
||||||
if(enable)
|
if(enable)
|
||||||
{
|
{
|
||||||
if(powerCreateRequest)
|
if(powerCreateRequest && powerSetRequest)
|
||||||
{
|
{
|
||||||
/* Windows 7, 8, 10 codepath */
|
/* Windows 7, 8, 10 codepath */
|
||||||
POWER_REQUEST_CONTEXT RequestContext;
|
POWER_REQUEST_CONTEXT RequestContext;
|
||||||
@ -293,7 +296,7 @@ bool win32_suppress_screensaver(void *data, bool enable)
|
|||||||
|
|
||||||
Request = PowerCreateRequest(&RequestContext);
|
Request = PowerCreateRequest(&RequestContext);
|
||||||
|
|
||||||
PowerSetRequest( Request, PowerRequestDisplayRequired);
|
powerSetRequest( Request, PowerRequestDisplayRequired);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user