diff options
| author | Krashgamer <64923888+Krashgamer@users.noreply.github.com> | 2026-11-23 19:35:24 +0100 |
|---|---|---|
| committer | Krashgamer <64923888+Krashgamer@users.noreply.github.com> | 2026-11-23 19:35:24 +0100 |
| commit | 39b757a6d283fedd32715f84107356b2250d7db9 (patch) | |
| tree | 5b408821e7262eadc8afe3c45ba59cfe70ec2f60 /runtime/src/main.cpp | |
| parent | 978d525d99413cce232efde07efbf392d1e782a5 (diff) | |
| parent | 6dda0630bd6fc0514baadb94fb98e36bd7d64c0b (diff) | |
Merge main into runtime/emulate-zen2-insns (keep both the cpu_emulation and xg_xs test targets)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/main.cpp')
| -rw-r--r-- | runtime/src/main.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index 5a9f7c76f..505cd3ea8 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | #include <cstdio> | 21 | #include <cstdio> |
| 22 | #include <cstdlib> | 22 | #include <cstdlib> |
| 23 | #include <exception> | ||
| 23 | #include <filesystem> | 24 | #include <filesystem> |
| 24 | #include <map> | 25 | #include <map> |
| 25 | #include <string> | 26 | #include <string> |
| @@ -189,9 +190,15 @@ int wmain(int argc, wchar_t** argv) { | |||
| 189 | r.error); | 190 | r.error); |
| 190 | } | 191 | } |
| 191 | if (run) rt::process::set_command_line(image.filename().wstring(), game_args); | 192 | if (run) rt::process::set_command_line(image.filename().wstring(), game_args); |
| 193 | std::exception_ptr init_failure; | ||
| 192 | if (init || run) { | 194 | if (init || run) { |
| 193 | loader.initialise(); // TLS callbacks, then DllMain(DLL_PROCESS_ATTACH) for DLLs | 195 | try { |
| 194 | std::printf("%zu module(s) initialised\n", loader.modules().size()); | 196 | loader.initialise(); // TLS callbacks, then DllMain(DLL_PROCESS_ATTACH) for DLLs |
| 197 | std::printf("%zu module(s) initialised\n", loader.modules().size()); | ||
| 198 | } catch (const std::exception&) { | ||
| 199 | // Keep the mapped modules available for the binding report on an attach failure. | ||
| 200 | init_failure = std::current_exception(); | ||
| 201 | } | ||
| 195 | } | 202 | } |
| 196 | int unimplemented = 0, unimplemented_hresult = 0; | 203 | int unimplemented = 0, unimplemented_hresult = 0; |
| 197 | for (auto* m : loader.modules()) { | 204 | for (auto* m : loader.modules()) { |
| @@ -215,6 +222,10 @@ int wmain(int argc, wchar_t** argv) { | |||
| 215 | std::printf("%zu module(s) mapped, %d unimplemented import(s)\n", loader.modules().size(), unimplemented); | 222 | std::printf("%zu module(s) mapped, %d unimplemented import(s)\n", loader.modules().size(), unimplemented); |
| 216 | std::printf("unimplemented by return policy: hresult=%d other=%d\n", unimplemented_hresult, | 223 | std::printf("unimplemented by return policy: hresult=%d other=%d\n", unimplemented_hresult, |
| 217 | unimplemented - unimplemented_hresult); | 224 | unimplemented - unimplemented_hresult); |
| 225 | if (init_failure) { | ||
| 226 | std::fflush(stdout); | ||
| 227 | std::rethrow_exception(init_failure); | ||
| 228 | } | ||
| 218 | if (!run) { | 229 | if (!run) { |
| 219 | rt::startup_trace::event("exit", "\"code\":0"); | 230 | rt::startup_trace::event("exit", "\"code\":0"); |
| 220 | return 0; | 231 | return 0; |