From 89f414ecd63c766029b28b0d78b3a66074e2e034 Mon Sep 17 00:00:00 2001 From: Hyblocker Date: Wed, 25 Feb 2026 00:32:33 +0100 Subject: [PATCH] feat: improve accuracy on the mwerks sdk --- configure.py | 4 ++-- .../Msl/MSL_C/MSL_Common_Embedded/ansi_fp.c | 5 +++++ .../debugger/embedded/MetroTRK/Portable/notify.c | 9 +++------ .../debugger/embedded/MetroTRK/Portable/support.c | 12 ++++++------ 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/configure.py b/configure.py index f956d1e4..18abb99c 100644 --- a/configure.py +++ b/configure.py @@ -576,7 +576,7 @@ def MatchingFor(*versions): Object(Matching, "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.c"), Object(Matching, "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/abort_exit.c"), Object(Matching, "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/errno.c"), - Object(NonMatching, "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common_Embedded/ansi_fp.c"), + Object(Matching, "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common_Embedded/ansi_fp.c"), Object(Matching, "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common_Embedded/uart_console_io.c"), Object(Matching, "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/buffer_io.c"), Object(Matching, "PowerPC_EABI_Support/Msl/MSL_C/PPC_EABI/critical_regions.ppc_eabi.c"), @@ -623,7 +623,7 @@ def MatchingFor(*versions): Object(Matching, "TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/msghndlr.c"), Object(NonMatching, "TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/support.c"), Object(Matching, "TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/mutex_TRK.c"), - Object(NonMatching, "TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/notify.c"), + Object(Matching, "TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/notify.c"), Object(Matching, "TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Processor/ppc/Generic/flush_cache.c"), Object(Matching, "TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/mem_TRK.c"), Object(Matching, "TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Processor/ppc/Generic/targimpl.c"), diff --git a/src/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common_Embedded/ansi_fp.c b/src/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common_Embedded/ansi_fp.c index 11bfc19c..b48732fc 100644 --- a/src/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common_Embedded/ansi_fp.c +++ b/src/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common_Embedded/ansi_fp.c @@ -24,6 +24,11 @@ void __num2dec(const decform* f, f64 x, decimal* d) int var_r6_2; const f64* var_r5; + // fixes float ordering issue + (void)0.0; + (void)1.0; + (void)4503601774854144.0; + digits = f->digits; if (digits > 16) { digits = 16; diff --git a/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/notify.c b/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/notify.c index 82a799ed..4d6b9424 100644 --- a/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/notify.c +++ b/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/notify.c @@ -6,24 +6,21 @@ inline DSError TRKDoNotifyStopped_Inline(TRKBuffer* msg, MessageCommandID cmd) { - DSError err; - if (msg->position >= 0x880) { - err = DS_MessageBufferOverflow; + return DS_MessageBufferOverflow; } else { msg->data[msg->position++] = cmd; msg->length += 1; - err = 0; + return DS_NoError; } - return err; } DSError TRKDoNotifyStopped(MessageCommandID cmd) { DSError err; - int bufIdx; int reqIdx; TRKBuffer* msg; + int bufIdx; err = TRKGetFreeBuffer(&bufIdx, &msg); if (err == DS_NoError) { diff --git a/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/support.c b/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/support.c index b943d81d..38208a96 100644 --- a/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/support.c +++ b/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Portable/support.c @@ -9,12 +9,12 @@ DSError TRKSuppAccessFile(u32 file_handle, u8* data, size_t* count, DSIOResult* io_result, BOOL need_reply, BOOL read) { - BOOL exit; u32 done; + BOOL exit; DSError error; + TRKBuffer* replyBuffer; int replyBufferId; TRKBuffer* buffer; - TRKBuffer* replyBuffer; u32 length; int bufferId; u16 replyLength; @@ -56,8 +56,8 @@ DSError TRKSuppAccessFile(u32 file_handle, u8* data, size_t* count, replyLength = 0; replyIOResult = DS_IONoError; - error = TRKRequestSend(buffer, &replyBufferId, read ? 5 : 5, 3, - !(read && file_handle == 0)); + error = (0, TRKRequestSend(buffer, &replyBufferId, read ? 5 : 5, + 3, !(read && file_handle == 0))); if (error == DS_NoError) { replyBuffer = (TRKBuffer*)TRKGetBuffer(replyBufferId); TRKSetBufferPosition(replyBuffer, 2); @@ -73,8 +73,8 @@ DSError TRKSuppAccessFile(u32 file_handle, u8* data, size_t* count, if (read && error == DS_NoError) { if (replyBuffer->length != replyLength + 5) { replyLength = replyBuffer->length - 5; - if (replyIOResult == DS_IONoError) - replyIOResult = DS_IOError; + if (replyIOResult == 0) + replyIOResult = 1; } if (replyLength <= length)