don't click here

Sonic Generations Setup Program Disassembled

Discussion in 'Engineering & Reverse Engineering' started by SSNTails, Nov 4, 2011.

  1. SSNTails

    SSNTails

    Oldbie
    32
    0
    6
    The port of the game might be great, but the setup program is a piece of VB.NET crap.

    It won't even start on mine, since it faults out with DXInputHelper.dll trying to enumerate my video card.

    So I decided to investigate, disassembling the .NET code back into C# and trying to rewrite some bits to make it work.

    http://ssntails.srb2.org/GenerationsConfigToolSrc.zip

    It'd be nice to make the thing entirely managed (I've started using SharpDX).
    Users are reporting that this still doesn't quite work for them, I think it generates an invalid config file (might just be off a characte ror two, I haven't looked into it more yet).

    If anyone is willing to help out with this, it might be a neat little project.
     
  2. Scarred Sun

    Scarred Sun

    Be who you needed when you were younger Administrator
    7,745
    127
    101
    Tower 8 ️
    Welp, this.
    Why.

    The need for this is basically non-existent. I can think of so many more productive uses of time. Say what you want about VB.NET, but it's the installer. All it does is load the damn files.
     
  3. TimmiT

    TimmiT

    ¯\_(ツ)_/¯ Member
    Because it seems like it's the reason why people that have laptops that use Optimus are fucked when we try to play the game. Optimus means the laptop switches between a powerful GPU and a less powerful GPU depending on what you're doing. To play the game it's obviously best to use the powerful GPU (in my case, a GeForce GT540M), however the config only detects the less powerful GPU (most of the time an Intel). Because of this, this happens when you try to launch the game:
    [​IMG]

    So the only way to play the game is to use the Intel GPU, which is just barely capable of playing the game at 25fps on 1024 x 768 and low settings.
     
  4. SSNTails

    SSNTails

    Oldbie
    32
    0
    6
    Uh... if you search the Steam forums, there's a lot of people who can't even get the config app to run, including me. Expanding upon this idea may be a solution. Till then the game refuses to run until the config app does it's thing.
     
  5. TimmiT

    TimmiT

    ¯\_(ツ)_/¯ Member
    Or we could just wait until SEGA updates the game.
     
  6. Sappharad

    Sappharad

    Oldbie
    1,413
    70
    28
    I took a look at this, because I'd like to try getting the game running under WINE. I went ahead and back-ported it to .NET 2.0 since that works on WINE and now the tool runs for me on there.

    But in the state you released it, it's never going to generate a valid config file. You have DepthFormat in AdapterInfo hardcoded to 24, which is not a valid value. Honestly, I haven't figured out what DepthFormat is though. When I boot into Windows and run the original unmodified utility there, it outputs 1515474505 for DepthFormat which doesn't correspond to anything in the DirectX DepthFormat enumeration. If I generate a config file with your version of the code, then replace DepthFormat manually in a text editor, the game accepts the file. (But that DepthFormat value isn't valid for WINE so the game crashes)

    I'll see if I can figure out what DepthFormat is supposed to be. It's kind of funny that they forgot to change the default icon in the corner of the window, so it was very obvious when you opened the program that it was a .NET app.

    Edit: It just realized that 1515474505 is ZTNI in ASCII, or INTZ if you reverse the endianness. Could this be some kind of depth buffer setting? Not sure what the possible values are yet.

    Edit 2: I think the possible values are INTZ, DF24 and DF16. Obtained these values looking at the DXInputHandler.dll in a hex editor. The game appears to accept these as valid values.

    Edit 3: Updated build of the application, this generates valid config files and runs under WINE:
    http://www.sappharad.com/junk/GenerationsConfig_MoreCompatible.zip

    Updated source code with my changes to downgrade to .NET 2.0 and force INTZ depth textures:
    http://www.sappharad.com/junk/GenerationsConfigToolSrc_Updated.zip

    I could have made it detect if cards support INTZ and if not fall back to DF24, but looking at the minimum game requirements all of the minimum supported cards support INTZ except ATI cards older than the 4000 series. DF24 is only supported by older ATI cards, so 90% of users who can run the game will be using INTZ anyway.

    Good luck with this. It didn't allow me to run the game in WINE, but maybe it will help some other users who want to try unsupported configurations.
     
  7. SSNTails

    SSNTails

    Oldbie
    32
    0
    6
    Hey, sonicblur! Good to see you're still around. :)

    Yeah, sorry, I ran short of time, and since the game still doesn't run on my computer (I managed to generate a valid config, but the game crashes out.. I guess I'm seriously not compatible :/ ), it's hard to test the results of the config.

    The modified setup program (MSP) also doesn't properly generate the 2nd to last line -- the registry information for the monitor. The MSP outputs 'nvd3dum.dll' on that line (or whatever your driver's d3d interface dll is), but it's supposed to be, for example, MONITOR\SAM006D\{4d36e96e-e325-11ce-bfc1-08002be10318}\0004, which corresponds to a location under HKEY_LOCAL_MACHINE/CurrentControlSet/Enum/DISPLAY/.

    Inside that registry location, the 'ClassGUID' is the GUID that gets put in the config string for the monitor.


    But other than the monitor string and the depthformat lines, it should be gold.

    I'll see if I can figure out what DepthFormat is supposed to be. It's kind of funny that they forgot to change the default icon in the corner of the window, so it was very obvious when you opened the program that it was a .NET app.

    See above about monitor string.. might be why it's still not running under WINE for you.
     
  8. PsychoSk8r

    PsychoSk8r

    PsychedelAnt | Tone Turner Oldbie
    2,641
    57
    28
    Birmingham, UK
    30 Day Project: Revisited.A New Release!
    This worked, thanks. Now I get a nice "Graphics Device Unsupported" on this laptop. Here's hoping my PC does better. =P
     
  9. Lobotomy

    Lobotomy

    35% Cognac Banned
    4,394
    1
    0
    Traverse City
    Project: Matter/Energy
    Bumping this due to interest in a working WINE version.

    Is there any way to make the Generations Config not come up as a zombie process in WINE? It's literally the only thing keeping me from go fast on Linux.
     
  10. Dark Sonic

    Dark Sonic

    Member
    14,631
    1,610
    93
    Working on my art!
    That's a good joke. You made me giggle.

    Sega updating a game you silly joker you.
     
  11. Sappharad

    Sappharad

    Oldbie
    1,413
    70
    28
    Not necessary. The latest version of WINE (and even CrossOver) can run the game with the original EXE's. I even contributed screenshots to CrossOver's compatibility archive.

    With the latest version of WINE, install the modern DirectX and the .NET 3.5 runtime. With .NET 3.5 installed, the setup program works out of the box. The only problem I had was that the config file generated was not accepted by the game. There was an extra character on the line that denotes the registry key of the display to output to. I cleared out that line, and the game launched fine.

    Unfortunately, sound doesn't work and Sonic's eyes always have polygons shooting out of them. (Installing Windows Media Player does not fix the missing sound problem)
     
  12. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    I've tried to play after installing the modified configuration tool, However, it detects my card as a ATI Radeon HD 3200, when it is actually a AMD Radeon HD 6670. It results in the game telling me the configuration does not match the system hardware, and that I need to run the config tool. :(

    This is on Ubuntu 12.04 running Wine 1.5.5.