From c72144abad7405ab883422c2c117bc2914e457db Mon Sep 17 00:00:00 2001 From: lizzie Date: Sun, 30 Nov 2025 06:04:36 +0100 Subject: [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 Reviewed-by: crueter Co-authored-by: lizzie Co-committed-by: lizzie --- src/common/windows/timer_resolution.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/common/windows/timer_resolution.cpp') 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 -- cgit v1.2.3