-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve crash during gear selection when BootToMenu is disabled #31
Conversation
Fixes #27! |
I didn't think I'd ever get a PR here, especially given that I haven't worked on this for 2 years at this point. In any case, seems good, just need to fixup the namespaces, e.g. |
…ar to avoid conflict with Sewer56.SonicRiders.Structures.Enums.ExtremeGear
Haha, can't ever rule out some looney like me making Sonic Riders my obsession-of-the-week! Cheers though! - There was a sneaky namespace conflict between |
….ExtremeGear that flew under the radar
There's also a missing alias for Hehehe. It happens. |
Whoops! - Good catch! |
Seems good to me, I'll chuck a release when I get to my machine later. |
Perfect, cheers mate! |
Description
This change resolves an issue where the game crashes after selecting a character in "Free Race" and
UnlockAllAndBootToMenu
is disabled.This occurs due to the
CustomGearCodePatcher
setting up the new_unlockedGearModels
array withfalse
for all values.It seems when a save file is loaded, it fails to update the new array, and only writes to the game's original "unlocked gears" memory space. (Presumably, loading the save writes a block of data to memory, starting from a Pointer that isn't updated by the Patcher?)
This failure to update the new array results in all gears remaining locked, so when the player goes to select a gear for the race, the game crashes as there are no gears to display.
Implementation
The crux of the implementation is a little crude - Effectively whenever the game loads the Character Select Menu, we check the vanilla game's unlock memory addresses, and clone their state over to the new array. We then manually unlock any custom gears, as there is of course no way to unlock these otherwise.
The custom gears themselves are also granted unique, arbitrary
ExtremeGearModel
values in the_gearToGearModel
array. This is simply such that custom gears can be unlocked exclusively from the original game'sExtremeGearModel
they are based on.Limitations / Known Issues
Tested Scenarios
I've only tested Single Player functionality, so I'm not sure how these changes would affect Netplay.
Nonetheless, I've tested with both a complete (i.e, all gears unlocked) save file and an incomplete one, alongside zero, one, and two custom gears in both scenarios, and had no issues in Free Race.
Default-only gamemodes such as Survival Mode also work as expected.