rework "Authentic Logo Screen" and "Fast File Select" (#4939)

* skip z_title with button press

* use `RegisterShipInitFunc`

* rip out a bunch of custom ztitle code

* ok now it's almost fully back to vanilla

* titles are back for a limited time

enjoy #Skipping

* move old customizations into new custom draw

* finally getting the hang of this shipinit thing

* vb should let it snow

* boot sequence logic

* clean up logic to better handle changing boot sequence settings

* remove fast file select stuff

* remove authentic logo screen setting

* about window - not super pretty but not ugly imo

* maybe this fixes windows

* maybe alloca? idk why it's working in other files

* just pulling in every include hoping something works

* Revert

This reverts commit c1d02c9a40a7b8c617a131cc5b0d7fd6f81fe1b4.

* try some macro fixing magic

* fix another c vs cpp thing

* do it without an extra var

* make `GitCommitHashTruncated` a private member on `AboutWindow` instead of truncating on draw

* move logo asset defs to `soh_assets.h`

* Apply suggestions from code review

Co-authored-by: Archez <Archez@users.noreply.github.com>

* VB_SHOULDN'T

---------

Co-authored-by: Archez <Archez@users.noreply.github.com>
This commit is contained in:
briaguya
2025-01-24 07:21:15 -08:00
committed by GitHub
parent 6d94cf9bac
commit 388eb487e3
16 changed files with 423 additions and 241 deletions

View File

@@ -752,8 +752,6 @@ static s16 sUnused = 106;
static s16 sScreenFillAlpha = 255;
static u8 isFastFileIdIncompatible = 0;
static Gfx sScreenFillSetupDL[] = {
gsDPPipeSync(),
gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
@@ -3354,20 +3352,6 @@ void FileChoose_Main(GameState* thisx) {
gSaveContext.skyboxTime += 0x10;
}
if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0) && CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1) <= FASTFILE_3 && !isFastFileIdIncompatible) {
if (Save_Exist(CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1)) && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1)))) {
this->buttonIndex = CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1);
this->menuMode = FS_MENU_MODE_SELECT;
this->selectMode = SM_LOAD_GAME;
} else {
isFastFileIdIncompatible = 1;
}
} else if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0) && CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1) == FASTFILE_MAP_SELECT) {
this->buttonIndex = 0xFF;
this->menuMode = FS_MENU_MODE_SELECT;
this->selectMode = SM_LOAD_GAME;
}
OPEN_DISPS(this->state.gfxCtx);
this->n64ddFlag = 0;
@@ -3726,7 +3710,6 @@ void FileChoose_Init(GameState* thisx) {
this->questType[0] = MIN_QUEST;
this->questType[1] = MIN_QUEST;
this->questType[2] = MIN_QUEST;
isFastFileIdIncompatible = 0;
CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
SREG(30) = 1;

View File

@@ -4,8 +4,6 @@
* Description: Displays the Nintendo Logo
*/
#define NORMAL_GAMEPLAY
#include "global.h"
#include "alloca.h"
#include "textures/nintendo_rogo_static/nintendo_rogo_static.h"
@@ -14,92 +12,14 @@
#include <soh/GameVersions.h>
#include <soh/SaveManager.h>
#include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include <string.h>
#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) {
#ifdef NORMAL_GAMEPLAY
if ((this->coverAlpha == 0) && (this->visibleDuration != 0)) {
this->visibleDuration--;
this->unk_1D4--;
@@ -118,14 +38,6 @@ void Title_Calc(TitleContext* this) {
}
this->uls = this->ult & 0x7F;
this->ult++;
if (gSkipLogoTest || gLoadFileSelect) {
this->exit = true;
}
#else
this->exit = true;
#endif
}
void Title_SetupView(TitleContext* this, f32 x, f32 y, f32 z) {
@@ -146,12 +58,6 @@ void Title_SetupView(TitleContext* this, f32 x, f32 y, f32 z) {
func_800AAA50(view, 0xF);
}
#define dgShipLogoDL "__OTR__textures/nintendo_rogo_static/gShipLogoDL"
static const ALIGN_ASSET(2) char gShipLogoDL[] = dgShipLogoDL;
#define dnintendo_rogo_static_Tex_LUS_000000 "__OTR__textures/nintendo_rogo_static/nintendo_rogo_static_Tex_LUS_000000"
static const ALIGN_ASSET(2) char nintendo_rogo_static_Tex_LUS_000000[] = dnintendo_rogo_static_Tex_LUS_000000;
void Title_Draw(TitleContext* this) {
static s16 sTitleRotY = 0;
static Lights1 sTitleLights = gdSPDefLights1(0x64, 0x64, 0x64, 0xFF, 0xFF, 0xFF, 0x45, 0x45, 0x45);
@@ -185,32 +91,21 @@ 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);
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);
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);
}
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 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);
@@ -221,25 +116,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);
}
@@ -255,24 +134,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);
}
CLOSE_DISPS(this->state.gfxCtx);
@@ -285,15 +152,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);
@@ -306,4 +169,6 @@ void Title_Init(GameState* thisx) {
this->coverAlpha = 255;
this->addAlpha = -3;
this->visibleDuration = 0x3C;
GameInteractor_ExecuteOnZTitleInit(this);
}