From 3b06ad52f04c2a2d30a2d66c133b85cb1712b29c Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Fri, 24 Nov 2023 14:49:23 -0500 Subject: [PATCH] Check RT64 initialization return status --- src/recomp/rt64_layer.cpp | 6 +++--- ultramodern/events.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/recomp/rt64_layer.cpp b/src/recomp/rt64_layer.cpp index e5a5583..6740c6d 100644 --- a/src/recomp/rt64_layer.cpp +++ b/src/recomp/rt64_layer.cpp @@ -45,7 +45,7 @@ void dummy_check_interrupts() { } -void RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHandle window_handle) { +bool RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHandle window_handle) { set_rt64_hooks(); // Dynamic loading //auto RT64 = LoadLibrary("RT64.dll"); @@ -100,11 +100,11 @@ void RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHandle window_han gfx_info.RDRAM_SIZE = &RDRAM_SIZE; #if defined(_WIN32) - InitiateGFXWindows(gfx_info, window_handle.window, window_handle.thread_id); + return InitiateGFXWindows(gfx_info, window_handle.window, window_handle.thread_id); #elif defined(__ANDROID__) static_assert(false && "Unimplemented"); #elif defined(__linux__) - InitiateGFXLinux(gfx_info, window_handle.window, window_handle.display); + return InitiateGFXLinux(gfx_info, window_handle.window, window_handle.display); #else static_assert(false && "Unimplemented"); #endif diff --git a/ultramodern/events.cpp b/ultramodern/events.cpp index 4669912..0fe6342 100644 --- a/ultramodern/events.cpp +++ b/ultramodern/events.cpp @@ -174,7 +174,7 @@ void dp_complete() { osSendMesg(PASS_RDRAM events_context.dp.mq, events_context.dp.msg, OS_MESG_NOBLOCK); } -void RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHandle window_handle); +bool RT64Init(uint8_t* rom, uint8_t* rdram, ultramodern::WindowHandle window_handle); void RT64SendDL(uint8_t* rdram, const OSTask* task); void RT64UpdateScreen(uint32_t vi_origin); void RT64ChangeWindow(); @@ -263,7 +263,9 @@ void gfx_thread_func(uint8_t* rdram, uint8_t* rom, std::atomic_flag* thread_read ultramodern::set_native_thread_name("Gfx Thread"); ultramodern::set_native_thread_priority(ultramodern::ThreadPriority::Normal); - RT64Init(rom, rdram, window_handle); + if (!RT64Init(rom, rdram, window_handle)) { + throw std::runtime_error("Failed to initialize RT64!"); + } rsp_constants_init();