Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Mc-muffin
Last active May 10, 2020 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mc-muffin/3ef6ceeed308186a3ebd5da2d51f6877 to your computer and use it in GitHub Desktop.
Save Mc-muffin/3ef6ceeed308186a3ebd5da2d51f6877 to your computer and use it in GitHub Desktop.
;0x20 (space) character isnt stored in s1 like every other character due
;to different width calculation, this made our s1 check unreliable anytime
;an space was in the text
;a3 is 1 whenever an space is procesed, and they mirror t0 otherwise
;s3 holds the address for the next character to be drawn
;t0 holds double byte characters, so we can use that to check for ASCII characters
;as s0 is unreliable
;Note1: Some move operations need delay before we can read the correct value
;this is important if we want the game to run in original hardware :P
li s0,0x003D79A0
sw s1,(s0) ;we store s1 in the address we set-up on s0
;Check is a3 == 1
li s0,0x1 ;This needs to inputted as 'addiu s0,zero,0x1' in PCSX2 for it to work
beql s0,a3,variableWidth ;if a3 is 1 we jump directly to our VWF code
nop
;check if the character is double bytes
andi s0,t0,0xFF00
bnez s0,originalFunction ;if the result of the AND is not zero we jump to the original
nop ;function as that means this is a SHIFT-JIS char
variableWidth:
li s0,table_address
lbu s1,-0x1(s3) ;We use s3 to get the correct space character (0x20)
addu s0,s1
lbu s0,(s0)
mtc1 s0,f23
nop ;Check note 1 as for why this nop is here
cvt.s.w f23,f23
j originalFunction
originalFunction:
li s0,0x003D79A0
lw s1,(s0) ;We load back original s1 from the address we set-up at the start
or s0,zero,zero ;reset s0 back to zero
add.s f26,f26,f23
addiu s6,0x1
j pos_00151DB0 ;back to original function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment