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.
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.