mirror of
https://github.com/notwa/mm
synced 2025-02-05 13:23:23 -08:00
use a cleaner method of loading extra file
This commit is contained in:
parent
955b5a5848
commit
1fc77b93ad
2 changed files with 24 additions and 5 deletions
|
@ -5,10 +5,26 @@
|
||||||
|
|
||||||
; 0x8016A2C8 -> 0xC4808
|
; 0x8016A2C8 -> 0xC4808
|
||||||
; 0x8016A2C8 - 0xC4808 = 0x800A5AC0
|
; 0x8016A2C8 - 0xC4808 = 0x800A5AC0
|
||||||
|
|
||||||
; 0x8016AC0C - 0x8016A2C8 = 0x944
|
; 0x8016AC0C - 0x8016A2C8 = 0x944
|
||||||
|
|
||||||
.org 0xC4808
|
.org 0xCEDE0 ; 0x801748A0
|
||||||
|
; this appears to be the main game loop function
|
||||||
|
; we can "make room" for some injected code
|
||||||
|
; by taking advantage of it never returning under normal circumstances.
|
||||||
|
; we'll cut out pushing RA, S1-S8 stuff on stack.
|
||||||
|
; props to CloudMax for doing this in OoT first.
|
||||||
|
addiu sp, sp, 0xFCC0 ; original code
|
||||||
|
; push removed here
|
||||||
|
li s0, 0x801BD910 ; original code
|
||||||
|
; pushes removed here
|
||||||
|
; 6 instructions to work with
|
||||||
|
li a1, @vstart ; 2
|
||||||
|
li a2, @size ; 2
|
||||||
|
jal @DMARomToRam ; 1
|
||||||
|
li a0, @start ; 1 (just make sure @start can be a LUI!)
|
||||||
|
|
||||||
|
.org 0xC4808 ; 0x8016A2C8
|
||||||
|
/*
|
||||||
; if we've already loaded once, don't load again
|
; if we've already loaded once, don't load again
|
||||||
lbu t0, @start ; 2
|
lbu t0, @start ; 2
|
||||||
bnez t0, + ; 1
|
bnez t0, + ; 1
|
||||||
|
@ -28,6 +44,9 @@
|
||||||
; and is moved into our extra file.
|
; and is moved into our extra file.
|
||||||
; we have (0x944 / 4 - 23) = 570 words of space here, should we need it.
|
; we have (0x944 / 4 - 23) = 570 words of space here, should we need it.
|
||||||
.word 0xDEADBEEF
|
.word 0xDEADBEEF
|
||||||
|
*/
|
||||||
|
j @dma_hook ; 1
|
||||||
|
nop ; 1
|
||||||
|
|
||||||
.org 0x9F9A4 ; JR of starting_exit's function
|
.org 0x9F9A4 ; JR of starting_exit's function
|
||||||
j @load_hook ; tail call
|
j @load_hook ; tail call
|
||||||
|
|
|
@ -26,9 +26,9 @@ dma_hook:
|
||||||
jal setup_hook
|
jal setup_hook
|
||||||
nop
|
nop
|
||||||
pop 4, 1, ra
|
pop 4, 1, ra
|
||||||
|
addiu sp, sp, 0xFF58 ; original code
|
||||||
; original code (includes jr)
|
j 0x8016A2D0 ; return to scene setup function
|
||||||
.include "setup.asm"
|
sw s1, 0x30(sp) ; original code
|
||||||
|
|
||||||
set_scene_flag:
|
set_scene_flag:
|
||||||
; a0: scene number
|
; a0: scene number
|
||||||
|
|
Loading…
Add table
Reference in a new issue