upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/process.cpp
diff options
context:
space:
mode:
authorisaactouzani34100 <isaactouzani34100@gmail.com>2026-11-22 01:10:57 +0100
committerisaactouzani34100 <isaactouzani34100@gmail.com>2026-11-22 01:10:57 +0100
commit1b3ddd4cf3e515e28f4d880c33da202624ea8074 (patch)
treedebbe8f41d8a8db7a6eefba5d1d1102ca1835a86 /runtime/shims/process.cpp
parent4abd54571b6efa02d97eda4711792fa00b455dc3 (diff)
runtime: shim the Debug UCRT (ucrtbased.dll) for the game's argv and exit
A Debug build of the stand-in game links ucrtbased.dll rather than ucrtbase.dll. The process shim only covered api-ms-win-crt-runtime and ucrtbase, so __p___argc/__p___argv went to the host CRT. The game then got gta6rt's own arguments (argc=6) and run_tiny_game failed in the Debug configuration, which is the Visual Studio generator's default.
Diffstat (limited to 'runtime/shims/process.cpp')
-rw-r--r--runtime/shims/process.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/shims/process.cpp b/runtime/shims/process.cpp
index 4e3cb9bd2..e8ec7c34e 100644
--- a/runtime/shims/process.cpp
+++ b/runtime/shims/process.cpp
@@ -7,7 +7,7 @@
7// the exit code is recorded, the run is signalled as finished and the calling thread ends. atexit handlers 7// the exit code is recorded, the run is signalled as finished and the calling thread ends. atexit handlers
8// and static destructors of the game are not run (its CRT shares the host's, whose process-wide atexit table 8// and static destructors of the game are not run (its CRT shares the host's, whose process-wide atexit table
9// also holds gta6rt's own). 9// also holds gta6rt's own).
10// Covered CRTs: the Universal CRT (api-ms-win-crt-runtime-l1-1-0.dll / ucrtbase.dll, what MSVC links) and 10// Covered CRTs: the Universal CRT (api-ms-win-crt-runtime-l1-1-0.dll / ucrtbase.dll, what MSVC links; ucrtbased.dll in Debug) and
11// msvcrt.dll (MinGW). Calls made inside host DLLs, not through the game's imports, are not seen here. 11// msvcrt.dll (MinGW). Calls made inside host DLLs, not through the game's imports, are not seen here.
12#include <windows.h> 12#include <windows.h>
13 13
@@ -188,6 +188,7 @@ using namespace rt::process;
188SHIM_TABLE(process, 188SHIM_TABLE(process,
189 UCRT("api-ms-win-crt-runtime-l1-1-0.dll"), 189 UCRT("api-ms-win-crt-runtime-l1-1-0.dll"),
190 UCRT("ucrtbase.dll"), 190 UCRT("ucrtbase.dll"),
191 UCRT("ucrtbased.dll"), // the Debug UCRT: a Debug build of the stand-in game (run_tiny_game) links it
191 {"msvcrt.dll", "exit", reinterpret_cast<void*>(&game_exit)}, 192 {"msvcrt.dll", "exit", reinterpret_cast<void*>(&game_exit)},
192 {"msvcrt.dll", "_exit", reinterpret_cast<void*>(&game_exit)}, 193 {"msvcrt.dll", "_exit", reinterpret_cast<void*>(&game_exit)},
193 {"msvcrt.dll", "abort", reinterpret_cast<void*>(&game_abort)}, 194 {"msvcrt.dll", "abort", reinterpret_cast<void*>(&game_abort)},