Sonic Mania: Hacking Discussion

Discussion in 'Engineering & Reverse Engineering' started by Chimera, Aug 29, 2017.

  1. Chimera

    Chimera

    I'm not a furry. Tech Member
    1,253
    0
    16
    Castlevania prettyness
    ITS FINALLY HERE!

    Time to start cracking it :specialed:/>/>


    --


    So Mania's finally out, the game by the fans, for the fans. This game's built on the Retro Engine, just like the 1, 2, and CD ports. However, unlike those games, Mania has a ton of improvements, features built with the PC platform in mind, and new content. Along with that, it's a new entry to the "classic style" series of games. It's the first time we have a legitimate full game, a new experience in the series, styled after the Genesis originals, SINCE the originals.

    And we have incentive to mod it.


    --


    WHAT WE CURRENTLY KNOW:



    Extraction

    ~90% of files extracted thanks to TPot.
    Sprites are not the raw files; TPot converted them from their originals using the level palettes.
    Some files are missing, as his extraction method requires rsdkv5_extract to work, which requires some tedious work in finding filenames etc. Likely the tool doesn't work 100% yet either.

    More info:
    Currently, there isn't a clear-cut method of extracting data from the game. RSDK, or RetroSDK, is the file format used for the game. The format was cracked by Glitch for Sonic CD, however the RSDK format has been updated, so while that build doesn't work, a new version's in the works. It's not exactly user friendly however, and requires you to enter the filename of the item you want (which can go wrong easily if you don't know what you're looking for), so be warned.

    Another partial extraction method, using "sonic-retrun," works as demonstrated by Qjimbo.

    An alternative method for extracting the .OGG files has proven successful on ffshrine by user Vector Harbor, using X-Ripper. it's unknown if this method yields any results for non-music files. Follow the thread link to download the OST (you must be signed into ffshrine to obtain the link; it will not be posted here.)


    Compression

    The RSDK format isn't yet fully understood, so no file replacement / packing is possible at this time. This post will be updated as information comes up.



    Sprites

    Sprite modification is not currently possible, since no method of replacing in-game content is yet discovered or functional. However...

    There have been sprite swaps by Beatz, accomplished by editing the main executable.

    At offset 0x21A950 in the .EXE, you will find these values:

    Code (Text):
    1. Players/Tails.bi
    2. n...Players/Tail
    3. Sprite.bin..Play
    4. ers/Knux.bin....
    5. Players/Sonic.bi
    6. n...Players/Supe
    7. rSonic.bin..

    Or, formatted correctly:

    Code (Text):
    1. Players/Tails.bin...
    2. Players/TailSprite.bin..
    3. Players/Knux.bin....
    4. Players/Sonic.bin...
    5. Players/SuperSonic.bin..

    This is, as you may guess, the string indexes the game reads to load the sprite .bin files for the main characters. This can lead to some funny happenings.

    [​IMG]
    [​IMG]

    Here I replaced everyone with Sonic, and doing so created a Sonic-with-Tails'-Tails abomination, along with giving insight on how Mania's sprite system works. In the second image, you can see that Sonic, or rather Knuckles, gliding uses a sprite that, when queued by the game, uses Sonic's peelout animation. From the looks of things, it's likely the Retro Engine calls for sprites indexed in an order for the 3's special moves, and the only sprites that match flight and gliding are Sonic's peelout animation. The same likely happens if Knuckles/Tails replace Sonic and they attempt the Peel Out maneuver.

    interestingly, if a sprite isn't available in a bin's index, the game actually doesn't load anything and the character turns blank. This doesn't crash the game; as long as the game can load the character's .bin file, there's no issue.

    Which means..

    [​IMG]

    Interesting thing about this is that it seems collision, to an extent, is tied to the .bin file as well in some way. Either this object has very small collision, or it has none, in which case the game doesn't know what to do with it and it just clips through the floor. However, this is promising, as its sprites were able to be loaded outside its base stage... with some side effects.

    [​IMG]
    Looks like Retro Engine still uses palettes.



    Save Data

    Work has been done on the save file format by codenamegamma. I'll link to his forum post, and quote what he's found here since he explains his findings better than I possibly could.



    MISC

    In codenamegamma's post, he also outlines how character loading can be forced, to legitimately have 2 sonics, 2 tails,' and... well 2 knuckles is already a thing, though other partner combinations like knuckles + sonic/tails and tails + sonic are possible through this method.

     
  2. Fenrir

    Fenrir

    Eh. Member
    Maybe an existing member of this community who just so happened to make this game possible can come in and tell us how to break open his own creation.

    ...

    Probably not. :v:
     
  3. Hamzawesome

    Hamzawesome

    Member
    19
    0
    0
    I'm really excited to see the mods for this game. It'll probably take a while, but still, it'll be great to see.
     
  4. Dark Sonic

    Dark Sonic

    I'll find the old avatar eventually Member
    12,235
    35
    28
    Working on my art!
    Stealth mentioned on his stream that Sonic Mania runs on Retro Engine version 5. As a frame of reference, Sonic CD ran on version 3 while Sonic 1 and 2 ran on version 4. I'm assuming Retro Sonic was version 1 and 2. Stealth also mentioned that a lot of things had to be rebuilt for version 5, so preexisting gimmicks from Sonic 1 and 2 for example could not just be reused. It's possible that RSDK extractor no longer works due to the updates.

    Speaking of which I feel like Stealth, Taxman, and Slingerland have transcended to a new rank of membership. They should be Mania members :specialed:

    While I'm here though, mod wishlist (this isn't a list of demands or anything, it's just for fun. Don't shoot me powers at be)!

    - Disable Super Music
    - Enable Super Peelout, Insta Shield, and & Knuckles mode for save files
    - Add more save files
    - Alternate dark blue palette for Sonic
    - Allow Tails to Follow Knuckles
    - Playable Metal Sonic
     
  5. Spanner

    Spanner

    The Tool Member
    3,241
    37
    28
    United Kingdom
    Sonic Hacking Contest
    Would be very interesting if mods happened for this but I haven't really seen anything for Sonic CD be really released or submitted to the Hacking Contest.
     
  6. Fenrir

    Fenrir

    Eh. Member
    Someone sound the Lone Devil alarm. :specialed:
     
  7. Dark Sonic

    Dark Sonic

    I'll find the old avatar eventually Member
    12,235
    35
    28
    Working on my art!
    Right? And now he has some new sprites to play with.

    Oh and how could I forget. I'm hoping someone figures out some kinda netplay setup with this for some 2P fun.
     
  8. Arcaden

    Arcaden

    Member
    10
    0
    0
    Sonic AMV: Boss - Big Arms
    I've just heard somewhere that the game uses Denuvo DRM (I believe this link is the proof). I'm not too familiar with this, what will this mean for possible Sonic Mania mods?
     
  9. stescoedw

    stescoedw

    Member
    82
    0
    0
    College
    Chimera is it possible for you guys to do backwards compatible modding like adding the drop dash or getting Knuckles as a playable character in Sonic CD?
     
  10. Overlord

    Overlord

    ...did we just switch realities? Moderator
    17,465
    36
    28
    Berkshire, England
    Learning Cymraeg
    You can all stop before you start - this is not a topic for "OMG MOD ME THIS INTO MANIA PLOX".
     
  11. Qjimbo

    Qjimbo

    Your friendly neighbourhood lemming. Oldbie
    I was able to extract some of the files from the Data.rsdk with the current version of retrun-sonic (http://unhaut.x10host.com/retrun/) using this command:
    retrun x Data.rsdk -3

    However it seems all the images are corrupt and only 5 of the OGG music tracks expanded. Not sure if there is another approach (not super familiar with the current status of RSDK extraction).

    Edit: Vector Harbor over at ffshrine used Xripper (http://www.zeus-software.com/downloads/xripper) to extract all the OGG music files from the archive. Obviously doesn't help much for modding since you can't re-pack it, but still neat.
     
  12. Fenrir

    Fenrir

    Eh. Member
    I recall someone mentioning a few weeks back in the Mania Spoilers topic that Sonic CD 2011 modding had some interesting/exciting things going on behind the scenes. I'd imagine/hope they'll be able to apply these "Things" to Mania, whatever they may be. Anyone know anything about that, or was it just hot air?
     
  13. Blue Spikeball

    Blue Spikeball

    Member
    564
    7
    18
    Can someone please make a Knuckles in Sonic Mania hack? I know he's already in the game, but you just can't have too much Knuckles :v:

    Seriously though, we could try requesting an official mod loader and modding tools as a future update. Many PC games have it, and Sega did add support for ROM hacks for the Steam versions of the classic games a while back, so chances are they would be willing to add it if people requested it. Not that official support would be necessary for a Mania modding scene to surface, but it would probably speed up its development.
     
  14. Chimera

    Chimera

    I'm not a furry. Tech Member
    1,253
    0
    16
    Castlevania prettyness
    The problem with a mod loader is that such a thing would be opening a whole can of worms I don't think SEGA's prepared for. The ROM hacking scene made a plethora of obvious, excellent content that SEGA could either ignore or use as part of a marketing shtick that would get their arcade thing more attention, so it made a bit of sense, I spose, for them to allow loading hacks of their games that people purchased, as a bit of "spice" to games that, outside of re-release licences, have pretty much become abandonware. The thing to understand is that those Genesis games are OLD. Like not just "beginning of the series" old, more "you were paying $60 for this thing" old. Mania isn't in the same category; it's a new sonic game that was released mostly last week and, on the platform we want to mod it on, today. I wouldn't doubt if, in SEGA's eyes, greenlighting Mania was an incredibly bold and risky move; in many ways it was, but it paid off and was legitimately great of them to do, but it was still bold. They're a company in a culture that usually distances themselves from mods (hello nintendo). Giving a neat way to load mods that *already exist* is one thing; a mod loader to their most recent, most anticipated game is pushing it.

    Which is why this...

    ..is probably very not legal :v:


    This would explain a few things. Was assuming 1 and 2 ran on a more updated build than CD, and since no one gave a toss about the iOS only ports because they'd be more work than what it's worth to dive into, id imagine no one other than like probably 2 passionate guys actually took a crack at the midpoint between CD and Mania. Meaning we don't even have a midway point of reference lol

    From what it sounds, some extraction's been successful but nothing outside of simple methods to rip the soundtrack, which to be fair is pretty good regardless. Anyone know of an upload of the OST's oggs? If that's not allowed on Retro, ignore this request; more interested in documenting an example of mod / "hacking" progress :p

    So seems what we have to wait for now is an advancement off the RSDK format's understanding, which, if Stealth saying some stuff had to be worked from the ground up is true, could mean even tweaks to the extractor's source could yield negative. Ah well, it's how it's gotta be I guess.
     
  15. Qjimbo

    Qjimbo

    Your friendly neighbourhood lemming. Oldbie
    This is the thread over at ffshrine: http://forums.ffshrine.org/showthread.php?t=218660&page=6&p=3651080&viewfull=1#post3651080
    You have to register an account to see the links, I won't repost them here due to the rules.
     
  16. Overlord

    Overlord

    ...did we just switch realities? Moderator
    17,465
    36
    28
    Berkshire, England
    Learning Cymraeg
    Yeah, Sega's selling the soundtrack so no links to the sound rips, please.
     
  17. tylerfoxorwhatever

    tylerfoxorwhatever

    ya yeet Member
    67
    1
    8
    Santiago, Chile
    i don't even know
    A thread for Sonic Mania mods already? Well that was fast.

    Don't have the PC version right now, but I might buy it in the future purely for the mods.
     
  18. Dark Sonic

    Dark Sonic

    I'll find the old avatar eventually Member
    12,235
    35
    28
    Working on my art!
    Hey look someone already did something

    http://youtu.be/c5kYsHcZ9no

    A simple mod replacing Sonic with chibi Sonic from MMZ and a music swap. Impressive considering this has been out on PC for maybe 5 hours
     
  19. Spanner

    Spanner

    The Tool Member
    3,241
    37
    28
    United Kingdom
    Sonic Hacking Contest
    Maybe there might be Mania stuff for the Hacking Contest this year after all the way things are going.
     
  20. RibShark

    RibShark

    Member
    85
    0
    6
    I found this:
    [​IMG]
    Add "devMenu=1" to the "[Game]" section of Settings.ini, then press ESC in game.

    EDIT: Oh my god what did i do:
    [​IMG]