Go to map select @ boot when in debug mode or when pressing Z+L+R (#20)

* Go to map select @ boot when in debug mode or when pressing Z+L+R

* Update mm/src/code/graph.c
This commit is contained in:
Garrett Cox
2024-05-22 09:04:57 -05:00
parent cefbee8e25
commit 67f7882242
3 changed files with 32 additions and 14 deletions
+11
View File
@@ -4,6 +4,7 @@
#include "functions.h"
#include "fault.h"
#include "gfxdebuggerbridge.h"
#include "libultraship/libultraship.h"
// Variables are put before most headers as a hacky way to bypass bss reordering
FaultAddrConvClient sGraphFaultAddrConvClient;
@@ -349,6 +350,16 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
Graph_UpdateGame(gameState);
Graph_ExecuteAndDraw(gfxCtx, gameState);
// 2S2H [Debug] Decomp didn't contain the original code that would allow for this, so this is stolen from ship
if (CVarGetInteger("gDebugEnabled", 0)) {
if (CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) &&
CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) {
STOP_GAMESTATE(gameState);
gSaveContext.gameMode = GAMEMODE_NORMAL;
SET_NEXT_GAMESTATE(gameState, MapSelect_Init, sizeof(MapSelectState));
}
}
}
static struct RunFrameContext {
@@ -23,16 +23,16 @@ void MapSelect_LoadFileSelect(MapSelectState* this) {
}
void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) {
//if (gSaveContext.fileNum == 0xFF) {
if (gSaveContext.fileNum == 0xFF) {
Sram_InitDebugSave();
//}
}
gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED;
gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED;
gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED;
gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED;
gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED;
gSaveContext.hudVisibilityForceButtonAlphasByStatus = true;
gSaveContext.hudVisibilityForceButtonAlphasByStatus = false;
gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE;
gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE;
gSaveContext.hudVisibilityTimer = 0;
+18 -11
View File
@@ -13,6 +13,7 @@
#include "overlays/gamestates/ovl_select/z_select.h"
#include <stdlib.h>
#include "BenPort.h"
#include "libultraship/libultraship.h"
void ConsoleLogo_UpdateCounters(ConsoleLogoState* this) {
if ((this->coverAlpha == 0) && (this->visibleDuration != 0)) {
@@ -124,9 +125,6 @@ void ConsoleLogo_Draw(GameState* thisx) {
CLOSE_DISPS(this->state.gfxCtx);
}
// hack for minibuild work
void MapSelect_Init(GameState* thisx);
void FileSelect_Init(GameState* thisx);
void ConsoleLogo_Main(GameState* thisx) {
ConsoleLogoState* this = (ConsoleLogoState*)thisx;
@@ -134,7 +132,7 @@ void ConsoleLogo_Main(GameState* thisx) {
OPEN_DISPS(this->state.gfxCtx);
gSPSegment(OVERLAY_DISP++, 0x01, this->staticSegment);
gSPSegment(POLY_OPA_DISP++, 0x01, this->staticSegment);
ConsoleLogo_UpdateCounters(this);
ConsoleLogo_Draw(&this->state);
@@ -144,8 +142,14 @@ void ConsoleLogo_Main(GameState* thisx) {
gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN;
STOP_GAMESTATE(&this->state);
// hack
SET_NEXT_GAMESTATE(&this->state, MapSelect_Init, sizeof(MapSelectState));
// #region 2S2H [Debug] Eventually we'll get rid of this
if (CVarGetInteger("gDebugEnabled", 0)) {
gSaveContext.gameMode = GAMEMODE_NORMAL;
SET_NEXT_GAMESTATE(&this->state, MapSelect_Init, sizeof(MapSelectState));
// #endregion
} else {
SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState));
}
}
CLOSE_DISPS(this->state.gfxCtx);
@@ -175,11 +179,14 @@ void ConsoleLogo_Init(GameState* thisx) {
this->state.destroy = ConsoleLogo_Destroy;
this->exit = false;
if (!(PadMgr_GetValidControllersMask() & 1)) {
gSaveContext.fileNum = 0xFEDC;
} else {
gSaveContext.fileNum = 0xFF;
}
// #region 2S2H [Debug] This value is set to indicate no controllers are connected, not only
// do we not need this, but it conflicts with us wanting to load the debug file on the map select at boot.
// if (!(PadMgr_GetValidControllersMask() & 1)) {
// gSaveContext.fileNum = 0xFEDC;
// } else {
gSaveContext.fileNum = 0xFF;
// }
// #endregion
gSaveContext.flashSaveAvailable = true;
Sram_Alloc(thisx, &this->sramCtx);