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 c1d02c9a40.

* 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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 423 additions and 241 deletions

View File

@ -338,3 +338,10 @@ static const ALIGN_ASSET(2) char gLinkAdultGoronTunicSkel[] = dgLinkAdultGoronTu
#define dgLinkAdultZoraTunicSkel "__OTR__objects/object_link_boy_zora/gLinkAdultZoraTunicSkel"
static const ALIGN_ASSET(2) char gLinkAdultZoraTunicSkel[] = dgLinkAdultZoraTunicSkel;
// LUS Logo
#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;

View File

@ -275,7 +275,12 @@ extern GraphicsContext* __gfxCtx;
: (((a2) >= (a3)) ? (a2) : (((a3) >= (a1)) ? (a1) : (a3))))
#define MATRIX_TOMTX(dest) Matrix_ToMtx(dest, __FILE__, __LINE__)
#ifdef __cplusplus
#define MATRIX_NEWMTX(gfxCtx) Matrix_NewMtx(gfxCtx, const_cast<char*>(__FILE__), __LINE__)
#else
#define MATRIX_NEWMTX(gfxCtx) Matrix_NewMtx(gfxCtx, __FILE__, __LINE__)
#endif
#define MATRIX_CHECKFLOATS(mf) Matrix_CheckFloats(mf, __FILE__, __LINE__)
#define ZELDA_ARENA_MALLOC_DEBUG(size) ZeldaArena_MallocDebug(size, __FILE__, __LINE__)

103
soh/soh/AboutWindow.cpp Normal file
View File

@ -0,0 +1,103 @@
#include "AboutWindow.h"
#include <imgui.h>
#include <soh/GameVersions.h>
#include "soh/ResourceManagerHelpers.h"
extern "C" {
#include "variables.h"
}
AboutWindow::~AboutWindow() {
SPDLOG_TRACE("destruct about window");
}
void AboutWindow::InitElement() {
mIsTaggedVersion = gGitCommitTag[0] != 0;
strncpy(mGitCommitHashTruncated, (char*)gGitCommitHash, 7);
mGitCommitHashTruncated[7] = 0;
}
void AboutWindow::Draw() {
if (!IsVisible()) {
return;
}
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoDocking |
ImGuiWindowFlags_NoScrollWithMouse |
ImGuiWindowFlags_NoScrollbar;
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(16 * ImGui::GetIO().FontGlobalScale, 8 * ImGui::GetIO().FontGlobalScale));
if (!ImGui::Begin(GetName().c_str(), &mIsVisible, windowFlags)) {
ImGui::End();
} else {
DrawElement();
ImGui::End();
}
ImGui::PopStyleVar();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
const char* AboutWindow::GetGameVersionString(uint32_t 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";
}
}
void AboutWindow::DrawElement() {
// The icon is already padded - adjust for that
ImVec2 cursorPos = ImGui::GetCursorScreenPos();
cursorPos.x -= 16 * ImGui::GetIO().FontGlobalScale;
ImGui::SetCursorScreenPos(cursorPos);
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon"), ImVec2(64.0f * ImGui::GetIO().FontGlobalScale, 64.0f * ImGui::GetIO().FontGlobalScale));
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Text("Ship of Harkinian");
if (mIsTaggedVersion) {
ImGui::Text("%s", gBuildVersion);
} else {
ImGui::Text("%s", gGitBranch);
ImGui::Text("%s", mGitCommitHashTruncated);
}
ImGui::EndGroup();
ImGui::Dummy(ImVec2(0, 2 * ImGui::GetIO().FontGlobalScale));
ImGui::Text("Game Archives:");
for (uint32_t i = 0; i < ResourceMgr_GetNumGameVersions(); i++) {
ImGui::BulletText(GetGameVersionString(i));
}
}

20
soh/soh/AboutWindow.h Normal file
View File

@ -0,0 +1,20 @@
#pragma once
#include <libultraship/libultraship.h>
class AboutWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;
~AboutWindow();
private:
void InitElement() override;
void Draw() override;
void DrawElement() override;
void UpdateElement() override {};
const char* GetGameVersionString(uint32_t index);
bool mIsTaggedVersion;
char mGitCommitHashTruncated[8];
};

View File

@ -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
@ -32,42 +24,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;
}

View File

