From 32fe030b42bc001b71d6edcf0530f60e6ecd73cc Mon Sep 17 00:00:00 2001 From: mzxrules Date: Wed, 18 Mar 2020 10:27:49 -0400 Subject: new repo, OK++ --- src/code/z_debug.c | 282 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 276 insertions(+), 6 deletions(-) (limited to 'src/code') diff --git a/src/code/z_debug.c b/src/code/z_debug.c index b5d078985..74f3965eb 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -1,20 +1,290 @@ #include #include +#include +#include +#include -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_800636C0.s") +#define BUTTON_C_RIGHT 0x0001 +#define BUTTON_C_LEFT 0x0002 +#define BUTTON_C_DOWN 0x0004 +#define BUTTON_C_UP 0x0008 +#define BUTTON_R 0x0010 +#define BUTTON_L 0x0020 +#define BUTTON_D_RIGHT 0x0100 +#define BUTTON_D_LEFT 0x0200 +#define BUTTON_D_DOWN 0x0400 +#define BUTTON_D_UP 0x0800 +#define BUTTON_START 0x1000 +#define BUTTON_Z 0x2000 +#define BUTTON_B 0x4000 +#define BUTTON_A 0x8000 -void func_8006375C(UNK_TYPE arg0, UNK_TYPE arg1, UNK_TYPE arg2) +#define REG_GROUP_TOTAL 29 +#define REG_N 96 +#define PAGE_N 16 + +GameInfo* gGameInfo; +int D_8015FA94; //no known symbols + +typedef struct +{ + u8 x; + u8 y; + u8 colorId; + char text[0x15]; +} PrintTextBuffer; + +PrintTextBuffer D_8015FA98[0x16]; +//s16 D_8011E0B0 //PrintTextBuffer index + +//#define D_8015FC18 D_8015FA98[0x10] +typedef struct +{ + u16 push; + u16 held; +} InputCombo; + +extern InputCombo D_8011E0D4[REG_GROUP_TOTAL]; //register button combos + +extern char D_8011E148[]; + +//initialize GameInfo +void func_800636C0() +{ + s32 i; + + gGameInfo = (GameInfo*)SystemArena_MallocDebug(sizeof(GameInfo), "../z_debug.c", 0x104); + gGameInfo->reg_page = 0; + gGameInfo->reg_group = 0; + gGameInfo->reg_cur = 0; + gGameInfo->dpad_last = 0; + gGameInfo->repeat = 0; + for (i = 0; i < 0xAE0; i++) + { + gGameInfo->data[i] = 0; + } +} + +//Called when free movement is active +void func_8006375C(s32 arg0, s32 arg1, float* d_80855320) { } +//8011D394 enable camera debugger + +#ifdef NON_MATCHING //regalloc +//Copy Camera Debugger Text +void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) +{ + PrintTextBuffer* buf; + char* next_text; + s16 i; //v1 + + buf = &D_8015FA98[D_8011E0B0]; + if (D_8011E0B0 < 0x16) { + + buf->x = x; + buf->y = y; + buf->colorId = colorId; + + i = 0; + next_text = buf->text + 1; + + if (*buf->text = *text++) { + do if (i++ > 0x14) { + break; + } while (*next_text++ = *text++); + } + + *next_text = '\0'; + D_8011E0B0++; + } +} + +#else #pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_8006376C.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_80063828.s") +//Draw Text +void func_80063828(GfxPrint* gfxPrint) +{ + s32 i; + Color_RGBA8* color; + PrintTextBuffer* buffer; + char* text; + + i = 0; + if (D_8011E0B0 > 0) + { + do + { + buffer = &D_8015FA98[i]; + text = buffer->text; + + color = &D_8011E0B4[buffer->colorId]; + GfxPrint_SetColor(gfxPrint, color->r, color->g, color->b, color->a); + GfxPrint_SetPos(gfxPrint, buffer->x, buffer->y); + GfxPrint_Printf(gfxPrint, "%s", text); + i += 1; + } while (i < D_8011E0B0); + } +} + +//Edit REG +void func_8006390C(Input* input) { + + s32 dpad; + s32 reg_group; + s32 increment; + InputCombo* input_combo; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_8006390C.s") + reg_group = (gGameInfo->reg_group * (REG_N / PAGE_N) + gGameInfo->reg_page) * PAGE_N - PAGE_N; + dpad = input->raw.pad & 0xF00; + if (!~(input->raw.pad | ~BUTTON_L) || + !~(input->raw.pad | ~BUTTON_R) || + !~(input->raw.pad | ~BUTTON_START)) { + input_combo = D_8011E0D4; + for (i = 0; i < REG_GROUP_TOTAL; i++) + { + if (~(~input_combo->push | input->raw.pad) || + ~(~input_combo->held | input->padPressed)) { + input_combo++; + } + else + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_80063C04.s") + if (i < REG_GROUP_TOTAL) { + if (i == gGameInfo->reg_group) { + gGameInfo->reg_page = (gGameInfo->reg_page + 1) % 7; + return; + } + gGameInfo->reg_group = i; + gGameInfo->reg_page = 0; + } + } + else { + switch (gGameInfo->reg_page - 1) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_80063D7C.s") + if (dpad == gGameInfo->dpad_last) { + gGameInfo->repeat--; + if (gGameInfo->repeat < 0) { + gGameInfo->repeat = 1; + } + else { + dpad ^= gGameInfo->dpad_last; + } + } + else { + gGameInfo->repeat = 0x10; + gGameInfo->dpad_last = dpad; + } + increment = + (dpad & BUTTON_D_RIGHT) ? ( + !~(input->raw.pad | ~(BUTTON_A | BUTTON_B)) ? 1000 : + !~(input->raw.pad | ~BUTTON_A) ? 100 : + !~(input->raw.pad | ~BUTTON_B) ? 10 : 1) : + (dpad & BUTTON_D_LEFT) ? ( + !~(input->raw.pad | ~(BUTTON_A | BUTTON_B)) ? -1000 : + !~(input->raw.pad | ~BUTTON_A) ? -100 : + !~(input->raw.pad | ~BUTTON_B) ? -10 : -1) : + 0; + + gGameInfo->data[gGameInfo->reg_cur + reg_group] += increment; + if (dpad & BUTTON_D_UP) { + gGameInfo->reg_cur--; + if (gGameInfo->reg_cur < 0) { + gGameInfo->reg_cur = PAGE_N - 1; + } + } + else if (dpad & BUTTON_D_DOWN) { + gGameInfo->reg_cur++; + if (gGameInfo->reg_cur >= PAGE_N) { + gGameInfo->reg_cur = 0; + } + } + if (iREG(0)) { + iREG(0) = 0; + func_800AA000(0, iREG(1), iREG(2), iREG(3)); + } + + } + } +} + +//Draw Memory Viewer +void func_80063C04(GfxPrint* gfxPrint) +{ + s32 i; + s32 page; + s32 reg_group; + s32 test; //removing affects stack + char reg_name[3]; + + page = (gGameInfo->reg_page * PAGE_N) - PAGE_N; + reg_group = (gGameInfo->reg_group * (REG_N / PAGE_N) + gGameInfo->reg_page) * PAGE_N - PAGE_N; + + //set up register name string + reg_name[0] = 'R'; + reg_name[1] = D_8011E148[gGameInfo->reg_group]; //r_group type char + reg_name[2] = '\0'; + GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80); + + for (i = 0; i != PAGE_N; i++) + { + if (i == gGameInfo->reg_cur) + { + GfxPrint_SetColor(gfxPrint, 0, 0xff, 0xff, 0xff); + } + GfxPrint_SetPos(gfxPrint, 3, i + 5); + GfxPrint_Printf(gfxPrint, "%s%02d%6d", ®_name, page + i, gGameInfo->data[i + reg_group]); + if (i == gGameInfo->reg_cur) + { + GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80); + } + } +} + +void func_80063D7C(GraphicsContext* gfxCtx) { + Gfx* sp7C; + Gfx* sp78; + Gfx* temp_ret; + void* unk2[6]; + GfxPrint gfxPrint; + void* unk[2]; + Gfx* dl_frame[4];//stores state of GfxCtx next ptrs + + func_800C6AC4(&dl_frame, gfxCtx, "../z_debug.c", 0x274); + GfxPrint_Ctor(&gfxPrint); + sp78 = gfxCtx->polyOpa.p; + temp_ret = func_800C6C20(gfxCtx->polyOpa.p); + gSPDisplayList(gfxCtx->overlay.p++, temp_ret); + GfxPrint_Open(&gfxPrint, temp_ret); + + if ((OREG(0) == 1) || (OREG(0) == 8)) { + func_80063828(&gfxPrint); + } + + if (gGameInfo->reg_page != 0) { + func_80063C04(&gfxPrint); + } + + D_8011E0B0 = 0; + sp7C = GfxPrint_Close(&gfxPrint); + gSPEndDisplayList(sp7C++); + func_800C6C28(sp78, sp7C); + gfxCtx->polyOpa.p = sp7C; + if (0); + func_800C6B54(&dl_frame, gfxCtx, "../z_debug.c", 0x298); + GfxPrint_Dtor(&gfxPrint); +} -- cgit v1.2.3 From dd4f67c3f51eba222060449972783951beedff9b Mon Sep 17 00:00:00 2001 From: mzxrules Date: Wed, 18 Mar 2020 12:31:36 -0400 Subject: convert z_debug.data --- src/code/z_debug.c | 71 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 17 deletions(-) (limited to 'src/code') diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 74f3965eb..f0971cfbf 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -23,9 +23,6 @@ #define REG_N 96 #define PAGE_N 16 -GameInfo* gGameInfo; -int D_8015FA94; //no known symbols - typedef struct { u8 x; @@ -34,19 +31,61 @@ typedef struct char text[0x15]; } PrintTextBuffer; -PrintTextBuffer D_8015FA98[0x16]; -//s16 D_8011E0B0 //PrintTextBuffer index - -//#define D_8015FC18 D_8015FA98[0x10] typedef struct { u16 push; u16 held; } InputCombo; -extern InputCombo D_8011E0D4[REG_GROUP_TOTAL]; //register button combos +GameInfo* gGameInfo; +int D_8015FA94; //no known symbols +PrintTextBuffer D_8015FA98[0x16]; -extern char D_8011E148[]; +s16 D_8011E0B0 = 0; //PrintTextBuffer index +Color_RGBA8 printTextColors[] = { + { 0xFF, 0xFF, 0x20, 0xC0 }, + { 0xFF, 0x96, 0x80, 0xC0 }, + { 0x80, 0x60, 0x00, 0x40 }, + { 0xC0, 0x80, 0x10, 0x80 }, + { 0xFF, 0xC0, 0x20, 0x80 }, + { 0xE6, 0xE6, 0xDC, 0x40 }, + { 0x80, 0x96, 0xFF, 0x80 }, + { 0x80, 0xFF, 0x20, 0x80 }, +}; + +InputCombo inputCombos[REG_GROUP_TOTAL] = { + { BUTTON_L, BUTTON_C_UP }, + { BUTTON_L, BUTTON_C_LEFT }, + { BUTTON_L, BUTTON_C_DOWN }, + { BUTTON_L, BUTTON_A }, + { BUTTON_R, BUTTON_C_DOWN }, + { BUTTON_L, BUTTON_C_RIGHT }, + { BUTTON_L, BUTTON_R }, + { BUTTON_L, BUTTON_D_LEFT }, + { BUTTON_L, BUTTON_D_RIGHT }, + { BUTTON_L, BUTTON_D_UP }, + { BUTTON_L, BUTTON_B }, + { BUTTON_L, BUTTON_Z }, + { BUTTON_L, BUTTON_D_DOWN }, + { BUTTON_R, BUTTON_A }, + { BUTTON_R, BUTTON_B }, + { BUTTON_R, BUTTON_Z }, + { BUTTON_R, BUTTON_L }, + { BUTTON_R, BUTTON_C_UP }, + { BUTTON_R, BUTTON_C_RIGHT }, + { BUTTON_R, BUTTON_D_LEFT }, + { BUTTON_R, BUTTON_C_LEFT }, + { BUTTON_R, BUTTON_START }, + { BUTTON_L, BUTTON_START }, + { BUTTON_R, BUTTON_D_RIGHT }, + { BUTTON_R, BUTTON_D_UP }, + { BUTTON_START, BUTTON_R }, + { BUTTON_START, BUTTON_A }, + { BUTTON_START, BUTTON_B }, + { BUTTON_START, BUTTON_C_RIGHT }, +}; + +char regChar[] = " SOPQMYDUIZCNKXcsiWAVHGmnBdkb"; //initialize GameInfo void func_800636C0() @@ -65,14 +104,13 @@ void func_800636C0() } } -//Called when free movement is active +//Called when free movement is active. +//8011D394 to enable camera debugger void func_8006375C(s32 arg0, s32 arg1, float* d_80855320) { } -//8011D394 enable camera debugger - #ifdef NON_MATCHING //regalloc //Copy Camera Debugger Text void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) @@ -122,7 +160,7 @@ void func_80063828(GfxPrint* gfxPrint) buffer = &D_8015FA98[i]; text = buffer->text; - color = &D_8011E0B4[buffer->colorId]; + color = &printTextColors[buffer->colorId]; GfxPrint_SetColor(gfxPrint, color->r, color->g, color->b, color->a); GfxPrint_SetPos(gfxPrint, buffer->x, buffer->y); GfxPrint_Printf(gfxPrint, "%s", text); @@ -145,7 +183,7 @@ void func_8006390C(Input* input) { if (!~(input->raw.pad | ~BUTTON_L) || !~(input->raw.pad | ~BUTTON_R) || !~(input->raw.pad | ~BUTTON_START)) { - input_combo = D_8011E0D4; + input_combo = inputCombos; for (i = 0; i < REG_GROUP_TOTAL; i++) { if (~(~input_combo->push | input->raw.pad) || @@ -217,7 +255,6 @@ void func_8006390C(Input* input) { iREG(0) = 0; func_800AA000(0, iREG(1), iREG(2), iREG(3)); } - } } } @@ -236,7 +273,7 @@ void func_80063C04(GfxPrint* gfxPrint) //set up register name string reg_name[0] = 'R'; - reg_name[1] = D_8011E148[gGameInfo->reg_group]; //r_group type char + reg_name[1] = regChar[gGameInfo->reg_group]; //r_group type char reg_name[2] = '\0'; GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80); @@ -262,7 +299,7 @@ void func_80063D7C(GraphicsContext* gfxCtx) { void* unk2[6]; GfxPrint gfxPrint; void* unk[2]; - Gfx* dl_frame[4];//stores state of GfxCtx next ptrs + Gfx* dl_frame[4]; //stores state of GfxCtx next ptrs func_800C6AC4(&dl_frame, gfxCtx, "../z_debug.c", 0x274); GfxPrint_Ctor(&gfxPrint); -- cgit v1.2.3 From a01f868a1a562f8d8c7aebdf8caff60eaccf9f1a Mon Sep 17 00:00:00 2001 From: wed <> Date: Fri, 20 Mar 2020 08:48:38 +1100 Subject: Finish z_lib.c --- src/code/z_lib.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'src/code') diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 7b8bcbc2c..51867991a 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -1,20 +1,16 @@ #include #include -#ifdef NON_MATCHING -void Lib_MemSet(void* dest, size_t size, u8 val) +void Lib_MemSet(u8 dest[], size_t size, u8 val) { - u8* destu = dest; - u32 i; + size_t i = 0; - for (i = 0; i < size; i++) - { - *destu++ = val; - } + if (i == size) return; + do { + *dest++ = val; + i++; + } while (i != size); } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_lib/Lib_MemSet.s") -#endif f32 Math_Coss(s16 angle) { @@ -559,15 +555,12 @@ f32 func_800784D8(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) return step; } -#ifdef NON_MATCHING -// regalloc differences s16 Math_SmoothScaleMaxMinS(s16* pValue, s16 target, s16 invScale, s16 maxStep, s16 minStep) { + s16 step = 0; s16 diff = (target - *pValue); - s32 baseStep; - s16 step; - baseStep = diff / invScale; + s32 baseStep = diff / invScale; if (*pValue != target) { @@ -604,9 +597,6 @@ s16 Math_SmoothScaleMaxMinS(s16* pValue, s16 target, s16 invScale, s16 maxStep, return diff; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_lib/Math_SmoothScaleMaxMinS.s") -#endif void Math_SmoothScaleMaxS(s16* pValue, s16 target, s16 invScale, s16 maxStep) { -- cgit v1.2.3 From 8063249af48736010d909cefd33aa8f194c223ce Mon Sep 17 00:00:00 2001 From: mzxrules Date: Thu, 19 Mar 2020 18:06:41 -0400 Subject: changes --- src/code/z_debug.c | 198 ++++++++++++++++++++++++----------------------------- 1 file changed, 91 insertions(+), 107 deletions(-) (limited to 'src/code') diff --git a/src/code/z_debug.c b/src/code/z_debug.c index f0971cfbf..489636d41 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -3,24 +3,8 @@ #include #include #include +#include -#define BUTTON_C_RIGHT 0x0001 -#define BUTTON_C_LEFT 0x0002 -#define BUTTON_C_DOWN 0x0004 -#define BUTTON_C_UP 0x0008 -#define BUTTON_R 0x0010 -#define BUTTON_L 0x0020 -#define BUTTON_D_RIGHT 0x0100 -#define BUTTON_D_LEFT 0x0200 -#define BUTTON_D_DOWN 0x0400 -#define BUTTON_D_UP 0x0800 -#define BUTTON_START 0x1000 -#define BUTTON_Z 0x2000 -#define BUTTON_B 0x4000 -#define BUTTON_A 0x8000 - -#define REG_GROUP_TOTAL 29 -#define REG_N 96 #define PAGE_N 16 typedef struct @@ -53,36 +37,36 @@ Color_RGBA8 printTextColors[] = { { 0x80, 0xFF, 0x20, 0x80 }, }; -InputCombo inputCombos[REG_GROUP_TOTAL] = { - { BUTTON_L, BUTTON_C_UP }, - { BUTTON_L, BUTTON_C_LEFT }, - { BUTTON_L, BUTTON_C_DOWN }, - { BUTTON_L, BUTTON_A }, - { BUTTON_R, BUTTON_C_DOWN }, - { BUTTON_L, BUTTON_C_RIGHT }, - { BUTTON_L, BUTTON_R }, - { BUTTON_L, BUTTON_D_LEFT }, - { BUTTON_L, BUTTON_D_RIGHT }, - { BUTTON_L, BUTTON_D_UP }, - { BUTTON_L, BUTTON_B }, - { BUTTON_L, BUTTON_Z }, - { BUTTON_L, BUTTON_D_DOWN }, - { BUTTON_R, BUTTON_A }, - { BUTTON_R, BUTTON_B }, - { BUTTON_R, BUTTON_Z }, - { BUTTON_R, BUTTON_L }, - { BUTTON_R, BUTTON_C_UP }, - { BUTTON_R, BUTTON_C_RIGHT }, - { BUTTON_R, BUTTON_D_LEFT }, - { BUTTON_R, BUTTON_C_LEFT }, - { BUTTON_R, BUTTON_START }, - { BUTTON_L, BUTTON_START }, - { BUTTON_R, BUTTON_D_RIGHT }, - { BUTTON_R, BUTTON_D_UP }, - { BUTTON_START, BUTTON_R }, - { BUTTON_START, BUTTON_A }, - { BUTTON_START, BUTTON_B }, - { BUTTON_START, BUTTON_C_RIGHT }, +InputCombo inputCombos[REG_GROUPS] = { + { L_TRIG, U_CBUTTONS }, + { L_TRIG, L_CBUTTONS }, + { L_TRIG, D_CBUTTONS }, + { L_TRIG, A_BUTTON }, + { R_TRIG, D_CBUTTONS }, + { L_TRIG, R_CBUTTONS }, + { L_TRIG, R_TRIG }, + { L_TRIG, L_JPAD }, + { L_TRIG, R_JPAD }, + { L_TRIG, U_JPAD }, + { L_TRIG, B_BUTTON }, + { L_TRIG, Z_TRIG }, + { L_TRIG, D_JPAD }, + { R_TRIG, A_BUTTON }, + { R_TRIG, B_BUTTON }, + { R_TRIG, Z_TRIG }, + { R_TRIG, L_TRIG }, + { R_TRIG, U_CBUTTONS }, + { R_TRIG, R_CBUTTONS }, + { R_TRIG, L_JPAD }, + { R_TRIG, L_CBUTTONS }, + { R_TRIG, START_BUTTON }, + { L_TRIG, START_BUTTON }, + { R_TRIG, R_JPAD }, + { R_TRIG, U_JPAD }, + { START_BUTTON, R_TRIG }, + { START_BUTTON, A_BUTTON }, + { START_BUTTON, B_BUTTON }, + { START_BUTTON, R_CBUTTONS }, }; char regChar[] = " SOPQMYDUIZCNKXcsiWAVHGmnBdkb"; @@ -92,13 +76,13 @@ void func_800636C0() { s32 i; - gGameInfo = (GameInfo*)SystemArena_MallocDebug(sizeof(GameInfo), "../z_debug.c", 0x104); - gGameInfo->reg_page = 0; - gGameInfo->reg_group = 0; - gGameInfo->reg_cur = 0; - gGameInfo->dpad_last = 0; + gGameInfo = (GameInfo*)SystemArena_MallocDebug(sizeof(GameInfo), "../z_debug.c", 260); + gGameInfo->regPage = 0; + gGameInfo->regGroup = 0; + gGameInfo->regCur = 0; + gGameInfo->dpadLast = 0; gGameInfo->repeat = 0; - for (i = 0; i < 0xAE0; i++) + for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) { gGameInfo->data[i] = 0; } @@ -116,7 +100,7 @@ void func_8006375C(s32 arg0, s32 arg1, float* d_80855320) void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) { PrintTextBuffer* buf; - char* next_text; + char* bufText; s16 i; //v1 buf = &D_8015FA98[D_8011E0B0]; @@ -127,15 +111,15 @@ void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) buf->colorId = colorId; i = 0; - next_text = buf->text + 1; + bufText = buf->text + 1; if (*buf->text = *text++) { do if (i++ > 0x14) { break; - } while (*next_text++ = *text++); + } while (*bufText++ = *text++); } - *next_text = '\0'; + *bufText = '\0'; D_8011E0B0++; } } @@ -173,18 +157,18 @@ void func_80063828(GfxPrint* gfxPrint) void func_8006390C(Input* input) { s32 dpad; - s32 reg_group; + s32 regGroup; s32 increment; InputCombo* input_combo; s32 i; - reg_group = (gGameInfo->reg_group * (REG_N / PAGE_N) + gGameInfo->reg_page) * PAGE_N - PAGE_N; + regGroup = (gGameInfo->regGroup * (REG_PER_GROUP / PAGE_N) + gGameInfo->regPage) * PAGE_N - PAGE_N; dpad = input->raw.pad & 0xF00; - if (!~(input->raw.pad | ~BUTTON_L) || - !~(input->raw.pad | ~BUTTON_R) || - !~(input->raw.pad | ~BUTTON_START)) { + if (!~(input->raw.pad | ~L_TRIG) || + !~(input->raw.pad | ~R_TRIG) || + !~(input->raw.pad | ~START_BUTTON)) { input_combo = inputCombos; - for (i = 0; i < REG_GROUP_TOTAL; i++) + for (i = 0; i < REG_GROUPS; i++) { if (~(~input_combo->push | input->raw.pad) || ~(~input_combo->held | input->padPressed)) { @@ -194,17 +178,17 @@ void func_8006390C(Input* input) { break; } - if (i < REG_GROUP_TOTAL) { - if (i == gGameInfo->reg_group) { - gGameInfo->reg_page = (gGameInfo->reg_page + 1) % 7; + if (i < REG_GROUPS) { + if (i == gGameInfo->regGroup) { + gGameInfo->regPage = (gGameInfo->regPage + 1) % 7; return; } - gGameInfo->reg_group = i; - gGameInfo->reg_page = 0; + gGameInfo->regGroup = i; + gGameInfo->regPage = 0; } } else { - switch (gGameInfo->reg_page - 1) + switch (gGameInfo->regPage - 1) { case 0: case 1: @@ -213,42 +197,42 @@ void func_8006390C(Input* input) { case 4: case 5: - if (dpad == gGameInfo->dpad_last) { + if (dpad == gGameInfo->dpadLast) { gGameInfo->repeat--; if (gGameInfo->repeat < 0) { gGameInfo->repeat = 1; } else { - dpad ^= gGameInfo->dpad_last; + dpad ^= gGameInfo->dpadLast; } } else { gGameInfo->repeat = 0x10; - gGameInfo->dpad_last = dpad; + gGameInfo->dpadLast = dpad; } increment = - (dpad & BUTTON_D_RIGHT) ? ( - !~(input->raw.pad | ~(BUTTON_A | BUTTON_B)) ? 1000 : - !~(input->raw.pad | ~BUTTON_A) ? 100 : - !~(input->raw.pad | ~BUTTON_B) ? 10 : 1) : - (dpad & BUTTON_D_LEFT) ? ( - !~(input->raw.pad | ~(BUTTON_A | BUTTON_B)) ? -1000 : - !~(input->raw.pad | ~BUTTON_A) ? -100 : - !~(input->raw.pad | ~BUTTON_B) ? -10 : -1) : + (dpad & R_JPAD) ? ( + !~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) ? 1000 : + !~(input->raw.pad | ~A_BUTTON) ? 100 : + !~(input->raw.pad | ~B_BUTTON) ? 10 : 1) : + (dpad & L_JPAD) ? ( + !~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) ? -1000 : + !~(input->raw.pad | ~A_BUTTON) ? -100 : + !~(input->raw.pad | ~B_BUTTON) ? -10 : -1) : 0; - gGameInfo->data[gGameInfo->reg_cur + reg_group] += increment; - if (dpad & BUTTON_D_UP) { - gGameInfo->reg_cur--; - if (gGameInfo->reg_cur < 0) { - gGameInfo->reg_cur = PAGE_N - 1; + gGameInfo->data[gGameInfo->regCur + regGroup] += increment; + if (dpad & U_JPAD) { + gGameInfo->regCur--; + if (gGameInfo->regCur < 0) { + gGameInfo->regCur = PAGE_N - 1; } } - else if (dpad & BUTTON_D_DOWN) { - gGameInfo->reg_cur++; - if (gGameInfo->reg_cur >= PAGE_N) { - gGameInfo->reg_cur = 0; + else if (dpad & D_JPAD) { + gGameInfo->regCur++; + if (gGameInfo->regCur >= PAGE_N) { + gGameInfo->regCur = 0; } } if (iREG(0)) { @@ -264,28 +248,28 @@ void func_80063C04(GfxPrint* gfxPrint) { s32 i; s32 page; - s32 reg_group; + s32 regGroup; s32 test; //removing affects stack - char reg_name[3]; + char name[3]; - page = (gGameInfo->reg_page * PAGE_N) - PAGE_N; - reg_group = (gGameInfo->reg_group * (REG_N / PAGE_N) + gGameInfo->reg_page) * PAGE_N - PAGE_N; + page = (gGameInfo->regPage * PAGE_N) - PAGE_N; + regGroup = (gGameInfo->regGroup * (REG_PER_GROUP / PAGE_N) + gGameInfo->regPage) * PAGE_N - PAGE_N; //set up register name string - reg_name[0] = 'R'; - reg_name[1] = regChar[gGameInfo->reg_group]; //r_group type char - reg_name[2] = '\0'; + name[0] = 'R'; + name[1] = regChar[gGameInfo->regGroup]; //r_group type char + name[2] = '\0'; GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80); for (i = 0; i != PAGE_N; i++) { - if (i == gGameInfo->reg_cur) + if (i == gGameInfo->regCur) { GfxPrint_SetColor(gfxPrint, 0, 0xff, 0xff, 0xff); } GfxPrint_SetPos(gfxPrint, 3, i + 5); - GfxPrint_Printf(gfxPrint, "%s%02d%6d", ®_name, page + i, gGameInfo->data[i + reg_group]); - if (i == gGameInfo->reg_cur) + GfxPrint_Printf(gfxPrint, "%s%02d%6d", &name, page + i, gGameInfo->data[i + regGroup]); + if (i == gGameInfo->regCur) { GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80); } @@ -295,24 +279,24 @@ void func_80063C04(GfxPrint* gfxPrint) void func_80063D7C(GraphicsContext* gfxCtx) { Gfx* sp7C; Gfx* sp78; - Gfx* temp_ret; + Gfx* tempRet; void* unk2[6]; GfxPrint gfxPrint; void* unk[2]; - Gfx* dl_frame[4]; //stores state of GfxCtx next ptrs + Gfx* dlFrame[4]; //stores state of GfxCtx next ptrs - func_800C6AC4(&dl_frame, gfxCtx, "../z_debug.c", 0x274); + func_800C6AC4(&dlFrame, gfxCtx, "../z_debug.c", 628); GfxPrint_Ctor(&gfxPrint); sp78 = gfxCtx->polyOpa.p; - temp_ret = func_800C6C20(gfxCtx->polyOpa.p); - gSPDisplayList(gfxCtx->overlay.p++, temp_ret); - GfxPrint_Open(&gfxPrint, temp_ret); + tempRet = func_800C6C20(gfxCtx->polyOpa.p); + gSPDisplayList(gfxCtx->overlay.p++, tempRet); + GfxPrint_Open(&gfxPrint, tempRet); if ((OREG(0) == 1) || (OREG(0) == 8)) { func_80063828(&gfxPrint); } - if (gGameInfo->reg_page != 0) { + if (gGameInfo->regPage != 0) { func_80063C04(&gfxPrint); } @@ -322,6 +306,6 @@ void func_80063D7C(GraphicsContext* gfxCtx) { func_800C6C28(sp78, sp7C); gfxCtx->polyOpa.p = sp7C; if (0); - func_800C6B54(&dl_frame, gfxCtx, "../z_debug.c", 0x298); + func_800C6B54(&dlFrame, gfxCtx, "../z_debug.c", 664); GfxPrint_Dtor(&gfxPrint); } -- cgit v1.2.3 From c931cd58376a6a9bda2290063974d2cfb371685b Mon Sep 17 00:00:00 2001 From: Random <28494085+Random0666@users.noreply.github.com> Date: Thu, 19 Mar 2020 23:29:33 +0100 Subject: Decompiled z_title.c `z_title.c` : matching --- src/code/title_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/code') diff --git a/src/code/title_setup.c b/src/code/title_setup.c index 22ee8b181..d7ac9cc87 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -6,7 +6,7 @@ void TitleSetup_InitImpl(GameState* gameState) osSyncPrintf("ゼルダ共通データ初期化\n"); SaveContext_Init(); gameState->running = false; - gameState->init = func_80800878; gameState->size = sizeof(TitleContext); + gameState->init = Title_Init; gameState->size = sizeof(TitleContext); } void TitleSetup_Destroy(GameState* gameState) -- cgit v1.2.3 From 858e937519558f1de85baecb8630fa60b9cd9387 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Thu, 19 Mar 2020 20:10:32 -0400 Subject: tweak defines --- src/code/z_debug.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/code') diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 489636d41..451443a6b 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -5,8 +5,6 @@ #include #include -#define PAGE_N 16 - typedef struct { u8 x; @@ -162,7 +160,7 @@ void func_8006390C(Input* input) { InputCombo* input_combo; s32 i; - regGroup = (gGameInfo->regGroup * (REG_PER_GROUP / PAGE_N) + gGameInfo->regPage) * PAGE_N - PAGE_N; + regGroup = (gGameInfo->regGroup * REG_PAGES + gGameInfo->regPage) * REG_PER_PAGE - REG_PER_PAGE; dpad = input->raw.pad & 0xF00; if (!~(input->raw.pad | ~L_TRIG) || !~(input->raw.pad | ~R_TRIG) || @@ -180,7 +178,7 @@ void func_8006390C(Input* input) { if (i < REG_GROUPS) { if (i == gGameInfo->regGroup) { - gGameInfo->regPage = (gGameInfo->regPage + 1) % 7; + gGameInfo->regPage = (gGameInfo->regPage + 1) % (REG_PAGES + 1); return; } gGameInfo->regGroup = i; @@ -190,12 +188,12 @@ void func_8006390C(Input* input) { else { switch (gGameInfo->regPage - 1) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: if (dpad == gGameInfo->dpadLast) { gGameInfo->repeat--; @@ -226,12 +224,12 @@ void func_8006390C(Input* input) { if (dpad & U_JPAD) { gGameInfo->regCur--; if (gGameInfo->regCur < 0) { - gGameInfo->regCur = PAGE_N - 1; + gGameInfo->regCur = REG_PER_PAGE - 1; } } else if (dpad & D_JPAD) { gGameInfo->regCur++; - if (gGameInfo->regCur >= PAGE_N) { + if (gGameInfo->regCur >= REG_PER_PAGE) { gGameInfo->regCur = 0; } } @@ -252,8 +250,8 @@ void func_80063C04(GfxPrint* gfxPrint) s32 test; //removing affects stack char name[3]; - page = (gGameInfo->regPage * PAGE_N) - PAGE_N; - regGroup = (gGameInfo->regGroup * (REG_PER_GROUP / PAGE_N) + gGameInfo->regPage) * PAGE_N - PAGE_N; + page = (gGameInfo->regPage * REG_PER_PAGE) - REG_PER_PAGE; + regGroup = (gGameInfo->regGroup * REG_PAGES + gGameInfo->regPage) * REG_PER_PAGE - REG_PER_PAGE; //set up register name string name[0] = 'R'; @@ -261,7 +259,7 @@ void func_80063C04(GfxPrint* gfxPrint) name[2] = '\0'; GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80); - for (i = 0; i != PAGE_N; i++) + for (i = 0; i != REG_PER_PAGE; i++) { if (i == gGameInfo->regCur) { -- cgit v1.2.3 From 8a7468689046bd6ab3be6f8d47703559c90434de Mon Sep 17 00:00:00 2001 From: wed <> Date: Fri, 20 Mar 2020 11:25:53 +1100 Subject: Changes --- src/code/z_lib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/code') diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 51867991a..a7411c53d 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -1,10 +1,11 @@ #include #include -void Lib_MemSet(u8 dest[], size_t size, u8 val) +void Lib_MemSet(u8* dest, size_t size, u8 val) { - size_t i = 0; + u32 i = 0; + // TODO: Convert this to while/for if possible if (i == size) return; do { *dest++ = val; -- cgit v1.2.3 From 8779aaa75875d17dded8605a4e1731de475f0760 Mon Sep 17 00:00:00 2001 From: Random <28494085+Random0666@users.noreply.github.com> Date: Fri, 20 Mar 2020 12:43:51 +0100 Subject: Decompiled various small files - Decompiled `code_8006C360.c` - Decompiled `prenmi_buf.c` (previously `code_8007BE60.c`) - Decompiled `code_8007BF10.c` - Documented `sys_ucode.c` --- src/code/code_8006C360.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++- src/code/code_8007BE60.c | 50 ------------------------------- src/code/code_8007BF10.c | 20 ++++++++++++- src/code/main.c | 8 ++--- src/code/prenmi_buff.c | 35 ++++++++++++++++++++++ src/code/sys_ucode.c | 8 ++--- src/code/z_room.c | 8 ++--- 7 files changed, 142 insertions(+), 64 deletions(-) delete mode 100644 src/code/code_8007BE60.c create mode 100644 src/code/prenmi_buff.c (limited to 'src/code') diff --git a/src/code/code_8006C360.c b/src/code/code_8006C360.c index 3180bab89..3551ed172 100644 --- a/src/code/code_8006C360.c +++ b/src/code/code_8006C360.c @@ -1,5 +1,80 @@ #include #include -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C360/func_8006C360.s") +//#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C360/func_8006C360.s") + +typedef struct +{ + u16 data[9]; +} struct_8011F3F0; // size = 0x12 + +struct_8011F3F0 D_8011F3F0[60] = +{ + { { 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 } }, + { { 0x0000, 0x7128, 0x7129, 0x7128, 0x7128, 0x7128, 0x7128, 0x712A, 0x712B } }, + { { 0x0000, 0x7128, 0x712B, 0x7128, 0x7128, 0x7129, 0x7128, 0x712B, 0x7128 } }, + { { 0x0000, 0x7128, 0x7129, 0x7128, 0x7128, 0x7128, 0x7128, 0x712A, 0x712B } }, + { { 0x0000, 0x7128, 0x7129, 0x712B, 0x7128, 0x7128, 0x7128, 0x7129, 0x7128 } }, + { { 0x0000, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712F } }, + { { 0x0000, 0x712C, 0x712C, 0x712C, 0x712E, 0x712C, 0x712C, 0x712F, 0x712F } }, + { { 0x0000, 0x712C, 0x712C, 0x712C, 0x712F, 0x712C, 0x712C, 0x712F, 0x712F } }, + { { 0x0000, 0x7130, 0x7132, 0x7133, 0x7130, 0x7130, 0x7131, 0x7132, 0x7131 } }, + { { 0x0000, 0x7134, 0x7137, 0x7135, 0x7134, 0x7136, 0x7135, 0x7134, 0x7135 } }, + { { 0x0000, 0x7138, 0x713A, 0x7138, 0x7139, 0x713A, 0x7138, 0x7139, 0x713B } }, + { { 0x0000, 0x7144, 0x7146, 0x7144, 0x7146, 0x7147, 0x7145, 0x7145, 0x7147 } }, + { { 0x0000, 0x7148, 0x7149, 0x7149, 0x714A, 0x714A, 0x714B, 0x7149, 0x714B } }, + { { 0x0000, 0x714C, 0x714D, 0x714C, 0x714C, 0x714E, 0x714C, 0x714E, 0x714F } }, + { { 0x0000, 0x7150, 0x7153, 0x7152, 0x7150, 0x7151, 0x7153, 0x7153, 0x7151 } }, + { { 0x0000, 0x7155, 0x7156, 0x7157, 0x7154, 0x7156, 0x7156, 0x7156, 0x7156 } }, + { { 0x0000, 0x715A, 0x7159, 0x715B, 0x715A, 0x715A, 0x7158, 0x7158, 0x715B } }, + { { 0x0000, 0x715E, 0x715D, 0x715D, 0x715F, 0x715E, 0x715C, 0x715C, 0x715D } }, + { { 0x0000, 0x7163, 0x7162, 0x7160, 0x7163, 0x7160, 0x7161, 0x7161, 0x7160 } }, + { { 0x0000, 0x7164, 0x7166, 0x7164, 0x7167, 0x7164, 0x7164, 0x7164, 0x7167 } }, + { { 0x0000, 0x716B, 0x7169, 0x7168, 0x716B, 0x716A, 0x716B, 0x716B, 0x716A } }, + { { 0x0000, 0x716C, 0x716D, 0x716F, 0x716C, 0x716E, 0x716E, 0x716E, 0x716F } }, + { { 0x0000, 0x7171, 0x7173, 0x7170, 0x7172, 0x0000, 0x0000, 0x0000, 0x0000 } }, + { { 0x0000, 0x7176, 0x7177, 0x7174, 0x7174, 0x7175, 0x7174, 0x7174, 0x7177 } }, + { { 0x0000, 0x7178, 0x7179, 0x7179, 0x717B, 0x717A, 0x717B, 0x717A, 0x717B } }, + { { 0x0000, 0x717D, 0x717C, 0x717C, 0x717D, 0x717F, 0x717C, 0x717E, 0x717D } }, + { { 0x0000, 0x7183, 0x7181, 0x7180, 0x7183, 0x7182, 0x7183, 0x7181, 0x7183 } }, + { { 0x0000, 0x7184, 0x7186, 0x7185, 0x7186, 0x7184, 0x7187, 0x7186, 0x7184 } }, + { { 0x0000, 0x71A4, 0x71A6, 0x71A5, 0x0000, 0x71A6, 0x71A6, 0x71A6, 0x71A7 } }, + { { 0x0000, 0x7188, 0x7188, 0x7189, 0x7188, 0x7189, 0x718B, 0x718A, 0x7189 } }, + { { 0x0000, 0x718C, 0x718C, 0x718D, 0x718C, 0x718E, 0x718F, 0x718D, 0x718C } }, + { { 0x0000, 0x7190, 0x7190, 0x7191, 0x7192, 0x7191, 0x7193, 0x7190, 0x7191 } }, + { { 0x0000, 0x7196, 0x7194, 0x7195, 0x7196, 0x7197, 0x7194, 0x7196, 0x7195 } }, + { { 0x0000, 0x7199, 0x719A, 0x7198, 0x7198, 0x719A, 0x719A, 0x719B, 0x7198 } }, + { { 0x0000, 0x719D, 0x719C, 0x719E, 0x719D, 0x719D, 0x719C, 0x719F, 0x719E } }, + { { 0x0000, 0x71A1, 0x71A0, 0x71A1, 0x71A2, 0x71A1, 0x71A2, 0x71A3, 0x71A2 } }, + { { 0x0000, 0x711C, 0x711E, 0x711C, 0x711F, 0x711E, 0x711C, 0x711D, 0x711F } }, + { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7107, 0x7105, 0x7106, 0x7107, 0x7107 } }, + { { 0x0000, 0x7107, 0x7105, 0x7107, 0x7107, 0x7106, 0x7107, 0x7107, 0x7105 } }, + { { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 } }, + { { 0x0000, 0x7113, 0x7113, 0x7113, 0x7113, 0x7113, 0x7113, 0x7111, 0x7113 } }, + { { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 } }, + { { 0x0000, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7113 } }, + { { 0x0000, 0x7101, 0x7100, 0x7102, 0x7103, 0x7101, 0x7100, 0x7102, 0x7103 } }, + { { 0x0000, 0x7100, 0x7102, 0x7100, 0x7100, 0x7100, 0x7100, 0x7100, 0x7102 } }, + { { 0x0000, 0x710A, 0x7109, 0x7109, 0x710A, 0x710B, 0x7108, 0x7109, 0x710B } }, + { { 0x0000, 0x7117, 0x7112, 0x7113, 0x7110, 0x710C, 0x7117, 0x710E, 0x7112 } }, + { { 0x0000, 0x710D, 0x710F, 0x710C, 0x7112, 0x710D, 0x710C, 0x710C, 0x710F } }, + { { 0x0000, 0x710A, 0x7109, 0x711A, 0x710A, 0x7109, 0x7108, 0x710B, 0x7109 } }, + { { 0x0000, 0x710C, 0x710F, 0x7113, 0x7110, 0x710D, 0x7112, 0x7116, 0x710D } }, + { { 0x0000, 0x7115, 0x7114, 0x7114, 0x7115, 0x7114, 0x7114, 0x7116, 0x7117 } }, + { { 0x0000, 0x7113, 0x710F, 0x7113, 0x7110, 0x710C, 0x711A, 0x710D, 0x7112 } }, + { { 0x0000, 0x7101, 0x7102, 0x7103, 0x7101, 0x7100, 0x7100, 0x7102, 0x7100 } }, + { { 0x0000, 0x7112, 0x710E, 0x7112, 0x710E, 0x710D, 0x7112, 0x710E, 0x710F } }, + { { 0x0000, 0x7142, 0x7141, 0x7142, 0x7143, 0x7140, 0x7140, 0x7141, 0x7143 } }, + { { 0x0000, 0x713C, 0x713D, 0x713D, 0x713E, 0x713E, 0x713F, 0x713D, 0x713F } }, + { { 0x0000, 0x7101, 0x7102, 0x7103, 0x7101, 0x7100, 0x7100, 0x7102, 0x7100 } }, + { { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 } }, + { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x7105, 0x7105, 0x7107, 0x7107 } }, + { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 } }, +}; + +u16 func_8006C360(GlobalContext* globalCtx, u32 idx) +{ + u8 mask = func_8008F080(globalCtx); + return D_8011F3F0[idx].data[mask]; +} diff --git a/src/code/code_8007BE60.c b/src/code/code_8007BE60.c deleted file mode 100644 index 59ef949c5..000000000 --- a/src/code/code_8007BE60.c +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include - -extern u32 osResetType; - -/* -void func_8007BE60(u32* a0) -{ - u32 var1; - - //*a0 = 0; - - if (osResetType == 0) - { - a0[1] = 0; - a0[2] = 0; - a0[3] = 0; - } - else - { - var1 = a0[3] + a0[5]; - a0[1]++; - a0[2] = (var1 < a0[5]) + a0[2] + a0[4]; - a0[3] = var1; - } - - a0[5] = 0; - a0[4] = 0; -} -*/ - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BE60/func_8007BE60.s") - -typedef struct -{ - /* 0x00 */ u32 unk_00; - /* 0x04 */ char unk_04[0x0C]; - /* 0x10 */ OSTime unk_10; -} struct_8007BED4; - -void func_8007BED4(struct_8007BED4* arg0) -{ - arg0->unk_00 = 1; - arg0->unk_10 = osGetTime(); -} - -u32 func_8007BF08(struct_8007BED4* arg0) -{ - return arg0->unk_00; -} diff --git a/src/code/code_8007BF10.c b/src/code/code_8007BF10.c index 46771a303..f318d23bf 100644 --- a/src/code/code_8007BF10.c +++ b/src/code/code_8007BF10.c @@ -1,5 +1,23 @@ #include #include +#include -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF10/func_8007BF10.s") +void func_8007BF10() +{ + u32 pad[4]; + OSScTask task; + OSMesgQueue queue; + OSMesg msg; + u32 pad2[1]; + task.next = NULL; + task.flags = 3; + task.msgQ = &queue; + task.msg = NULL; + task.framebuffer = NULL; + task.list.t.type = 0; + osCreateMesgQueue(task.msgQ, &msg, 1); + osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK); + func_800C95F8(&gSchedContext); // osScKickEntryMsg + osRecvMesg(&queue, NULL, OS_MESG_BLOCK); +} diff --git a/src/code/main.c b/src/code/main.c index f69f62317..987654a41 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -7,7 +7,7 @@ u32 gScreenWidth = SCREEN_WIDTH; u32 gScreenHeight = SCREEN_HEIGHT; u32 gSystemHeapSize = 0; -u8* gAppNmiBufferPtr; +PreNmiBuff* gAppNmiBufferPtr; SchedContext gSchedContext; PadMgr gPadMgr; IrqMgr gIrqMgr; @@ -50,8 +50,8 @@ void Main(void* arg0) osSyncPrintf("mainproc 実行開始\n"); //Start running gScreenWidth = SCREEN_WIDTH; gScreenHeight = SCREEN_HEIGHT; - gAppNmiBufferPtr = osAppNmiBuffer; - func_8007BE60(gAppNmiBufferPtr); + gAppNmiBufferPtr = (PreNmiBuff*)osAppNmiBuffer; + PreNmiBuff_Init(gAppNmiBufferPtr); Fault_Start(); SysCfb_Init(0); sysHeap = (u32)gSystemHeap; @@ -112,7 +112,7 @@ void Main(void* arg0) if (*msg == OS_SC_PRE_NMI_MSG) { osSyncPrintf("main.c: リセットされたみたいだよ\n"); //Looks like it's been reset - func_8007BED4(gAppNmiBufferPtr); + PreNmiBuff_SetReset(gAppNmiBufferPtr); } } diff --git a/src/code/prenmi_buff.c b/src/code/prenmi_buff.c new file mode 100644 index 000000000..5616e3b79 --- /dev/null +++ b/src/code/prenmi_buff.c @@ -0,0 +1,35 @@ +#include +#include + +#define COLD_RESET 0 +#define NMI 1 + + +void PreNmiBuff_Init(PreNmiBuff* this) +{ + this->resetting = false; + if (osResetType == COLD_RESET) + { + this->resetCount = 0; + this->duration = 0; + } + else + { + this->resetCount++; + this->duration += this->resetTime; + } + + this->resetTime = 0; +} + + +void PreNmiBuff_SetReset(PreNmiBuff* this) +{ + this->resetting = true; + this->resetTime = osGetTime(); +} + +u32 PreNmiBuff_IsResetting(PreNmiBuff* this) +{ + return this->resetting; +} diff --git a/src/code/sys_ucode.c b/src/code/sys_ucode.c index f92a0d61e..0bd169090 100644 --- a/src/code/sys_ucode.c +++ b/src/code/sys_ucode.c @@ -1,21 +1,21 @@ #include -u32 func_800D2DF0() +u32 SysUcode_GetUCodeBoot() { return &D_80009320; } -u32 func_800D2DFC() +u32 SysUcode_GetUcodeBootSize() { return (u32)&D_800093F0 - (u32)&D_80009320; } -u32 func_800D2E14() +u32 SysUcode_GetUcode() { return D_8012DBA0; } -u32 func_800D2E20() +u32 SysUcode_GetUcodeData() { return D_8012DBA4; } diff --git a/src/code/z_room.c b/src/code/z_room.c index bbcb3d6f4..79c0d2bf6 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -426,8 +426,8 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) gfxCtx->polyOpa.p = spA8; } - // gSPLoadUcode(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20())? - gSPLoadUcodeEx(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20(), 0x800); + // gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData())? + gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData(), 0x800); } } @@ -542,8 +542,8 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) gfxCtx->polyOpa.p = spA8; } - // gSPLoadUcode(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20())? - gSPLoadUcodeEx(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20(), 0x800); + // gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData())? + gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData(), 0x800); } } -- cgit v1.2.3 From bf071937918a92141cb4c0b86b21a193138906c4 Mon Sep 17 00:00:00 2001 From: Random <28494085+Random0666@users.noreply.github.com> Date: Fri, 20 Mar 2020 14:22:44 +0100 Subject: Changes in PE #15 - Removed `struct_8011F3F0` - Removed old comment --- src/code/code_8006C360.c | 132 ++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 70 deletions(-) (limited to 'src/code') diff --git a/src/code/code_8006C360.c b/src/code/code_8006C360.c index 3551ed172..fa48f62ed 100644 --- a/src/code/code_8006C360.c +++ b/src/code/code_8006C360.c @@ -1,80 +1,72 @@ #include #include -//#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C360/func_8006C360.s") - - -typedef struct -{ - u16 data[9]; -} struct_8011F3F0; // size = 0x12 - -struct_8011F3F0 D_8011F3F0[60] = +u16 D_8011F3F0[60][9] = { - { { 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 } }, - { { 0x0000, 0x7128, 0x7129, 0x7128, 0x7128, 0x7128, 0x7128, 0x712A, 0x712B } }, - { { 0x0000, 0x7128, 0x712B, 0x7128, 0x7128, 0x7129, 0x7128, 0x712B, 0x7128 } }, - { { 0x0000, 0x7128, 0x7129, 0x7128, 0x7128, 0x7128, 0x7128, 0x712A, 0x712B } }, - { { 0x0000, 0x7128, 0x7129, 0x712B, 0x7128, 0x7128, 0x7128, 0x7129, 0x7128 } }, - { { 0x0000, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712F } }, - { { 0x0000, 0x712C, 0x712C, 0x712C, 0x712E, 0x712C, 0x712C, 0x712F, 0x712F } }, - { { 0x0000, 0x712C, 0x712C, 0x712C, 0x712F, 0x712C, 0x712C, 0x712F, 0x712F } }, - { { 0x0000, 0x7130, 0x7132, 0x7133, 0x7130, 0x7130, 0x7131, 0x7132, 0x7131 } }, - { { 0x0000, 0x7134, 0x7137, 0x7135, 0x7134, 0x7136, 0x7135, 0x7134, 0x7135 } }, - { { 0x0000, 0x7138, 0x713A, 0x7138, 0x7139, 0x713A, 0x7138, 0x7139, 0x713B } }, - { { 0x0000, 0x7144, 0x7146, 0x7144, 0x7146, 0x7147, 0x7145, 0x7145, 0x7147 } }, - { { 0x0000, 0x7148, 0x7149, 0x7149, 0x714A, 0x714A, 0x714B, 0x7149, 0x714B } }, - { { 0x0000, 0x714C, 0x714D, 0x714C, 0x714C, 0x714E, 0x714C, 0x714E, 0x714F } }, - { { 0x0000, 0x7150, 0x7153, 0x7152, 0x7150, 0x7151, 0x7153, 0x7153, 0x7151 } }, - { { 0x0000, 0x7155, 0x7156, 0x7157, 0x7154, 0x7156, 0x7156, 0x7156, 0x7156 } }, - { { 0x0000, 0x715A, 0x7159, 0x715B, 0x715A, 0x715A, 0x7158, 0x7158, 0x715B } }, - { { 0x0000, 0x715E, 0x715D, 0x715D, 0x715F, 0x715E, 0x715C, 0x715C, 0x715D } }, - { { 0x0000, 0x7163, 0x7162, 0x7160, 0x7163, 0x7160, 0x7161, 0x7161, 0x7160 } }, - { { 0x0000, 0x7164, 0x7166, 0x7164, 0x7167, 0x7164, 0x7164, 0x7164, 0x7167 } }, - { { 0x0000, 0x716B, 0x7169, 0x7168, 0x716B, 0x716A, 0x716B, 0x716B, 0x716A } }, - { { 0x0000, 0x716C, 0x716D, 0x716F, 0x716C, 0x716E, 0x716E, 0x716E, 0x716F } }, - { { 0x0000, 0x7171, 0x7173, 0x7170, 0x7172, 0x0000, 0x0000, 0x0000, 0x0000 } }, - { { 0x0000, 0x7176, 0x7177, 0x7174, 0x7174, 0x7175, 0x7174, 0x7174, 0x7177 } }, - { { 0x0000, 0x7178, 0x7179, 0x7179, 0x717B, 0x717A, 0x717B, 0x717A, 0x717B } }, - { { 0x0000, 0x717D, 0x717C, 0x717C, 0x717D, 0x717F, 0x717C, 0x717E, 0x717D } }, - { { 0x0000, 0x7183, 0x7181, 0x7180, 0x7183, 0x7182, 0x7183, 0x7181, 0x7183 } }, - { { 0x0000, 0x7184, 0x7186, 0x7185, 0x7186, 0x7184, 0x7187, 0x7186, 0x7184 } }, - { { 0x0000, 0x71A4, 0x71A6, 0x71A5, 0x0000, 0x71A6, 0x71A6, 0x71A6, 0x71A7 } }, - { { 0x0000, 0x7188, 0x7188, 0x7189, 0x7188, 0x7189, 0x718B, 0x718A, 0x7189 } }, - { { 0x0000, 0x718C, 0x718C, 0x718D, 0x718C, 0x718E, 0x718F, 0x718D, 0x718C } }, - { { 0x0000, 0x7190, 0x7190, 0x7191, 0x7192, 0x7191, 0x7193, 0x7190, 0x7191 } }, - { { 0x0000, 0x7196, 0x7194, 0x7195, 0x7196, 0x7197, 0x7194, 0x7196, 0x7195 } }, - { { 0x0000, 0x7199, 0x719A, 0x7198, 0x7198, 0x719A, 0x719A, 0x719B, 0x7198 } }, - { { 0x0000, 0x719D, 0x719C, 0x719E, 0x719D, 0x719D, 0x719C, 0x719F, 0x719E } }, - { { 0x0000, 0x71A1, 0x71A0, 0x71A1, 0x71A2, 0x71A1, 0x71A2, 0x71A3, 0x71A2 } }, - { { 0x0000, 0x711C, 0x711E, 0x711C, 0x711F, 0x711E, 0x711C, 0x711D, 0x711F } }, - { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7107, 0x7105, 0x7106, 0x7107, 0x7107 } }, - { { 0x0000, 0x7107, 0x7105, 0x7107, 0x7107, 0x7106, 0x7107, 0x7107, 0x7105 } }, - { { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 } }, - { { 0x0000, 0x7113, 0x7113, 0x7113, 0x7113, 0x7113, 0x7113, 0x7111, 0x7113 } }, - { { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 } }, - { { 0x0000, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7113 } }, - { { 0x0000, 0x7101, 0x7100, 0x7102, 0x7103, 0x7101, 0x7100, 0x7102, 0x7103 } }, - { { 0x0000, 0x7100, 0x7102, 0x7100, 0x7100, 0x7100, 0x7100, 0x7100, 0x7102 } }, - { { 0x0000, 0x710A, 0x7109, 0x7109, 0x710A, 0x710B, 0x7108, 0x7109, 0x710B } }, - { { 0x0000, 0x7117, 0x7112, 0x7113, 0x7110, 0x710C, 0x7117, 0x710E, 0x7112 } }, - { { 0x0000, 0x710D, 0x710F, 0x710C, 0x7112, 0x710D, 0x710C, 0x710C, 0x710F } }, - { { 0x0000, 0x710A, 0x7109, 0x711A, 0x710A, 0x7109, 0x7108, 0x710B, 0x7109 } }, - { { 0x0000, 0x710C, 0x710F, 0x7113, 0x7110, 0x710D, 0x7112, 0x7116, 0x710D } }, - { { 0x0000, 0x7115, 0x7114, 0x7114, 0x7115, 0x7114, 0x7114, 0x7116, 0x7117 } }, - { { 0x0000, 0x7113, 0x710F, 0x7113, 0x7110, 0x710C, 0x711A, 0x710D, 0x7112 } }, - { { 0x0000, 0x7101, 0x7102, 0x7103, 0x7101, 0x7100, 0x7100, 0x7102, 0x7100 } }, - { { 0x0000, 0x7112, 0x710E, 0x7112, 0x710E, 0x710D, 0x7112, 0x710E, 0x710F } }, - { { 0x0000, 0x7142, 0x7141, 0x7142, 0x7143, 0x7140, 0x7140, 0x7141, 0x7143 } }, - { { 0x0000, 0x713C, 0x713D, 0x713D, 0x713E, 0x713E, 0x713F, 0x713D, 0x713F } }, - { { 0x0000, 0x7101, 0x7102, 0x7103, 0x7101, 0x7100, 0x7100, 0x7102, 0x7100 } }, - { { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 } }, - { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x7105, 0x7105, 0x7107, 0x7107 } }, - { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 } }, + { 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 }, + { 0x0000, 0x7128, 0x7129, 0x7128, 0x7128, 0x7128, 0x7128, 0x712A, 0x712B }, + { 0x0000, 0x7128, 0x712B, 0x7128, 0x7128, 0x7129, 0x7128, 0x712B, 0x7128 }, + { 0x0000, 0x7128, 0x7129, 0x7128, 0x7128, 0x7128, 0x7128, 0x712A, 0x712B }, + { 0x0000, 0x7128, 0x7129, 0x712B, 0x7128, 0x7128, 0x7128, 0x7129, 0x7128 }, + { 0x0000, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712D, 0x712F }, + { 0x0000, 0x712C, 0x712C, 0x712C, 0x712E, 0x712C, 0x712C, 0x712F, 0x712F }, + { 0x0000, 0x712C, 0x712C, 0x712C, 0x712F, 0x712C, 0x712C, 0x712F, 0x712F }, + { 0x0000, 0x7130, 0x7132, 0x7133, 0x7130, 0x7130, 0x7131, 0x7132, 0x7131 }, + { 0x0000, 0x7134, 0x7137, 0x7135, 0x7134, 0x7136, 0x7135, 0x7134, 0x7135 }, + { 0x0000, 0x7138, 0x713A, 0x7138, 0x7139, 0x713A, 0x7138, 0x7139, 0x713B }, + { 0x0000, 0x7144, 0x7146, 0x7144, 0x7146, 0x7147, 0x7145, 0x7145, 0x7147 }, + { 0x0000, 0x7148, 0x7149, 0x7149, 0x714A, 0x714A, 0x714B, 0x7149, 0x714B }, + { 0x0000, 0x714C, 0x714D, 0x714C, 0x714C, 0x714E, 0x714C, 0x714E, 0x714F }, + { 0x0000, 0x7150, 0x7153, 0x7152, 0x7150, 0x7151, 0x7153, 0x7153, 0x7151 }, + { 0x0000, 0x7155, 0x7156, 0x7157, 0x7154, 0x7156, 0x7156, 0x7156, 0x7156 }, + { 0x0000, 0x715A, 0x7159, 0x715B, 0x715A, 0x715A, 0x7158, 0x7158, 0x715B }, + { 0x0000, 0x715E, 0x715D, 0x715D, 0x715F, 0x715E, 0x715C, 0x715C, 0x715D }, + { 0x0000, 0x7163, 0x7162, 0x7160, 0x7163, 0x7160, 0x7161, 0x7161, 0x7160 }, + { 0x0000, 0x7164, 0x7166, 0x7164, 0x7167, 0x7164, 0x7164, 0x7164, 0x7167 }, + { 0x0000, 0x716B, 0x7169, 0x7168, 0x716B, 0x716A, 0x716B, 0x716B, 0x716A }, + { 0x0000, 0x716C, 0x716D, 0x716F, 0x716C, 0x716E, 0x716E, 0x716E, 0x716F }, + { 0x0000, 0x7171, 0x7173, 0x7170, 0x7172, 0x0000, 0x0000, 0x0000, 0x0000 }, + { 0x0000, 0x7176, 0x7177, 0x7174, 0x7174, 0x7175, 0x7174, 0x7174, 0x7177 }, + { 0x0000, 0x7178, 0x7179, 0x7179, 0x717B, 0x717A, 0x717B, 0x717A, 0x717B }, + { 0x0000, 0x717D, 0x717C, 0x717C, 0x717D, 0x717F, 0x717C, 0x717E, 0x717D }, + { 0x0000, 0x7183, 0x7181, 0x7180, 0x7183, 0x7182, 0x7183, 0x7181, 0x7183 }, + { 0x0000, 0x7184, 0x7186, 0x7185, 0x7186, 0x7184, 0x7187, 0x7186, 0x7184 }, + { 0x0000, 0x71A4, 0x71A6, 0x71A5, 0x0000, 0x71A6, 0x71A6, 0x71A6, 0x71A7 }, + { 0x0000, 0x7188, 0x7188, 0x7189, 0x7188, 0x7189, 0x718B, 0x718A, 0x7189 }, + { 0x0000, 0x718C, 0x718C, 0x718D, 0x718C, 0x718E, 0x718F, 0x718D, 0x718C }, + { 0x0000, 0x7190, 0x7190, 0x7191, 0x7192, 0x7191, 0x7193, 0x7190, 0x7191 }, + { 0x0000, 0x7196, 0x7194, 0x7195, 0x7196, 0x7197, 0x7194, 0x7196, 0x7195 }, + { 0x0000, 0x7199, 0x719A, 0x7198, 0x7198, 0x719A, 0x719A, 0x719B, 0x7198 }, + { 0x0000, 0x719D, 0x719C, 0x719E, 0x719D, 0x719D, 0x719C, 0x719F, 0x719E }, + { 0x0000, 0x71A1, 0x71A0, 0x71A1, 0x71A2, 0x71A1, 0x71A2, 0x71A3, 0x71A2 }, + { 0x0000, 0x711C, 0x711E, 0x711C, 0x711F, 0x711E, 0x711C, 0x711D, 0x711F }, + { 0x0000, 0x7104, 0x7105, 0x7107, 0x7107, 0x7105, 0x7106, 0x7107, 0x7107 }, + { 0x0000, 0x7107, 0x7105, 0x7107, 0x7107, 0x7106, 0x7107, 0x7107, 0x7105 }, + { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 }, + { 0x0000, 0x7113, 0x7113, 0x7113, 0x7113, 0x7113, 0x7113, 0x7111, 0x7113 }, + { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 }, + { 0x0000, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7117, 0x7113 }, + { 0x0000, 0x7101, 0x7100, 0x7102, 0x7103, 0x7101, 0x7100, 0x7102, 0x7103 }, + { 0x0000, 0x7100, 0x7102, 0x7100, 0x7100, 0x7100, 0x7100, 0x7100, 0x7102 }, + { 0x0000, 0x710A, 0x7109, 0x7109, 0x710A, 0x710B, 0x7108, 0x7109, 0x710B }, + { 0x0000, 0x7117, 0x7112, 0x7113, 0x7110, 0x710C, 0x7117, 0x710E, 0x7112 }, + { 0x0000, 0x710D, 0x710F, 0x710C, 0x7112, 0x710D, 0x710C, 0x710C, 0x710F }, + { 0x0000, 0x710A, 0x7109, 0x711A, 0x710A, 0x7109, 0x7108, 0x710B, 0x7109 }, + { 0x0000, 0x710C, 0x710F, 0x7113, 0x7110, 0x710D, 0x7112, 0x7116, 0x710D }, + { 0x0000, 0x7115, 0x7114, 0x7114, 0x7115, 0x7114, 0x7114, 0x7116, 0x7117 }, + { 0x0000, 0x7113, 0x710F, 0x7113, 0x7110, 0x710C, 0x711A, 0x710D, 0x7112 }, + { 0x0000, 0x7101, 0x7102, 0x7103, 0x7101, 0x7100, 0x7100, 0x7102, 0x7100 }, + { 0x0000, 0x7112, 0x710E, 0x7112, 0x710E, 0x710D, 0x7112, 0x710E, 0x710F }, + { 0x0000, 0x7142, 0x7141, 0x7142, 0x7143, 0x7140, 0x7140, 0x7141, 0x7143 }, + { 0x0000, 0x713C, 0x713D, 0x713D, 0x713E, 0x713E, 0x713F, 0x713D, 0x713F }, + { 0x0000, 0x7101, 0x7102, 0x7103, 0x7101, 0x7100, 0x7100, 0x7102, 0x7100 }, + { 0x0000, 0x7113, 0x7117, 0x7113, 0x7110, 0x7112, 0x7112, 0x7116, 0x7112 }, + { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x7105, 0x7105, 0x7107, 0x7107 }, + { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 }, }; u16 func_8006C360(GlobalContext* globalCtx, u32 idx) { u8 mask = func_8008F080(globalCtx); - return D_8011F3F0[idx].data[mask]; + return D_8011F3F0[idx][mask]; } -- cgit v1.2.3 From 1fe00fcce1150e1e9b8950015fd2f891a8b51639 Mon Sep 17 00:00:00 2001 From: Random <28494085+Random0666@users.noreply.github.com> Date: Fri, 20 Mar 2020 17:15:39 +0100 Subject: Changes in PR #15 (2) - Documented z_msgevent.c --- src/code/code_8007BF10.c | 23 ----------------------- src/code/z_msgevent.c | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-) delete mode 100644 src/code/code_8007BF10.c create mode 100644 src/code/z_msgevent.c (limited to 'src/code') diff --git a/src/code/code_8007BF10.c b/src/code/code_8007BF10.c deleted file mode 100644 index f318d23bf..000000000 --- a/src/code/code_8007BF10.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -void func_8007BF10() -{ - u32 pad[4]; - OSScTask task; - OSMesgQueue queue; - OSMesg msg; - u32 pad2[1]; - - task.next = NULL; - task.flags = 3; - task.msgQ = &queue; - task.msg = NULL; - task.framebuffer = NULL; - task.list.t.type = 0; - osCreateMesgQueue(task.msgQ, &msg, 1); - osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK); - func_800C95F8(&gSchedContext); // osScKickEntryMsg - osRecvMesg(&queue, NULL, OS_MESG_BLOCK); -} diff --git a/src/code/z_msgevent.c b/src/code/z_msgevent.c new file mode 100644 index 000000000..3282d0342 --- /dev/null +++ b/src/code/z_msgevent.c @@ -0,0 +1,23 @@ +#include +#include +#include + +void MsgEvent_SendNullTask() +{ + u32 pad[4]; + OSScTask task; + OSMesgQueue queue; + OSMesg msg; + u32 pad2[1]; + + task.next = NULL; + task.flags = OS_SC_RCP_MASK; + task.msgQ = &queue; + task.msg = NULL; + task.framebuffer = NULL; + task.list.t.type = M_NULTASK; + osCreateMesgQueue(task.msgQ, &msg, 1); + osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK); + func_800C95F8(&gSchedContext); // osScKickEntryMsg + osRecvMesg(&queue, NULL, OS_MESG_BLOCK); +} -- cgit v1.2.3 From 3e764f6ed8667928c4d1303fc6d52b7761c9b378 Mon Sep 17 00:00:00 2001 From: Random <28494085+Random0666@users.noreply.github.com> Date: Fri, 20 Mar 2020 18:13:47 +0100 Subject: Changes in PR #15 - Renamed `prenmi_buff.c` to `z_prenmi_buff.c` --- src/code/prenmi_buff.c | 35 ----------------------------------- src/code/z_prenmi_buff.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 src/code/prenmi_buff.c create mode 100644 src/code/z_prenmi_buff.c (limited to 'src/code') diff --git a/src/code/prenmi_buff.c b/src/code/prenmi_buff.c deleted file mode 100644 index 5616e3b79..000000000 --- a/src/code/prenmi_buff.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include - -#define COLD_RESET 0 -#define NMI 1 - - -void PreNmiBuff_Init(PreNmiBuff* this) -{ - this->resetting = false; - if (osResetType == COLD_RESET) - { - this->resetCount = 0; - this->duration = 0; - } - else - { - this->resetCount++; - this->duration += this->resetTime; - } - - this->resetTime = 0; -} - - -void PreNmiBuff_SetReset(PreNmiBuff* this) -{ - this->resetting = true; - this->resetTime = osGetTime(); -} - -u32 PreNmiBuff_IsResetting(PreNmiBuff* this) -{ - return this->resetting; -} diff --git a/src/code/z_prenmi_buff.c b/src/code/z_prenmi_buff.c new file mode 100644 index 000000000..5616e3b79 --- /dev/null +++ b/src/code/z_prenmi_buff.c @@ -0,0 +1,35 @@ +#include +#include + +#define COLD_RESET 0 +#define NMI 1 + + +void PreNmiBuff_Init(PreNmiBuff* this) +{ + this->resetting = false; + if (osResetType == COLD_RESET) + { + this->resetCount = 0; + this->duration = 0; + } + else + { + this->resetCount++; + this->duration += this->resetTime; + } + + this->resetTime = 0; +} + + +void PreNmiBuff_SetReset(PreNmiBuff* this) +{ + this->resetting = true; + this->resetTime = osGetTime(); +} + +u32 PreNmiBuff_IsResetting(PreNmiBuff* this) +{ + return this->resetting; +} -- cgit v1.2.3