From 97b0b1097052f5873fe7fbd8d790701c2802c89a Mon Sep 17 00:00:00 2001 From: gijs Date: Wed, 18 Oct 2023 17:33:01 +0200 Subject: [PATCH] Changed `obStackMain` to be used differently in different functions as I think it's an alias --- include/common.h | 2 +- src/_ob_prized_reading.c | 38 +++++++++++++++++++++++++++++++++++++- src/boot.c | 2 ++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/include/common.h b/include/common.h index 3f82fae..86a39bb 100644 --- a/include/common.h +++ b/include/common.h @@ -363,7 +363,7 @@ extern void obIdle(void*); extern void obMain(void*); extern OSThread obThreadMain; -extern u8 obStackMain[]; +// extern u8 obStackMain[]; extern OSThread obThreadIdle; extern u8 obStackIdle[]; diff --git a/src/_ob_prized_reading.c b/src/_ob_prized_reading.c index 73b5d1f..a809579 100644 --- a/src/_ob_prized_reading.c +++ b/src/_ob_prized_reading.c @@ -1,7 +1,43 @@ #include "common.h" +void func_8008A5D0(); +void func_8008A640(); + +extern OSMesg OSMESG_800BE190; +extern OSMesg OSMESG_800BE194; + +extern u32 obStackMain; + +/* 1A660 8008A260 */ +u8 func_8008A260(void) { + s32 var_a0; + s32 var_a1; + s32 var_v1; + + func_8008A5D0(); + osCreateMesgQueue(&MQ_800C4A00, &OSMESG_800BE190, 1); + osCreateMesgQueue(&MQ_800E9BF0, &OSMESG_800BE194, 1); + func_8008B130(&D_800A9FF8); + func_8008A640(); + + var_a0 = 1; + var_a1 = 0; + var_v1 = 0; + obStackMain = 0; + for(; var_v1 < MAXCONTROLLERS; var_v1++) { + if (__GLOBAL_CONT_STATUS[var_v1].errno == 0) { + if ((__GLOBAL_CONT_STATUS[var_v1].type & CONT_TYPE_MASK) == CONT_TYPE_NORMAL) { + var_a1 |= var_a0; + obStackMain += 1; + } + var_a0 *= 2; + } + } + + return var_a1; +} + -INCLUDE_ASM(const s32, "_ob_prized_reading", func_8008A260); void func_8008A334(void) { func_8008B1D0(&D_800A9FF8); diff --git a/src/boot.c b/src/boot.c index 4130ccf..c347a29 100644 --- a/src/boot.c +++ b/src/boot.c @@ -1,5 +1,7 @@ #include "common.h" +extern u8 obStackMain[]; + void boot(void) { osInitialize(); osCreateThread(&obThreadIdle, 1, obIdle, NULL, obStackIdle, 0xA);