@ -3,19 +3,6 @@
#include <libultraship/libultra.h>
#include <z64.h>
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

View File

@ -0,0 +1,232 @@
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"
#include "textures/nintendo_rogo_static/nintendo_rogo_static.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "soh_assets.h"
extern "C" {
#include "macros.h"
#include "z64.h"
#include "functions.h"
#include "variables.h"
#include "soh/Enhancements/enhancementTypes.h"
}
extern "C" {
extern void Title_Calc(TitleContext*);
extern void Title_SetupView(TitleContext*, f32, f32, f32);
}
#define LOGO_TO_DRAW_LUS 0
#define LOGO_TO_DRAW_N64 1
static bool shouldDrawIceOnSpinningLogo = false;
extern "C" void CustomLogoTitle_Draw(TitleContext* titleContext, uint8_t logoToDraw) {
static s16 sTitleRotY = 0;
static Lights1 sTitleLights = gdSPDefLights1(0x64, 0x64, 0x64, 0xFF, 0xFF, 0xFF, 0x45, 0x45, 0x45);
u16 y;
u16 idx;
s32 pad1;
Vec3f v3;
Vec3f v1;
Vec3f v2;
s32 pad2[2];
OPEN_DISPS(titleContext->state.gfxCtx);
v3.x = 69;
v3.y = 69;
v3.z = 69;
v2.x = -4949.148;
v2.y = 4002.5417;
v1.x = 0;
v1.y = 0;
v1.z = 0;
v2.z = 1119.0837;
func_8002EABC(&v1, &v2, &v3, titleContext->state.gfxCtx);
gSPSetLights1(POLY_OPA_DISP++, sTitleLights);
Title_SetupView(titleContext, 0, 150.0, 300.0);
Gfx_SetupDL_25Opa(titleContext->state.gfxCtx);
Matrix_Translate(-53.0, -5.0, 0, MTXMODE_NEW);
Matrix_Scale(1.0, 1.0, 1.0, MTXMODE_APPLY);
Matrix_RotateZYX(0, sTitleRotY, 0, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(titleContext->state.gfxCtx), G_MTX_LOAD);
if (logoToDraw == LOGO_TO_DRAW_LUS) {
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gShipLogoDL);
} else {
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gNintendo64LogoDL);
}
Gfx_SetupDL_39Opa(titleContext->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);
}
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++, (logoToDraw == LOGO_TO_DRAW_N64) ? 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,
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);
gDPSetTileSize(POLY_OPA_DISP++, 0, 0, 0, (192 - 1) << G_TEXTURE_IMAGE_FRAC,
(2 - 1) << G_TEXTURE_IMAGE_FRAC);
gDPSetTileSize(POLY_OPA_DISP++, 1, titleContext->uls, (titleContext->ult & 0x7F) - idx * 4, 0, 0);
gSPTextureRectangle(POLY_OPA_DISP++, 388, y << 2, 1156, (y + 2) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
// Draw ice block around spinning N or ship.
if (shouldDrawIceOnSpinningLogo) {
f32 scale = 0.4f;
gSPSegment(POLY_OPA_DISP++, 0x08,
(uintptr_t)Gfx_TwoTexScroll(titleContext->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(titleContext->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 50, 100, 255);
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gEffIceFragment3DL);
}
Environment_FillScreen(titleContext->state.gfxCtx, 0, 0, 0, (s16)titleContext->coverAlpha, FILL_SCREEN_XLU);
sTitleRotY += (300 * CVarGetFloat(CVAR_COSMETIC("N64Logo.SpinSpeed"), 1.0f));
CLOSE_DISPS(titleContext->state.gfxCtx);
}
#define CVAR_BOOTSEQUENCE_NAME CVAR_ENHANCEMENT("BootSequence")
#define CVAR_BOOTSEQUENCE_DEFAULT BOOTSEQUENCE_DEFAULT
#define CVAR_BOOTSEQUENCE_VALUE CVarGetInteger(CVAR_BOOTSEQUENCE_NAME, CVAR_BOOTSEQUENCE_DEFAULT)
extern "C" void CustomLogoTitle_Main(TitleContext* titleContext) {
static uint8_t logosSeen = 0;
uint8_t logoToDraw;
if (CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_DEFAULT) {
if (logosSeen == 0) {
logoToDraw = LOGO_TO_DRAW_LUS;
} else {
logoToDraw = LOGO_TO_DRAW_N64;
}
}
if (CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_AUTHENTIC) {
logoToDraw = LOGO_TO_DRAW_N64;
}
OPEN_DISPS(titleContext->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0, (uintptr_t)NULL);
gSPSegment(POLY_OPA_DISP++, 1, (uintptr_t)titleContext->staticSegment);
Gfx_SetupFrame(titleContext->state.gfxCtx, 0, 0, 0);
Title_Calc(titleContext);
CustomLogoTitle_Draw(titleContext, logoToDraw);
if (titleContext->exit) {
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = 0xFF;
gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN;
titleContext->state.running = false;
logosSeen++;
if (CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_DEFAULT && logosSeen == 1) {
SET_NEXT_GAMESTATE(&titleContext->state, Title_Init, TitleContext);
}
if ((CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_DEFAULT && logosSeen == 2) ||
(CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_AUTHENTIC)) {
SET_NEXT_GAMESTATE(&titleContext->state, Opening_Init, OpeningContext);
logosSeen = 0;
}
}
GameInteractor_ExecuteOnZTitleUpdate(titleContext);
CLOSE_DISPS(titleContext->state.gfxCtx);
}
// // // //
// Always
//
void OnZTitleInitReplaceTitleMainWithCustom(void* gameState) {
TitleContext* titleContext = (TitleContext*)gameState;
titleContext->state.main = (GameStateFunc)CustomLogoTitle_Main;
}
// Allows pressing A to skip the boot logo and go to the next state (opening or file select)
void OnZTitleUpdatePressButtonToSkip(void* gameState) {
TitleContext* titleContext = (TitleContext*)gameState;
if (CHECK_BTN_ANY(titleContext->state.input->press.button, BTN_A | BTN_B | BTN_START)) {
// Force the title state to start fading to black and to last roughly 5 frames based on current fade in/out
titleContext->visibleDuration = 0;
titleContext->addAlpha = (255 - titleContext->coverAlpha) / 5;
}
}
void RegisterCustomLogoTitle() {
COND_HOOK(OnZTitleInit, true, OnZTitleInitReplaceTitleMainWithCustom);
COND_HOOK(OnZTitleUpdate, true, OnZTitleUpdatePressButtonToSkip);
}
static RegisterShipInitFunc initFuncAlways(RegisterCustomLogoTitle);
// // // // // //
// Bootsequence
//
void OnZTitleUpdateSkipToFileSelect(void* gameState) {
TitleContext* titleContext = (TitleContext*)gameState;
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = 0xFF;
gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN;
titleContext->state.running = false;
SET_NEXT_GAMESTATE(&titleContext->state, FileChoose_Init, FileChooseContext);
}
void RegisterCustomLogoTitleBootsequence() {
COND_HOOK(OnZTitleUpdate, CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_FILESELECT, OnZTitleUpdateSkipToFileSelect);
}
static RegisterShipInitFunc initFuncBootsequence(RegisterCustomLogoTitleBootsequence, { CVAR_BOOTSEQUENCE_NAME });
// // // // // //
// Let it Snow
//
#define CVAR_LETITSNOW_NAME CVAR_GENERAL("LetItSnow")
#define CVAR_LETITSNOW_DEFAULT 0
#define CVAR_LETITSNOW_VALUE CVarGetInteger(CVAR_LETITSNOW_NAME, CVAR_LETITSNOW_DEFAULT)
void RegisterCustomLogoTitleLetItSnow() {
shouldDrawIceOnSpinningLogo = CVAR_LETITSNOW_VALUE != CVAR_LETITSNOW_DEFAULT;
}
static RegisterShipInitFunc initFuncLetItSnow(RegisterCustomLogoTitleLetItSnow, { CVAR_LETITSNOW_NAME });

View File

@ -52,14 +52,6 @@ typedef enum {
ENEMY_RANDOMIZER_RANDOM_SEEDED,
} EnemyRandomizerMode;
typedef enum {
FASTFILE_1,
FASTFILE_2,
FASTFILE_3,
FASTFILE_MAP_SELECT,
FASTFILE_FILE_SELECT
} FastFileSelectTarget;
typedef enum {
AUTOSAVE_OFF,
AUTOSAVE_LOCATION_AND_MAJOR_ITEMS,
@ -69,6 +61,12 @@ typedef enum {
AUTOSAVE_ALL_ITEMS
} AutosaveType;
typedef enum {
BOOTSEQUENCE_DEFAULT,
BOOTSEQUENCE_AUTHENTIC,
BOOTSEQUENCE_FILESELECT
} BootSequenceType;
typedef enum {
ZFIGHT_FIX_DISABLED,
ZFIGHT_FIX_CONSISTENT_VANISH,

View File

@ -5,6 +5,8 @@
* - Argument 1: Name of the hook
* - Argument 2: Function type that the hook uses
*/
DEFINE_HOOK(OnZTitleInit, (void* gameState));
DEFINE_HOOK(OnZTitleUpdate, (void* gameState));
DEFINE_HOOK(OnLoadGame, (int32_t fileNum));
DEFINE_HOOK(OnExitGame, (int32_t fileNum));
DEFINE_HOOK(OnGameStateMainStart, ());

View File

@ -2,6 +2,14 @@
// MARK: - Gameplay
void GameInteractor_ExecuteOnZTitleInit(void* gameState) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnZTitleInit>(gameState);
}
void GameInteractor_ExecuteOnZTitleUpdate(void* gameState) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnZTitleUpdate>(gameState);
}
void GameInteractor_ExecuteOnLoadGame(int32_t fileNum) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnLoadGame>(fileNum);
}

