diff options
| author | ASTROWwwW <astrxwledev@gmail.com> | 2026-11-23 19:38:48 +0100 |
|---|---|---|
| committer | ASTROWwwW <astrxwledev@gmail.com> | 2026-11-23 19:38:48 +0100 |
| commit | 5caef48a194d1a39d0568427cdbb4da22a482817 (patch) | |
| tree | e11ac7fe306d4247a3cb432fbeddafe3896bca88 /runtime/src/main.cpp | |
| parent | 8644ce10dc3ef16e18d07cb59c50edcf6d65a827 (diff) | |
| parent | 39b757a6d283fedd32715f84107356b2250d7db9 (diff) | |
Merge branch 'pr7111' into ladder-frame
# Conflicts:
# docs/runtime_imports.md
# runtime/CMakeLists.txt
Diffstat (limited to 'runtime/src/main.cpp')
| -rw-r--r-- | runtime/src/main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index 7e42afb73..11da727b8 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 "cpu_emulation.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" |
| @@ -162,6 +163,15 @@ int wmain(int argc, wchar_t** argv) { | |||
| 162 | : "error: cannot create the trace file\n"); | 163 | : "error: cannot create the trace file\n"); |
| 163 | return 2; | 164 | return 2; |
| 164 | } | 165 | } |
| 166 | // The console's Zen 2 instructions this CPU may lack (docs/cpu_features.md): emulated on #UD. Installed after the | ||
| 167 | // trace's handler so it runs first, and an emulated instruction is not recorded as an exception. | ||
| 168 | if (const auto host = rt::cpu_emulation::detect_host(); !host.sse4a || !host.clzero || !host.monitorx || !host.clwb) | ||
| 169 | std::fprintf(stderr, "[rt] cpu: this CPU lacks%s%s%s%s; the game's uses are emulated (docs/cpu_features.md)\n", | ||
| 170 | host.sse4a ? "" : " SSE4a", host.clzero ? "" : " CLZERO", host.monitorx ? "" : " MONITORX", | ||
| 171 | host.clwb ? "" : " CLWB"); | ||
| 172 | if (!rt::cpu_emulation::install()) | ||
| 173 | std::fprintf(stderr, "[rt] cpu: AddVectoredExceptionHandler failed (error %lu); instructions this CPU lacks " | ||
| 174 | "will stop the game\n", GetLastError()); | ||
| 165 | 175 | ||
| 166 | try { | 176 | try { |
| 167 | rt::Loader loader(game_dir); | 177 | rt::Loader loader(game_dir); |