Sonic Mania: Hacking Discussion

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

  1. Dark Sonic

    Dark Sonic

    Member
    12,639
    224
    43
    Working on my art!
    Taxman and Co can you let us know when you won't be updating the game anymore, thanks :v:
     
  2. EyeKey

    EyeKey

    Member
    29
    0
    0
    My script will do that part. I just meant that the faces should be consistent between the frames, that they will be in the same order in the exported file. I think that as long as you just move the vertices for each frame it will be fine. I will probably make that tool today.
     
  3. Rageguy

    Rageguy

    Member
    9
    0
    0
    That's fantastic! Eager to use it!
     
  4. Chimera

    Chimera

    I'm not a furry. Tech Member
    1,258
    1
    18
    Castlevania prettyness
    anyone know if this patch just removed denuvo yet :specialed:

    EyeKey, do you mean to say you don't know how the animation format works yet, or is it something weird like moving vertices? Something tells me this game isn't about using joints.
     
  5. Matsilagi

    Matsilagi

    Member
    3
    0
    0
    Nope, Denuvo is still there, but didn't seem to be updated.
    Makes sense though, they are probably just waiting for the refund policy of the protection at this time.

    Oh, also, is it possible to export the game's 3D models/textures to some other format (OBJ,3ds,FBX) for editing or viewing?
    I have some ideas for them.
     
  6. nineko

    nineko

    I am the Holy Cat Tech Member
    I might as well ask this here too, do you think there is any chance to get Mania running in Windows XP? That's literally the last thing that prevents me from legitimately buying a copy. That and Steam/Denuvo, yeah, but I can still buy a copy to show my support and play a cracked version for ease of use :U
     
  7. flarn2006

    flarn2006

    Member
    274
    3
    18
    SA2 Cheat Table
    You still use Windows XP despite the lack of security updates?
     
  8. darkspines35

    darkspines35

    It's Easy Actually. No, seriously. Tech Member
    248
    0
    16
    .V.
    Sanik Adevnt Casters
    Some talk about the model format and everything I noticed was going on. I made a MaxScript to import the binary model files from the game directly to 3DS Max, though I know there is some mdl2stl converter out there,
    but this has some use too maybe. You can download my MaxScript here. This script will import the mesh, the vertex colours, and the animation into the timeline. Just hit play to view it.

    Format is really simple, and making an exporter for it probably won't be hard, but I don't know enough to make one yet. Here's a little run down of the format though:
    Code (Text):
    1. Sonic Mania Meshes
    2.  
    3. //The following is the "header" format for the binary Mesh files.
    4. 0x00    str     MDL
    5. 0x04    int8    Has Vertex Colours  //0x01, no colours. 0x05, has colours
    6. 0x05    int8    Poly Type           //0x03, triangles. 0x04, quads
    7. 0x06    int16   Vertex Count
    8. 0x08    int16   Frame Count
    9.  
    10. //In file order are the next structures
    11. //Colours
    12. 0x00    int32   Colour //Format is per byte in BGRA order
    13.  
    14. //Faces
    15. 0x00    int16   Face Index Count    //Count*2 then divide by the face type (6 for tris, 8 for quads) for face total
    16.  
    17. 0x00    int16   Face Index
    18. 0x02    int16   Face Index
    19. 0x04    int16   Face Index
    20. 0x08    int16   Face Index  //This one is only for quads
    21.  
    22. //Vertex
    23. //For each frame is a new vertex array
    24. 0x00    float   Vertex X
    25. 0x04    float   Vertex Y
    26. 0x08    float   Vertex Z
    27. 0x0C    float   Normal X    //I'm not sure if these are normals, but they are floats
    28. 0x10    float   Normal Y
    29. 0x14    float   Normal Z
    The hardest part would be getting the animations taken care of, but I don't think it's too complicated. I've not looked into it though, so I can't say for certain.
     
  9. flarn2006

    flarn2006

    Member
    274
    3
    18
    SA2 Cheat Table

    Google tells me Denuvo doesn't give refunds to publishers when games get cracked.
     
  10. Dark Sonic

    Dark Sonic

    Member
    12,639
    224
    43
    Working on my art!
    "It's not our fault people cracked our shitty work" :specialed:
     
  11. Matsilagi

    Matsilagi

    Member
    3
    0
    0
    Weird, i could swear they had a policy that said "If the work gets cracked in less than a month, we will refund the price paid on the protection".

    Oh well... bad for whoever had this idea i guess...
     
  12. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,412
    67
    28
    SonLVL
    Djohe tried it and was unsuccessful, then he tried installing the MSVC 2017 redist to see if that would fix it and it hung on him. He suggests that you should try it yourself. He also wants you to come on IRC.

    He tried again, and it didn't work.
     
  13. EyeKey

    EyeKey

    Member
    29
    0
    0
    Ok the script to convert models to mdl is ready.
    The command line arguments are:
    3d2mdl.py output.bin frame1_model [frame2_model [...]]

    I am using the library assimp, so it should handle pretty much any popular 3d format.
    Right now each frame should be in a different model file. And it must have the same number of vertices.
    My script only handle 3d files with one mesh. It should also support colors.

    As usual, I packaged it into a binary.



    And also about the patch, it removed two directories from the rsdk: Data/Sprites/Blueprint and Data/Sprites/SBZ. Here is the list of files that were in them:
    Data/Sprites/Blueprint/BuzzBomber.bin
    Data/Sprites/Blueprint/CheckerBall.bin
    Data/Sprites/Blueprint/CircleBumper.bin
    Data/Sprites/Blueprint/MonkeyDude.bin
    Data/Sprites/Blueprint/Motobug.bin
    Data/Sprites/Blueprint/Objects.gif
    Data/Sprites/Blueprint/Platform.bin
    Data/Sprites/Blueprint/SpearBlock.bin
    Data/Sprites/Blueprint/SpringBoard.bin
    Data/Sprites/Blueprint/TargetBumper.bin
    Data/Sprites/Blueprint/WallCrawl.bin
    Data/Sprites/Blueprint/Wisp.bin
    Data/Sprites/SBZ/BallHog.bin
    Data/Sprites/SBZ/Bomb.bin
    Data/Sprites/SBZ/Button.bin
    Data/Sprites/SBZ/BuzzSaw.bin
    Data/Sprites/SBZ/CaterKiller.bin
    Data/Sprites/SBZ/ConveyorWheel.bin
    Data/Sprites/SBZ/ElectricOrb.bin
    Data/Sprites/SBZ/Flamethrower.bin
    Data/Sprites/SBZ/JunctionWheel.bin
    Data/Sprites/SBZ/Objects-Classic.gif
    Data/Sprites/SBZ/OneWayDoor.bin
    Data/Sprites/SBZ/Orbinaut.bin
    Data/Sprites/SBZ/PistonMachine.bin
    Data/Sprites/SBZ/Platform.bin
    Data/Sprites/SBZ/Trapdoor.bin
     
  14. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,412
    67
    28
    SonLVL
    So, who's gonna try porting Generations models to Mania?
     
  15. Chimera

    Chimera

    I'm not a furry. Tech Member
    1,258
    1
    18
    Castlevania prettyness
    that sounds fun :specialed:

    Hmmm a little bizarre up they're outright removing beta content from an update. I spose it's moreso in the interest of optomizing the game and not having any data left in that they legitimately don't need. Like Tax said, the old Blueprint zone stuff was 100% just for engine testing and was slated to be deleted anyway. Hope they don't do this for other unused code though; that'd just be a shame.


    Is Denuvo what's stopping Mania from being run on Windows XP? I can't imagine anything other than, potentially, DirectX libraries stopping it. There really doesn't seem to be any reason a game optimized to be playable on an *actual saturn* can't run on a previous OS of Windows :colbert: even YoYo Games' GameMaker programs can run on XP.
     
  16. Dark Sonic

    Dark Sonic

    Member
    12,639
    224
    43
    Working on my art!
    I want the reverse :v:
     
  17. Rageguy

    Rageguy

    Member
    9
    0
    0
    I've got the model imported, but I'm stumped at colors.
     
  18. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,412
    67
    28
    SonLVL
    All it takes is the programmer using a function that Windows XP doesn't have, and the whole thing won't run on Windows XP, regardless of whether it theoretically could have otherwise. The error message specifically identifies kernel32:GetTickCount64, which sure enough only exists on Vista+. This appears to be used in some code related to Steam, actually. But that probably isn't the only function that's missing, and some of them could be in game code.

    The SADX Mod Loader is able to run on Windows XP because I specifically use the compiler designed to create Windows XP compatible programs, and avoid any functions that didn't exist in XP. Sonic Mania likely wasn't made with the intention of supporting XP, because why would they? It's not supported by Microsoft, and newer functions may be safer and faster.
     
  19. HEDGESMFG

    HEDGESMFG

    Oldbie
    292
    8
    18
    I don't mean to rush or push anyone here, but has anyone had any more success at ripping level maps? I'm very interested in seeing the stage layouts and comparing them with the classics. The stage design is so good in so many ways I wish to analyze it indepth same way we can do with the classics.
     
  20. TuxKnux

    TuxKnux

    Member
    3
    0
    0
    I spent a lot of time trying to Mania to run on XP. GetTickCount64() merely returns the number of ticks since the computer has booted. It can be replaced with GetTickCount() as the functions are identical until the computer has been running for a month and a half, at which point, GetTickCount will overflow to 0 as it returns a 32-bit value, while GetTickCount64 returns a 64-bit value and thus will not. I have tested this replacement and it works.

    There are four other kernel functions Mania uses that are incompatible with XP (InitializeCriticalSectionEx, QueryFullProcessImageNameW, and GetModuleFileNameW in kernel32.dll and SHGetKnownFolderPath in shell32.dll) which cannot be easily replaced. It's possible to create stubs for these functions in a file (e.g. kernelxp.dll) and hex edit the game to use that file instead of kernel32.dll, but I didn't want to spend the time to get that working. All these functions are supported on Vista, though, so the game should run on it even though it's below the minimum system requirements (I don't have a Vista system to test with; if someone wants to try it out, I'd love to hear the result).

    Interestingly enough, when I replaced these functions with others that would obviously not work, the game crashes on Windows 7+. But on XP, Denuvo activates and prevents the game from running. So Denuvo might block Vista as well.

    Edit: have a level map of Egg Reverie. Object placement outside the fighting area is quite haphazard:
    [​IMG]