Sonic Mania: Hacking Discussion

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

  1. Ralakimus

    Ralakimus

    pretty much a dead account Tech Member
    557
    158
    43
    Fine.

     
  2. Dark Sonic

    Dark Sonic

    Member
    12,799
    282
    63
    Working on my art!
    Those models are adorable. I wish they could be ported into Sonic R.

    Or I hope they're ported into Generations at least.
     
  3. Hydr0city

    Hydr0city

    > Kamikazee Member
    40
    0
    6
    Finally, the game is playable.
     
  4. LukyHRE

    LukyHRE

    The only one who has a Portal-themed avatar Member
    380
    2
    18
    Buenos Aires, Argentina
    Bitching and complaining about my country -.-'
    I wonder what Tax and Stealth may be thinking with all this lunacy going on...
     
  5. Dark Sonic

    Dark Sonic

    Member
    12,799
    282
    63
    Working on my art!
    They probably did this months ago :specialed:

    Or at least they did something like this unintentionally

    http://www.youtube.com/watch?v=RjTFNGg4XBI
     
  6. Fenrir

    Fenrir

    Eh. Member
    Bless you.
     
  7. Dr. Mecha

    Dr. Mecha

    Member
    1,083
    0
    16
    Dallas, TX
    3d Models
    So, can you edit the pallete, and, if so, would you provide an example of the pallete editing?
     
  8. ICEknight

    ICEknight

    Researcher Researcher
    Glad I'm not the only one who missed this.

    We could call it... the "Spin Drop". =P
     
  9. Dark Sonic

    Dark Sonic

    Member
    12,799
    282
    63
    Working on my art!
    Actually yea, now that the drop dash is a thing that should be a feature, even if it was a glitch :specialed:
     
  10. Kurausukun

    Kurausukun

    Member
    15
    0
    0
    This might have already been discovered, but I'm going to post it here just in case.

    While making music mods, it was easy to replace the stage themes' loops since they're right there in SceneXX.bin, but there were some things notably missing, such as the boss themes and invincibility, etc. I tried replacing them in the Level Select and DA Garden files to see if it reads them from there, but no dice. But lo and behold, I have found them! Like the BlueSpheresSPD loop, they are hardcoded into the game's exe. They're very easy to find if you search for a little-endian 32-bit unsigned integer using the values you get from the level select file, but I'm going to post the addresses of the ones I could find here:

    BossPuyo: 0x000D5EFA
    BossMini: 0x00234159
    BossEggman1: 0x00234181
    BossEggman2: 0x00234195
    BossHBH: 0x0023416D
    Super: 0x002341DC

    Invincible is notably missing, not sure what's going on with that. Additionally, HBHMischief and Sneakers appear multiple times in the exe; HBH appears twice and Sneakers appears SEVEN times. I'm not sure if there are just coincidentally other fields that have the same value as the loop point or if they're all used in different situations since I don't know what the surrounding code is for. If someone more well-versed in looking through exe files wants to have a go, be my guest :P

    Note that both BossFinal and both of the Egg Reverie loop points are not stored here; they can be found in the normal scene files of their respective zones.
     
  11. Dark Sonic

    Dark Sonic

    Member
    12,799
    282
    63
    Working on my art!
    So since Super's theme is hardcoded into the exe, is there any way to prevent the game from loading it?

    EDIT: Quoted for new page.
     
  12. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,435
    76
    28
    SonLVL
    Unfortunately, all that function is doing is loading data for several songs into some structure. The code for playing the music is somewhere else entirely, and presumably it would be just referencing the music by the slot number it's loaded to, so searching for the song's name won't help.

    Here's the rest of the stuff from that function:
    Invincible: 0x00234131
    Sneakers: 0x00234145
    HBHMischief: 0x2341F0
     
  13. Kurausukun

    Kurausukun

    Member
    15
    0
    0
    The "triggers," if that's the right word, for switching to the super/sneakers/invincible music are almost definitely in the exe, but I don't know if they're nearby the loop point or not since I don't really know what any of the code in the exe is actually doing. I think if you just removed it, it would probably play silence or something; you'd need to change a bit more to get it to keep playing the level music while super. At least I think, I can't say anything for sure.

    EDIT: Ninja'd
     
  14. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,435
    76
    28
    SonLVL
    For reference, this is the function where most of the loop points are located:
    Code (Text):
    1. void __cdecl sub_D90B30()
    2. {
    3.   sub_4013A0("Invincible.ogg", 1, 139263);
    4.   sub_4013A0("Sneakers.ogg", 2, 120960);
    5.   sub_4013A0("BossMini.ogg", 3, 276105);
    6.   sub_4013A0("BossHBH.ogg", 4, 70560);
    7.   sub_4013A0("BossEggman1.ogg", 5, 282240);
    8.   sub_4013A0("BossEggman2.ogg", 6, 264600);
    9.   sub_4013A0("ActClear.ogg", 7, 0);
    10.   sub_4013A0("Drowning.ogg", 8, 0);
    11.   sub_4013A0("GameOver.ogg", 9, 0);
    12.   sub_4013A0("Super.ogg", 10, 165375);
    13.   sub_4013A0("HBHMischief.ogg", 12, 381405);
    14.   sub_4013A0("1up.ogg", 13, 0);
    15.   if ( !*(_DWORD *)(dword_D84670 + 200880) )
    16.     *(_DWORD *)(dword_D84524 + 588) = 0;
    17.   *(_DWORD *)(dword_D84524 + 592) = -1;
    18.   *(_DWORD *)(dword_D84524 + 600) = -1;
    19.   *(_DWORD *)(dword_D84524 + 612) = 0;
    20.   *(_DWORD *)(dword_D84524 + 604) = 0;
    21.   *(_DWORD *)(dword_D84524 + 608) = 0;
    22. }
     
  15. Kurausukun

    Kurausukun

    Member
    15
    0
    0
    Good find, thanks for completing my incomplete research :P

    EDIT: I just realized, the BossPuyo file is also referenced in its own Stage.bin file, so I'm not sure what the use of the address I found was. It seems unlikely that it's another value that just happened to be the loop point, but I don't know.
     
  16. ICEknight

    ICEknight

    Researcher Researcher
    Maybe this is a leftover of the Power Sneakers using sped-up versions of the level music at one point?
     
  17. Josh

    Josh

    Oldbie
    1,594
    200
    43
    USA
    So, someone was nice enough to put the HUEHUEHUEs back into Stardust Speedway:

    [youtube]http://www.youtube.com/watch?v=wuKp6itNQdE[/youtube]

    I'm more tempted than ever to jump in and try to figure out how to replace songs, haha. Haven't done that since the Generations days, but I recall it involved using a Street Fighter IV file converter and a bunch of steps.

    EDIT: Or I might instead go with S0LV0's version.
     
  18. Drex

    Drex

    Lazy perfectionist Member
    800
    39
    28
    ☝️Sorry, but this first few seconds of that is pretty bad. The samples thrown on top of don't match the pace of the music very well at all. Didn't bother to hear the rest
     
  19. Kurausukun

    Kurausukun

    Member
    15
    0
    0
    Replacing songs in Mania is really simple. Mania uses completely normal OGG Vorbis files, so if you encode anything to that, name the file properly, replace and repack it, it'll work perfectly. The only things you need to worry about are that the audio must be 44100Hz or the game will play it too fast/slow depending on its actual samplerate. The other thing is that unless you edit the loop points in the stage file or exe, your loop will likely be wonky. But if you just want to have the song in, it's simple.
     
  20. Tiranno

    Tiranno

    Steveosaurus Rex Member
    Just thought I'd share two mods I just finished


    True Blue Sonic & Rad Red Knuckles: https://youtu.be/S1Tngy-TM2Q

    Sonic 3 Palette: https://youtu.be/GmgYq_xl8JI