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:
authorSenne Cools <113857183+sennecools@users.noreply.github.com>2026-11-23 23:07:51 +0100
committerSenne Cools <113857183+sennecools@users.noreply.github.com>2026-11-23 23:07:51 +0100
commitad6e5d6bbee5bd8c3c8a7e95216f12038fe3db22 (patch)
tree4f0020d3c5053cf5ce189b7a26c5150c4861b5af /runtime/src/main.cpp
parent5d74c272363f2703265d44e6aaab1a1df8ddfaf3 (diff)
gta6rt: --init/--run stop with a clear message on a host without AVX
The game runs AVX code from its TLS callbacks on, so a CPU or OS without AVX (a QEMU qemu64 guest) died with a bare 0xC000001D. Check CPUID.1 AVX/OSXSAVE and XCR0 YMM state first, print one line and exit 4 (3 is LEONIDA_UNIMPLEMENTED=stop). --dry-run is unchanged and LEONIDA_SKIP_CPU_CHECK=1 skips the check. AI-assisted.
Diffstat (limited to 'runtime/src/main.cpp')
-rw-r--r--runtime/src/main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp
index 71a5b44e1..c24fa0b1e 100644
--- a/runtime/src/main.cpp
+++ b/runtime/src/main.cpp
@@ -29,6 +29,7 @@
29 29
30#include "base_reservation.h" 30#include "base_reservation.h"
31#include "code_hooks.h" 31#include "code_hooks.h"
32#include "host_cpu.h"
32#include "mods.h" 33#include "mods.h"
33#include "pe_loader.h" 34#include "pe_loader.h"
34#include "../shims/d3d12_trace.h" 35#include "../shims/d3d12_trace.h"
@@ -101,6 +102,12 @@ int wmain(int argc, wchar_t** argv) {
101 if (image.empty()) return usage(); 102 if (image.empty()) return usage();
102 // Exactly one mode: --dry-run --run would otherwise initialise the modules and call the entry point. 103 // Exactly one mode: --dry-run --run would otherwise initialise the modules and call the entry point.
103 if (dry_run + init + run != 1) return usage(); 104 if (dry_run + init + run != 1) return usage();
105 // The game runs AVX code from its TLS callbacks on; without AVX that is a bare 0xC000001D (src/host_cpu.h).
106 if ((init || run) && !rt::host_cpu::check_skipped())
107 if (const auto missing = rt::host_cpu::missing_host_features(); !missing.empty()) {
108 std::fprintf(stderr, "%s\n", rt::host_cpu::message(missing).c_str());
109 return rt::host_cpu::kExitCode;
110 }
104 // The console folders are fixed once, as absolute paths. A bare image name (`gta6rt --run game.exe` from the 111 // The console folders are fixed once, as absolute paths. A bare image name (`gta6rt --run game.exe` from the
105 // game folder) has an empty parent path, which left GAME: with no root; and a relative --game-dir or --overlay 112 // game folder) has an empty parent path, which left GAME: with no root; and a relative --game-dir or --overlay
106 // would follow the title's later SetCurrentDirectory. If absolute() fails the path stays as given. 113 // would follow the title's later SetCurrentDirectory. If absolute() fails the path stays as given.