diff options
| author | Jcw87 <Jcw87@users.noreply.github.com> | 2026-01-20 20:28:42 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-20 20:28:42 -0800 |
| commit | 7e0d9c31695f12bbc74fa8ddbd9be4d4224f9df5 (patch) | |
| tree | 9e9d45e12469ae322f10b22e5c9b6de4d1564ac2 /src/JSystem/JUtility/JUTException.cpp | |
| parent | c256a9965ed3b8eb984a85787b94a7d235ff6c0a (diff) | |
JUtility wii (#3061)
* JUtility wii
* lbl_8074CFA4
Diffstat (limited to 'src/JSystem/JUtility/JUTException.cpp')
| -rw-r--r-- | src/JSystem/JUtility/JUTException.cpp | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/src/JSystem/JUtility/JUTException.cpp b/src/JSystem/JUtility/JUTException.cpp index 19c3fafe0e..efd5157910 100644 --- a/src/JSystem/JUtility/JUTException.cpp +++ b/src/JSystem/JUtility/JUTException.cpp @@ -10,8 +10,21 @@ #include <dolphin/dolphin.h> #include <stdint.h> +struct CallbackObject { + /* 0x00 */ JUTExceptionUserCallback callback; + /* 0x04 */ u16 error; + /* 0x08 */ OSContext* context; + /* 0x0C */ int param_3; + /* 0x10 */ int param_4; +}; + OSMessageQueue JUTException::sMessageQueue = {0}; +STATIC_ASSERT(sizeof(CallbackObject) == 0x14); +static CallbackObject exCallbackObject; + +JSUList<JUTException::JUTExMapFile> JUTException::sMapFileList(false); + static OSTime c3bcnt[4] = {0, 0, 0, 0}; const char* JUTException::sCpuExpName[17] = { @@ -38,10 +51,16 @@ JUTException* JUTException::sErrorManager; JUTExceptionUserCallback JUTException::sPreUserCallback; - JUTExceptionUserCallback JUTException::sPostUserCallback; +JUTExceptionUserCallback JUTException::sPostUserCallback; + +#if PLATFORM_GCN +const int stack_size = 0x1C00; +#else +const int stack_size = 0x4000; +#endif JUTException::JUTException(JUTDirectPrint* directPrint) - : JKRThread(0x1C00, 0x10, 0), mDirectPrint(directPrint) { + : JKRThread(stack_size, 0x10, 0), mDirectPrint(directPrint) { OSSetErrorHandler(__OS_EXCEPTION_DSI, (OSErrorHandler)errorHandler); OSSetErrorHandler(__OS_EXCEPTION_ISI, (OSErrorHandler)errorHandler); OSSetErrorHandler(__OS_EXCEPTION_PROGRAM, (OSErrorHandler)errorHandler); @@ -74,16 +93,6 @@ JUTException* JUTException::create(JUTDirectPrint* directPrint) { OSMessage JUTException::sMessageBuffer[1] = {0}; -struct CallbackObject { - /* 0x00 */ JUTExceptionUserCallback callback; - /* 0x04 */ u16 error; - /* 0x06 */ u16 pad_0x06; - /* 0x08 */ OSContext* context; - /* 0x0C */ int param_3; - /* 0x10 */ int param_4; - /* 0x14 */ -}; - void* JUTException::run() { u32 msr = PPCMfmsr(); msr &= ~0x0900; @@ -118,9 +127,6 @@ void* JUTException::run() { } } -STATIC_ASSERT(sizeof(CallbackObject) == 0x14); -static CallbackObject exCallbackObject; - void* JUTException::sConsoleBuffer; u32 JUTException::sConsoleBufferSize; @@ -154,8 +160,6 @@ void JUTException::errorHandler(OSError error, OSContext* context, u32 param_3, OSYieldThread(); } -JSUList<JUTException::JUTExMapFile> JUTException::sMapFileList(false); - void JUTException::panic_f_va(char const* file, int line, char const* format, va_list args) { char buffer[256]; vsnprintf(buffer, sizeof(buffer) - 1, format, args); @@ -525,12 +529,8 @@ bool JUTException::isEnablePad() const { bool JUTException::readPad(u32* out_trigger, u32* out_button) { bool result = false; OSTime start_time = OSGetTime(); - OSTime ms; do { - OSTime end_time = OSGetTime(); - OSTime ticks = end_time - start_time; - ms = ticks / (OS_TIMER_CLOCK / 1000); - } while (ms < 0x32); + } while (OSTicksToMilliseconds(OSGetTime() - start_time) < 0x32); if (mGamePad == (JUTGamePad*)0xffffffff) { JUTGamePad gamePad0(JUTGamePad::EPort1); @@ -750,24 +750,19 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3 } void JUTException::waitTime(s32 timeout_ms) { - if (timeout_ms) { - OSTime start_time = OSGetTime(); - OSTime ms; - do { - OSTime end_time = OSGetTime(); - OSTime ticks = end_time - start_time; - ms = ticks / (OS_TIMER_CLOCK / 1000); - } while (ms < timeout_ms); + if (!timeout_ms) { + return; } + + OSTime start_time = OSGetTime(); + do { + } while (OSTicksToMilliseconds(OSGetTime() - start_time) < timeout_ms); } void JUTException::createFB() { _GXRenderModeObj* renderMode = &GXNtsc480Int; void* end = (void*)OSGetArenaHi(); - u16 width = ALIGN_NEXT(renderMode->fbWidth, 16); - u16 height = renderMode->xfbHeight; - u32 pixel_count = width * height; - u32 size = pixel_count * 2; + u32 size = (u16(ALIGN_NEXT(u16(renderMode->fbWidth), 16)) * renderMode->xfbHeight) * 2; void* begin = (void*)ALIGN_PREV((uintptr_t)end - size, 32); void* object = (void*)ALIGN_PREV((s32)begin - sizeof(JUTExternalFB), 32); @@ -807,7 +802,7 @@ void JUTException::appendMapFile(char const* path) { } for (JSUListIterator<JUTExMapFile> iterator = sMapFileList.getFirst(); iterator != sMapFileList.getEnd(); iterator++) { - if (strcmp(path, iterator->mPath) == 0) { + if (strcmp(path, iterator.getObject()->mPath) == 0) { return; } } |
