RSDKModding / RSDKv4-Decompilation

A complete decompilation of Sonic 1 & Sonic 2 (2013) & Retro Engine (v4)
Other
946 stars 175 forks source link

A game.xml mod above a gameconfig.bin mod will crash when loading levels #441

Open ElspethThePict opened 1 month ago

ElspethThePict commented 1 month ago

Before opening this issue, I ensure that...

Expected Behavior

Both mods load, XML additions applied over modified .bin config

Actual Behavior

Application crashes to desktop when loading a level that uses global scripts

Steps to Reproduce

  1. Supply two mods, one with a modified gameconfig.bin and one with a game.xml that adds objects.
  2. Place the game.xml mod above the other in the mod list and activate both.
  3. Attempt to start a regular stage that uses global objects, like Green Hill Zone
  4. Application closes

Screenshots

No response

Log File

No response

Decompilation Version

Current latest

Game

Sonic 1

Game Version

Mobile (Sega Forever)

Game Revision

No response

Platform

Windows 10

Additional Comments

No response

ElspethThePict commented 1 month ago

I've fixed this in my own fork by reversing the load order of XML files in

RetroEngine::LoadXMLVariables()
RetroEngine::LoadXMLPalettes()
RetroEngine::LoadXMLObjects()
RetroEngine::LoadXMLSoundFX()
RetroEngine::LoadXMLPlayers()
RetroEngine::LoadXMLStages()

In truth, this has likely simply moved the bug to affect XML mods placed below gameconfig.bin mods in the list but the expected behaviour there is already undesired (the gameconfig file overwrites the XML changes completely).

ElspethThePict commented 1 month ago

Other users have found that the mod without an xml doesn't need a gameconfig.bin to cause the crash, and adding even a blank game.xml file fixes the issue. Given that this issue also doesn't happen when there are no new global objects in the xml, I believe RetroEngine::LoadXMLObjects() is crashing when it fails to find an xml file.