True Velocity Meter [Vega]
#1
True Velocity Meter [Vega]

This will display your velocity (factoring in force, collisions, gravity, engine speed, etc) in the milliseconds section of your timer. Will only work in Solo TT's.

NTSC-U
C2690444 00000008
2C190000 41820034
C1BA0804 FDA0681C
D9A1FFF8 8181FFFC
3D603B80 7D6B6378
3D80807F 956CD9F8
7C00606C 7C0004AC
7C0067AC 4C00012C
3B390001 00000000

PAL
C26948CC 00000008
2C190000 41820034
C1BA0804 FDA0681C
D9A1FFF8 8181FFFC
3D603B80 7D6B6378
3D808080 956C84F8
7C00606C 7C0004AC
7C0067AC 4C00012C
3B390001 00000000

NTSC-J
C2693F38 00000008
2C190000 41820034
C1BA0804 FDA0681C
D9A1FFF8 8181FFFC
3D603B80 7D6B6378
3D80807F 956C7B64
7C00606C 7C0004AC
7C0067AC 4C00012C
3B390001 00000000

NTSC-K
C2682C74 00000008
2C190000 41820034
C1BA0804 FDA0681C
D9A1FFF8 8181FFFC
3D603B80 7D6B6378
3D80807E 956C68B8
7C00606C 7C0004AC
7C0067AC 4C00012C
3B390001 00000000



Code creator: Vega
Code Credits: JoshuaMK (Millisecond Display Mod)



Source:
Code:
#Address Ports
#NTSC-U = 80690444
#PAL = 806948CC
#NTSC-J = 80693F38
#NTSC-K = 80682C74

#Compilation Region Setting
.set region, ''

#Region Dependent Addresses
.if (region == 'E' || region == 'e') # RMCE
.set millmod, 0x807ED9F8
.elseif (region == 'P' || region == 'p') # RMCP
.set millmod, 0x807F84F8
.elseif (region == 'J' || region == 'j') # RMCJ
.set millmod, 0x807F7B64
.elseif (region == 'K' || region == 'k') # RMCK
.set millmod, 0x807E68B8
.else # Invalid Region
.err
.endif

#Velocity is most updated (r26 correct address) when r25 is 1 (can only be 0 or 1 before default instruction)
cmpwi r25, 0
beq- default_instruction

#Get Velocity
lfs f13, 0x0804 (r26)

#Convert float w/ standard rounding, place conversion into a GPR; no need for fabs, value is always positive
fctiw f13, f13
stfd f13, -0x8 (sp)
lwz r12, -0x4 (sp)

#Modify millisecond value of timer
lis r11, 0x3B80 #Upper bits of new instruction
or r11, r11, r12
lis r12, millmod@ha #Use ha in macro to adjust for possible signed offset values in the following store instruction
stwu r11, millmod@l (r12) #Use stwu for upcoming cache instructions

#Update cache
dcbst 0, r12 #Adjust cache for new instruction
sync
icbi 0, r12
isync

#Default Instruction
default_instruction:
addi r25, r25, 1
Reply


Messages In This Thread
True Velocity Meter [Vega] - by Vega - 07-23-2021, 12:52 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)