From e21f2b8fcf73622e7bc45c31ea2d2bb4c4beb35c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 13 Nov 2021 09:40:07 -0800 Subject: [PATCH] Common: UWP buildfix. Just use SetThreadDescription() directly, assuming new enough Windows. --- Common/Thread/ThreadUtil.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Common/Thread/ThreadUtil.cpp b/Common/Thread/ThreadUtil.cpp index f47738befa..73eab75e5c 100644 --- a/Common/Thread/ThreadUtil.cpp +++ b/Common/Thread/ThreadUtil.cpp @@ -63,7 +63,7 @@ static EXCEPTION_DISPOSITION NTAPI ignore_handler(EXCEPTION_RECORD *rec, #endif -#if PPSSPP_PLATFORM(WINDOWS) +#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP) typedef HRESULT (WINAPI *TSetThreadDescription)(HANDLE, PCWSTR); static TSetThreadDescription g_pSetThreadDescription = nullptr; @@ -91,7 +91,7 @@ void SetCurrentThreadNameThroughException(const char *threadName); #endif void SetCurrentThreadName(const char* threadName) { -#if PPSSPP_PLATFORM(WINDOWS) +#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP) InitializeSetThreadDescription(); if (g_pSetThreadDescription) { // Use the modern API @@ -102,7 +102,10 @@ void SetCurrentThreadName(const char* threadName) { // Use the old exception hack. SetCurrentThreadNameThroughException(threadName); } - +#elif PPSSPP_PLATFORM(WINDOWS) + wchar_t buffer[256]; + ConvertUTF8ToWString(buffer, ARRAY_SIZE(buffer), threadName); + SetThreadDescription(GetCurrentThread(), buffer); #elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(LINUX) pthread_setname_np(pthread_self(), threadName); #elif defined(__APPLE__)