Replace old pause buffer input experience with a more accurate one (#4918)

This commit is contained in:
Garrett Cox
2025-01-22 19:30:34 -06:00
committed by GitHub
parent 69e3342808
commit aa2ad23601
15 changed files with 145 additions and 44 deletions

View File

@@ -255,6 +255,8 @@ void GameState_Update(GameState* gameState) {
GameState_SetFrameBuffer(gfxCtx);
GameInteractor_ExecuteOnGameStateMainStart();
gameState->main(gameState);
func_800C4344(gameState);

View File

@@ -286,13 +286,6 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) {
Fault_AddHungupAndCrash(__FILE__, __LINE__);
}
// When 3 frames are left on easy pause buffer, re-apply the last held inputs to the prev inputs
// to compute the pressed difference. This makes it so previously held inputs are continued as "held",
// but new inputs when unpausing are "pressed" out of the pause menu.
if (CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0) == 3) {
input->prev.button = CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferLastInputs"), 0);
}
buttonDiff = input->prev.button ^ input->cur.button;
input->press.button |= (u16)(buttonDiff & input->cur.button);
input->rel.button |= (u16)(buttonDiff & input->prev.button);

View File

@@ -18,23 +18,11 @@ void KaleidoSetup_Update(PlayState* play) {
play->shootingGalleryStatus <= 1 && gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY && gSaveContext.magicState != MAGIC_STATE_FILL &&
(play->sceneNum != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) {
u8 easyPauseBufferEnabled = CVarGetInteger(CVAR_CHEAT("EasyPauseBuffer"), 0);
u8 easyPauseBufferTimer = CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0);
// If start is not seen as pressed on the 2nd to last frame then we should end the easy frame advance flow
if (easyPauseBufferEnabled && easyPauseBufferTimer == 2 &&
!CHECK_BTN_ALL(input->press.button, BTN_START)) {
CVarSetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0);
}
if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
if (BREG(0)) {
pauseCtx->debugState = 3;
}
} else if ((CHECK_BTN_ALL(input->press.button, BTN_START) && (!easyPauseBufferEnabled || !easyPauseBufferTimer)) ||
(easyPauseBufferEnabled && easyPauseBufferTimer == 1)) { // Force Kaleido open when easy pause buffer reaches 0
// Remember last held buttons for pause buffer cheat (minus start so easy frame advance works)
CVarSetInteger(CVAR_GENERAL("CheatEasyPauseBufferLastInputs"), input->cur.button & ~(BTN_START));
} else if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
gSaveContext.unk_13EE = gSaveContext.unk_13EA;

View File

@@ -1668,11 +1668,6 @@ time_t Play_GetRealTime() {
void Play_Main(GameState* thisx) {
PlayState* play = (PlayState*)thisx;
// Decrease the easy pause buffer timer every frame
if (CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0) > 0) {
CVarSetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0) - 1);
}
if (play->envCtx.unk_EE[2] == 0 && CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0)) {
play->envCtx.unk_EE[3] = 64;
Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_OBJECT_KANKYO, 0, 0, 0, 0, 0, 0, 3, 0);

View File

@@ -3992,10 +3992,6 @@ void KaleidoScope_Update(PlayState* play)
switch (pauseCtx->unk_1E4) {
case 0:
if (GameInteractor_Should(VB_CLOSE_PAUSE_MENU, CHECK_BTN_ALL(input->press.button, BTN_START))) {
if (CVarGetInteger(CVAR_CHEAT("EasyPauseBuffer"), 0) || CVarGetInteger(CVAR_CHEAT("EasyInputBuffer"), 0)) {
// Easy pause buffer is 13 frames, 12 for kaledio to end, and one more to advance a single frame
CVarSetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 13);
}
Interface_SetDoAction(play, DO_ACTION_NONE);
pauseCtx->state = 0x12;
WREG(2) = -6240;
@@ -4546,6 +4542,10 @@ void KaleidoScope_Update(PlayState* play)
break;
case 0x13:
if (!GameInteractor_Should(VB_KALEIDO_UNPAUSE_CLOSE, true)) {
break;
}
pauseCtx->state = 0;
R_UPDATE_RATE = 3;
R_PAUSE_MENU_MODE = 0;