From eb7d7ec122c9d06ab7e9f547cf7798b4b91b1c5f Mon Sep 17 00:00:00 2001 From: Josh Sanchez Date: Fri, 28 Nov 2025 21:34:00 -0600 Subject: [PATCH 1/5] xTRC: Get xTRCReset to equivalent match --- src/SB/Core/x/xTRC.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SB/Core/x/xTRC.cpp b/src/SB/Core/x/xTRC.cpp index a53fa711e..8bebf3885 100644 --- a/src/SB/Core/x/xTRC.cpp +++ b/src/SB/Core/x/xTRC.cpp @@ -43,9 +43,8 @@ void xTRCReset() if (isStall) { zGameModeSwitch(eGameMode_Game); + xSndResume(); } - - xSndResume(); } // SDA relocation shenanigans From 9ef9001dd49d3fd749e51adab52fda9db77ce501 Mon Sep 17 00:00:00 2001 From: Josh Sanchez Date: Sat, 29 Nov 2025 00:23:05 -0600 Subject: [PATCH 2/5] zVar: Correctly export bad_card_available S32 var --- src/SB/Game/zVar.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SB/Game/zVar.h b/src/SB/Game/zVar.h index 7d75f30a4..d38289f58 100644 --- a/src/SB/Game/zVar.h +++ b/src/SB/Game/zVar.h @@ -47,6 +47,7 @@ struct var_type }; extern S32 bad_card_needed; +extern S32 bad_card_available; void var_init(); void zVarNewGame(); From 2d733dbf7c08914d34db6feb9d31635970db9eed Mon Sep 17 00:00:00 2001 From: Josh Sanchez Date: Sat, 29 Nov 2025 00:23:32 -0600 Subject: [PATCH 3/5] xTRC: Near equiv match on xTRC --- src/SB/Core/x/xTRC.cpp | 86 ++++++++++++++++++++++++++++++++++++++++-- src/SB/Core/x/xTRC.h | 1 + 2 files changed, 84 insertions(+), 3 deletions(-) diff --git a/src/SB/Core/x/xTRC.cpp b/src/SB/Core/x/xTRC.cpp index 8bebf3885..b71f58acd 100644 --- a/src/SB/Core/x/xTRC.cpp +++ b/src/SB/Core/x/xTRC.cpp @@ -3,6 +3,9 @@ #include "zGame.h" #include "zGlobals.h" +#include "xMath2.h" +#include "xFont.h" +#include "zVar.h" #include #include @@ -10,7 +13,22 @@ _tagTRCPadInfo gTrcPad[4]; _tagTRCState gTrcDisk[2]; -const char* message_text; +static const char* __deadstripped_xTRC() +{ + return "The Controller in Controller Socket 1 has been removed. Reconnect the Controller to continue with the game.\0" + "The Controller in Controller Socket 1 is an unknown type. Connect a standard Controller to continue with the game.\0" + "Please wait... Checking for the 'SpongeBob SquarePants: Battle for Bikini Bottom' Game Disc.\0" + "The Disc Cover is open. If you want to continue the game, please close the Disc Cover.\0" + "Please insert the 'SpongeBob SquarePants: Battle for Bikini Bottom' Game Disc.\0" + "This is not the 'SpongeBob SquarePants: Battle for Bikini Bottom' Game Disc. Please insert the 'SpongeBob SquarePants: Battle for Bikini Bottom' Game Disc.\0" + "The Game Disc could not be read. Please read the Nintendo GameCube\x99 Instruction Booklet for more information.\0" + "An error has occurred. Turn the power off and refer to the Nintendo GameCube\x99 Instruction Booklet for further instructions."; +} + +static const char* message_text; + +static const basic_rect screen_bounds = { 0.0f, 0.0f, 1.0f, 1.0f }; +static S32 yellow = 0xFFE600FF; void xTRCInit() { @@ -22,7 +40,24 @@ void xTRCInit() memset(gTrcDisk, 0, 8); } -void render_message(const char*); +static void render_message(const char* s) +{ + static xtextbox tb = xtextbox::create(xfont::create(1, NSCREENX(19.0f), NSCREENY(22.0f), 0.0f, + *(iColor_tag*)&yellow, screen_bounds), + screen_bounds, 0x2, 0.0f, 0.0f, 0.0f, 0.0f); + + tb.set_text(s); + tb.bounds = screen_bounds; + tb.bounds.contract(0.1f); + + F32 yextent = (F64)tb.yextent(true); + tb.bounds.h = yextent; + tb.bounds.y = -(0.5f * yextent + 0.5f); + + render_fill_rect(tb.font.clip, xColorFromRGBA(0, 0, 0, 0xC8)); + + tb.render(true); +} void xTRCRender() { @@ -47,6 +82,10 @@ void xTRCReset() } } +void xTRCPad(S32, _tagTRCState) +{ +} + // SDA relocation shenanigans void xTRCDisk(_tagTRCState state) { @@ -61,6 +100,47 @@ void xTRCDisk(_tagTRCState state) } } -void xTRCPad(S32, _tagTRCState) +void render_mem_card_no_space(S32 needed, S32 available, S32 neededFiles, bool enabled) +{ + if (available < 0 && neededFiles != -1 && needed != -1) + { + available = 0; + } + + bad_card_needed = needed; + bad_card_available = available; + + char* error_text = "{i:text_mem_card_no_space}"; + if (neededFiles == 0 && needed > available) + { + error_text = "{i:text_mem_card_no_space_overwrite}"; + } + else if ((neededFiles > 0 && needed > available) || neededFiles == -1 || needed > available) + { + error_text = "{i:text_mem_card_no_space_no_save}"; + } + + RenderText(error_text, enabled); +} + +void RenderText(const char* text, bool enabled) { + static xtextbox tb = + xtextbox::create(xfont::create(1, NSCREENX(19.0f), NSCREENY(22.0f), 0.0f, + xColorFromRGBA(0xFF, 0xE6, 0x00, 0xFF), screen_bounds), + screen_bounds, 0x2, 0.0f, 0.0f, 0.0f, 0.0f); + + tb.set_text(enabled ? text : ""); + tb.bounds = screen_bounds; + tb.bounds.contract(0.1f); + + F32 yextent = (F64)tb.yextent(true); + tb.bounds.h = yextent; + tb.bounds.y = -(0.5f * yextent - 0.5f); + tb.render(true); + + if (!enabled) + { + render_fill_rect(tb.font.clip, xColorFromRGBA(0, 0, 0, 0xC8)); + } } diff --git a/src/SB/Core/x/xTRC.h b/src/SB/Core/x/xTRC.h index cb2557144..5b6e49f19 100644 --- a/src/SB/Core/x/xTRC.h +++ b/src/SB/Core/x/xTRC.h @@ -36,5 +36,6 @@ void xTRCRender(); void xTRCReset(); void xTRCDisk(_tagTRCState state); void render_mem_card_no_space(S32 needed, S32 available, S32 neededFiles, bool enabled); +void RenderText(const char* text, bool enabled); #endif From 26875eb3a7278b8424a8106d47a99f558906cf24 Mon Sep 17 00:00:00 2001 From: Josh Sanchez Date: Fri, 28 Nov 2025 23:56:20 -0600 Subject: [PATCH 4/5] Use -sym on for xTRC --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 3b4f87535..e43964d88 100644 --- a/configure.py +++ b/configure.py @@ -464,7 +464,7 @@ def MatchingFor(*versions): Object(NonMatching, "SB/Core/x/xString.cpp"), Object(Matching, "SB/Core/x/xSurface.cpp"), Object(Matching, "SB/Core/x/xTimer.cpp"), - Object(NonMatching, "SB/Core/x/xTRC.cpp"), + Object(NonMatching, "SB/Core/x/xTRC.cpp", extra_cflags=["-sym on"]), Object(Matching, "SB/Core/x/xutil.cpp"), Object(Matching, "SB/Core/x/xVec3.cpp"), Object(NonMatching, "SB/Game/zActionLine.cpp"), From 0f503c0585adf09c39af93bd0a523dc14d0e902a Mon Sep 17 00:00:00 2001 From: Josh Sanchez Date: Sat, 29 Nov 2025 00:29:17 -0600 Subject: [PATCH 5/5] xTRC: the wisdom of Seil --- src/SB/Core/x/xTRC.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/SB/Core/x/xTRC.cpp b/src/SB/Core/x/xTRC.cpp index b71f58acd..87bbdffa0 100644 --- a/src/SB/Core/x/xTRC.cpp +++ b/src/SB/Core/x/xTRC.cpp @@ -50,9 +50,8 @@ static void render_message(const char* s) tb.bounds = screen_bounds; tb.bounds.contract(0.1f); - F32 yextent = (F64)tb.yextent(true); - tb.bounds.h = yextent; - tb.bounds.y = -(0.5f * yextent + 0.5f); + tb.bounds.h = tb.yextent(true); + tb.bounds.y = -(0.5f * tb.bounds.h + 0.5f); render_fill_rect(tb.font.clip, xColorFromRGBA(0, 0, 0, 0xC8)); @@ -133,10 +132,8 @@ void RenderText(const char* text, bool enabled) tb.set_text(enabled ? text : ""); tb.bounds = screen_bounds; tb.bounds.contract(0.1f); - - F32 yextent = (F64)tb.yextent(true); - tb.bounds.h = yextent; - tb.bounds.y = -(0.5f * yextent - 0.5f); + tb.bounds.h = tb.yextent(true); + tb.bounds.y = -(0.5f * tb.bounds.h - 0.5f); tb.render(true); if (!enabled)