diff options
| author | tedin7 <tommasoderosa94@gmail.com> | 2026-11-23 17:27:58 +0100 |
|---|---|---|
| committer | tedin7 <tommasoderosa94@gmail.com> | 2026-11-23 17:27:58 +0100 |
| commit | aeb253754c1d4fc42a5f4419120cc65047b1465b (patch) | |
| tree | de9274f8d8d79d399baff59ca76de3b6ad7a659b /runtime/src/main.cpp | |
| parent | c7ca0f2d1c3d1aaa1dca7c01740dac076c523154 (diff) | |
| parent | 359390833f62378a5d1d2c0f9a6cea48fccbcb53 (diff) | |
Merge fast-rtbudget into fast-desc-clean
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 b75baf15f..71a5b44e1 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> |
| @@ -179,9 +180,15 @@ int wmain(int argc, wchar_t** argv) { | |||
| 179 | r.error); | 180 | r.error); |
| 180 | } | 181 | } |
| 181 | if (run) rt::process::set_command_line(image.filename().wstring(), game_args); | 182 | if (run) rt::process::set_command_line(image.filename().wstring(), game_args); |
| 183 | std::exception_ptr init_failure; | ||
| 182 | if (init || run) { | 184 | if (init || run) { |
| 183 | loader.initialise(); // TLS callbacks, then DllMain(DLL_PROCESS_ATTACH) for DLLs | 185 | try { |
| 184 | std::printf("%zu module(s) initialised\n", loader.modules().size()); | 186 | loader.initialise(); // TLS callbacks, then DllMain(DLL_PROCESS_ATTACH) for DLLs |
| 187 | std::printf("%zu module(s) initialised\n", loader.modules().size()); | ||
| 188 | } catch (const std::exception&) { | ||
| 189 | // Keep the mapped modules available for the binding report on an attach failure. | ||
| 190 | init_failure = std::current_exception(); | ||
| 191 | } | ||
| 185 | } | 192 | } |
| 186 | int unimplemented = 0, unimplemented_hresult = 0; | 193 | int unimplemented = 0, unimplemented_hresult = 0; |
| 187 | for (auto* m : loader.modules()) { | 194 | for (auto* m : loader.modules()) { |
| @@ -205,6 +212,10 @@ int wmain(int argc, wchar_t** argv) { | |||
| 205 | std::printf("%zu module(s) mapped, %d unimplemented import(s)\n", loader.modules().size(), unimplemented); | 212 | std::printf("%zu module(s) mapped, %d unimplemented import(s)\n", loader.modules().size(), unimplemented); |
| 206 | std::printf("unimplemented by return policy: hresult=%d other=%d\n", unimplemented_hresult, | 213 | std::printf("unimplemented by return policy: hresult=%d other=%d\n", unimplemented_hresult, |
| 207 | unimplemented - unimplemented_hresult); | 214 | unimplemented - unimplemented_hresult); |
| 215 | if (init_failure) { | ||
| 216 | std::fflush(stdout); | ||
| 217 | std::rethrow_exception(init_failure); | ||
| 218 | } | ||
| 208 | if (!run) { | 219 | if (!run) { |
| 209 | rt::startup_trace::event("exit", "\"code\":0"); | 220 | rt::startup_trace::event("exit", "\"code\":0"); |
| 210 | return 0; | 221 | return 0; |