From a9cd9e2c453d871c9a2f485f39d941b4ae900757 Mon Sep 17 00:00:00 2001 From: jeffman Date: Tue, 24 Mar 2015 12:33:24 -0400 Subject: [PATCH] Working on PSI help window redrawing --- m2-formatting.asm | 3 + m2-hack.asm | 10 ++++ m2-vwf.asm | 139 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 151 insertions(+), 1 deletion(-) diff --git a/m2-formatting.asm b/m2-formatting.asm index ba2336f..4679e45 100644 --- a/m2-formatting.asm +++ b/m2-formatting.asm @@ -386,4 +386,7 @@ mov r0,r4 bl $80C8FFC //-------------------------------- +// Set all dirty flags +bl m2_vwf.set_all_dirty_flags + pop {r0-r7,pc} \ No newline at end of file diff --git a/m2-hack.asm b/m2-hack.asm index b9a3243..7a9642f 100644 --- a/m2-hack.asm +++ b/m2-hack.asm @@ -156,6 +156,16 @@ org $80C21B4; mov r1,#0x14 org $80C224A; mov r1,#0x14 org $80C229E; mov r1,#0x14 +// PSI -- set clean/dirty flags +org $80BAD1A; bl m2_vwf.psi_clear1 +org $80BAD28; bl m2_vwf.psi_clean1 +org $80BE658; bl m2_vwf.cursor_dirty1 +org $80BE764; bl m2_vwf.cursor_dirty1 + +// PSI help -- set clean/dirty flags +org $80BADCE; bl m2_vwf.psi_help_clear1 +org $80BADD4; bl m2_vwf.psi_help_clean1 + // PSI target strings org $80B8B12; mov r0,#0x14 diff --git a/m2-vwf.asm b/m2-vwf.asm index 7dbd026..2594f76 100644 --- a/m2-vwf.asm +++ b/m2-vwf.asm @@ -249,6 +249,14 @@ pop {r0-r7,pc} .print_string_relative: push {r0-r6,lr} +//-------------------------------- +// Check the dirty flag +mov r6,r0 +bl .get_dirty_flag +cmp r0,#0 +bne + +mov r0,r6 + //-------------------------------- mov r5,#0x22 ldrb r4,[r0,r5] // Window X @@ -265,8 +273,9 @@ lsl r3,r3,#3 mov r0,r2 mov r2,r1 mov r1,r3 -bl m2_vwf.print_string +bl .print_string ++ //-------------------------------- pop {r0-r6,pc} @@ -2024,6 +2033,134 @@ bl $80C8BE4 pop {pc} +//============================================================================== +// void psi_clean1() +//============================================================================== + +.psi_clean1: +print "m2vwf.psi_clean1: $",pc + +push {r0-r1,lr} + +// Clobbered code +bl $80BAE98 // render the PSI window + +// Unset the dirty flag +mov r1,r5 // = #0x3005230 +ldr r0,[r1,#0x1C] // PSI window address +mov r1,#1 +bl .set_dirty_flag + +pop {r0-r1,pc} + + +//============================================================================== +// void psi_clear1() +//============================================================================== + +.psi_clear1: +print "m2vwf.psi_clear1: $",pc + +push {r0-r1,lr} + +// Check the dirty flag +bl .get_dirty_flag + +// If it's clean, don't erase +cmp r0,#0 +bne + + +// Clobbered code -- clear the window +pop {r0-r1} +bl $80CA834 +pop {pc} + ++ +pop {r0-r1,pc} + + +//============================================================================== +// void psi_help_clean1() +//============================================================================== + +.psi_help_clean1: +print "m2vwf.psi_help_clean1: $",pc + +push {r0-r1,r4,lr} + +// Clobbered code +mov r4,r0 +bl $80C8BE4 // render the PSI help window + +// Unset the dirty flag +mov r0,r4 +mov r1,#1 +bl .set_dirty_flag + +pop {r0-r1,r4,pc} + + +//============================================================================== +// void psi_help_clear1() +//============================================================================== + +.psi_help_clear1: +print "m2vwf.psi_help_clear1: $",pc + +push {r0-r1,lr} + +// Check the dirty flag +bl .get_dirty_flag + +// If it's clean, don't erase +cmp r0,#0 +bne + + +// Clobbered code -- clear the window +pop {r0-r1} +bl $80BE458 +pop {pc} + ++ +pop {r0-r1,pc} + + +//============================================================================== +// void cursor_dirty1() +//============================================================================== + +.cursor_dirty1: +print "m2vwf.cursor_dirty1: $",pc + +push {lr} + +// Set the dirty flag +bl .set_all_dirty_flags + +// Clobbered code +strh r0,[r5,#0x36] +mov r1,#0x36 + +pop {pc} + + +//============================================================================== +// void set_all_dirty_flags() +//============================================================================== + +.set_all_dirty_flags: +print "m2vwf.set_all_dirty_flags: $",pc + +push {r0-r1,lr} +ldr r0,=#m2_custom_wram +add r0,#0x14 +mov r1,#0 +str r1,[r0,#0] +str r1,[r0,#4] +str r1,[r0,#8] +pop {r0-r1,pc} + + //============================================================================== // void get_coords(TILEMAP* map) // In: