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:
Diffstat (limited to 'runtime/src/main.cpp')
-rw-r--r--runtime/src/main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp
index b75baf15f..5a9f7c76f 100644
--- a/runtime/src/main.cpp
+++ b/runtime/src/main.cpp
@@ -28,6 +28,7 @@
28 28
29#include "base_reservation.h" 29#include "base_reservation.h"
30#include "code_hooks.h" 30#include "code_hooks.h"
31#include "cpu_emulation.h"
31#include "mods.h" 32#include "mods.h"
32#include "pe_loader.h" 33#include "pe_loader.h"
33#include "../shims/d3d12_trace.h" 34#include "../shims/d3d12_trace.h"
@@ -151,6 +152,15 @@ int wmain(int argc, wchar_t** argv) {
151 : "error: cannot create the trace file\n"); 152 : "error: cannot create the trace file\n");
152 return 2; 153 return 2;
153 } 154 }
155 // The console's Zen 2 instructions this CPU may lack (docs/cpu_features.md): emulated on #UD. Installed after the
156 // trace's handler so it runs first, and an emulated instruction is not recorded as an exception.
157 if (const auto host = rt::cpu_emulation::detect_host(); !host.sse4a || !host.clzero || !host.monitorx || !host.clwb)
158 std::fprintf(stderr, "[rt] cpu: this CPU lacks%s%s%s%s; the game's uses are emulated (docs/cpu_features.md)\n",
159 host.sse4a ? "" : " SSE4a", host.clzero ? "" : " CLZERO", host.monitorx ? "" : " MONITORX",
160 host.clwb ? "" : " CLWB");
161 if (!rt::cpu_emulation::install())
162 std::fprintf(stderr, "[rt] cpu: AddVectoredExceptionHandler failed (error %lu); instructions this CPU lacks "
163 "will stop the game\n", GetLastError());
154 164
155 try { 165 try {
156 rt::Loader loader(game_dir); 166 rt::Loader loader(game_dir);