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.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp
index 753dd6d28..7e42afb73 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>
@@ -203,9 +204,15 @@ int wmain(int argc, wchar_t** argv) {
203 r.error); 204 r.error);
204 } 205 }
205 if (run) rt::process::set_command_line(image.filename().wstring(), game_args); 206 if (run) rt::process::set_command_line(image.filename().wstring(), game_args);
207 std::exception_ptr init_failure;
206 if (init || run) { 208 if (init || run) {
207 loader.initialise(); // TLS callbacks, then DllMain(DLL_PROCESS_ATTACH) for DLLs 209 try {
208 std::printf("%zu module(s) initialised\n", loader.modules().size()); 210 loader.initialise(); // TLS callbacks, then DllMain(DLL_PROCESS_ATTACH) for DLLs
211 std::printf("%zu module(s) initialised\n", loader.modules().size());
212 } catch (const std::exception&) {
213 // Keep the mapped modules available for the binding report on an attach failure.
214 init_failure = std::current_exception();
215 }
209 } 216 }
210 int unimplemented = 0, unimplemented_hresult = 0; 217 int unimplemented = 0, unimplemented_hresult = 0;
211 for (auto* m : loader.modules()) { 218 for (auto* m : loader.modules()) {
@@ -229,6 +236,10 @@ int wmain(int argc, wchar_t** argv) {
229 std::printf("%zu module(s) mapped, %d unimplemented import(s)\n", loader.modules().size(), unimplemented); 236 std::printf("%zu module(s) mapped, %d unimplemented import(s)\n", loader.modules().size(), unimplemented);
230 std::printf("unimplemented by return policy: hresult=%d other=%d\n", unimplemented_hresult, 237 std::printf("unimplemented by return policy: hresult=%d other=%d\n", unimplemented_hresult,
231 unimplemented - unimplemented_hresult); 238 unimplemented - unimplemented_hresult);
239 if (init_failure) {
240 std::fflush(stdout);
241 std::rethrow_exception(init_failure);
242 }
232 if (!run) { 243 if (!run) {
233 rt::startup_trace::event("exit", "\"code\":0"); 244 rt::startup_trace::event("exit", "\"code\":0");
234 return 0; 245 return 0;