From 3896f82bbc01ebe5a823393ba82d0d724a6e341b Mon Sep 17 00:00:00 2001 From: gijs Date: Fri, 20 Oct 2023 18:03:48 +0200 Subject: [PATCH] Rename `func_80089CF8` to `nuSiSendMesg` and clean it up --- include/common.h | 2 -- linker_scripts/symbols/addr.txt | 1 + src/_ob_classy_fold.c | 4 +++- src/_ob_icy_coast.c | 29 +++++++++++------------------ 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/include/common.h b/include/common.h index de0fe59..04324ac 100644 --- a/include/common.h +++ b/include/common.h @@ -172,8 +172,6 @@ extern void __calls_osViBlack(bool black); extern void __osViSwapBuffer_3(void** buffers); -extern s32 func_80089CF8(s16 arg0, s32 arg1); - extern void __start_copy_global_controller_data(void); extern void __end_copy_global_controller_data(void); diff --git a/linker_scripts/symbols/addr.txt b/linker_scripts/symbols/addr.txt index e68be75..574fb75 100644 --- a/linker_scripts/symbols/addr.txt +++ b/linker_scripts/symbols/addr.txt @@ -58,6 +58,7 @@ nuGfxDisplayOff = 0x80089BC0; nuGfxDisplayOn = 0x80089C50; nuSiMgrInit = 0x80089C60; nuSiMgrThread = 0x80089D9C; +nuSiSendMesg = 0x80089CF8; obCurrentTime = 0x800C47D0; diff --git a/src/_ob_classy_fold.c b/src/_ob_classy_fold.c index cf59e9c..1c12ff2 100644 --- a/src/_ob_classy_fold.c +++ b/src/_ob_classy_fold.c @@ -1,5 +1,7 @@ #include "common.h" +#include "nu/nusys.h" + void __copy_global_controller_data(OSContPad* arg0) { __start_copy_global_controller_data(); bcopy(&__GLOBAL_CONTROLLER_DATA, arg0, 0x18); @@ -7,7 +9,7 @@ void __copy_global_controller_data(OSContPad* arg0) { } void func_8008A640(void) { - func_80089CF8(0x103, 0); + nuSiSendMesg(0x103, 0); } void __set_fp_8008A660(void(*arg0)(s16)) { diff --git a/src/_ob_icy_coast.c b/src/_ob_icy_coast.c index 32890ee..4621795 100644 --- a/src/_ob_icy_coast.c +++ b/src/_ob_icy_coast.c @@ -20,31 +20,24 @@ u8 nuSiMgrInit(void) { return pattern; } -s32 func_80089CF8(s16 arg0, s32 arg1) { - typedef struct { - /* 0x0 */ s16 unk0; - /* 0x4 */ OSMesgQueue* msgQueue; - /* 0x8 */ s32 unk8; - /* 0xC */ s32 unkC; - } Message; // size 0x10 - - OSMesgQueue sp10; - Message msg; +s32 nuSiSendMesg(NUScMsg mesg, void* dataPtr) { + OSMesgQueue rtnMesgQ; + NUSiCommonMesg siCommonMesg; OSMesg sp38; // maybe this is part of the struct? - msg.unk0 = arg0; - msg.unkC = arg1; - msg.msgQueue = &sp10; + siCommonMesg.mesg = mesg; + siCommonMesg.dataPtr = dataPtr; + siCommonMesg.rtnMesgQ = &rtnMesgQ; - osCreateMesgQueue(&sp10, &sp38, 1); - osSendMesg(&MQ_800E7988, &msg, OS_MESG_BLOCK); - osRecvMesg(&sp10, NULL, OS_MESG_BLOCK); + osCreateMesgQueue(&rtnMesgQ, &sp38, 1); + osSendMesg(&MQ_800E7988, &siCommonMesg, OS_MESG_BLOCK); + osRecvMesg(&rtnMesgQ, NULL, OS_MESG_BLOCK); - return msg.unk8; + return siCommonMesg.error; } void func_80089D5C(void) { - func_80089CF8(0x7F00, 0); + nuSiSendMesg(0x7F00, 0); }