SADX Mod Loader
After seven days of work (mostly on the mods) the first version of SA2 Mod Loader is done. It's rather similar to SonicGMI/CPKREDIR, except while those are designed to replace data files, the SA2 Mod Loader is designed to inject custom C++ code into the game. It does this by replacing Data_DLL.dll with a custom DLL, requiring no modification to the sonic2app.exe file. In fact, it should work even with the original encrypted exe from Steam.
Download SA2 Mod Loader. The archive should be extracted to your SA2 install folder.
In the root folder you'll find SA2ModManager.exe (and some additional files for debugging and stuff). When you run it, it looks something like this:
This allows you to enable and disable mods, change the order they're loaded in, install or uninstall the loader dll, and play the game. You can also enable a console window, which will print the build version and date, the list of mods loaded, any mods that failed to load, and anything a mod writes to stdout, for example with printf or cout.
You may replace SA2's Launcher.exe with this if you have no need to configure SA2 (you should probably back it up though).
The archive also contains a folder named "mods", which is where mods will go, each in their own folder with a "mod.ini" file and at least one DLL. It also contains SA2ModLoader.dll which is copied to SA2's Data_DLL.dll when you install. If I update the loader you can replace this copy of the dll and the manager will detect the change and ask if you want to copy it over the currently installed version.
Finally there's a "programming" folder, which contains the header files that define the mod API, several important variables, functions, structures and enums in SA2, and a couple convenience functions and macros. You will also find a copy of the Character Randomizer mod's source code as an example.
There are currently three mods, all made by me:
- Character Randomizer, which causes the game to load a random character instead of the one you select in each level.
- Item Box Randomizer, which randomizes the contents of all item boxes and balloons. It seems to crash sometimes if a mech's lockon shot hits a balloon.
- An updated version of my character select mod (more info in the SA2 hacking thread).