11-21-2021, 05:39 PM
(11-21-2021, 05:26 PM)Vega Wrote: Which exact source is not compiling for you?
Every source for every region option compiles for me on old legacy PyiiASMH2. I only use the old version because I can't get the new version to run/compile on Debian 10. So I'm unable to test on PyiiASMH3.
Codewrite & ASMWiiRD won't compile the 5th source. It will reject it and say that 'string16' is an unknown pseudo-op. You can easily fix this though by just putting in the raw hex. Is that what you are attempting to do (hence why you get the alignment error)?
If so try this...
Replace .string16 "%.2f\0"
with...
.long 0x0025002e #16-bit ASCII for %.
.long 0x00320066 #16-bit ASCII for 2f
.long 0x00000000 #Alignment
This will compile the 16-bit ascii string and then have enough null bytes for the alignment
this one
Code:
# inject at 807ed1d8 (PAL)
# inject at 807e392c (NTSC-U)
# inject at 807ec844 (NTSC-J)
# inject at 807db598 (NTSC-K)
.set region, 'E'
.if (region == 'P')
.set swprintf, 0x80017814
.set LayoutUIControl_setMessageAll, 0x8063ddb4
.set RaceConfig_s_instance, 0x809bd728
.set KartManager_s_instance, 0x809c18f8
.elseif (region == 'E')
.set swprintf, 0x80016cb4
.set LayoutUIControl_setMessageAll, 0x8060c994
.set RaceConfig_s_instance, 0x809b8f68
.set KartManager_s_instance, 0x809bd110
.elseif (region == 'J')
.set swprintf, 0x80017738
.set LayoutUIControl_setMessageAll, 0x8063d420
.set RaceConfig_s_instance, 0x809bc788
.set KartManager_s_instance, 0x809c0958
.elseif (region == 'K')
.set swprintf, 0x8001787c
.set LayoutUIControl_setMessageAll, 0x8062c0cc
.set RaceConfig_s_instance, 0x809abd68
.set KartManager_s_instance, 0x809aff38
.else
.err
.endif
lbz r3, 0x81 (r30)
cmpwi r3, 0x0 # check if the control is custom
bne end # if not, we are done
# get the local player id
lbz r31, 0x190 (r30)
# get the player id
lis r3, RaceConfig_s_instance@ha
lwz r3, RaceConfig_s_instance@l (r3)
add r3, r3, r31
lbz r4, 0xb84 (r3)
# get the speed
lis r3, KartManager_s_instance@ha
lwz r3, KartManager_s_instance@l (r3)
lwz r3, 0x20 (r3)
slwi r4, r4, 2
lwzx r3, r3, r4
lwz r3, 0x0 (r3)
lwz r3, 0x28 (r3)
lfs f1, 0x20 (r3)
# format the string
addi r3, r1, 0x8
li r4, 0xd
bl format
.short 0x001a, 0x0800, 0x0001, 0x0030 # color
.string16 "%.2f\0"
format:
mflr r5
crset 4 * cr1 + eq
lis r12, swprintf@h
ori r12, r12, swprintf@l
mtctr r12
bctrl
addi r4, r1, 0x10
# change the color depending on the local player id and the team
addi r3, r31, 0x30
lis r5, RaceConfig_s_instance@ha
lwz r5, RaceConfig_s_instance@l (r5)
mulli r6, r31, 0xf0
add r5, r5, r6
lwz r5, 0xf4 (r5)
cmpwi r5, 0x2
beq no_team
addi r3, r5, 0x20
no_team:
sth r3, -0x2 (r4)
# replace digits, dashes and dots with the timer versions
loop:
lhz r3, 0x0 (r4)
cmpwi r3, 0x0
beq out
cmpwi r3, 0x2d
bne not_a_dash
li r3, 0x246d
not_a_dash:
cmpwi r3, 0x2e
bne not_a_dot
li r3, 0x246b
not_a_dot:
subi r5, r3, 0x30
cmplwi r5, 0x9
bgt not_a_digit
addi r3, r5, 0x2460
not_a_digit:
sth r3, 0x0 (r4)
addi r4, r4, 0x1
b loop
out:
# update the message
mr r3, r30
addi r4, r1, 0x8
li r5, 0x0
lis r12, LayoutUIControl_setMessageAll@h
ori r12, r12, LayoutUIControl_setMessageAll@l
mtctr r12
bctrl
end:
lwz r0, 0xe4 (r1) # original instruction