don't click here

SADX/SA1 Hacking/Modding

Discussion in 'Engineering & Reverse Engineering' started by MainMemory, Aug 15, 2009.

  1. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,237
    969
    93
    Long-term happiness
    There is a "Now you can play as SONIC!" string in SA:DX PC (at the very least) - maybe at some point in development he WAS intended to be unlocked in some form (like just after the initial cutscene, perhaps?)
     
  2. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    Well, it's not much, but I've started work on a rewrite of SADXLVL on the SVN:
    [​IMG]
    I don't know why the UVs are broken, probably some difference between Managed DirectX and SlimDX.
     
  3. SANiK

    SANiK

    Tech Member
    413
    0
    16
    The UV issue makes it look like Katamari Damacy. Pretty neat.
     
  4. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    Since it's been bumped, I might as well give an update:
    [​IMG]

    I've tried comparing the new code to the old code and can't find where the problem is.

    If anyone wants to look, you can find the code here.
     
  5. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    With the help of FraGag, we were able to force sadx to use a 24 bit zbuffer, fixing most of the problems with draw distance. Here are some comparison pics:

    Before:
    [​IMG]
    After:
    [​IMG]

    To do this with your copy of sonic.exe, open it up in hex workshop and go to the following address: 0x34A5D80
    You'll be replacing the next 0x28 bytes with 4D 00 00 00.

    before:
    [​IMG]
    after:
    [​IMG]

    What's going on here is that SADX, when invoking direct3d loops through all of the z-buffer modes available and settles on the first working one. Since the first one in the list is 16 bit, and 16 bit is ugly as fuck, we're forcing it to only try 24 bit.

    If you're going to make vast, expansive levels for SADX then this process is an absolute must. You'll probably also need to expand the sky box, clip and fog distances as well but those are already partially documented.
     
  6. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    In other news, I finally fixed the missing polygons and uvs in the SADXLVL rewrite:
    [​IMG]
    But now I have to make it actually do something...
     
  7. n00neimp0rtant

    n00neimp0rtant

    EYES ONLY Member
    262
    0
    0
    South Park, PA
    Creation Kit (Skyrim mods and patches)
    I have been looking for a way to tweak the fog settings like you can do in the debug mode within the "SADX (Preview)" prototype for GameCube. (Specifically, I'm trying to record a video of a cutscene with intense green fog in the background so I can chroma key the whole background out.) Is there a tool for the PC version that does this?
     
  8. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    You can use cheat engine and this cheat table: sadx_fog.ct (right-click save as) to mess with the ingame fog and draw distance settings.
     
  9. n00neimp0rtant

    n00neimp0rtant

    EYES ONLY Member
    262
    0
    0
    South Park, PA
    Creation Kit (Skyrim mods and patches)
    Thanks a bunch, works great =] I had never heard of Cheat Engine until now, but it seems like a great tool.

    Another question: I literally just started playing around with the SADX modding tools, and I feel like I'm getting familiar with them; but when I'm using MainMemory's SADXLVL, I can edit a level just fine within the editor, but no matter what I have tried, I can't get it to actually save my modifications. It appears to save the sonic.exe correctly, and the "Date Modified" field in Explorer updates to the current time, but if I start up sonic.exe or close SADXLVL and open it again, the layouts are the same. No errors or warnings of any sort at any time. Any idea what I might be doing wrong?

    (If it makes any difference, I now have to use a "patched" sonic.exe file because regrettably, I found my SADX disc 2 popped out of its little plastic CD holder thing inside the case and got all scratched up from being shook around, so I couldn't run/reinstall it =[ I made sure to change the region in the sonic.exe.ini file to the patched European version, though)

    Thanks again for the help.
     
  10. SF94

    SF94

    Tech Member
    Well, are you modifying the geometry of the level, or just the items? If it's just the items, be sure to click the little save button next to the list of characters in the set editor. Otherwise... I dunno.
     
  11. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    It shouldn't matter, but you can also download a US sonic.exe cracked by me here.
     
  12. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    Here's an image of an upcoming level I'm working on, which should hopefully make it for the hacking contest.

    [​IMG]
     
  13. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    Do you think it would be worthwhile to make an SCHG article for <a href="http://info.sonicretro.org/Sonic Adventure (2010)" target="_blank" style="background: url(http://info.sonicretro.org/images/5/50/Reticon.png) right no-repeat; padding-right: 20px; border-bottom: 1px dotted #3366BB; color: #3366BB; cursor:pointer; text-decoration:none;" class="wiki">Sonic Adventure (2010)</a>? Although initially it would only have about as much content as SCHG:Sonic Adventure DX, I don't have the game, and am not interested in hacking it either.
     
  14. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    I don't know really - I don't plan on hacking it either. But somebody might. It's not like the page needs to exist just to verify the existence of the game.
     
  15. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    I went ahead and made it anyway: <a href="http://info.sonicretro.org/SCHG:Sonic Adventure (2010)" target="_blank" style="background: url(http://info.sonicretro.org/images/5/50/Reticon.png) right no-repeat; padding-right: 20px; border-bottom: 1px dotted #3366BB; color: #3366BB; cursor:pointer; text-decoration:none;" class="wiki">SCHG:Sonic Adventure (2010)</a>
     
  16. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    I think I've figured out a way to make editing SADX easier from a tool-writing perspective. Rather than having each tool read data from the EXE, edit it, try to find enough free space for it, and change the necessary pointers, have a "split" program which takes data from the EXE and puts it in separate files, tools to edit those files, and a "build" program to put the files together into a .data2 segment of the EXE and update the required pointers. All of these programs would be open source as part of the Community SVN Project (or whatever it gets changed to).

    I'm thinking the INI file would look something like this:
    Code (Text):
    1. [Levels\Emerald Coast\Act 1 Layout.sal] ;filename
    2. relocate=1 ;if 1, the data can't be put back in its original location
    3. pointers=57DA28 ;a list of all pointers that need to be updated
    4. type=LandTable ;optional type of data, for customized extraction/insertion
    5. [Characters\Sonic\Physics.bin]
    6. relocate=0
    7. address=5154E8
    8. length=84 ;hex
     
  17. darkspines35

    darkspines35

    It's Easy Actually. No, seriously. Tech Member
    248
    0
    16
    .V.
    Sanik Adevnt Casters
    If one were to do that MainMemory, wouldn't that concept make easier to create a tool for working with Adventure fields too? In a sense anyway since they have they additional pointer tables.
     
  18. Wouldn't it be better to somehow make the EXE load these separate files directly, if that's possible?
     
  19. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    It would, but that would require a lot of ASM hacking in the EXE, this method requires none.

    No, you'd still need to decompile the DLLs to edit those.
     
  20. total

    total

    Member
    67
    0
    0
    [​IMG]
    Am I the only person who ever tried that?

    You know, there are objects' names (and other strings) in every sa2 stage.
    Example (boss_bigfoot):

    Code (Text):
    1. (IDs added for better reading)
    2.  
    3. 0x00&nbsp;&nbsp;&nbsp;&nbsp;SAMPLE S....
    4. 0x01&nbsp;&nbsp;&nbsp;&nbsp;SAMPLE M....
    5. 0x02&nbsp;&nbsp;&nbsp;&nbsp;SAMPLE L....
    6. 0x03&nbsp;&nbsp;&nbsp;&nbsp;SAMPLESW....(collision volumes - sphere, cylinder)
    7. 0x04&nbsp;&nbsp;&nbsp;&nbsp;LIGHT SW....
    8. 0x05&nbsp;&nbsp;&nbsp;&nbsp;MODMOD..
    9. 0x06&nbsp;&nbsp;&nbsp;&nbsp;RING....
    10. 0x07&nbsp;&nbsp;&nbsp;&nbsp;RINGLINE....
    11. 0x08&nbsp;&nbsp;&nbsp;&nbsp;RINGCIRC....
    12. 0x09&nbsp;&nbsp;&nbsp;&nbsp;SPRINGA.
    13. 0x0a&nbsp;&nbsp;&nbsp;&nbsp;SPRINGB.(*)
    14. 0x0b&nbsp;&nbsp;&nbsp;&nbsp;3SPRING.(*)
    15. 0x0c&nbsp;&nbsp;&nbsp;&nbsp;KASOKU..(*dashpanel*)
    16. 0x0d&nbsp;&nbsp;&nbsp;&nbsp;SAVEPOINT...(*)
    17. 0x0e&nbsp;&nbsp;&nbsp;&nbsp;SWITCH..(* behind Sonic)
    18. 0x0f&nbsp;&nbsp;&nbsp;&nbsp;ITEMBOX.(*)
    19. 0x10&nbsp;&nbsp;&nbsp;&nbsp;ITEMBOXAIR..
    20. 0x11&nbsp;&nbsp;&nbsp;&nbsp;BALLOON.
    21. 0x12&nbsp;&nbsp;&nbsp;&nbsp;IRONBALL2...
    22. 0x13&nbsp;&nbsp;&nbsp;&nbsp;BIGJUMP.
    23. 0x14&nbsp;&nbsp;&nbsp;&nbsp;ROCKETK.
    24. 0x15&nbsp;&nbsp;&nbsp;&nbsp;MISSSILE....
    25. 0x16&nbsp;&nbsp;&nbsp;&nbsp;BUNCHIN.
    26. 0x17&nbsp;&nbsp;&nbsp;&nbsp;CHAOPIPE....
    27. 0x18&nbsp;&nbsp;&nbsp;&nbsp;ORI.
    28. 0x19&nbsp;&nbsp;&nbsp;&nbsp;CONTWOOD....
    29. 0x1a&nbsp;&nbsp;&nbsp;&nbsp;CONTIRON....
    30. 0x1b&nbsp;&nbsp;&nbsp;&nbsp;SKULL...
    31. 0x1c&nbsp;&nbsp;&nbsp;&nbsp;UDREEL..
    32. 0x1d&nbsp;&nbsp;&nbsp;&nbsp;GOALRING....
    33. 0x1e&nbsp;&nbsp;&nbsp;&nbsp;EMERALD.
    34. 0x1f&nbsp;&nbsp;&nbsp;&nbsp;DYNAMITE....(*)
    35. 0x20&nbsp;&nbsp;&nbsp;&nbsp;LEVUPDAI....(*)
    36. 0x21&nbsp;&nbsp;&nbsp;&nbsp;E KUMI..
    37. 0x22&nbsp;&nbsp;&nbsp;&nbsp;E_EMI...(*)
    38. ...
    39. etc
    40. (I marked with * everything visible on the screenshot)
    And since everyone knows that format is basically the same as SA1's, there is almost nothing to figure out bout objects placement.
    I am sure it is also possible to port those gamecube set files to the dreamcast version. I'll try that later.

    Anyone willing to go on?

    PS: although this can be found
    Code (Text):
    1. ...
    2. 0x54&nbsp;&nbsp;&nbsp;&nbsp;FENCEL..
    3. 0x55&nbsp;&nbsp;&nbsp;&nbsp;BIG THE CAT.
    4. 0x56&nbsp;&nbsp;&nbsp;&nbsp;SIGNBOARD...
    5. ...
    his model is probably missing or something (he is still used in set files but there is nothing ingame). Of course there is a possibility to restore him.

    If my guesses are correct it should be relatively easy to "port" objects between stages. We'll see when (and if) I work out format a little bit more.