diff options
| author | lizzie <lizzie@eden-emu.dev> | 2025-11-30 06:04:36 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-11-30 06:04:36 +0100 |
| commit | c72144abad7405ab883422c2c117bc2914e457db (patch) | |
| tree | 132cf271885a084d513b338b8014bc5467669db7 /src/common/windows/timer_resolution.cpp | |
| parent | d656e347c851b6aa0e1624b8864bc061788b2e2e (diff) | |
[port] windows 7 support (#3105)
Signed-off-by: lizzie lizzie@eden-emu.dev
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3105
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Reviewed-by: crueter <crueter@eden-emu.dev>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/common/windows/timer_resolution.cpp')
| -rw-r--r-- | src/common/windows/timer_resolution.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/common/windows/timer_resolution.cpp b/src/common/windows/timer_resolution.cpp index 29c6e5c7e1..1fb985b735 100644 --- a/src/common/windows/timer_resolution.cpp +++ b/src/common/windows/timer_resolution.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -62,14 +65,15 @@ TimerResolution GetTimerResolution() { void SetHighQoS() { // https://learn.microsoft.com/en-us/windows/win32/procthread/quality-of-service - PROCESS_POWER_THROTTLING_STATE PowerThrottling{ - .Version{PROCESS_POWER_THROTTLING_CURRENT_VERSION}, - .ControlMask{PROCESS_POWER_THROTTLING_EXECUTION_SPEED | - PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION}, - .StateMask{}, - }; - SetProcessInformation(GetCurrentProcess(), ProcessPowerThrottling, &PowerThrottling, - sizeof(PROCESS_POWER_THROTTLING_STATE)); + static auto pf = (decltype(&SetProcessInformation))(void*)GetProcAddress(GetModuleHandle(TEXT("Kernel32.dll")), "SetProcessInformation"); + if (pf) { + PROCESS_POWER_THROTTLING_STATE PowerThrottling{ + .Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION, + .ControlMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED | PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION, + .StateMask = 0, + }; + pf(GetCurrentProcess(), ProcessPowerThrottling, &PowerThrottling, sizeof(PROCESS_POWER_THROTTLING_STATE)); // Windows 7+ + } } } // Anonymous namespace |
