Add RmlUi

This commit is contained in:
Zero
2026-06-10 16:12:51 +02:00
parent b1d5ea2253
commit d2b7ff5f43
1255 changed files with 270119 additions and 1362 deletions

View File

@@ -1,3 +1,4 @@
#include "stdafx.h"
// From Xbox documentation
@@ -8,9 +9,46 @@ typedef struct tagTHREADNAME_INFO {
DWORD dwFlags; // Reserved for future use; must be zero
} THREADNAME_INFO;
#if (defined _WINDOWS64) || (defined _DURANGO)
static bool TrySetThreadDescriptionWin10(DWORD dwThreadID, LPCSTR szThreadName)
{
typedef HRESULT (WINAPI *SetThreadDescriptionFn)(HANDLE, PCWSTR);
static const SetThreadDescriptionFn pfn = []() -> SetThreadDescriptionFn {
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
if (kernel32 == nullptr)
return nullptr;
return reinterpret_cast<SetThreadDescriptionFn>(
GetProcAddress(kernel32, "SetThreadDescription"));
}();
if (pfn == nullptr || szThreadName == nullptr)
return false;
wchar_t wideName[256] = {};
if (MultiByteToWideChar(CP_UTF8, 0, szThreadName, -1, wideName, 256) == 0)
return false;
HANDLE thread = (dwThreadID == static_cast<DWORD>(-1))
? GetCurrentThread()
: OpenThread(THREAD_SET_LIMITED_INFORMATION, FALSE, dwThreadID);
if (thread == nullptr)
return false;
const HRESULT hr = pfn(thread, wideName);
if (thread != GetCurrentThread())
CloseHandle(thread);
return SUCCEEDED(hr);
}
#endif
void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName )
{
#ifndef __PS3__
#if (defined _WINDOWS64) || (defined _DURANGO)
if (TrySetThreadDescriptionWin10(dwThreadID, szThreadName))
return;
#endif
THREADNAME_INFO info;
info.dwType = 0x1000;
@@ -19,6 +57,8 @@ void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName )
info.dwFlags = 0;
#if ( defined _WINDOWS64 | defined _DURANGO )
#ifdef _MSC_VER
// Legacy MSVC debugger thread naming (requires SEH, not C++ exceptions).
__try
{
RaiseException(0x406D1388, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR *)&info);
@@ -27,6 +67,7 @@ void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName )
{
}
#endif
#endif
#ifdef _XBOX
__try
{