Mania Mod Loader

Discussion in 'Engineering & Reverse Engineering' started by MainMemory, Sep 1, 2017.

  1. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,342
    32
    28
    SonLVL
    You can download it here. It works basically the same way as the SADX Mod Loader and SA2 Mod Loader, except this one only does file replacements right now.

    To make a mod, simply create a folder containing a "mod.ini" file like so:
    Code (Text):
    1. Name=Mod Name Here
    2. Author=Your Name Here
    3. Description=Describe mod here.
    4. Version=v11.q (optional)
    Then, create a "Data" folder in that folder, and place whichever files you want your mod to replace in their relative paths within that folder (ie Data\Sprites\Players\Sonic.bin).

    To use mods, extract it into the folder Sonic Mania is in, run ManiaModManager.exe, click the "Install Loader" button on the bottom, then check the mods you want to enable and hit "Save" or "Save and Play".

    The source code is available on Sonic Retro's GitHub.
     
  2. LoneDevil

    LoneDevil

    Member
    132
    0
    16
    Metal Sonic Rebooted
    I've been waiting for this one, very flexible and works like a charm.
     
  3. Qjimbo

    Qjimbo

    Your friendly neighbourhood lemming. Oldbie
    Neato. I see a lot of potential use of this by talented modders, and perhaps more possibilities for the program in future (scripting etc.). May be able to contribute to the loader if needed as I see it's in C#.
     
  4. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,342
    32
    28
    SonLVL
    The manager is C#, the loader is C++.
     
  5. RibShark

    RibShark

    Member
    85
    0
    6
    Is the modloader under a licence of any kind? I want to adapt it to another (non-Sonic) game, but I can't see a licence file anywhere, so right now I can't (legally).
     
  6. null1024

    null1024

    Member
    161
    0
    0
    Oh, this is cool. Been playing around with it for a little bit doing little sprite edits and it's working like a charm.
     
  7. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,342
    32
    28
    SonLVL
    I hate software licenses. Even if I just want to say "yeah I don't care what you do with any of this", it has to be some kind of legally binding document that gets applied to every project that uses so much as one line of code from my project. None of the tools I write are released under any kind of license. Some of them probably can't be licensed because they use copyrighted code or assets.
     
  8. Dude

    Dude

    Tech Member
    3,137
    0
    0
    Southbridge, MA
    Random VR/AR trash
    You should use the MIT license then, and state in your readmes that it only applies to the things you've made.
     
  9. CyberKitsune

    CyberKitsune

    Never enough time. Member
    83
    0
    0
    aaaaaaaaa
    https://tldrlegal.com/license/do-wtf-you-want-to-public-license-v2-(wtfpl-2.0)#fulltext
     
  10. winterhell

    winterhell

    Member
    1,160
    0
    16
    You'd want to add "You agree not to sue me".
     
  11. Hydr0city

    Hydr0city

    > Kamikazee Member
    40
    0
    6
    Does this modloader look for the Mania EXE in the C: drive? I have Mania installed onto a external HDD, and every time I try to use this it just fails to load.

    [​IMG]

    This is the error I get each time. Should I just reinstall the game onto my C: disk? Or is this a different error?
     
  12. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,342
    32
    28
    SonLVL
    You should have the mod manager in the same folder as Mania. It shouldn't matter where that is, as long as everything's in the same place.

    Also, when reporting errors, it helps greatly to copy the text that appears when you click "Details", just that error message by itself hardly tells me anything.
     
  13. Hydr0city

    Hydr0city

    > Kamikazee Member
    40
    0
    6
    My bad! Thank you for the heads up though.
     
  14. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,342
    32
    28
    SonLVL
    New version of the mod loader, now it supports custom code by loading DLL files. To create a DLL, you'll need the files from the mod loader's include folder, and a C++ file that looks something like this:
    Code (Text):
    1. #include "ManiaModLoader.h"
    2.  
    3. extern "C"
    4. {
    5.     __declspec(dllexport) void Init(const char *path)
    6.     {
    7.         // code to run on init goes here
    8.     }
    9.  
    10.     __declspec(dllexport) ModInfo ManiaModInfo = { ModLoaderVer, GameVer };
    11. }
    You can also export lists of byte patches, jumps, calls, and pointers to be applied to the game, but I find it's generally simpler to just do that from Init.

    I don't currently have an example mod, but the system is basically identical to SADX mods, so maybe look at those, idk.

    Unfortunately, as Mania is very likely going to be updated in the future, the mod loader and all custom code mods will have to be rebuilt to account for the shifted addresses. I currently have a mechanism in place so the mod loader should detect if the game has been updated and refuse to do anything, and the GameVer setting will be able to detect mods built for other versions of the game as well, since I'll increment it every time I have to update the mod loader for a new version of the game.
     
  15. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,342
    32
    28
    SonLVL
    Now the mod loader supports cheat codes, OnFrame hooks for mods, and options to start Mania with the console enabled, or at a specific scene. Cheat codes use the same format as the other mod loaders, so you can look at the Codes.xml files from the others for examples, or this document that lists all the code types. It comes with a few basic codes to start with, I may add more in the future, and contributions are certainly welcome.
     
  16. MegaSuperab

    MegaSuperab

    Member
    Awesome! I'll be sure to get when (or if) I get the PC version of Sonic Mania. :)
     
  17. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,342
    32
    28
    SonLVL
    I've updated the mod loader to be compatible with the newest version of the game. I will also be updating the cheat code list as soon as codenamegamma releases the updated cheat table, so look for that soon-ish. Unless they update the game again.
     
  18. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,342
    32
    28
    SonLVL
    New update with more cheat codes taken from codenamegamma's cheat table, because he rushed out a new version even though I told him I was fine with waiting.
    Includes: disable super music, enable insta-shield and drop dash, enable super peel-out for all characters, force character selection for both players, mid-jump ability swapping, making super forms fly, always have shield abilities.

    Also, avoid using the dash move while flying with the ERZ moveset, it crashes the game. I'll see if I can fix it later.
     
  19. Shade Vortex

    Shade Vortex

    The Black Vortex Member
    474
    0
    16
    USA, WA.
    Twitch Streams
    Well, when I try the insta-shield and drop dash code, the game crashes when I try to use it (when I hit/hold down the button once in the air). Also, random side note, but the program title says SADX Mod Manager. :P

    How would you react if the game gets another update in like a week? I can imagine it being pretty annoying to keep this game updated for mod support, at least until development stops...
     
  20. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,342
    32
    28
    SonLVL
    Ugh. Every time I look at that bit of code I find something else that makes me shocked it works for anyone at all. Try using this one instead:
    Code (Text):
    1.   <Code name="Enable Insta-Shield and Drop Dash" patch="true">
    2.     <CodeLine>
    3.       <Type>write16</Type>
    4.       <Address>00483756</Address>
    5.       <Value>5190</Value>
    6.       <ValueType>hex</ValueType>
    7.     </CodeLine>
    8.     <CodeLine>
    9.       <Type>write16</Type>
    10.       <Address>004837B6</Address>
    11.       <Value>9090</Value>
    12.       <ValueType>hex</ValueType>
    13.     </CodeLine>
    14.     <CodeLine>
    15.       <Type>write8</Type>
    16.       <Address>004837B8</Address>
    17.       <Value>59</Value>
    18.       <ValueType>hex</ValueType>
    19.     </CodeLine>
    20.   </Code>
    As for the other things, I could just tell people that they should keep an old version around for mods/cheats if it gets to the point where I just can't be bothered to keep everything updated. Also yeah, I just copied the SADX Mod Manager's main form again when I added cheat code support and forgot to change the title and remove the icon. Speaking of which, I should figure out some kind of icon for the manager.