don't click here

Sonic Generations Hacking (and More!)

Discussion in 'Engineering & Reverse Engineering' started by Andrew75, Jun 23, 2011.

  1. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    I'm pretty sure it is. The xml files in gens indicate that the wii is a target platform. And not to mention that, the coordinate spaces match up perfectly between colors and gens. Also, the path files are kind of the same (binary version of the same format). Colors also uses the same general gameplay structure as generations (dash mode, side view, 'forward' mode, etc.)
     
  2. Lobotomy

    Lobotomy

    35% Cognac Banned
    4,394
    1
    0
    Traverse City
    Project: Matter/Energy
    Alright, it's science time motherfuckers.

    There are a lot of diffuse maps that aren't totally bork in the game. They must use a different type of shader. I'm going to make this renderer work, god damn it.
     
  3. Hodgy

    Hodgy

    Member
    797
    0
    16
    UK
    Games programming :)
    glorious guys. just glorious! You lot never cease to amaze me!
     
  4. RedMetallix

    RedMetallix

    Supreme Thunder Member
    709
    0
    16
    A desk.
    What? Don't be silly.
    Out of curiousity, is it possible to swap Classic Sonic out with another character? All the mods I see have people swapping out with Modern, but not Classic.

    Thought it would make more sense to have Cream over Classic as opposed to Modern, seeing as they're about the same height and all.
     
  5. Sparks

    Sparks

    Member
    3,147
    183
    43
    Sondro Gomez / Kyle & Lucy
    Or better yet, Classic Tails. :v:
     
  6. Lobotomy

    Lobotomy

    35% Cognac Banned
    4,394
    1
    0
    Traverse City
    Project: Matter/Energy
    [​IMG]
     
  7. Azu

    Azu

    I must be stupid. Member
    An iced over Planet Wisp?
     
  8. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    As I mentioned before, some shaders seems to have the diffuse bugged with full white. If you use the Generations standard shaders, you get full red instead. However, there's other shaders which work the same way(blending shader for example), and have correct colors, so I wonder if it's possible to fix it that way.

    Another interesting tidbit, as pointed out by Chimera before, is that the Unleashed renderer can do the directional shadows. However, it has some problems. First off, it's pitch black. I have no idea what of the XML settings control it, but hopefully it's possible to fix it.

    The other problem is, the shadow map resolution is BAD. If you want it to render more shadows in more range, it has to stretch the shadow map texture all over, making the quality even worse. However, I doubt this will be that noticeable if the shadow was as smooth as the level is. Hopefully it can be fixed.

     
  9. Lyrica

    Lyrica

    (Formerly: Donnyku) Oldbie
    1,374
    39
    28
    Pennsylvania
    Wedding Planning
    With them all White like that they look like The Hub World, which is actually something I had wanted to see all the levels in from the start of the modding process. Not sure what all would have to be done, but could a mod be released that would make all the levels look like such?
     
  10. ancara

    ancara

    Member
    375
    0
    0
    I actually like the white and some red only touch, like a "Sonic if he was in Mirror's Edge" type of deal.

    A level in that style would be AWESOME to see and play through. :v:
     
  11. DustArma

    DustArma

    Member
    1,338
    10
    18
    Santiago, Chile
    Learning Python.
    [​IMG]

    Speed Highway looks very surreal like this.
     
  12. Dark Sonic

    Dark Sonic

    Member
    14,631
    1,611
    93
    Working on my art!
    Looks like mirrors edge.

    Can someone release this unleashed shader as is? Honestly this is what the levels should have looked like during initial play through. It looks really cool to play
     
  13. Dario FF

    Dario FF

    Tech Support Hotline Tech Member
    I was checking in the HUB and even if it calls the same shaders(Common_dpn and such) that the main stages do, those look fine. I think something's mixed up between both renderers with what handles making the white world well... white! And making it transition into color. Like if the Unleashed renderer default to saying these meshes aren't painted(like the level isn't unlocked), while the Generations one does, or it has an exception.

    I wonder if it can be fixed by disassembling and reassembling these .wpu shaders, if that's possible of course. The rest of the files seem like it'd be really easy to crack, but they're just a bunch of names and references.
     
  14. Falk

    Falk

    Member
    1,570
    15
    18
    I was actually about to say that Planet Wisp shot reminded me of Mirror's Edge. A -lot-
     
  15. Korama

    Korama

    Tech Member
    272
    2
    0
    Great find, Lobotomy!
    I guess I should have looked at those shader files a bit more closely. :v:


    Here's a little how-to so that everyone can try this. Note: The offsets are for the latest v1.0.0.5 of Sonic Generations, make sure that's what you have.
    1. back up your SonicGenerations.exe
    2. open SonicGenerations.exe in a hex editor (I'll be using HxD as an example)
    3. go to offset 12E1094 and make a selection of length 7C hex (Ctrl+E, then verify values in status bar)
    4. copy selected bytes (Ctrl+C)
    5. go to offset 12E1164 and make a selection of length 7C hex (Ctrl+E again)
    6. paste (Ctrl+V)
    7. save

    Congratulations, now the game uses the Unleashed renderer.

    To get light shafts, you have to do some more work, namely edit the SceneEffect.prm.xml in the #xxx.ar.00 files (eg. #ghz200.ar.00). Find the <LightShaft> section and change "<ms_IsEnable>false</ms_IsEnable>" to "<ms_IsEnable>true</ms_IsEnable>".
    You can use MainMemory's editor to unpack and repack .ar files, or you can do this simple change with a hex editor. Be aware that the value has to be "true", not "true " (no leading or trailing spaces). So if you use a hex editor, I suggest replacing "<ms_IsEnable>false" with " <ms_IsEnable>true" (leading space before the xml tag, not inside the value).
    For directional shadows, change ms_IsEnableVerticalShadow to false in the same way.


    Now you can make your own little mod with the adjusted #xxx.ar.00 files. Here's a suitable mod.ini:

    Code (Text):
    1. [Main]
    2. IncludeDirCount=1
    3. IncludeDir0="."
    4.  
    5. [Desc]
    6. Title="Unleashed Shaders"
    7. Description="Swaps shader_r and shader_s files"
    8. Version="1.0"
    9. Date="2012-08-02"
    10. Author="Korama"
    11.  
    12. [CPKs]
    13. disk\bb3.cpk="bb3.ini"
    And bb3.ini needs to contain this:

    Code (Text):
    1. [Main]
    2. CommandCount=1
    3. Command0=Swap:SwapShaders
    4.  
    5. [SwapShaders]
    6. ; swap the Generations shaders with the Unleashed shaders, discovered by Lobotomy
    7. shader_r.arl = shader_s.arl
    8. shader_r.ar.00 = shader_s.ar.00
    9. shader_r_add.arl = shader_s_add.arl
    10. shader_r_add.ar.00 = shader_s_add.ar.00
    11. shader_r_add.ar.01 = shader_s_add.ar.01
    12. shader_r_add.ar.02 = shader_s_add.ar.02

    Place these mod.ini and bb3.ini files in a new folder, make "bb" and "bb2" subfolders and place your modified #xxx.ar.00 files in those.
    Then link this mod to Sonic Generations by using SonicGMI or do it manually by editing cpkredir's ModsDB.ini
     
     
  16. Lobotomy

    Lobotomy

    35% Cognac Banned
    4,394
    1
    0
    Traverse City
    Project: Matter/Energy
    We need a plan of attack with this whole diffuse map bug dealie. I mean, at this point, it wouldn't make sense not to work on it, considering the majority of it actually works now.

    It's either a shader problem or a renderer problem. We should see if any of the shaders are to blame first.

    If this renderer works, we'll need to increase the simply god awful resolution of the shaders, too. Shadows are pixelated, refraction is choppy, godrays could be sharper, et al.

    Has anyone tried a .NET decompiler or a C++ decompiler on sonicgenerations.exe yet?
     
  17. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.


    It's not even a related game engine. Colours is based from Secret Rings. It is set up nearly identical. The layout format, the physics engine, and scripting files are all the same.
     
  18. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    That's why I said probably. I can tell you for sure they used it for unleashed and gens though.
     
  19. Chimera

    Chimera

    I'm not a furry. Tech Member
    1,272
    17
    18
    Castlevania prettyness
    May it be noted that when you enable light shafts, the direction of the sun rays are ALWAYS the same. They should be, "out of the box," [25, 45, 25] or something along those lines. This is basically the sun direction of the rays. And you're gonna need to modify them yourselves if you want them to look right.

    I suck at explaining so bear with me.

    The X Y Z values in the light shaft direction basicllly are the direction of the sun. Essentially it is the light vector. If you want to find the direction of the sunlight in your level and have the light rays match it exactly (this doesn't HAVE to happen but it makes things easier/less weird), what you should do is:

    1) Open the level's primary .light file; this is the sunlight.
    2) Go to the Community Hacking Guide page for Sonic Generations and scroll down to .light files
    3) Find the XYZ floats in your hex editor for the direction of the sun; as I recall these are the last floats. For non tech-savvy people, the floats are the last 16 bytes of the file sans the last 4 bytes of the file, so essentially the last 12 bytes. The X direction is the first four bytes of this set, the Y the next 4, and yeah.
    4) Convert these hex values into actual floating points. I'm sure you can find that out yourself.
    5) Now that you have your floats, replace the XYZ for lightshaft direction with those.

    If you have basic understanding of vector math or a way to display vectors, you can play with these settings and offset the ray direction a bit for a bit of dramatic effect; it's what Cool Edge does actually!
     
  20. Lobotomy

    Lobotomy

    35% Cognac Banned
    4,394
    1
    0
    Traverse City
    Project: Matter/Energy
    Did I even post this here yet?



    Well here it is. I have another video currently processing that will show off the Unleashed renderer.

    Oh, I should note, if ENB is too dark on your monitor, you can raise it. My screen is much brighter than most, so I compensate in ENB.