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:
authorAsh Hopkins <ashleighhopkins87@gmail.com>2026-11-22 11:25:05 +0000
committerAsh Hopkins <ashleighhopkins87@gmail.com>2026-11-22 12:53:32 +0000
commitd820ecfa63fa9939209e305d5f94cda59ca7f16f (patch)
tree66ef66207632527124aa192dce3552e5f51d8635 /runtime/src/main.cpp
parent41f448261e1de8a410b4d760e69a7e5656cef858 (diff)
runtime: reserve a relocation-less image's range before arm64 Wine takes it
An EXE without .reloc can only run at its ImageBase (0x140000000 by default; RT-22 asks whether the game's is one). Under arm64 Wine on macOS (CrossOver's arm64 bottles, x86-64 code under FEX) the process's own start-up allocations sit at 0x100000000 and up before gta6rt runs, so such an image failed with "preferred base is taken". gta6rt now starts itself again suspended when the image has no relocations and its range is not free, reserves [ImageBase, ImageBase + SizeOfImage) in the new process, resumes it and returns its exit code; the loader commits the image inside that reservation. LEONIDA_BASE_RESERVED tells the new process, which does not start itself again. Where the range is free at start-up (Windows, x86-64 Wine) nothing changes. tiny_game_fixed is the stand-in game linked /FIXED at 0x140000000; run_tiny_game_fixed and run_tiny_game_fixed_exit_code run it. Arm64 bottle (CrossOver Preview 20260821, M2 Max): it maps at 0x140000000 and both tests pass, --dry-run and --init exit 0; with the relaunch disabled it fails as before. The Rosetta (x86-64) bottle passes them too. The in-process loader tests that build relocation-less images (loader, pe_loader_bounds, unimplemented_policy) still fail on arm64. AI-assisted. No game files.
Diffstat (limited to 'runtime/src/main.cpp')
-rw-r--r--runtime/src/main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp
index 9ceccf53a..475ae6ec7 100644
--- a/runtime/src/main.cpp
+++ b/runtime/src/main.cpp
@@ -20,6 +20,7 @@
20#include <string> 20#include <string>
21#include <vector> 21#include <vector>
22 22
23#include "base_reservation.h"
23#include "pe_loader.h" 24#include "pe_loader.h"
24#include "../shims/d3d12_trace.h" 25#include "../shims/d3d12_trace.h"
25#include "../shims/process_shim.h" 26#include "../shims/process_shim.h"
@@ -68,6 +69,10 @@ int wmain(int argc, wchar_t** argv) {
68 // Exactly one mode: --dry-run --run would otherwise initialise the modules and call the entry point. 69 // Exactly one mode: --dry-run --run would otherwise initialise the modules and call the entry point.
69 if (dry_run + init + run != 1) return usage(); 70 if (dry_run + init + run != 1) return usage();
70 if (game_dir.empty()) game_dir = image.parent_path(); 71 if (game_dir.empty()) game_dir = image.parent_path();
72 // An image without relocations whose range this process already uses (arm64 Wine on macOS) runs in a new
73 // process that has the range reserved from the start (base_reservation.h); that process does not do this again.
74 if (!rt::base_reservation::inherited())
75 if (const auto range = rt::base_reservation::needed(image)) return rt::base_reservation::relaunch(*range);
71 rt::d3d12_trace::set_enabled(trace_d3d12); 76 rt::d3d12_trace::set_enabled(trace_d3d12);
72 77
73 try { 78 try {