diff --git a/m2-hack.asm b/m2-hack.asm index ff296be..1e40d72 100644 --- a/m2-hack.asm +++ b/m2-hack.asm @@ -43,6 +43,37 @@ org $80C21B4; mov r1,#0x14 org $80C224A; mov r1,#0x14 org $80C229E; mov r1,#0x14 +//--------------------------------------------------------- +// C438C hacks (PSI window cursor movement) +//--------------------------------------------------------- + +org $80C4580; bl m2_vwf_entries.c438c_moveup +org $80C4642; bl m2_vwf_entries.c438c_movedown +org $80C4768; bl m2_vwf_entries.c438c_moveright +org $80C48B2; bl m2_vwf_entries.c438c_moveleft + +//--------------------------------------------------------- +// PSI target window hacks +//--------------------------------------------------------- + +// PSI target length hack +org $80B8B12; mov r0,#0x14 + +// Fix PSI target offset calculation +org $80B8B08 +mov r1,#100 +mul r1,r2 +nop +nop + +// Make PP cost use correct number values +org $80CA732 +add r1,#0x60 + +// Make PP cost use the correct space value if there's only one digit +org $80CA712 +mov r0,#0x50 + //--------------------------------------------------------- // C4B2C hacks (Equip window render) //--------------------------------------------------------- diff --git a/m2-vwf-entries.asm b/m2-vwf-entries.asm index 5f95b09..af155a9 100644 --- a/m2-vwf-entries.asm +++ b/m2-vwf-entries.asm @@ -191,3 +191,57 @@ bl .clear_equipment strh r1,[r3,#0] ldr r0,=#0x80C4EFF bx r0 + +//============================================================================== +// Clear PSI target window when moving left/right on PSI screen +.c438c_moveright: +push {r0-r1,lr} +ldr r1,=#0x3005230 +ldr r0,[r1,#0x24] // PSI target window pointer +mov r1,#4 +bl m2_vwf.clear_window +pop {r0-r1} + +// Clobbered code +add r0,#1 +strh r0,[r5,#0x34] +pop {pc} + +.c438c_moveleft: +push {r0-r1,lr} +ldr r1,=#0x3005230 +ldr r0,[r1,#0x24] // PSI target window pointer +mov r1,#4 +bl m2_vwf.clear_window +pop {r0-r1} + +// Clobbered code +sub r0,#1 +strh r0,[r5,#0x34] +pop {pc} + +.c438c_moveup: +push {r0-r1,lr} +ldr r1,=#0x3005230 +ldr r0,[r1,#0x24] // PSI target window pointer +mov r1,#4 +bl m2_vwf.clear_window +pop {r0-r1} + +// Clobbered code +sub r0,#1 +strh r0,[r5,#0x36] +pop {pc} + +.c438c_movedown: +push {r0-r1,lr} +ldr r1,=#0x3005230 +ldr r0,[r1,#0x24] // PSI target window pointer +mov r1,#4 +bl m2_vwf.clear_window +pop {r0-r1} + +// Clobbered code +add r0,#1 +strh r0,[r5,#0x36] +pop {pc}