don't click here

SonicGMI (Sonic Generations Mod Installer) v1.1 RC6

Discussion in 'Engineering & Reverse Engineering' started by Dario FF, Nov 17, 2011.

  1. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    [​IMG] SonicGMI v1.1 RC6 (Sonic Generations Mod Installer)

    SonicGMI used to be a mod installer of its own, but now it's been rehauled as a GUI front-end to CPKREDIR, so users can easily configure the mods they use, their order, and various other settings in an quick and simple interface.

    You can make a shortcut to SonicGMI directly to play the game and be able to configure mods easily, but it's not required to launch the game from it for the mods to work!

    Download the latest version here.


    *) Updates
    Version 1.1:
    • Redesigned GUI, added some foolproof conditions for being able to play with mods(such as installing CPKREDIR if mods are enabled)
    • Added Online Update support for mods. Mods can now have an update server, so the end users can easily update their mods directly from the program whenever an update is available, without the need of redownloading the whole thing.
    • FxPipeline renderer support(AKA the misnamed Unleashed Renderer). Now you can create the alternate renderer exe from SonicGMI, and boot it directly from the program, without having to manually run it from the game's folder. Note this renderer is purely experimental and under constant research, so it might improve and have its bugs ironed out as more discoveries are done. In its current state, it does its purpose just fine, there's only a few visual glitches that can be tolerated sometimes. When new settings are discovered in the EXE, those options will appear in SonicGMI.
    • FxPipeline Shaders Mod added, it must be used if the alternate renderer is enabled, as it fixes various glitches present with the regular shaders. These are NOT the shader_s files found before(which had many lacking features, such as gloss map support), these are new, custom fixed shaders by me, that support correct directional shadows, no red tint, and some other stuff. This mod is currently in Beta and updates frequently, which is perfect for showing off the updating feature.
    • Ring Cap removal is now supported with the creation of an alternate executable, and has no known issues so far. This will be useful for the Unleashed Project as you can imagine, but feel free to go nuts in your own stages as well.
    • Bundled the newest CPKREDIR 0.4.1 version.

    1) Installing
    Copy the contents of this folder into the folder where SonicGenerations.exe is stored. For example: C:\Program Files(x86)\Steam\steamapps\common\sonic generations\

    It doesn't replace any of the game's files, so uninstalling it is trivial. It's not even needed since you can just disable the mod redirection and play the vanilla game.

    2) Usage

    Simply run SonicGMI.exe for configuring the mod loading, patching the exe, and playing! The first time you run SonicGMI it might take a bit since it'll scan the exe to see if CPKREDIR is enabled or not. The scanning will be disabled by default.

    If you never patched your EXE so CPKREDIR works, you can do it directly from SonicGMI with the Install/Uninstall button. It will warn you if you're about to play with an unpatched version of the game.

    You can make brand new Mod configurations by saving the INI with a different name, or even to another folder! You don't need to define mods in your INIs to find them. SonicGMI will simply scan the folder the INI is in for more Mods to add to the list.

    3) Save backups
    In case your mod uses Save File redirection, you can specify in your mod.ini with the key "SaveFileBackup" the save file that will be restored when users click on "Restore Save File" for that particular mod. If you don't specify it, SonicGMI will search for the save file you specified, with a ".new" appended to the end.

    Note that if none of the mods use Save File redirection, launching it now will create a brand new save file on the directory called "cpkredir.sav", copied from your regular Sonic Generations save file. This prevents users tampering with their records by default, but you can disable the Save File redirection easily.

    4) How can I distribute my Mod?
    • In your Mod Installation instructions, redirect them to this thread to download SonicGMI.
    • Distribute the mod folder and tell your users to copy it to the mods folder they use.
    • Make sure to properly fill the description entries in your mod.ini! SonicGMI will display this info to the user.
    • You can get a Mod template here.

    5) Credits
    SonicGMI v1.1 RC6 - Dario ff
    Special thanks to Korama for CPKREDIR v0.4.1, the main tool used for mod distribution. Also for finding out how to enable the alternate renderer.

    Really old post:
    Sonic Generations Mod Installer (SonicGMI) for the Steam PC version

    What's this?

    Distributing mods for a game of the size of Sonic Generations, and with not a really open file support(yet), most of the modding of the game relies on packing/unpacking the game datafiles, or in the case of level swaps, renaming several files. Of course, regular users can't really enjoy any of this without a long set of instructions, so this is my take at trying to make a script-based installer for any mods you guys need to install.

    It's an incredibly early release though, because I won't bother working on it if it doesn't catch up enough interest to make a good format for the script for making your custom mods. And also looking for feedback on what might be the best way to do it, and what better place than SRetro for that? :eng101:/>/>

    • Install with ease mods developed and distributed by other users, by just selecting it. Then press Install, wait a while, and bam! Sonic generations modded.
    • Mods are as lightweight as possible(can be even more optimized when it supports modifying AR0 files individually), so distributing your mod using SonicGMI will save you a few headaches on how to distribute a 2.8gb datafile, by just installing what's modified.
    • Buttons that you can click! Only on Windows at the moment though.

    Very early Alpha Test Binary Win32 Here

    Instructions on how to use it on the bonus spoiler. :ssh:/>/>

    To be done
    • Add some of the features it says it does. :v:/>/>
    • Add automatic backup to revert changes done.
    • Merge and use my own code to pack/unpack CPK files. ATM it's using external software to do it.
    • Add support to add files to an AR0 instead of having to replace it fully.

    11/21/2011 v0.11
    + Added "installer.txt" option for forcing the installer to select a particular mod in its folder. Useful for distributing mod installers.
    + Added a new #swap command to merge 3 rename commands into 1 simpler line.
    * Fixed the "Uses bb#.cpk display text, as it wasn't showing correctly when the option was on.

    v0.1 Early Test Release

    Bonus download on the spoiler!
    As a first test mod for SonicGMI, I present to you something that everybody's done but you always wanted to and was too lazy to try...

    Green Hill zone act swap! :v:/>/>

    Download this mod (Less than 1 MB!)


    To install it, unzip the contents of the mod somewhere, run SonicGMI.exe(you'll need to download the binary above), select your Sonic Generations root folder, select the .txt inside the mod folder on the 2nd text box, leave the options as marked, and Install! It should take like 5-10 minutes, given that it has to unpack quite a big file.

    Some screenies:

    Tech Info for mod installation
    My own parser reads the txt file on the mod folder called "sgmod.txt". Here's a look at the commands it supports so far:

    # name <mod name> : sets the name of the mod. cosmetic purposes
    # unpack <cpk datafile> : Tells the program to unpack the CPK file
    # repack <cpk datafile> : Tells the program to repack the CPK file
    # addto <cpk name> <file> : Adds an specific file to the CPK
    # rename <cpk name> <file> <newname> : Renames a file of the CPK. Note that you just need to add
    # the new name on the 2nd part, not the full path again.

    Please lemme know if you run into any bugs, or it just doesn't god damn work. :rolleyes:/>/> You're at your risk of using this though, but the worse it could do is unpack files in a wrong directory or something. Just make sure you have no fucked up path names, or stupidly long filenames or stuff like that.

    Enjoy! :)/>/>
  2. Chimera


    I'm not a furry. Tech Member
    Castlevania prettyness
    This has potential to be very, very useful. Props man.

    If you want to have some help to make other Generations hacking programs, or to expand on this, to make modding Generations itself easier, me and a group of people just excavating these XML files for Generations can provide you with some information we discovered through both experimentation and the power of READING! :v:
  3. DustArma


    Santiago, Chile
    Learning Python.
    Oh you are a lifesaver, this will come in real useful later on, I hope you can expand on it. :)
  4. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    Oh don't worry, I'll most surely release the source once it's polished up a bit more. This ain't much more than a glorified file copier and command line batch file though, but someone needed to do the dirty work. :v:

    I haven't had much time to do a lot of research, but if there's anything needing to be automated(conversion, easier editors, or something), I could give it a try.

    Does anyone have any leads to an open source CPK-file packer? Only reliable one I found was crifilesystem but that's closed afaik. I already got an open source file unpacker though, just gotta find the time later for it, and exams don't exactly help this time of the year.
  5. Chimera


    I'm not a furry. Tech Member
    Castlevania prettyness
    An object editor, for one.
  6. Azu


    I must be stupid. Member
    Visual object editor, although, I'm not sure how easy that would be.
  7. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    Certainly not very easy since I'm not really familiar with 3D rendering yet. :v:

    Though I guess it would be easy enough using Ogre3D(and while we're at it, ensuring cross platform compatibility ahoy!), since it already has GUI tools of its own, a nice 3D renderer, and I can just use TinyXML to parse the files. Of course, it would all just be floating objects with no scenery around until that script is released though.

    If you guys want to share any mods, feel free to look at the example I provided, and try to modify it. Like for example that lightspeed dash ring mod I heard before.
  8. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    Did a quick update to the program, changes below. You can find the download link up.

  9. Lobotomy


    35% Cognac Banned
    Traverse City
    Project: Matter/Energy
    Is there, or will there be an option to bring the game back to stock?
  10. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    Probably, but I don't want to force backups atm where people might be tight with space, so doing it manually is the way to go IMO for now.
  11. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    Bump because new update. It's not even the same program anymore. :v: Let me know if you run into any issues!

    Check the first post for the details.

    EDIT: RC2 out, fixing the checkbox bug and the About... box.
  12. So, Save File Redirection allows you to play the game using mods, without affecting your save data at all. Am I understanding this correct?

    Would it be possible to make it create a new save file for playing "vanilla" Generations? For instance, if I had a younger sibling who wanted to play through the storyline, but I don't want him/her deleting my file on the game?
  13. Sure, you could just make a blank mod that has nothing in it but still redirects to a different save file, right?

    I don't understand why they didn't give Sonic Generations multiple save slots in the first place. At least on the 360 version you can just use profiles
  14. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    If you enable Save File redirection, but NONE of the mods you have use it, it will copy the Save you're on to cpkredir.sav by default. You can edit this path in cpkredir.ini.

    The other alternative which I would recommend, although it's harder to set up, is to create a mod like say, "Pete's Game", that redirects on its own folder to a brand new save file. Once you enable that mod(you don't need to boot up SonicGMI constantly to enable it, just once and Save), all his progress will be redirected there. If you wanted to swap to your regular game, just disable his mod.
  15. Great. I've got a little brother who absolutely loves playing the Sonic games, but I don't want to lose my save file. Probably not quite what the program was intended for, but until there's a really awesome mod that catches my eye, that'll probably be what I use it for.
  16. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    As long as it gets used I think it does its purpose. However, noone here has reported any issues(other than DinnerSonic in the other thread) and I keep seeing the Downloads counter go up... So I'll assume the silence is good and it means it works.

    The Dragon Road demo will be obviously released to be used with this(and CPKREDIR obviously), although not mandatory. Pretty much the reason I've coded this application for so people can get used to it. Back when we released the Windmill Isle demo, some people had a hard time on figuring out how to merge the mods, even if it involved some really simple INI editing. Well now anyone can figure that out easily by using this. At least I hope so. :v:
  17. Korama


    Tech Member
    Yeah, you can do that.
    Also be aware that CPKREDIR can expand environment variables. So, if several users share a PC, and have their own user accounts, you can use the common variables %USERPROFILE% and %USERNAME%, for example, to keep things separated.

    Let's suppose the Dragon Road demo has been released. It uses save file redirection, so you'll find the line "SaveFile=Saves\sonic.sav" in its mod.ini.
    This will cause all users on the PC to share that same sonic.sav file - not necessarily what you want. So you could change that line to "SaveFile=Saves\sonic.%USERNAME%.sav", for example, which would automatically be expanded to "sonic.Joe.sav", "sonic.Dave.sav" or whatever the user names are.
    But keep in mind that you have to make sure those files exist before you start playing. Just make copies of Dragon Road's original sonic.sav file and rename them accordingly to sonic.Joe.sav etc.

    %USERPROFILE% expands to the account's home folder, normally C:\Users\<username> (eg. "C:\Users\Joe"). You could use that as well, like this: "SaveFile=%USERPROFILE%\DragonRoad.sav".

    This expansion is done by the ExpandEnvironmentStrings Windows API function and if you want to get an overview of the existing variables, just open a command prompt (cmd.exe) and enter "set".
    But the most useful ones are only USERPROFILE, USERNAME and perhaps APPDATA.
  18. Overlord


    Now playable in Smash Bros Ultimate Moderator
    Long-term happiness
    Maybe on creation/installation of the mod, that file should be created automatically by the installer?
  19. TheUltimaXtreme


    Breaking logic since whenever Member
    Okay, I'm going to assume it doesn't work with pirated copies, because past installing CPKREDIR, it's giving me the "Unable to start (0xc0000142)" error.
  20. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    It should work regardless. My bet is you just have an outdated version of the game. This isn't really related to SonicGMI, but more to CPKREDIR.