diff options
author | Treeki <treeki@gmail.com> | 2011-05-08 02:55:31 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-05-08 02:55:31 +0200 |
commit | 61e1f79238a8d282e9322619d6027bd7e5e462a9 (patch) | |
tree | db848af8b9345bb3fc7bed9ff1b29a1424ba9623 | |
parent | 0f06f01c78b6ae6d80c851c016ca0ddd83fb33d1 (diff) | |
download | kamek-61e1f79238a8d282e9322619d6027bd7e5e462a9.tar.gz kamek-61e1f79238a8d282e9322619d6027bd7e5e462a9.zip |
initial untested Switch Block implementation
-rw-r--r-- | src/switchblock.S | 72 | ||||
-rw-r--r-- | switchblock.yaml | 25 |
2 files changed, 97 insertions, 0 deletions
diff --git a/src/switchblock.S b/src/switchblock.S new file mode 100644 index 0000000..f219ee4 --- /dev/null +++ b/src/switchblock.S @@ -0,0 +1,72 @@ +.text + +#ifndef __MWERKS__ +.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3 +#endif + +.align 4 +.extern GameMgr +.extern BG_GM_ptr + +.global BG_GM_InitRedSwitchFlag_Patch +BG_GM_InitRedSwitchFlag_Patch: + lis r5, GameMgr@h + ori r5, r5, GameMgr@l + lwz r5, 0(r5) + + addis r4, r3, 9 + lbz r0, 0x380(r5) + stb r0, 0xAA8(r4) + blr + +.global ProcessTileNum_EndPatch +ProcessTileNum_EndPatch: + lis r5, BG_GM_ptr@h + ori r5, r5, BG_GM_ptr@l + lwz r5, 0(r5) + addis r5, r5, 9 + lbz r5, 0xAA8(r3) + + cmplwi r30, 0x58 + bne not_red + andi. r3, r5, 1 + beq not_red + li r3, 0x57 + b ptnReturn +not_red: + cmplwi r30, 0x5A + bne not_green + andi. r3, r5, 2 + beq not_green + li r3, 0x59 + b ptnReturn +not_green: + cmplwi r30, 0x56 + bne not_yellow + andi. r3, r5, 4 + beq not_yellow + li r3, 0x55 + b ptnReturn +not_yellow: + cmplwi r30, 0x54 + bne not_blue + andi. r3, r5, 8 + beq not_blue + li r3, 0x53 + b ptnReturn +not_blue: + mr r3, r30 +ptnReturn: + lwz r0, 0x14(r1) + lwz r31, 0xC(r1) + lwz r30, 0x8(r1) + mtlr r0 + addi sp, sp, 0x10 + blr + diff --git a/switchblock.yaml b/switchblock.yaml new file mode 100644 index 0000000..20ecf24 --- /dev/null +++ b/switchblock.yaml @@ -0,0 +1,25 @@ +---
+source_files: [../src/switchblock.S]
+hooks:
+ - name: PrepareReplay_SwitchPatch
+ type: patch
+ addr_pal: 0x8091F800
+ data: '60000000 60000000 60000000 98830380'
+
+ - name: MoveInfoFromWorldDataToStructArray_SwitchPatch
+ type: patch
+ addr_pal: 0x80102C28
+ data: '60000000 3B800001 60000000 3BC0002A 60000000 98830380'
+
+ - name: BG_GM_InitRedSwitchFlag_SwitchPatch
+ type: branch_insn
+ src_addr_pal: 0x800784D0
+ branch_type: b
+ target_func: 'BG_GM_InitRedSwitchFlag_Patch'
+
+ - name: ProcessTileNum_EndPatch
+ type: branch_insn
+ src_addr_pal: 0x80081B54
+ branch_type: b
+ target_func: 'ProcessTileNum_EndPatch'
+
|