From 71b2b88838407d7d6aed112a047acdbefe3f5d7d Mon Sep 17 00:00:00 2001 From: CreateSource Date: Sun, 7 Jan 2024 00:20:19 -0500 Subject: [PATCH 1/2] fault beginnings --- src/game/fault.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/game/fault.c diff --git a/src/game/fault.c b/src/game/fault.c new file mode 100644 index 00000000..5ebd2183 --- /dev/null +++ b/src/game/fault.c @@ -0,0 +1,48 @@ +#include "common.h" +#include "stdarg.h" +#include "stdio.h" + +typedef struct rgb_color { + s8 r; + s8 g; + s8 b; +} RGBColor; + +static RGBColor XFB_Colors[5] = { + { 0x00, 0x80, 0x80 }, + { 0xFF, 0x80, 0x80 }, + { 0xC0, 0x80, 0x80 }, + { 0x80, 0x80, 0x80 }, + { 0x40, 0x80, 0x80 } +}; + +s16 XFB_Geometry[6][2]; + +static RGBColor Draw_Color; +static s32 y_start; +static s32 x_start; + +const char* lbl_801D34A0 = "OSPanic encounterd:"; + +void OSPanic(const char* file, int line, const char* msg, ...) { + va_list sp78; + s32 sp74; + s32 sp70; + char sp84[1024]; + s32 puts; + + sp74 = x_start = 0x10; + sp70 = y_start = 0x20; + puts = XFB_puts(lbl_801D34A0, sp74, sp70); + XFB_CR(puts + 1, &sp74, &sp70); + sprintf(sp84, "%s:%d", file, line); + puts = XFB_puts(sp84, sp74, sp70); + XFB_CR(puts, &sp74, &sp70); + va_start(sp78, msg); + vsnprintf(sp84, 0x400U, msg, &sp78[0]); + puts = XFB_puts(sp84, sp74, sp70); + XFB_CR(puts, &sp74, &sp70); + XFB_WriteBackCache(); + PPCHalt(); + va_end(); +} \ No newline at end of file From 8178a6634fb5ba138edb89937fdfd805dc8d456e Mon Sep 17 00:00:00 2001 From: CreateSource Date: Sun, 7 Jan 2024 12:35:52 -0500 Subject: [PATCH 2/2] Variable adjustments --- src/game/board/player.c | 43 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/src/game/board/player.c b/src/game/board/player.c index aee15dac..9b4755ac 100644 --- a/src/game/board/player.c +++ b/src/game/board/player.c @@ -3,6 +3,7 @@ #include "game/window.h" #include "game/object.h" #include "game/process.h" +#include "game/hsfman.h" //// #include "game/board/main.h" extern s32 BoardIsStarted(void); @@ -156,14 +157,10 @@ s32 ExecJunction(s32, s16*); s32 MegaPlayerPassFunc(s32, s16); s32 BoardPlayerAnimBlendCheck(s32); -static void (*playerMatCopy[4])(); +static HsfMaterial *playerMatCopy[4]; static s32 (*postTurnHook[4])(); static s32 (*preTurnHook[4])(); -static s32 diceJumpObj[4] = {0, 0, 0, 0}; -static s32 animDoneF[4] = {0, 0, 0, 0}; -static s16 bowserSuitMot[5] = {-1, -1, -1, -1, -1}; - s16 boardPlayerMdl[4]; static s16 playerMot[4]; static s16 junctionArrowRot[4]; @@ -176,6 +173,26 @@ static s16 suitMdl = -1; static s16 suitPlayerMdl = -1; static s16 suitCurrMot = -1; +static s32 diceJumpObj[4] = {0, 0, 0, 0}; +static s32 animDoneF[4] = {0, 0, 0, 0}; +static s16 bowserSuitMot[5] = {-1, -1, -1, -1, -1}; +char* lbl_8013993C[] = { + "eye1", + "eye2", + "mat14", + "mat16", + "mat65", + "mat66", + "Mario", + "Luigi", + "Peach", + "Yoshi", + "Wario", + "Donky", + "Daisy", + "Waluigi", +}; + inline PlayerState* GetPlayer(s32 index) { return &GWPlayer[index]; } @@ -979,4 +996,20 @@ void BoardJunctionMaskReset(s32 arg0) { void BoardJunctionMaskZero(void) { junctionMask = 0; +} + +// ... + +void BoardPlayerCopyMat(s32 arg0) { + s16 modelID; + ModelData *model; + void* temp_r3; + HsfData* temp_r31; + + modelID = BoardModelIDGet(GetBoardPlayer(arg0)); + model = &Hu3DData[modelID]; + temp_r31 = model->hsfData; + temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, temp_r31->materialCnt * 0x3C, 0x10000000U); + memcpy(temp_r3, temp_r31->material, temp_r31->materialCnt * 0x3C); + playerMatCopy[arg0] = temp_r3; } \ No newline at end of file