Commit Graph

3 Commits

Author SHA1 Message Date
1b3ddd4cf3 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.
2026-11-22 01:10:57 +01:00
4abd54571b runtime: rename shims/process.h to process_shim.h (it hid the CRT's <process.h> from <thread>)
With runtime/shims on the include path, <thread>'s #include <process.h> found #316's header, so
_beginthreadex was undeclared in d3d12_com.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 18:47:53 -05:00
0ca9bb8bc0 Runtime: gta6rt --run, and a stand-in game executable run through the loader
gta6rt --run <exe> [-- args] maps and binds the executable, initialises its
modules and calls its entry point on a game thread. shims/process.cpp answers
the process-level imports through the game's own import table: argv/argc and
GetCommandLine are the game's (UCRT api-set/ucrtbase and msvcrt forms), and
exit/_exit/quick_exit/ExitProcess/abort end the run with that exit code
instead of the host. gta6rt then exits with the game's code directly, so the
game's atexit handlers don't run during host shutdown.

tiny_game.exe (CTest run_tiny_game, run_tiny_game_exit_code) does what a title
does in its first second: arguments, a static initializer, a 4 MiB allocation,
a file round trip, a thread, and xgameruntime.dll imports, which the shim
registry answers instead of the link-time stub. thread_local and a C++
exception are opt-in (LEONIDA_RUN_TLS / LEONIDA_RUN_EH) until #93 and #176.
2026-11-21 23:50:31 +01:00