upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/src/main.cpp
diff options
context:
space:
mode:
authorKam471 <kam471@users.noreply.github.com>2026-11-21 22:19:03 +0000
committerKam471 <kam471@users.noreply.github.com>2026-11-21 23:29:24 +0000
commit993a2cbf72a9509ca730e509ea38e455d35f5a74 (patch)
treea3d6dc8481bfeabb7e5a94840ef4474504add23d /runtime/src/main.cpp
parentd7cbc3e7cb4d031c790dddd265a83fb6a1a1a7a5 (diff)
Runtime: install static TLS for mapped images
Diffstat (limited to 'runtime/src/main.cpp')
-rw-r--r--runtime/src/main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp
index d79ff97dc..07b9086f9 100644
--- a/runtime/src/main.cpp
+++ b/runtime/src/main.cpp
@@ -1,8 +1,10 @@
1// gta6rt: native runtime for the Xbox Series build. 1// gta6rt: native runtime for the Xbox Series build.
2// 2//
3// gta6rt --dry-run <image> [--game-dir DIR] 3// gta6rt --dry-run <image> [--game-dir DIR]
4// Maps the image and its bundled modules, applies relocations, binds every import and prints a report. 4// Maps the image and its bundled modules, applies relocations, binds every import, installs static TLS for
5// No code from the image runs. 5// this thread and prints a report. No code from the mapped images
6// runs. TLS needs the runtime's own gta6rt_tls_host.dll, which reserves the module TLS index; system DLLs are
7// loaded to resolve host imports, as before.
6// 8//
7// gta6rt --init <image> [--game-dir DIR] 9// gta6rt --init <image> [--game-dir DIR]
8// The same mapping, then each loaded DLL's TLS callbacks and DllMain(DLL_PROCESS_ATTACH) are run. 10// The same mapping, then each loaded DLL's TLS callbacks and DllMain(DLL_PROCESS_ATTACH) are run.
@@ -66,9 +68,9 @@ int wmain(int argc, wchar_t** argv) {
66 68
67 try { 69 try {
68 rt::Loader loader(game_dir); 70 rt::Loader loader(game_dir);
69 rt::Module& main_module = loader.load(image); 71 rt::Module& main_module = loader.load(image); // maps, binds and installs TLS; runs no image code
70 if (init || run) { 72 if (init || run) {
71 loader.initialise(); 73 loader.initialise(); // TLS callbacks, then DllMain(DLL_PROCESS_ATTACH) for DLLs
72 std::printf("%zu module(s) initialised\n", loader.modules().size()); 74 std::printf("%zu module(s) initialised\n", loader.modules().size());
73 } 75 }
74 int unimplemented = 0; 76 int unimplemented = 0;