From e244de285a07ce743a3aa8a1ac924f3f09dbc6c5 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:42:06 -0500 Subject: [PATCH] rip out a bunch of custom ztitle code --- soh/soh/Enhancements/bootcommands.c | 47 ------ soh/soh/Enhancements/bootcommands.h | 13 -- .../overlays/gamestates/ovl_title/z_title.c | 137 +----------------- 3 files changed, 8 insertions(+), 189 deletions(-) diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index c010067da..b96fda70a 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -12,14 +12,6 @@ #include "soh/OTRGlobals.h" #include "soh/cvar_prefixes.h" -uint8_t gLoadFileSelect = 0, gSkipLogoTest = 0; - -extern BootCommandFunc BootCommands_Command_SkipLogo(char** argv, s32 argc); -extern BootCommandFunc BootCommands_Command_LoadFileSelect(char** argv, s32 argc); - -static BootCommand sCommands[] = { { "--skiplogo", BootCommands_Command_SkipLogo }, - { "--loadfileselect", BootCommands_Command_LoadFileSelect } }; - void BootCommands_Init() { // Clears vars to prevent randomizer menu from being disabled @@ -34,42 +26,3 @@ void BootCommands_Init() CVarRegisterInteger(CVAR_IMGUI_CONTROLLER_NAV, 1); // always enable controller nav on switch/wii u #endif } - -//void BootCommands_ParseBootArgs(char* str) -void BootCommands_ParseBootArgs(s32 argc, char** argv) -{ - s32 i; - - // Parse the commands - for (i = 0; i < argc; i++) { - s32 j; - - for (j = 0; j < ARRAY_COUNT(sCommands); j++) { - if (!strcmp(argv[i], sCommands[j].name)) { - s32 numArgsProcessed = sCommands[j].func(&argv[i], argc - i); - i += numArgsProcessed; - break; - } - } - } -} - -/* - * Command Name: --skiplogo - * Description: Skips the N64 Logo Screen - * Arguments: None - */ -BootCommandFunc BootCommands_Command_SkipLogo(char** argv, s32 argc) { - gSkipLogoTest = 1; - return 0; -} - -/* - * Command Name: --loadfileselect - * Description: Loads the file select screen on bootup. - * Arguments: None - */ -BootCommandFunc BootCommands_Command_LoadFileSelect(char** argv, s32 argc) { - gLoadFileSelect = 1; - return 0; -} diff --git a/soh/soh/Enhancements/bootcommands.h b/soh/soh/Enhancements/bootcommands.h index fdf362e97..5c6cb8c8c 100644 --- a/soh/soh/Enhancements/bootcommands.h +++ b/soh/soh/Enhancements/bootcommands.h @@ -3,19 +3,6 @@ #include #include -typedef s32 (*BootCommandFunc)(char** argv, s32 argc); // Returns the number of arguments it read - -typedef struct BootCommand -{ - char* name; - BootCommandFunc func; -} BootCommand; - -extern uint8_t gLoadFileSelect; -extern uint8_t gSkipLogoTest; - void BootCommands_Init(); -//void BootCommands_ParseBootArgs(char* str); -void BootCommands_ParseBootArgs(s32 argc, char** argv); #endif \ No newline at end of file diff --git a/soh/src/overlays/gamestates/ovl_title/z_title.c b/soh/src/overlays/gamestates/ovl_title/z_title.c index b0455bf7e..a60f24a04 100644 --- a/soh/src/overlays/gamestates/ovl_title/z_title.c +++ b/soh/src/overlays/gamestates/ovl_title/z_title.c @@ -19,84 +19,6 @@ #include "time.h" -const char* GetGameVersionString(s32 index); -char* quote; - -void Title_PrintBuildInfo(Gfx** gfxp) { - Gfx* g; - GfxPrint printer; - - g = *gfxp; - g = Gfx_SetupDL_28(g); - - GfxPrint_Init(&printer); - GfxPrint_Open(&printer, g); - GfxPrint_SetColor(&printer, 131, 154, 255, 255); - - //if tag is empty (not a release build) - bool showGitInfo = gGitCommitTag[0] == 0; - - if (showGitInfo) { - GfxPrint_SetPos(&printer, 1, 24); - GfxPrint_Printf(&printer, "Git Branch: %s", gGitBranch); - - //truncate the commit to 7 characters - char gGitCommitHashTruncated[8]; - strncpy(gGitCommitHashTruncated, gGitCommitHash, 7); - gGitCommitHashTruncated[7] = 0; - - GfxPrint_SetPos(&printer, 1, 25); - GfxPrint_Printf(&printer, "Git Commit: %s", gGitCommitHashTruncated); - } else { - GfxPrint_SetPos(&printer, 1, 25); - GfxPrint_Printf(&printer, "%s", gBuildVersion); - } - GfxPrint_SetPos(&printer, 1, 26); - GfxPrint_Printf(&printer, "%s", gBuildDate); - - u32 numVersions = ResourceMgr_GetNumGameVersions(); - s32 pos = 27 - numVersions; - for (u32 i = 0; i < numVersions; i++) { - GfxPrint_SetPos(&printer, 29, pos++); - GfxPrint_Printf(&printer, "%s", GetGameVersionString(i)); - } - - g = GfxPrint_Close(&printer); - GfxPrint_Destroy(&printer); - *gfxp = g; -} - -const char* GetGameVersionString(s32 index) { - uint32_t gameVersion = ResourceMgr_GetGameVersion(index); - switch (gameVersion) { - case OOT_NTSC_US_10: - return "NTSC-U 1.0"; - case OOT_NTSC_US_11: - return "NTSC-U 1.1"; - case OOT_NTSC_US_12: - return "NTSC-U 1.2"; - case OOT_PAL_10: - return "PAL 1.0"; - case OOT_PAL_11: - return "PAL 1.1"; - case OOT_PAL_GC: - return "PAL GC"; - case OOT_PAL_MQ: - return "PAL MQ"; - case OOT_PAL_GC_DBG1: - case OOT_PAL_GC_DBG2: - return "PAL GC-D"; - case OOT_PAL_GC_MQ_DBG: - return "PAL MQ-D"; - case OOT_IQUE_CN: - return "IQUE CN"; - case OOT_IQUE_TW: - return "IQUE TW"; - default: - return "UNKNOWN"; - } -} - // Note: In other rom versions this function also updates unk_1D4, coverAlpha, addAlpha, visibleDuration to calculate // the fade-in/fade-out + the duration of the n64 logo animation void Title_Calc(TitleContext* this) { @@ -119,11 +41,6 @@ void Title_Calc(TitleContext* this) { } this->uls = this->ult & 0x7F; this->ult++; - - if (gSkipLogoTest || gLoadFileSelect) { - this->exit = true; - } - #else this->exit = true; #endif @@ -186,32 +103,26 @@ void Title_Draw(TitleContext* this) { Matrix_RotateZYX(0, sTitleRotY, 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(this->state.gfxCtx), G_MTX_LOAD); - if (CVarGetInteger(CVAR_ENHANCEMENT("AuthenticLogo"), 0)) { - gSPDisplayList(POLY_OPA_DISP++, gNintendo64LogoDL); - } else { - gSPDisplayList(POLY_OPA_DISP++, gShipLogoDL); - } + gSPDisplayList(POLY_OPA_DISP++, gNintendo64LogoDL); Gfx_SetupDL_39Opa(this->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetCycleType(POLY_OPA_DISP++, G_CYC_2CYCLE); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF2, G_RM_OPA_CI | CVG_DST_WRAP); gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); if (CVarGetInteger(CVAR_COSMETIC("Title.NintendoLogo.Changed"), 0)) { - Color_RGB8 nintendoLogoColor = CVarGetColor24(CVAR_COSMETIC("Title.NintendoLogo.Value"), (Color_RGB8){0, 0, 255}); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + Color_RGB8 nintendoLogoColor = CVarGetColor24(CVAR_COSMETIC("Title.NintendoLogo.Value"), (Color_RGB8){0, 0, 255}); gDPSetEnvColor(POLY_OPA_DISP++, nintendoLogoColor.r, nintendoLogoColor.g, nintendoLogoColor.b, 128); } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 170, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 255, 128); } gDPLoadMultiBlock(POLY_OPA_DISP++, nintendo_rogo_static_Tex_001800, 0x100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 2, 11); - for (idx = 0, y = 94; idx < 16; idx++, y += 2) - { - gDPLoadMultiTile(POLY_OPA_DISP++, CVarGetInteger(CVAR_ENHANCEMENT("AuthenticLogo"), 0) ? nintendo_rogo_static_Tex_000000 : nintendo_rogo_static_Tex_LUS_000000, 0, G_TX_RENDERTILE, G_IM_FMT_I, G_IM_SIZ_8b, 192, 32, + for (idx = 0, y = 94; idx < 16; idx++, y += 2) { + gDPLoadMultiTile(POLY_OPA_DISP++, nintendo_rogo_static_Tex_000000, 0, G_TX_RENDERTILE, G_IM_FMT_I, G_IM_SIZ_8b, 192, 32, 0, idx * 2, 192 - 1, (idx + 1) * 2 - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); @@ -222,25 +133,9 @@ void Title_Draw(TitleContext* this) { gSPTextureRectangle(POLY_OPA_DISP++, 388, y << 2, 1156, (y + 2) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } - // Draw ice cube around N64 logo. - if (CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0)) { - f32 scale = 0.4f; - - gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(this->state.gfxCtx, 0, 0, (0 - 1) % 128, 32, 32, 1, - 0, (1 * -2) % 128, 32, 32)); - - Matrix_Translate(0.0f, -10.0f, 0.0f, MTXMODE_APPLY); - Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(this->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetEnvColor(POLY_OPA_DISP++, 0, 50, 100, 255); - gSPDisplayList(POLY_OPA_DISP++, gEffIceFragment3DL); - } - Environment_FillScreen(this->state.gfxCtx, 0, 0, 0, (s16)this->coverAlpha, FILL_SCREEN_XLU); - sTitleRotY += (300 * CVarGetFloat(CVAR_COSMETIC("N64Logo.SpinSpeed"), 1.0f)); + sTitleRotY += 300; CLOSE_DISPS(this->state.gfxCtx); } @@ -256,24 +151,12 @@ void Title_Main(GameState* thisx) { Title_Calc(this); Title_Draw(this); - if (!CVarGetInteger(CVAR_ENHANCEMENT("AuthenticLogo"), 0)) { - Gfx* gfx = POLY_OPA_DISP; - s32 pad; - - Title_PrintBuildInfo(&gfx); - POLY_OPA_DISP = gfx; - } - - if (this->exit || CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0)) { + if (this->exit) { gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = 0xFF; gSaveContext.gameMode = 1; this->state.running = false; - - if (gLoadFileSelect || CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0)) - SET_NEXT_GAMESTATE(&this->state, FileChoose_Init, FileChooseContext); - else - SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext); + SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext); } GameInteractor_ExecuteOnZTitleUpdate(this); @@ -288,15 +171,11 @@ void Title_Destroy(GameState* thisx) { } void Title_Init(GameState* thisx) { - //u32 size = 0; TitleContext* this = (TitleContext*)thisx; this->staticSegment = NULL; - //this->staticSegment = GAMESTATE_ALLOC_MC(&this->state, size); osSyncPrintf("z_title.c\n"); - //ResourceMgr_LoadDirectory("nintendo_rogo_static*"); - R_UPDATE_RATE = 1; Matrix_Init(&this->state); View_Init(&this->view, this->state.gfxCtx);