Files
mandy/third_party/xtaskqueue/Source/Common/ResultMacros.h
IAmNotSiob 36bc1200ad Runtime: offline xgameruntime shim (XGameRuntime, XSystem, XTaskQueue, XAsync)
Every GDK title calls XGameRuntimeInitialize first and builds its async work on
XTaskQueue/XAsync. Add an xgameruntime.dll shim table for those, ahead of the
executable: XGameRuntimeInitialize/Uninitialize (reference counted),
XSystemGetDeviceType (Series X; LEONIDA_DEVICE_TYPE overrides) and
XSystemGetConsoleId (placeholder), plus the 23 XTaskQueue/XAsync functions.

XTaskQueue/XAsync come from microsoft/libHttpClient (MIT), copied unmodified
into third_party/xtaskqueue (task queue only, no HTTP stack); a small pch.h
stand-in lets them build alone. xgameruntime_test drives the table through
the shim registry the way a title boots. Nothing goes online.
2026-11-21 23:06:10 +01:00

22 lines
1.7 KiB
C

#pragma once
#define RETURN_HR(hr) return(hr)
#define RETURN_LAST_ERROR() return HRESULT_FROM_WIN32(GetLastError())
#define RETURN_WIN32(win32err) return HRESULT_FROM_WIN32(win32err)
#define RETURN_IF_FAILED(hr) do { HRESULT __hrRet = hr; if (FAILED(__hrRet)) { RETURN_HR(__hrRet); }} while (0, 0)
#define RETURN_IF_WIN32_BOOL_FALSE(win32BOOL) do { BOOL __boolRet = win32BOOL; if (!__boolRet) { RETURN_LAST_ERROR(); }} while (0, 0)
#define RETURN_IF_NULL_ALLOC(ptr) do { if ((ptr) == nullptr) { RETURN_HR(E_OUTOFMEMORY); }} while (0, 0)
#define RETURN_HR_IF(hr, condition) do { if (condition) { RETURN_HR(hr); }} while (0, 0)
#define RETURN_HR_IF_FALSE(hr, condition) do { if (!(condition)) { RETURN_HR(hr); }} while (0, 0)
#define RETURN_LAST_ERROR_IF(condition) do { if (condition) { RETURN_LAST_ERROR(); }} while (0, 0)
#define RETURN_LAST_ERROR_IF_NULL(ptr) do { if ((ptr) == nullptr) { RETURN_LAST_ERROR(); }} while (0, 0)
#define LOG_IF_FAILED(hr) do { HRESULT __hrRet = hr; if (FAILED(__hrRet)) { HC_TRACE_ERROR(HTTPCLIENT, "%s: 0x%08X", #hr, __hrRet); }} while (0, 0)
#define FAIL_FAST_MSG(fmt, ...) \
HC_TRACE_ERROR(HTTPCLIENT, fmt, ##__VA_ARGS__); \
ASSERT(false); \
#define FAIL_FAST_IF_FAILED(hr) do { HRESULT __hrRet = hr; if (FAILED(__hrRet)) { FAIL_FAST_MSG("%s 0x%08X", #hr, __hrRet); }} while (0, 0)