mirror of
https://github.com/notwa/mm
synced 2025-02-05 13:23:23 -08:00
add ROM version of spawner for OoT debug
This commit is contained in:
parent
c38ac76ba6
commit
f2a291c6cd
6 changed files with 101 additions and 48 deletions
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
[hold_delay_amount]: 3
|
[hold_delay_amount]: 3
|
||||||
|
|
||||||
|
spawn:
|
||||||
push 4, s0, s1, s2, s3, s4, ra,
|
push 4, s0, s1, s2, s3, s4, ra,
|
||||||
li t0, @link_save
|
|
||||||
li t1, @global_context
|
li t1, @global_context
|
||||||
lhu s0, anum
|
lhu s0, anum
|
||||||
lw s1, hold_delay
|
lw s1, hold_delay
|
||||||
|
|
41
patch/dma O EUDB MQ.asm
Normal file
41
patch/dma O EUDB MQ.asm
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
[DMARomToRam]: 0x80000BFC
|
||||||
|
|
||||||
|
[vstart]: 0x035D0000
|
||||||
|
[start]: 0x80700000
|
||||||
|
[size]: 0x10000
|
||||||
|
|
||||||
|
/*
|
||||||
|
.org 0x18F30
|
||||||
|
; add an entry to the end of dmatable to hold our extra code
|
||||||
|
; this actually just crashes the game so don't bother
|
||||||
|
; (no debug filename associated with it = bad pointer dereference? maybe?)
|
||||||
|
.word @vstart ; virtual start
|
||||||
|
.word 0x035E0000 ; virtual end (@vstart + @size)
|
||||||
|
.word @vstart ; physical start (should be same as virtual start)
|
||||||
|
.word 0 ; physical end (should be 0 for uncompressed)
|
||||||
|
*/
|
||||||
|
|
||||||
|
.org 0xB3D9E4 ; 0x800C6844
|
||||||
|
; 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 coming up with this.
|
||||||
|
addiu sp, sp, 0xFC60 ; original code
|
||||||
|
; push removed here
|
||||||
|
li s0, 0x8011F830 ; original code
|
||||||
|
; pushes removed here
|
||||||
|
; 9 instructions to work with?
|
||||||
|
; dma args are backwards compared to MM?
|
||||||
|
li a1, @start
|
||||||
|
li a2, @size
|
||||||
|
jal @DMARomToRam
|
||||||
|
li a0, @vstart
|
||||||
|
lui a0 0x8014 ; original code
|
||||||
|
cl a1
|
||||||
|
cl a2
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
|
@ -56,10 +56,8 @@ unc "$code"
|
||||||
mkdir -p lips
|
mkdir -p lips
|
||||||
cp ../"$lips"/* lips
|
cp ../"$lips"/* lips
|
||||||
|
|
||||||
cp ../"$inject/"{crc32,entrances}.asm .
|
cp ../"$inject"/*.asm .
|
||||||
cp ../extra.asm .
|
cp ../*.asm .
|
||||||
cp ../common.asm .
|
|
||||||
cp ../code.asm .
|
|
||||||
|
|
||||||
dd if=/dev/zero of=extra bs=370688 count=1 2>/dev/null
|
dd if=/dev/zero of=extra bs=370688 count=1 2>/dev/null
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ cp ../../"$rom" "$out"
|
||||||
mkdir -p lips
|
mkdir -p lips
|
||||||
cp ../"$lips"/* lips
|
cp ../"$lips"/* lips
|
||||||
|
|
||||||
cp ../"$inject/"widescreen-either.asm .
|
cp ../"$inject/"*.asm .
|
||||||
cp ../widescreen-inline.asm .
|
cp ../*.asm .
|
||||||
|
|
||||||
luajit patch.lua -o 0 \
|
luajit patch.lua -o 0 \
|
||||||
--extra-rom 0x035D0000 --extra-ram 0x80700000 \
|
--extra-rom 0x035D0000 --extra-ram 0x80700000 \
|
||||||
|
|
54
patch/spawn O EUDB MQ.asm
Normal file
54
patch/spawn O EUDB MQ.asm
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
.include "dma O EUDB MQ.asm"
|
||||||
|
|
||||||
|
[original]: 0x800C6AC4
|
||||||
|
[inject_from]: 0xB3D458 ; 0x800C62B8
|
||||||
|
[inject_to]: 0x80700000
|
||||||
|
|
||||||
|
.org @inject_from
|
||||||
|
jal @inject_to
|
||||||
|
|
||||||
|
.org @inject_to
|
||||||
|
sw ra, -4(sp)
|
||||||
|
sw a0, 0(sp)
|
||||||
|
sw a1, 4(sp)
|
||||||
|
sw a2, 8(sp)
|
||||||
|
sw a3, 12(sp)
|
||||||
|
bal spawn
|
||||||
|
subi sp, sp, 24
|
||||||
|
lw ra, 20(sp)
|
||||||
|
lw a0, 24(sp)
|
||||||
|
lw a1, 28(sp)
|
||||||
|
lw a2, 32(sp)
|
||||||
|
lw a3, 36(sp)
|
||||||
|
j @original
|
||||||
|
addi sp, sp, 24
|
||||||
|
|
||||||
|
[actor_spawn]: 0x80031F50
|
||||||
|
[object_spawn]: 0x80097C00
|
||||||
|
[object_index]: 0xAF246C ; 0x8009812C
|
||||||
|
|
||||||
|
[max_actor_no]: 0x1D6
|
||||||
|
|
||||||
|
[global_context]: 0x80212020
|
||||||
|
[buttons_offset]: 0x14
|
||||||
|
[actor_spawn_offset]: 0x1C24
|
||||||
|
[object_spawn_offset]: 0x117A4
|
||||||
|
|
||||||
|
[link_actor]: 0x802245B0
|
||||||
|
[actor_x]: 0x24
|
||||||
|
[actor_y]: 0x28
|
||||||
|
[actor_z]: 0x2C
|
||||||
|
[actor_horiz_angle]: 0x46
|
||||||
|
|
||||||
|
// offset from first pointer in global context
|
||||||
|
[dlist_offset]: 0x2B0
|
||||||
|
|
||||||
|
[SetTextRGBA]: 0x800FB3AC
|
||||||
|
[SetTextXY]: 0x800FB41C
|
||||||
|
[SetTextString]: 0x800FBCB4
|
||||||
|
[TxtPrinter]: 0x800FBB60
|
||||||
|
[InitTxtStruct]: 0x800FBB8C // unused here; we set it up inline
|
||||||
|
[DoTxtStruct]: 0x800FBC1C
|
||||||
|
[UpdateTxtStruct]: 0x800FBC64
|
||||||
|
|
||||||
|
.include "spawn.asm"
|
|
@ -6,47 +6,7 @@
|
||||||
[ctxt]: 0x80212020
|
[ctxt]: 0x80212020
|
||||||
[dlists]: 0x80168930
|
[dlists]: 0x80168930
|
||||||
|
|
||||||
[DMARomToRam]: 0x80000BFC
|
.include "dma O EUDB MQ.asm"
|
||||||
|
|
||||||
[vstart]: 0x035D0000
|
|
||||||
[start]: 0x80700000
|
|
||||||
[size]: 0x10000
|
|
||||||
|
|
||||||
/*
|
|
||||||
.org 0x18F30
|
|
||||||
; add an entry to the end of dmatable to hold our extra code
|
|
||||||
; this actually just crashes the game so don't bother
|
|
||||||
; (no debug filename associated with it = bad pointer dereference? maybe?)
|
|
||||||
.word @vstart ; virtual start
|
|
||||||
.word 0x035E0000 ; virtual end (@vstart + @size)
|
|
||||||
.word @vstart ; physical start (should be same as virtual start)
|
|
||||||
.word 0 ; physical end (should be 0 for uncompressed)
|
|
||||||
*/
|
|
||||||
|
|
||||||
.org 0xB3D9E4 ; 0x800C6844
|
|
||||||
; 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 coming up with this.
|
|
||||||
addiu sp, sp, 0xFC60 ; original code
|
|
||||||
; push removed here
|
|
||||||
li s0, 0x8011F830 ; original code
|
|
||||||
; pushes removed here
|
|
||||||
; 9 instructions to work with?
|
|
||||||
; dma args are backwards compared to MM?
|
|
||||||
li a1, @start
|
|
||||||
li a2, @size
|
|
||||||
jal @DMARomToRam
|
|
||||||
li a0, @vstart
|
|
||||||
lui a0 0x8014 ; original code
|
|
||||||
cl a1
|
|
||||||
cl a2
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
|
|
||||||
[original]: 0x800C6AC4
|
[original]: 0x800C6AC4
|
||||||
[inject_from]: 0xB3D458 ; 0x800C62B8
|
[inject_from]: 0xB3D458 ; 0x800C62B8
|
||||||
|
|
Loading…
Add table
Reference in a new issue