View File

@ -7,6 +7,8 @@
extern "C" {
#endif
// MARK: - Gameplay
void GameInteractor_ExecuteOnZTitleInit(void* gameState);
void GameInteractor_ExecuteOnZTitleUpdate(void* gameState);
void GameInteractor_ExecuteOnLoadGame(int32_t fileNum);
void GameInteractor_ExecuteOnExitGame(int32_t fileNum);
void GameInteractor_ExecuteOnGameStateMainStart();

View File

@ -65,7 +65,6 @@ namespace SohGui {
static const char* subSubPowers[7] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6] };
static const char* zFightingOptions[3] = { "Disabled", "Consistent Vanish", "No Vanish" };
static const char* autosaveLabels[6] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" };
static const char* FastFileSelect[5] = { "File N.1", "File N.2", "File N.3", "Zelda Map Select (require OoT Debug Mode)", "File select" };
static const char* bonkDamageValues[8] = {
"No Damage",
"0.25 Heart",
@ -135,6 +134,7 @@ namespace SohGui {
std::shared_ptr<SohModalWindow> mModalWindow;
std::shared_ptr<Notification::Window> mNotificationWindow;
std::shared_ptr<TimeDisplayWindow> mTimeDisplayWindow;
std::shared_ptr<AboutWindow> mAboutWindow;
void SetupGuiElements() {
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
@ -222,6 +222,8 @@ namespace SohGui {
mNotificationWindow->Show();
mTimeDisplayWindow = std::make_shared<TimeDisplayWindow>(CVAR_WINDOW("TimeDisplayEnabled"), "Additional Timers");
gui->AddGuiWindow(mTimeDisplayWindow);
mAboutWindow = std::make_shared<AboutWindow>(CVAR_WINDOW("AboutWindow"), "About");
gui->AddGuiWindow(mAboutWindow);
}
void Destroy() {
@ -258,6 +260,7 @@ namespace SohGui {
mTimeSplitWindow = nullptr;
mPlandomizerWindow = nullptr;
mTimeDisplayWindow = nullptr;
mAboutWindow = nullptr;
}
void RegisterPopup(std::string title, std::string message, std::string button1, std::string button2, std::function<void()> button1callback, std::function<void()> button2callback) {

View File

@ -26,6 +26,7 @@
#include "Enhancements/randomizer/randomizer_settings_window.h"
#include "Enhancements/timesplits/TimeSplits.h"
#include "Enhancements/randomizer/Plandomizer.h"
#include "AboutWindow.h"
#include "SohModals.h"
#ifdef __cplusplus

View File

@ -44,6 +44,7 @@
#include "Enhancements/timesplits/TimeSplits.h"
#include "Enhancements/randomizer/Plandomizer.h"
#include "Enhancements/TimeDisplay/TimeDisplay.h"
#include "AboutWindow.h"
// FA icons are kind of wonky, if they worked how I expected them to the "+ 2.0f" wouldn't be needed, but
// they don't work how I expect them to so I added that because it looked good when I eyeballed it
@ -104,8 +105,8 @@ static const char* imguiScaleOptions[4] = { "Small", "Normal", "Large", "X-Large
static const char* subSubPowers[7] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6] };
static const char* zFightingOptions[3] = { "Disabled", "Consistent Vanish", "No Vanish" };
static const char* autosaveLabels[6] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" };
static const char* bootSequenceLabels[3] = { "Default", "Authentic", "File Select" };
static const char* DebugSaveFileModes[3] = { "Off", "Vanilla", "Maxed" };
static const char* FastFileSelect[5] = { "File N.1", "File N.2", "File N.3", "Zelda Map Select (require OoT Debug Mode)", "File select" };
static const char* DekuStickCheat[3] = { "Normal", "Unbreakable", "Unbreakable + Always on Fire" };
static const char* bonkDamageValues[8] = {
"No Damage",
@ -177,8 +178,18 @@ void DrawMenuBarIcon() {
}
}
extern std::shared_ptr<AboutWindow> mAboutWindow;
void DrawShipMenu() {
if (ImGui::BeginMenu("Ship")) {
if (mAboutWindow) {
if (ImGui::MenuItem("About...")) {
mAboutWindow->Show();
}
}
UIWidgets::Spacer(0);
if (ImGui::MenuItem("Hide Menu Bar",
#if !defined(__SWITCH__) && !defined(__WIIU__)
"F1"
@ -1546,8 +1557,6 @@ void DrawEnhancementsMenu() {
if (ImGui::BeginMenu("Restoration"))
{
UIWidgets::EnhancementCheckbox("Authentic Logo Screen", CVAR_ENHANCEMENT("AuthenticLogo"));
UIWidgets::Tooltip("Hide the game version and build details and display the authentic model and texture on the boot logo start screen");
UIWidgets::PaddedEnhancementCheckbox("Red Ganon blood", CVAR_ENHANCEMENT("RedGanonBlood"), true, false);
UIWidgets::Tooltip("Restore the original red blood from NTSC 1.0/1.1. Disable for green blood");
UIWidgets::PaddedEnhancementCheckbox("Fish while hovering", CVAR_ENHANCEMENT("HoverFishing"), true, false);
@ -1712,6 +1721,16 @@ void DrawEnhancementsMenu() {
UIWidgets::PaddedSeparator(true, true, 2.0f, 2.0f);
UIWidgets::PaddedText("Boot Sequence", false, true);
UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("BootSequence"), bootSequenceLabels, BOOTSEQUENCE_DEFAULT);
UIWidgets::Tooltip("Configure what happens when starting or resetting the game\n\n"
"Default: LUS logo -> N64 logo\n"
"Authentic: N64 logo only\n"
"File Select: Skip to file select menu"
);
UIWidgets::PaddedSeparator(true, true, 2.0f, 2.0f);
ImGui::EndDisabled();
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f));
@ -2001,12 +2020,6 @@ void DrawDeveloperToolsMenu() {
}
UIWidgets::PaddedEnhancementCheckbox("OoT Skulltula Debug", CVAR_DEVELOPER_TOOLS("SkulltulaDebugEnabled"), true, false);
UIWidgets::Tooltip("Enables Skulltula Debug, when moving the cursor in the menu above various map icons (boss key, compass, map screen locations, etc) will set the GS bits in that area.\nUSE WITH CAUTION AS IT DOES NOT UPDATE THE GS COUNT.");
UIWidgets::PaddedEnhancementCheckbox("Fast File Select", CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), true, false);
UIWidgets::Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only if you toggle on \"Create a new save if none ?\" else it will bring you to the File choose menu");
if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0)) {
ImGui::Text("Loading:");
UIWidgets::EnhancementCombobox(CVAR_DEVELOPER_TOOLS("SaveFileID"), FastFileSelect, 0);
};
UIWidgets::PaddedEnhancementCheckbox("Better Debug Warp Screen", CVAR_DEVELOPER_TOOLS("BetterDebugWarpScreen"), true, false);
UIWidgets::Tooltip("Optimized debug warp screen, with the added ability to chose entrances and time of day");
UIWidgets::PaddedEnhancementCheckbox("Debug Warp Screen Translation", CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true);

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);
}
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);
}
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,23 +134,11 @@ 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);
}
@ -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);
}