Posts: 4,318
Threads: 901
Joined: Feb 2018
Reputation:
98
Karts Behave Like Bikes [vabold]
NTSC-U
0458F550 3BE00001
04581454 40810010
PAL
04595D74 3BE00001
04587C78 40810010
NTSC-J
045956F4 3BE00001
045875F8 40810010
NTSC-K
04583DCC 3BE00001
04575CD0 40810010
Code creator: vabold
Posts: 6
Threads: 4
Joined: Jan 2022
Reputation:
4
11-16-2023, 04:26 PM
(This post was last modified: 11-16-2023, 04:26 PM by vabold.
Edit Reason: Grammar
)
I forgot about this code. Quick rundown:
A bike's virtual function table differs from a kart's. The virtual function responsible for updating wheelies for karts is obviously an empty definition, but for bikes, it calls additional virtual functions for canceling, trying to start, and starting wheelies. These virtual functions (along with some other wheelie-specific data members) aren't present for karts, which is why something like 048B5FB4 80587D64 (PAL) can't work. Instead, the first patch forces the enum controlling which class to create to be a bike regardless of the settings.
However, this introduces a new crash. Bikes have a pointer to a struct containing turning parameters, and the game assumes the vehicle type must be either an outside drifting bike or inside drifting bike to set it. Because the vehicle type is determined externally by kartParam.bin, the simplest fix is including the outside drifting kart case into the first case. Because the comparison is done with cmplwi against 0x1 (outside drifting bikes) and we need to include 0x0 (outside drifting karts), the second patch replaces beq with ble.