diff options
Diffstat (limited to 'runtime/src/main.cpp')
| -rw-r--r-- | runtime/src/main.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index c8545f338..f44eb2535 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp | |||
| @@ -176,8 +176,10 @@ void start_title_peek(std::uint8_t* base) { | |||
| 176 | 176 | ||
| 177 | } // namespace | 177 | } // namespace |
| 178 | 178 | ||
| 179 | #include "avx2_emulation.h" | ||
| 179 | #include "base_reservation.h" | 180 | #include "base_reservation.h" |
| 180 | #include "compile_gate_policy.h" | 181 | #include "compile_gate_policy.h" |
| 182 | #include "bmi_emulation.h" | ||
| 181 | #include "code_hooks.h" | 183 | #include "code_hooks.h" |
| 182 | #include "cpu_emulation.h" | 184 | #include "cpu_emulation.h" |
| 183 | #include "host_cpu.h" | 185 | #include "host_cpu.h" |
| @@ -545,6 +547,8 @@ int wmain(int argc, wchar_t** argv) { | |||
| 545 | leonida::kernel_writes::set_committer(&rt::xmem::commit_physical_range); | 547 | leonida::kernel_writes::set_committer(&rt::xmem::commit_physical_range); |
| 546 | rt::d3d12_xs::set_texture_page_provider(&rt::xmem::pin_mapped_data); | 548 | rt::d3d12_xs::set_texture_page_provider(&rt::xmem::pin_mapped_data); |
| 547 | leonida::kernel_writes::set_unguarder(&rt::xmem::reopen_unowned); | 549 | leonida::kernel_writes::set_unguarder(&rt::xmem::reopen_unowned); |
| 550 | // The first call of a forwarded device slot names its caller as module+offset (RT-526). | ||
| 551 | rt::d3d12_xs::set_device_slot_caller_formatter(&rt::shims::module_offset); | ||
| 548 | if (int trace_error = 0; !trace_file.empty() && !rt::startup_trace::open(trace_file.c_str(), &trace_error)) { | 552 | if (int trace_error = 0; !trace_file.empty() && !rt::startup_trace::open(trace_file.c_str(), &trace_error)) { |
| 549 | std::fprintf(stderr, trace_error == EEXIST ? "error: the trace file already exists; --trace only creates a new file\n" | 553 | std::fprintf(stderr, trace_error == EEXIST ? "error: the trace file already exists; --trace only creates a new file\n" |
| 550 | : "error: cannot create the trace file\n"); | 554 | : "error: cannot create the trace file\n"); |
| @@ -559,6 +563,19 @@ int wmain(int argc, wchar_t** argv) { | |||
| 559 | if (!rt::cpu_emulation::install()) | 563 | if (!rt::cpu_emulation::install()) |
| 560 | std::fprintf(stderr, "[rt] cpu: AddVectoredExceptionHandler failed (error %lu); instructions this CPU lacks " | 564 | std::fprintf(stderr, "[rt] cpu: AddVectoredExceptionHandler failed (error %lu); instructions this CPU lacks " |
| 561 | "will stop the game\n", GetLastError()); | 565 | "will stop the game\n", GetLastError()); |
| 566 | if (const auto bmi = rt::bmi_emulation::detect_host(); !bmi.bmi1 || !bmi.bmi2 || !bmi.lzcnt || !bmi.movbe) | ||
| 567 | std::fprintf(stderr, "[rt] cpu: this CPU lacks%s%s%s%s; the game's uses are emulated (docs/cpu_features.md)\n", | ||
| 568 | bmi.bmi1 ? "" : " BMI1", bmi.bmi2 ? "" : " BMI2", bmi.lzcnt ? "" : " LZCNT", | ||
| 569 | bmi.movbe ? "" : " MOVBE"); | ||
| 570 | if (!rt::bmi_emulation::install()) | ||
| 571 | std::fprintf(stderr, "[rt] cpu: AddVectoredExceptionHandler (BMI) failed (error %lu); instructions this CPU " | ||
| 572 | "lacks will stop the game\n", GetLastError()); | ||
| 573 | if (const auto avx2 = rt::avx2_emulation::detect_host(); !avx2.avx2 || !avx2.fma || !avx2.f16c) | ||
| 574 | std::fprintf(stderr, "[rt] cpu: this CPU lacks%s%s%s; the game's uses are emulated (docs/cpu_features.md)\n", | ||
| 575 | avx2.avx2 ? "" : " AVX2", avx2.fma ? "" : " FMA3", avx2.f16c ? "" : " F16C"); | ||
| 576 | if (!rt::avx2_emulation::install()) | ||
| 577 | std::fprintf(stderr, "[rt] cpu: AddVectoredExceptionHandler (AVX2) failed (error %lu); instructions this CPU " | ||
| 578 | "lacks will stop the game\n", GetLastError()); | ||
| 562 | 579 | ||
| 563 | try { | 580 | try { |
| 564 | rt::Loader loader(game_dir); | 581 | rt::Loader loader(game_dir); |