2015-12-26 19:06:50 -08:00
|
|
|
// translates calls to 800021F8
|
|
|
|
// to copy strings to memory instead
|
|
|
|
// for Lua to later pick up on
|
|
|
|
|
2016-09-27 12:13:11 -07:00
|
|
|
jr
|
|
|
|
nop
|
|
|
|
/*
|
2016-01-11 16:42:40 -08:00
|
|
|
[global_context]: 0x80212020
|
|
|
|
|
|
|
|
// offset from first pointer in global context
|
2016-04-15 08:34:25 -07:00
|
|
|
[dlist_offset]: 0x2B0
|
2016-01-11 16:42:40 -08:00
|
|
|
|
|
|
|
[SetTextRGBA]: 0x800FB3AC
|
|
|
|
[SetTextXY]: 0x800FB41C
|
|
|
|
[SetTextString]: 0x800FBCB4
|
|
|
|
[TxtPrinter]: 0x800FBB60
|
2016-01-12 06:59:29 -08:00
|
|
|
[InitTxtStruct]: 0x800FBB8C // unused here; we set it up inline
|
2016-01-11 16:42:40 -08:00
|
|
|
[DoTxtStruct]: 0x800FBC1C
|
|
|
|
[UpdateTxtStruct]: 0x800FBC64
|
|
|
|
push 4, 1, ra
|
2016-04-15 08:34:25 -07:00
|
|
|
// draw the debug text
|
2016-01-11 16:42:40 -08:00
|
|
|
li a0, 0x00010001 // xy
|
|
|
|
li a1, 0x88CCFFFF // rgba
|
|
|
|
la a2, fmt
|
|
|
|
la a3, buffer
|
2016-01-12 06:59:29 -08:00
|
|
|
jal simple_text
|
2016-01-11 16:42:40 -08:00
|
|
|
nop
|
2016-04-15 08:34:25 -07:00
|
|
|
// reset buffer position
|
2015-12-26 19:06:50 -08:00
|
|
|
la t0, buffer
|
|
|
|
sw t0, buffer_pos
|
|
|
|
// and set the string to null
|
|
|
|
sb r0, 0(t0)
|
2016-05-18 03:24:20 -07:00
|
|
|
ret 4, 1, ra
|
2016-01-11 16:42:40 -08:00
|
|
|
|
|
|
|
fmt:
|
2016-01-13 11:20:28 -08:00
|
|
|
.asciiz "%s"
|
2016-01-11 16:42:40 -08:00
|
|
|
.align
|
|
|
|
|
2016-01-12 06:59:29 -08:00
|
|
|
.include "simple text.asm"
|
2016-09-27 12:13:11 -07:00
|
|
|
*/
|
2016-01-03 04:11:51 -08:00
|
|
|
|
2015-12-26 19:06:50 -08:00
|
|
|
// keep track of where we are in the buffer
|
2016-09-27 12:13:11 -07:00
|
|
|
.org 0x807006F8
|
2015-12-26 19:06:50 -08:00
|
|
|
buffer_pos:
|
2016-09-27 12:13:11 -07:00
|
|
|
.word buffer
|
|
|
|
|
|
|
|
buffer_lock:
|
2015-12-26 19:06:50 -08:00
|
|
|
.word 0
|
|
|
|
|
2016-09-27 12:13:11 -07:00
|
|
|
//.align 4
|
2015-12-26 19:06:50 -08:00
|
|
|
buffer:
|
2016-01-13 11:20:28 -08:00
|
|
|
.skip 0x3000
|
2015-12-26 19:06:50 -08:00
|
|
|
|
2016-09-27 12:13:11 -07:00
|
|
|
// force a crash-like thing that dumps a ton of (RDP?) info:
|
|
|
|
//.org 0x800C5E78
|
|
|
|
// li t8, 0x29a
|
|
|
|
|
2015-12-26 19:06:50 -08:00
|
|
|
// overwrite (not hook) the debug printing function
|
|
|
|
.org 0x800021B0
|
|
|
|
// a0: unknown
|
|
|
|
// a1: char *msg
|
|
|
|
// a2: size_t len
|
2016-09-27 12:13:11 -07:00
|
|
|
li t0, 1
|
|
|
|
sw t0, buffer_lock
|
2015-12-26 19:06:50 -08:00
|
|
|
lw t0, buffer_pos
|
|
|
|
copy_loop:
|
|
|
|
lb t1, 0(a1)
|
|
|
|
sb t1, 0(t0)
|
|
|
|
addi t0, t0, 1
|
|
|
|
addi a1, a1, 1
|
|
|
|
subi a2, a2, 1
|
|
|
|
bne a2, r0, copy_loop
|
|
|
|
sb r0, 0(t0) // null terminate
|
|
|
|
sw t0, buffer_pos
|
2016-09-27 12:13:11 -07:00
|
|
|
sw r0, buffer_lock
|
2015-12-26 19:06:50 -08:00
|
|
|
jr
|
|
|
|
nop
|