From 048e7f4c1b8f55c1732b7ecf26e8b363e1713cda Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Wed, 12 Jan 2022 18:23:08 +0000 Subject: [PATCH] GUI: Convert Power plan name to UTF-8 --- pcsx2/windows/WinPowerProfile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pcsx2/windows/WinPowerProfile.cpp b/pcsx2/windows/WinPowerProfile.cpp index 8d60343ed4..28c05fd18d 100644 --- a/pcsx2/windows/WinPowerProfile.cpp +++ b/pcsx2/windows/WinPowerProfile.cpp @@ -14,13 +14,13 @@ */ #include "PrecompiledHeader.h" +#include "common/StringUtil.h" #include #include using unique_any_guidptr = wil::unique_any; // Checks the current active power plan -// If the power plan isn't named 'high performance', put a little message in the console // This function fails silently void CheckIsUserOnHighPerfPowerPlan() { @@ -32,6 +32,7 @@ void CheckIsUserOnHighPerfPowerPlan() UCHAR aBuffer[2048]; DWORD aBufferSize = sizeof(aBuffer); ret = PowerReadFriendlyName(NULL, pPwrGUID.get(), &NO_SUBGROUP_GUID, NULL, aBuffer, &aBufferSize); + std::string friendlyName(StringUtil::WideStringToUTF8String((wchar_t*)aBuffer)); if (ret != ERROR_SUCCESS) return; @@ -43,5 +44,5 @@ void CheckIsUserOnHighPerfPowerPlan() PowerReadDCValueIndex(NULL, pPwrGUID.get(), &GUID_PROCESSOR_SETTINGS_SUBGROUP, &GUID_PROCESSOR_THROTTLE_MINIMUM, &dcMin)) return; - Console.WriteLn("The current power profile is '%S'.\nThe current min / max processor states\nAC: %d%% / %d%%\nBattery: %d%% / %d%%\n", aBuffer,acMin,acMax,dcMin,dcMax); + Console.WriteLn("The current power profile is '%s'.\nThe current min / max processor states\nAC: %d%% / %d%%\nBattery: %d%% / %d%%\n", friendlyName.c_str(), acMin, acMax, dcMin, dcMax); }