From 2d464a78a46831a1a7e32104337b6f6d9b7d1960 Mon Sep 17 00:00:00 2001 From: gijs Date: Thu, 19 Oct 2023 18:50:20 +0200 Subject: [PATCH] Clean up and move definitions to `common.h` --- include/common.h | 6 ++++++ src/_ob_rabid_jar.c | 34 ++++++++++++---------------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/include/common.h b/include/common.h index 3bf1918..c5e21c3 100644 --- a/include/common.h +++ b/include/common.h @@ -625,4 +625,10 @@ extern u8 __reset_compared_osTvType(); extern void func_8016CD50(u8 arg0); extern void __inc_compared_osTvType(u8 arg0); +extern s32 func_80173B60(s32); +extern s32 D_800AF0B0; + +extern void Unpack(s32, s32); +extern OSMesgQueue MQ_800AF320; + #endif \ No newline at end of file diff --git a/src/_ob_rabid_jar.c b/src/_ob_rabid_jar.c index eac854c..38b32bc 100644 --- a/src/_ob_rabid_jar.c +++ b/src/_ob_rabid_jar.c @@ -1,4 +1,5 @@ #include "common.h" +#include "os_message.h" typedef struct { s32 field_0x0; @@ -55,7 +56,7 @@ extern void* D_800AF090[4]; extern void* D_800C47F0[4]; extern void func_8007819C(); -extern void func_8009C7C0(s32 time); // this function doesnt take an s64 +extern void func_8009C7C0(s32 time); extern s32 func_80173B60(s32); INCLUDE_ASM(const s32, "_ob_rabid_jar", __calls_loads_overlay_array); @@ -102,14 +103,12 @@ INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076324); INCLUDE_ASM(const s32, "_ob_rabid_jar", __get_overlay_index); -// INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800764E0); - /* 68E0 800764E0 */ void func_800764E0(void) { u16 i; osGetTime(); - bzero(D_800E82C8, 0x3F0); + bzero(D_800E82C8, sizeof(D_800E82C8)); bzero(D_800C4C10, sizeof(D_800C4C10)); D_800C4C20 = 1; @@ -140,9 +139,6 @@ INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076DC8); INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076E00); -s32 func_80173B60(s32); /* extern */ -extern s32 D_800AF0B0; - /* 722C 80076E2C */ void func_80076E2C(void) { D_800AF0B0 = func_80173B60(D_800AF0B0); @@ -186,7 +182,6 @@ loop_1: return var_a1; } - INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800773D4); INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007740C); @@ -385,7 +380,6 @@ INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007896C); // } // } - INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80078C6C); INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079028); @@ -437,7 +431,6 @@ INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079E9C); // return var_s0; // } - INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079EF4); INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079F70); @@ -459,28 +452,25 @@ INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007AB7C); INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007ABAC); -void Unpack(s32, s32); -extern OSMesgQueue MQ_800AF320; - /* B030 8007AC30 */ void UnpackProc(void) { struct { /* 0x00 */ s32 field_0x0; - /* 0x04 */ OSMesgQueue* field_0x4; - /* 0x08 */ u8 field_0x8; + /* 0x04 */ OSMesgQueue* queue; + /* 0x08 */ u8 format; /* 0x09 */ u8 field_0x9[3]; /* 0x0C */ s32 field_0xc; /* 0x10 */ s32 field_0x10; - } *sp10; + } *pack; - sp10 = NULL; + pack = NULL; while(1) { - osRecvMesg(&MQ_800AF320, &sp10, 1); - if (sp10->field_0x8 == 1) { - Unpack(sp10->field_0x10, sp10->field_0xc); - osSendMesg(sp10->field_0x4, sp10, 1); + osRecvMesg(&MQ_800AF320, (OSMesg)&pack, 1); + if (pack->format == 1) { + Unpack(pack->field_0x10, pack->field_0xc); + osSendMesg(pack->queue, pack, OS_MESG_BLOCK); } else { - osSyncPrintf("UnpackProc: no supported format %d\n", sp10->field_0x8); + osSyncPrintf("UnpackProc: no supported format %d\n", pack->format); } } }