1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-04 22:39:02 -08:00

add really rough onscreen printing

This commit is contained in:
Connor Olding 2016-01-11 16:42:40 -08:00
parent ea1e055e87
commit c5eaf96e1a
2 changed files with 98 additions and 5 deletions

View file

@ -26,8 +26,13 @@ local injection_points = {
['O EUDB MQ'] = {
inject_addr = 0x700000,
inject_maxlen = 0x100000,
ow_addr = 0x0C6940,
ow_before = 0x0C03151F,
-- main rendering loop:
-- the only other function (that literally just loads and returns)
--ow_addr = 0x0C6940,
--ow_before = 0x0C03151F,
-- first (high-level) function after iterating over actors
ow_addr = 0x0C62B8,
ow_before = 0x0C031AB1,
},
}
injection_points['O JP10'] = injection_points['O US10']

View file

@ -2,16 +2,104 @@
// to copy strings to memory instead
// for Lua to later pick up on
[global_context]: 0x80212020
// offset from first pointer in global context
[dlist_offset]: 0x2C0
[SetTextRGBA]: 0x800FB3AC
[SetTextXY]: 0x800FB41C
[SetTextString]: 0x800FBCB4
[TxtPrinter]: 0x800FBB60
[InitTxtStruct]: 0x800FBB8C
[DoTxtStruct]: 0x800FBC1C
[UpdateTxtStruct]: 0x800FBC64
[ObjectSpawn]: 0x80097C00
[ObjectIndex]: 0x8009812C
push 4, 1, ra
// draw some nonsense text
li a0, 0x00010001 // xy
li a1, 0x88CCFFFF // rgba
la a2, fmt
la a3, buffer
jal easytext
nop
// reset buffer position in our per-frame hook
la t0, buffer
sw t0, buffer_pos
// and set the string to null
sb r0, 0(t0)
jr
jpop 4, 1, ra
fmt:
.byte 0x25,0x73,0x00 // %s
.align
str:
.byte 0x68,0x65,0x79,0x00 // hey
.align
textdata:
.word 0, 0, 0, 0, 0
easytext:
// a0: xxxxyyyy
// a1: rrggbbaa
// a2: printf formatting string
// a3: first argument for format string (optional)
// TODO: support more than 4 args
push 4, 1, s0, s1, ra
la s0, textdata
sw a0, 32(sp)
sw a1, 36(sp)
sw a2, 40(sp)
sw a3, 44(sp)
li t0, @TxtPrinter
sw t0, 0(s0) // printer
sw r0, 4(s0) // dlist end
sh r0, 8(s0) // x
sh r0, 10(s0) // y
li t0, 0xC
sw t0, 12(s0) // unknown
sw r0, 16(s0) // color
li t0, @global_context
lw s1, 0(t0)
lw t2, @dlist_offset(s1)
mov a0, s0
mov a1, t2
jal @DoTxtStruct
nop
[ObjectSpawn]: 0x80097C00
[ObjectIndex]: 0x8009812C
lbu a1, 36(sp)
lbu a2, 37(sp)
lbu a3, 38(sp)
lbu t1, 39(sp)
sw t1, 0x10(sp)
jal @SetTextRGBA
mov a0, s0
lh a1, 32(sp)
lh a2, 34(sp)
jal @SetTextXY
mov a0, s0
lw a1, 40(sp)
lw a2, 44(sp)
jal @SetTextString
mov a0, s0
mov a0, s0
jal @UpdateTxtStruct
nop
sw v0, @dlist_offset(s1)
jpop 4, 1, s0, s1, ra
ObjectSpawnWrap:
// keep track of which objects we're spawning