don't click here

Sonic Mania: Hacking Discussion

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

  1. Xeeynamo


    If someone is interested, I am working on an Animation Editor for RSDK (compatible from Sonic CD to Sonic Mania):

  2. Drex


    Lazy perfectionist Member
    yes please and thank you
  3. Chimera


    I'm not a furry. Tech Member
    Castlevania prettyness
    Oh dang, this is excellent. Makes things much easier to edit sprites and the like. Replacing Sonic with Metal ought to be a snap with this :) Great job Xee, can't wait!

    I assume this is also capable of re-mapping a sprite sheet, yes? Any idea how the .bin files handle multiple sheets?
  4. Xeeynamo


    It is really easy, it works like Sonic CD/1/2: An animation data file defines what textures are imported on its loading, then for each frame you can specify what texture will be associated with that file.

    About re-mapping it is possible but it is painful as hell. I am planning two buttons to import and export single frames into a texture altas, populating automatically every animation. The only trouble that I am getting is about maintaining the palette order.
  5. Mr. Potatobadger

    Mr. Potatobadger

    Saturn Sonic
    Much to my surprise, passing over the coin does end the stage. I was expecting to just walk right over it.

    Grabbing the coin by loading the stage from the dev menu doesn't add it to your save. I haven't tested it in an actual save file though, I have a feeling it might actually add to your save then. I can't confirm that yet.
  6. Techokami


    For use only on NTSC Genesis systems Researcher
    Sonic Worlds Next
    Tried to compile this with Visual Studio Community 2015 Update 3, and got this error from the compiler:
    Code (Text):
    1. C:\Users\techo\Documents\GitHub\RSDK\AnimationEditor\MainWindow.xaml(179,26): error MC3074: The tag 'NumericUpDown' does not exist in XML namespace 'clr-namespace:Xe.Tools.Wpf.Controls;assembly=Xe.Tools.Wpf'. Line 179 Position 26.
  7. Thanks to soneek and Neo for the list of loop points!

    Here is a batch file to automatically tag the ogg files with LOOP_START.

    This is using the names as given by rdskv5_extract, and requires Tag.exe.

    Code (Text):
    1. @echo off
    2. tag BlueSpheres.ogg -t LOOP_START=407077
    3. tag BlueSpheresSPD.ogg -t LOOP_START=5309957
    4. tag BossEggman1.ogg -t LOOP_START=282240
    5. tag BossEggman2.ogg -t LOOP_START=264600
    6. tag BossFinal.ogg -t LOOP_START=302400
    7. tag BossHBH.ogg -t LOOP_START=70560
    8. tag BossMini.ogg -t LOOP_START=276105
    9. tag BossPuyo.ogg -t LOOP_START=846720
    10. tag ChemicalPlant1.ogg -t LOOP_START=680400
    11. tag ChemicalPlant2.ogg -t LOOP_START=680400
    12. tag Competition.ogg -t LOOP_START=94500
    13. tag EggReverie.ogg -t LOOP_START=176400
    14. tag EggReveriePinch.ogg -t LOOP_START=226800
    15. tag FlyingBattery1.ogg -t LOOP_START=158760
    16. tag FlyingBattery2.ogg -t LOOP_START=70560
    17. tag GreenHill1.ogg -t LOOP_START=776160
    18. tag GreenHill2.ogg -t LOOP_START=775552
    19. tag HBHMischief.ogg -t LOOP_START=381405
    20. tag Hydrocity1.ogg -t LOOP_START=1
    21. tag Hydrocity2.ogg -t LOOP_START=329797
    22. tag Invincible.ogg -t LOOP_START=139623
    23. tag LavaReef1.ogg -t LOOP_START=497329
    24. tag LavaReef2.ogg -t LOOP_START=769745
    25. tag MainMenu.ogg -t LOOP_START=202752
    26. tag MetallicMadness1.ogg -t LOOP_START=470400
    27. tag MetallicMadness2.ogg -t LOOP_START=296056
    28. tag MetalSonic.ogg -t LOOP_START=151200
    29. tag MirageSaloon1.ogg -t LOOP_START=48510
    30. tag MirageSaloon1K.ogg -t LOOP_START=1007820
    31. tag MirageSaloon2.ogg -t LOOP_START=179390
    32. tag OilOcean1.ogg -t LOOP_START=358389
    33. tag OilOcean2.ogg -t LOOP_START=176400
    34. tag PulpSolstice1.ogg -t LOOP_START=318316
    35. tag PulpSolstice2.ogg -t LOOP_START=226625
    36. tag Results.ogg -t LOOP_START=88991
    37. tag RubyPresence.ogg -t LOOP_START=198457
    38. tag SaveSelect.ogg -t LOOP_START=131290
    39. tag Sneakers.ogg -t LOOP_START=120960
    40. tag StardustSpeedway1.ogg -t LOOP_START=432894
    41. tag StardustSpeedway2.ogg -t LOOP_START=1
    42. tag Studiopolis1.ogg -t LOOP_START=1146600
    43. tag Studiopolis2.ogg -t LOOP_START=311142
    44. tag Super.ogg -t LOOP_START=165375
    45. tag TitanicMonarch1.ogg -t LOOP_START=184069
    46. tag TitanicMonarch2.ogg -t LOOP_START=384873
    47. tag UFOSpecial.ogg -t LOOP_START=288655
    48. ren *.ogg *.logg
  8. LukyHRE


    The only one who has a Portal-themed avatar Member
    Buenos Aires, Argentina
    Bitching and complaining about my country -.-'
    I don't know who the fuck did this, but it's so fucking hilarious.

    Regarding the dev Menu, does the Studiopolis zone present under the Media Demo menu differ from the final version? A quick check confirms that the sewer exit (from which the player gets out in the zone transition) is absent in the demo level. I wonder if there is any other difference!

    Studiopolis song had changed during development (you can compare the first footage with the final version, the song is the same, but there are several tune ups). Maybe the demo level tries to load an older version of the song not present in the final build.
  9. The Press Garden mid-boss is named "Shiversaw", judging by Shiversaw.bin and ShiversawExplosion.ogg.
  10. Dark Sonic

    Dark Sonic

    Working on my art!
    Actually yes, it's def an older map. It's the one from the show demos that has the end of act sign with the rings floating above it.
  11. jman2050


    Teh Sonik Haker Tech Member
    So hey guys I did a thing

    25% Scale

    100% scale *LARGE IMAGE WARNING*

    I'll post my notes on what I have regarding the level format tomorrow as it's late and I'm very tired but honestly it really isn't much so far. Basic level map rips are the barest of bare minimums but hey, it's a start.
  12. Xeeynamo


    The NumericUpDown depends to Xe.Tools.Wpf. Have you tried to compile it first? Plus I am using VS2017 15.3.3 and it compiles with success.

    EDIT: Download link:
  13. Chimera


    I'm not a furry. Tech Member
    Castlevania prettyness
    Would imagine remapping would be a good bit of a pain. Your solution sounds good, especially considering people would have to re-arrange pretty much everything to begin with to have sprites fit together correctly in some instances; honestly if you're making a new player character, you might as well do that.

    Regarding palette order, by that do you mean forcing the order of the colors in the .gif to the game palette, if it isn't ordered already? Like if someone makes a sprite with an unorganized palette, but all the colors are correct, you want the sprite's palette to reorganize itself on import? I feel like you can leave that on the backburner for *now* and just inform your users to make sure every image they import has the same palette, as that's ideally what they should be doing anyway. It's really their responsibility to keep track of that, and both Gimp and Photoshop have easy ways of forcing an image to order their colors correctly--for photoshop what I usually do is just have a master image with the proper palette, and paste the sprite I made into that image. Works like a charm.

    Still, accessibility is nice, and not everyone has access to PS and Gimp's method is probably more annoying, so.. obviously look into that for the future. I'd imagine all you'd need to do is maybe do a hex code lookup for every color in the .gif's index, compare them to the "master palette" of the sprite sheet, and then store in memory what the current index of each color is VS. what they should be as noted in the master palette. Then make it that any pixel that's indexed incorrectly is changed to the proper index #, and finally set all those indexed colors to the correct color hex code in the sprite's local palette.

    Of course this is probably what you're *trying* to do and the real issue is dealing executing it / with the .gif format, which I can understand if thats the case :specialed: i don't know how to deal with image formats/libraries at all. But theory-wise that's how I'd do it, probably saving a temp .gif as well so as to not mess with any source files and probably make things more stable
  14. Techokami


    For use only on NTSC Genesis systems Researcher
    Sonic Worlds Next
    Code (Text):
    1. 1>------ Build started: Project: Xe.Tools.Wpf, Configuration: Debug Any CPU ------
    2. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Utility.cs(45,41,45,49): error CS1026: ) expected
    3. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Utility.cs(45,49,45,50): error CS1002: ; expected
    4. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleSelectionDialog.xaml.cs(52,17,52,19): error CS1043: { or ; expected
    5. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Utility.cs(45,49,45,50): error CS1513: } expected
    6. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleSelectionDialog.xaml.cs(52,17,52,19): error CS1513: } expected
    7. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleInputDialog.xaml.cs(51,17,51,19): error CS1043: { or ; expected
    8. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleInputDialog.xaml.cs(51,17,51,19): error CS1513: } expected
    9. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleInputDialog.xaml.cs(53,10,53,10): error CS1513: } expected
    10. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleInputDialog.xaml.cs(56,17,56,19): error CS1043: { or ; expected
    11. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleInputDialog.xaml.cs(56,17,56,19): error CS1513: } expected
    12. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleInputDialog.xaml.cs(58,10,58,10): error CS1513: } expected
    13. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleSelectionDialog.xaml.cs(54,10,54,10): error CS1513: } expected
    14. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleSelectionDialog.xaml.cs(57,17,57,19): error CS1043: { or ; expected
    15. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleSelectionDialog.xaml.cs(57,17,57,19): error CS1513: } expected
    16. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleSelectionDialog.xaml.cs(59,10,59,10): error CS1513: } expected
    17. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleSelectionDialog.xaml.cs(62,17,62,19): error CS1043: { or ; expected
    18. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleSelectionDialog.xaml.cs(62,17,62,19): error CS1513: } expected
    19. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Dialogs\SingleSelectionDialog.xaml.cs(64,10,64,10): error CS1513: } expected
    20. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(78,17,78,19): error CS1043: { or ; expected
    21. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(78,17,78,19): error CS1513: } expected
    22. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(80,10,80,10): error CS1513: } expected
    23. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(83,17,83,19): error CS1043: { or ; expected
    24. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(83,17,83,19): error CS1513: } expected
    25. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(85,10,85,10): error CS1513: } expected
    26. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(88,17,88,19): error CS1043: { or ; expected
    27. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(88,17,88,19): error CS1513: } expected
    28. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(90,10,90,10): error CS1513: } expected
    29. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(157,39,157,42): error CS1525: Invalid expression term 'int'
    30. 1>C:\Users\techo\Documents\GitHub\RSDK\Xe.Tools.Wpf\Controls\NumericUpDown.xaml.cs(157,43,157,48): error CS1003: Syntax error, ',' expected
    31. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Soooo... I gotta get a newer Visual Studio it looks like? -_-;

    EDIT: ahahahaha what the fuck VS, it wants to install everything to my C: drive instead of my massive D: or F: drives
    I'll just stick to VS2015 (the tools I got from Nintendo rely on that version anyway) and grab binaries
  15. xenoSonic


    Tech Member
    Awesome! Great stuff, a start it is indeed. Considering what's been done in less than a week, I can't see it being long before full custom levels are possible.
  16. Overlord


    Now playable in Smash Bros Ultimate Moderator
    Long-term happiness
    Those level maps will come in very useful for learning where all the rings are, nice work!

    Hax is coming along very quickly and in a wide variety of ways, Sonic running backwards being chased by the UFO cracked me up =P
  17. Devon


    I think I'm paranoid Tech Member
    your mom


    (Sorry for the slowdown here, my computer isn't that powerful ;P)
  18. EyeKey


    Hi, I just joined the forum and wanted to share my findings and tools so far.
    First of all rsdkv5_extract, which was mentioned here, which can unpack and pack files to rsdk.

    For the next files, I descrbied the structure of them with python construct library. (which allows me to parse and rebuild them, very convenient)
    So the first file is Meshes .bin. I created mdl2stl. Which converts mdl 3d models to stl. (the description of the file structure is in the script)
    I am really not sure about what I called "Normal", but since it seems that verticies can have this property, I guessed that this is it. But I can't even dump it per vexel with STL. ALL the models have this information (HasNormals on)
    And for the colors, some of the models have embedded colors. I am not sure how to extract them, because they seems to be per vertex, but in binary STL format I can only encode them per face (which is the logical thing to do).
    And there isn't even one file with what I called "MaybeHasTextureCoordinates" on.
    It should be simple to write a tool that does the other way (stl2mdl), but it may be an issue because of the colors (for the models that have them)...

    The next files that I researched are GameConfig.bin and StageConfig.bin. The structures are in and
    StageConfig.bin is mostly subset of GameConfig.bin.
    Here is an example of GameConfig.bin parsed and of StageConfig.bin

    One of the interesting things in those files is the palette of course. From what I gathered, there are 8 palettes. In each palette there are 256 colors, which are splitted to 16 columns. If a column of pixels isn't defined in StageConfig.bin, it will be taken from GameConfig.bin.
    I wrote a palette editor with an option to import and export the palette (to ACT and PAL formats, Photoshop and GIMP support them)
    (better not look on the code of that one.. I did something quick).

    There are also downloads of packaged windows binaries for some of those tools.

    also from GameConfig.bin, I extracted the list of all the scenes:

    If you want to run a specific scene, you can enter a scene directly from the command line:
    Code (Text):
    1. SonicMania.exe "stage=GHZ;scene=1;"
    you can also make the game open a console with some prints:
    Code (Text):
    1. SonicMania.exe "stage=GHZ;scene=1;console=true;"
  19. Hydr0city


    > Kamikazee Member
    The Sonic heads as the blue spheres is a nice touch.

    When can I download a version of Mania where everything is replaced with Sonic
  20. Fenrir


    Eh. Member
    Forget Sonic, we need to meme it up. Everything replaced with Knuckles. The game already gave us a head start on that :V