From e328c8393dca5c6e98bf8b65d17de33822133ead Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Fri, 26 Aug 2022 19:10:19 +0200 Subject: [PATCH] Option: ``NO_MAP_SELECT`` --- include/config/config_debug.h | 14 ++++++++++++++ include/functions.h | 5 +++++ include/z64.h | 5 +++++ spec | 2 ++ src/code/graph.c | 7 +++++++ src/code/z_game_dlftbls.c | 9 +++++++++ .../gamestates/ovl_file_choose/z_file_choose.c | 4 ++-- 7 files changed, 44 insertions(+), 2 deletions(-) diff --git a/include/config/config_debug.h b/include/config/config_debug.h index c3d3330e1..45231e945 100644 --- a/include/config/config_debug.h +++ b/include/config/config_debug.h @@ -39,4 +39,18 @@ */ #define NO_DEBUG_SCENES +/** + * Remove map select + */ +#define NO_MAP_SELECT + +/** + * No map select on file 1 (enabled under certain conditions) + */ +// #define FILE_1_NORMAL + +#if (defined BOOT_TO_SCENE && defined BOOT_TO_FILE_SELECT) || (defined NO_MAP_SELECT) +#define FILE_1_NORMAL +#endif + #endif diff --git a/include/functions.h b/include/functions.h index de5e5c886..746ad5b72 100644 --- a/include/functions.h +++ b/include/functions.h @@ -3,6 +3,7 @@ #include "z64.h" #include "macros.h" +#include "config.h" f32 fabsf(f32 f); #ifndef __sgi @@ -2263,8 +2264,12 @@ void Setup_Init(GameState* thisx); void Setup_Destroy(GameState* thisx); void ConsoleLogo_Init(GameState* thisx); void ConsoleLogo_Destroy(GameState* thisx); + +#ifndef NO_MAP_SELECT void MapSelect_Init(GameState* thisx); void MapSelect_Destroy(GameState* thisx); +#endif + void TitleSetup_Init(GameState* thisx); void TitleSetup_Destroy(GameState* thisx); void FileSelect_Init(GameState* thisx); diff --git a/include/z64.h b/include/z64.h index fa1d5135e..2cafe4080 100644 --- a/include/z64.h +++ b/include/z64.h @@ -36,6 +36,7 @@ #include "padmgr.h" #include "fault.h" #include "sched.h" +#include "config.h" #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 @@ -1084,6 +1085,8 @@ typedef struct { /* 0x01E2 */ char unk_1E2[0x06]; } ConsoleLogoState; // size = 0x1E8 +#ifndef NO_MAP_SELECT + struct MapSelectState; typedef struct { @@ -1114,6 +1117,8 @@ typedef struct MapSelectState { /* 0x0238 */ u8* staticSegment; } MapSelectState; // size = 0x240 +#endif + typedef struct { /* 0x0000 */ GameState state; /* 0x00A4 */ u8* staticSegment; diff --git a/spec b/spec index ba82535d0..baab77125 100644 --- a/spec +++ b/spec @@ -541,11 +541,13 @@ beginseg include "build/src/overlays/gamestates/ovl_title/ovl_title_reloc.o" endseg +#ifndef NO_MAP_SELECT beginseg name "ovl_select" include "build/src/overlays/gamestates/ovl_select/z_select.o" include "build/src/overlays/gamestates/ovl_select/ovl_select_reloc.o" endseg +#endif beginseg name "ovl_opening" diff --git a/src/code/graph.c b/src/code/graph.c index fc41f1a61..4a5f8403b 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,5 +1,6 @@ #include "global.h" #include "vt.h" +#include "config.h" #define GFXPOOL_HEAD_MAGIC 0x1234 #define GFXPOOL_TAIL_MAGIC 0x5678 @@ -105,9 +106,13 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) { if (gameStateInitFunc == Setup_Init) { return &gGameStateOverlayTable[0]; } + +#ifndef NO_MAP_SELECT if (gameStateInitFunc == MapSelect_Init) { return &gGameStateOverlayTable[1]; } +#endif + if (gameStateInitFunc == ConsoleLogo_Init) { return &gGameStateOverlayTable[2]; } @@ -382,12 +387,14 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { sGraphUpdateTime = time; } +#ifndef NO_MAP_SELECT if (gIsCtrlr2Valid && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) && CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) { gSaveContext.gameMode = GAMEMODE_NORMAL; SET_NEXT_GAMESTATE(gameState, MapSelect_Init, MapSelectState); gameState->running = false; } +#endif if (gIsCtrlr2Valid && PreNmiBuff_IsResetting(gAppNmiBufferPtr) && !gameState->unk_A0) { // "To reset mode" diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 55da621a7..a8ca7caee 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -1,4 +1,5 @@ #include "global.h" +#include "config.h" #define GAMESTATE_OVERLAY(name, init, destroy, size) \ { \ @@ -8,9 +9,17 @@ #define GAMESTATE_OVERLAY_INTERNAL(init, destroy, size) \ { NULL, 0, 0, NULL, NULL, NULL, init, destroy, NULL, NULL, 0, size } +#define GAMESTATE_NONE { NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0 } + GameStateOverlay gGameStateOverlayTable[] = { GAMESTATE_OVERLAY_INTERNAL(Setup_Init, Setup_Destroy, sizeof(SetupState)), + +#ifndef NO_MAP_SELECT GAMESTATE_OVERLAY(select, MapSelect_Init, MapSelect_Destroy, sizeof(MapSelectState)), +#else + GAMESTATE_NONE, +#endif + GAMESTATE_OVERLAY(title, ConsoleLogo_Init, ConsoleLogo_Destroy, sizeof(ConsoleLogoState)), GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(PlayState)), GAMESTATE_OVERLAY(opening, TitleSetup_Init, TitleSetup_Destroy, sizeof(TitleSetupState)), diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index f7596678e..f023c5c79 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1441,7 +1441,7 @@ void FileSelect_LoadGame(GameState* thisx) { u16 swordEquipValue; s32 pad; -#if (!defined BOOT_TO_SCENE && !defined BOOT_TO_FILE_SELECT) +#ifndef FILE_1_NORMAL if (this->buttonIndex == FS_BTN_SELECT_FILE_1) { Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1459,7 +1459,7 @@ void FileSelect_LoadGame(GameState* thisx) { gSaveContext.gameMode = GAMEMODE_NORMAL; SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); this->state.running = false; -#if (!defined BOOT_TO_SCENE && !defined BOOT_TO_FILE_SELECT) +#ifndef FILE_1_NORMAL } #endif