fix ExtendedItemInfo patch and add AR code

This commit is contained in:
Martin Michelsen
2025-02-22 17:18:30 -08:00
parent 104e31028b
commit 11d539042c
9 changed files with 471 additions and 56 deletions
@@ -31,10 +31,19 @@ start:
.address 0x802619BC
bl set_window_state_on_switch_to_enemy
.data 0x80286BB0
.data 0x00000004
.address 0x80286BB0
b on_TWindowMainMenu1P_created
.data 0x80286B14
.data 0x00000004
.address 0x80286B14
b on_TWindowMainMenu1P_destroyed
.label is_split_screen, 0x800196B0
.label malloc7, 0x80228C80
.label TWindow::close, 0x8024302C
.label TWindowCtrlPlayer::get_for_player, 0x8024B3CC
.label TWindowHelpItem::init, 0x8025426C
.label TWindowHelpItem::set_displayed_item_by_id, 0x80253DF0
.label TWindowLockOn::update_for_enemy, 0x8026137C
@@ -47,9 +56,25 @@ start:
code_start:
.data 0x00000000 # Placeholder for active window pointer
.data 0x00000000 # Placeholder for TWindowMainMenu1P object
.data 0x41F00000 # TWindowHelpItem x position
.data 0x43480000 # TWindowHelpItem y position
on_TWindowMainMenu1P_created:
lis r4, 0x8000
stw [r4 + 0x4004], r3
blr
on_TWindowMainMenu1P_destroyed:
lis r4, 0x8000
lwz r0, [r4 + 0x4004]
cmpl r0, r3
bne on_TWindowMainMenu1P_destroyed_different_object
li r0, 0
stw [r4 + 0x4004], r0
on_TWindowMainMenu1P_destroyed_different_object:
blr
set_window_state_on_lock_on_delete:
stwu [r1 - 0x20], r1
mflr r0
@@ -118,15 +143,15 @@ set_window_state: # (TItem* item: r3) -> void
cmplwi r3, 0
bne window_should_not_exist
# If the player's TWindowCtrlPlayer's TWindowMainMenu is visible, the
# TWindowHelpItem should not be visible
bl TWindowCtrlPlayer::get_for_player
lwz r3, [r3 + 0x28]
# If the TWindowMainMenu1P exists and is visible, the TWindowHelpItem should
# not be visible
lis r3, 0x8000
lwz r3, [r3 + 0x4004]
cmplwi r3, 0
beq window_should_exist # TWindowMainMenu does not exist
lwz r3, [r3 + 0x4C]
rlwinm. r3, r3, 0, 31, 31
beq window_should_not_exist
bne window_should_not_exist # TWindowMainMenu exists and is visible
window_should_exist:
# Check if the window already exists
@@ -142,7 +167,7 @@ window_should_exist:
# Call the constructor if malloc7 succeeded
cmplwi r3, 0
beq set_window_state_return
ori r3, r31, 0x4004
ori r3, r31, 0x4008
mr r4, r3
lwz r3, [r31 + 0x4000]
lwz r5, [r13 - 0x5298] # local_client_id