Sonic Adventure 2 Hacking

Discussion in 'Engineering & Reverse Engineering' started by Turbohog, Feb 20, 2012.

  1. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,290
    2
    18
    SonLVL
    http://youtu.be/Yxh-x-lbhgc
    I've published an update to the SA2 Physics Swap Mod adding options for Sonic Heroes physics, thanks to sewer56lol. It turns out Heroes uses the same structure as SADX and SA2, so perhaps they didn't throw out as much of the Adventure engine as people previously thought.
     
  2. Does this mean that it's potentially possible to put SA/2 physics in heroes? :V
     
  3. Dark Sonic

    Dark Sonic

    I'll find the old avatar eventually Member
    12,060
    4
    18
    Working on my art!
    Yup. Look up the Heroes mod loader that came out during the hacking contest. There's the ability to do exactly that.
     
  4. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,290
    2
    18
    SonLVL
    Of course, it won't make Heroes feel exactly like SA1/SA2, there are many other factors than just the values in this structure.
     
  5. roachdaripper

    roachdaripper

    Source Engine Junkie Member
    35
    0
    0
    Wales
    Trying not to rage when porting SADX/SA2 models on PC.
    So it doesn't fix rail grinding?

    [sup]Dammit.[/sup]
     
  6. Shaddy the guy

    Shaddy the guy

    Zaphod's just some guy, you know? Member
    329
    1
    18
    Beaverton OR
    Thinga Comic
    I was just hoping it'd fix the whole "shoot forward upon landing if you hold a direction even slightly" bit. That's the worst.
     
  7. End User

    End User

    Member
    14
    0
    0
    Supers Over Hedgehogs (SA2)
    What should have taken a few days to clean up was delayed to now. I apologize for the long wait.

    Here is a revision of the DC Characters mod for SA2 PC that was released some time ago. Most of the characters that had weird texture errors (or caused game crashes) in the cutscenes have been fixed to display the correct ones, no matter what. Trial Sonic and most of the multiplayer characters are also included, with some exceptions. There were some complications in the matter, which I'll list here:

    Rouge:
    Her DC model for the wings loads up fine when viewed in the SAMDL program, but when viewed in-game, they're a garbled mess that vaguely resemble wings. For now, the wing model will remain untouched from the Battle version until a solution is found.

    Eggman:
    There's a transparency issue regarding Eggman's model in both the Egg Walker and his Chao World variant which causes parts of his jacket and mustache to disappear when viewed from most camera angles. For now, those models are not included, but an optional mod that replaces the Egg Walker with the Big the Cat variant is included in the mod pack.
    (Sorry, JoeTE. I didn't see that you already converted Big to the Battle format before this point!)

    Chaos Zero:
    No matter what, rebuilding the model file for Chaos 0 crashes the game during his multiplayer intro, even if you don't alter any of the files. He's also not included, of course.

    As a little bonus, I was also able to port Big onto Dark Chao Walker, which is also included in the mod pack. It's still very much a work-in-progress, as I'm not exactly sure of how to edit the animation files for SA2B. BuildMTN works for the Dreamcast version, but the edited animation packages crash SA2B.

    The Supers Over Hedgehogs mod package - now shortened to just "Super Hedgehogs" - has also been updated, and you can download it here. Don't use the old Dropbox link, as I forgot the password for it like a dolt it's a somewhat outdated build. For brevity's sake, it now only includes files that are compatible with the PC version, which is the go-to version for most people that play the game these days. The Dreamcast and GameCube versions can be made available once again upon request.

    Aside from that, everything should work fine. Credit goes to MainMemory for the SA Tools modding package.

    What I know about the .sa2mdl format

    Texture assignment

    This value is usually located in this format when individual model files are viewed in a hex editor:
    08 X4 YY 40 ?? ZZ

    X can be any value from 0-F, though most of the time, 3 is used in both versions of SA2. The meaning of the different numbers is unclear to me at the moment.

    YY is the texture that's intended to be loaded for that particular model chunk. 00 is the first texture in the model's assigned texture pack.

    ?? can be either 40 or 41. Again, not entirely sure why, but these are the two values I found most often while editing the files. Modifying this parameter more often than not causes the entire file to become unreadable, so proceed with caution. Some parts of the model data omit the first four bytes and start here, as well.

    ZZ determines how the textures are displayed on the model. 00-0A appear to be mostly static placements, while values of 58 and above cause the textures to appear reflective (Super Sonic's body, the Shovel Claw, and the windshields for the mech characters are examples of what I mean.)

    Vertex colors

    These are stored as BGRA values. In SA2's models, most of these parameters are stored as "B2 B2 B2 FF" (gray), while in SA2B, a majority of them were changed to "FF FF FF FF", which is pure white. Generally, these are located close to the texture values or near the end of a model chunk.

    Example: 6.sa2mdl (Sonic's jump ball model, DC version)

    [​IMG]

    BONUS: Fog files

    From a cursory examination of SA2 and SA2B's STGXX_FOG.bin files (XX being the targeted stage's ID), the way each game handles them is different. SA2 seems to read the entire package as-is, while SA2B only seems to focus on the first 16 bytes. Editing those parameters in SA2B can cause either the draw distance to change, the background to appear lighter, or the entire screen becoming enveloped in your chosen color (again, stored in the BGRA format). Stranger still, the values after the first 16 bytes were byte-swapped in SA2B, yet changing them back doesn't affect the targeted stage at all.

    Lighting files

    SA2 has lighting data for every stage stored in the format STGXX_LIGHT.bin, and fortunately, those parameters remain untouched - aside from the necessary byte-swapping - in SA2B. These only seem to affect the lighting of the objects and the characters in each stage, and SA2B adds in new lighting files with _gc added to the end of the filename. I used Pumpkin Hill (ID 05) as a test to see which models were affected by the modified lighting scheme, and found that stg05_light_gc.bin determined the lighting for Knuckles and several environment objects. The original file affected the ghosts and the emerald shards. The catch is that the _gc file only adjusts the lighting for certain objects, as modifying the file to give no lighting to the models causes the values from the original stg05_light.bin file to be used in its place. Examples

    The major difference comes in the form of how the game processes that lighting information, which, if it's anything like the porting job done with SA1 to the GameCube and beyond, necessitated some guesswork and approximations to get "close enough" while also adding certain enhancements.

    The data I listed under the .sa2mdl file section will be posted on the Model Files section of the SA2 Hacking Guide for future reference. Changes, suggestions, complaints, and the like are welcome.
     
  8. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,290
    2
    18
    SonLVL
    Finally, the mod you've all been waiting for: Sonic Adventure 2: Omochao Edition!
    http://www.youtube.com/watch?v=spcoAYZC2j8
    Info/Download
    + - And if for some reason you want less Omochao, there's a new cheat code in the mod loader for that.  
     
  9. Shaddy the guy

    Shaddy the guy

    Zaphod's just some guy, you know? Member
    329
    1
    18
    Beaverton OR
    Thinga Comic
    Well I don't know why anyone else bothers modding when you end up creating the best ones out of all of them


    Shadow in a dress when
     
  10. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,290
    2
    18
    SonLVL
    First off, thank you. Secondly, as soon as someone figures out how to work with SA2 models.
     
  11. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,290
    2
    18
    SonLVL
    I finally fixed the SA2 Character Select mod so it doesn't crash in Route 101/Route 280 or Sonic vs. Shadow 1. https://gamebanana.com/gamefiles/6301
     
  12. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,290
    2
    18
    SonLVL
    I've added a new editor for SA2's message files to SA Tools:
    [​IMG]
    It supports DC/GC/PC files, can export to a text file, and has a search feature.
    [hr]
    I've also released a minor update to the Omochao mod.
     
  13. Exant

    Exant

    Member
    5
    0
    0
    Does anyone know if there's a SetChunkTextureIndexB equivalent in SA2?
     
  14. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,290
    2
    18
    SonLVL
    There doesn't appear to be. Instead, the game seems to call the same function twice in a row in the Chao code.
     
  15. Exant

    Exant

    Member
    5
    0
    0
    Yep, which seems to cause the bright chao glitch. I tried to do the same thing in SADX (calling indexA twice) and I was able to replicate it. Now if I could figure out what those other 2 arguments are for (it seems to set those to a dword which never gets referred to anywhere, so it seems useless a bit)
     
  16. MainMemory

    MainMemory

    Every day's the same old thing... Same place, diff Tech Member
    4,290
    2
    18
    SonLVL
    [​IMG]
    In case you haven't heard, TheGag96 has fixed SA2's emerald radar with a new "All emeralds trackable in treasure hunt stages" code in the mod loader.
     
  17. Turbohog

    Turbohog

    Member
    600
    0
    16
    Oh my Goooooood! Great to see someone do this. The levels are probably designed with only having one emerald trackable at a time in mind, but this will make some of the treasure hunting levels much more bearable.

    Edit: Also I guess this breaks the hints, but they kind of sucked anyway.
     
  18. Dark Sonic

    Dark Sonic

    I'll find the old avatar eventually Member
    12,060
    4
    18
    Working on my art!
    Doing god's work. Fantastic stuff, that just made levels like Mad Space 10x more bearable.
     
  19. TheInvisibleSun

    TheInvisibleSun

    OVER THE TOP TECHNO-BLAST Member
    1,416
    0
    16
    Buffalo, NY, USA
    Sonic 1 Color Contrast
    Perhaps now all that's needed is a mod that makes Omochao act like the Tikal hints did in SA1 (or just straight up port Tikal over)? I have no idea how possible/impossible this is to do though.
     
  20. Turbohog

    Turbohog

    Member
    600
    0
    16
    I think that would be a nice solution and I'd honestly prefer it over the monitor hints.In my opinion, the monitor hints break the flow of the game more than the Tikal hints.

    An alternate solution would be making it clear which shard the hints are for I guess, but I'm not sure if that's even worth it.