PSP DRA CheckGravityBootsInput (#2068)

Got stuck with registers on the -O4 area I was working on, so I'm
refocusing to this area of code which should be easier. Also simplified
the selection of compiler optimizations; it seems like DRA is roughly
50/50 on O4 and O0 so it doesn't make sense to check for the overlay
first.
This commit is contained in:
bismurphy 2025-01-14 11:54:56 -05:00 committed by GitHub
parent b23eb3dd0b
commit 327fd162db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 73 additions and 30 deletions

View File

@ -103,12 +103,11 @@ $(BUILD_DIR)/%.s.o: %.s
@mkdir -p $(dir $@)
$(AS) $(AS_FLAGS) -o $@ $<
# Much of DRA has O4. Here we set optimization of the overlay - DRA gets O4, otherwise Op.
# Most of PSP is compiled with -O0, except part of DRA. This block selects the proper flag.
OPT_HIGH = -O4,p #need this because otherwise the comma breaks the if-statement
OPT_OVL = $(if $(findstring dra, $@), $(OPT_HIGH), -Op)
# Allow override. Any file in this list will get Op.
OPT_LO_OVERRIDES = 67F0.c.o 86A0.c.o 22A40.c.o 23FE0.c.o 32DA0.c.o 3AE30.c.o 60D80.c.o 60F10.c.o
OPTIMIZATION = $(if $(filter $(notdir $@),$(OPT_LO_OVERRIDES)), -Op, $(OPT_OVL))
# Allow override. Any file in this list will get O4.
OPT_HI_OVERRIDES = 33F0.c.o A710.c.o C0B0.c.o EC60.c.o 186E8.c.o 61F30.c.o 624DC.c.o 628AC.c.o 63C90.c.o 64EE0.c.o
OPTIMIZATION = $(if $(filter $(notdir $@),$(OPT_HI_OVERRIDES)), $(OPT_HIGH), -Op)
$(BUILD_DIR)/%.c.o: %.c $(MWCCPSP) $(MWCCGAP_APP)
@mkdir -p $(dir $@)

View File

@ -44,15 +44,15 @@ segments:
subsegments:
- [0x80, c, dra_psp/80]
- [0x1E50, c, dra_psp/1E50]
- [0x33F0, c, dra_psp/33F0]
- [0x33F0, c, dra_psp/33F0] # O4
- [0x5DA0, c, dra/624DC] # O4
- [0x60F8, c, dra/628AC] # O4
- [0x66B0, c, dra_psp/66B0]
- [0x67F0, c, dra_psp/67F0] # O0
- [0xA710, c, dra_psp/A710]
- [0xA710, c, dra_psp/A710] # O4
- [0xBDE0, c, dra_psp/BDE0]
- [0xC0B0, c, dra_psp/C0B0]
- [0xEC60, c, dra_psp/EC60]
- [0xC0B0, c, dra_psp/C0B0] # O4
- [0xEC60, c, dra_psp/EC60] # O4
- [0xF4A0, c, dra_psp/F4A0]
- [0xF4D0, c, dra_psp/F4D0]
- [0xF740, c, dra_psp/F740]
@ -76,7 +76,6 @@ segments:
- [0x15520, c, dra_psp/15520]
- [0x160C0, c, dra_psp/160C0]
- [0x18210, c, dra_psp/18210]
# Start of shared C. All prior C is PSP-exclusive.
- [0x186E8, c, dra_psp/186E8]
- [0x18BE0, c, dra_psp/18BE0]
- [0x19AB0, c, dra_psp/19AB0]
@ -90,8 +89,8 @@ segments:
- [0x1DDC0, c, dra_psp/1DDC0]
- [0x1E1B0, c, dra_psp/1E1B0]
- [0x20560, c, dra_psp/20560]
- [0x22A40, c, dra_psp/22A40]
- [0x23FE0, c, dra_psp/23FE0]
- [0x22A40, c, dra_psp/22A40] # O0
- [0x23FE0, c, dra_psp/23FE0] # O0
- [0x26948, c, dra_psp/26948]
- [0x29420, c, dra_psp/29420]
- [0x29760, c, dra_psp/29760]
@ -100,9 +99,9 @@ segments:
- [0x2E050, c, dra_psp/2E050]
- [0x2E0E0, c, dra_psp/2E0E0]
- [0x329F0, c, dra_psp/329F0]
- [0x32DA0, c, dra_psp/32DA0]
- [0x32DA0, c, dra_psp/32DA0] # O0
- [0x35060, c, dra_psp/35060]
- [0x353B0, c, dra_psp/353B0]
- [0x353B0, c, dra_psp/353B0] # O0
- [0x35840, c, dra_psp/35840]
- [0x37280, c, dra_psp/37280]
- [0x375C0, c, dra_psp/375C0]
@ -117,7 +116,7 @@ segments:
- [0x398C0, c, dra_psp/398C0]
- [0x3A4C0, c, dra_psp/3A4C0]
- [0x3A770, c, dra_psp/3A770]
- [0x3AE30, c, dra_psp/3AE30]
- [0x3AE30, c, dra_psp/3AE30] # O0
- [0x3B240, c, dra_psp/3B240]
- [0x3EEA0, c, dra_psp/3EEA0]
- [0x41E80, c, dra_psp/41E80]
@ -149,17 +148,17 @@ segments:
- [0x5DA20, c, dra_psp/5DA20]
- [0x5EC50, c, dra_psp/5EC50]
- [0x60C90, c, dra_psp/60C90]
- [0x60D80, c, dra_psp/60D80]
- [0x60F10, c, dra_psp/60F10]
- [0x60D80, c, dra_psp/60D80] # O0
- [0x60F10, c, dra_psp/60F10] # O0
- [0x61030, c, dra_psp/61030]
- [0x61F30, c, dra_psp/61F30]
- [0x61F30, c, dra_psp/61F30] # O4
- [0x62FE0, c, dra_psp/62FE0]
- [0x63C90, c, dra_psp/63C90]
- [0x63C90, c, dra_psp/63C90] # O4
- [0x63E60, c, dra_psp/63E60]
- [0x63FE0, c, dra_psp/63FE0]
- [0x64370, c, dra_psp/64370]
- [0x64480, c, dra_psp/64480]
- [0x64EE0, c, dra_psp/64EE0]
- [0x64EE0, c, dra_psp/64EE0] # O4
- [0x65290, c, dra_psp/65290]
- [0x654B0, c, dra_psp/654B0]
- [0x65790, c, dra_psp/65790]

View File

@ -118,6 +118,8 @@ BatFormFinished = 0x0910F1A0;
func_8011690C = 0x0910F298;
CheckWingSmashInput = 0x0910F370;
ControlBatForm = 0x0910F720;
CheckGravityBootsInput = 0x09111D30;
DoGravityJump = 0x09114438;
func_8010FAF4 = 0x09116090;
SetPlayerAnim = 0x09116B48;
UpdateUnarmedAnim = 0x09116CE0;
@ -207,6 +209,7 @@ D_8013AECC = 0x09234B98;
g_BatScreechDone = 0x09234CD8;
g_WingSmashTimer = 0x09234CE0;
g_WingSmashButtonCounter = 0x09234CF0;
g_ButtonCombo = 0x09234D70;
g_sfxRingBufferWritePos = 0x09236b80;
g_SfxRingBuffer = 0x09236b90;
g_SoundCommandRingBufferWritePos = 0x09237190;

View File

@ -23,7 +23,7 @@ bool CheckGravityBootsInput(void) {
}
break;
case 2:
if ((g_ButtonCombo[COMBO_GRAVITY_BOOTS].timer != 0) &&
if ((g_ButtonCombo[COMBO_GRAVITY_BOOTS].timer) &&
--g_ButtonCombo[COMBO_GRAVITY_BOOTS].timer == 0) {
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect = 0;
break;
@ -32,14 +32,14 @@ bool CheckGravityBootsInput(void) {
(g_Player.padTapped & PAD_CROSS) && !(g_Player.unk46 & 0x8000) &&
((PLAYER.step == Player_Crouch) ||
((PLAYER.step == Player_Jump) && (g_Player.unk44 & 1)))) {
if (g_Player.unk72 == 0) {
if (HandleGravityBootsMP(REDUCE) >= 0) {
DoGravityJump();
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect = 0;
return 1;
}
} else {
if (g_Player.unk72) {
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect = 0;
break;
}
if (HandleGravityBootsMP(REDUCE) >= 0) {
DoGravityJump();
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect = 0;
return 1;
}
}
break;

View File

@ -1,6 +1,48 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "../dra/dra.h"
#include "../dra/dra_bss.h"
INCLUDE_ASM("dra_psp/psp/dra_psp/353B0", func_psp_09111D30);
bool CheckGravityBootsInput(void) {
switch (g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect) {
case 0:
if ((g_Player.padTapped & PAD_DOWN) && (g_Player.padHeld == 0)) {
g_ButtonCombo[COMBO_GRAVITY_BOOTS].timer = 16;
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect++;
}
break;
case 1:
if (g_Player.padTapped & PAD_UP) {
g_ButtonCombo[COMBO_GRAVITY_BOOTS].timer = 16;
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect++;
} else {
if (--g_ButtonCombo[COMBO_GRAVITY_BOOTS].timer == 0) {
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect = 0;
}
}
break;
case 2:
if ((g_ButtonCombo[COMBO_GRAVITY_BOOTS].timer) &&
--g_ButtonCombo[COMBO_GRAVITY_BOOTS].timer == 0) {
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect = 0;
break;
}
if (IsRelicActive(RELIC_GRAVITY_BOOTS) &&
(g_Player.padTapped & PAD_CROSS) && !(g_Player.unk46 & 0x8000) &&
((PLAYER.step == Player_Crouch) ||
((PLAYER.step == Player_Jump) && (g_Player.unk44 & 1)))) {
if (g_Player.unk72) {
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect = 0;
break;
}
if (HandleGravityBootsMP(REDUCE) >= 0) {
DoGravityJump();
g_ButtonCombo[COMBO_GRAVITY_BOOTS].buttonsCorrect = 0;
return 1;
}
}
break;
}
return 0;
}
INCLUDE_ASM("dra_psp/psp/dra_psp/353B0", func_psp_09111F58);

View File

@ -3,4 +3,4 @@
INCLUDE_ASM("dra_psp/psp/dra_psp/37A50", func_psp_091143D0);
INCLUDE_ASM("dra_psp/psp/dra_psp/37A50", func_psp_09114438);
INCLUDE_ASM("dra_psp/psp/dra_psp/37A50", DoGravityJump);