don't click here

SADX/SA1 Hacking/Modding

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

  1. MissingNoGuy


    Sounds totally automated. Member
    Are dude's scripts outdated or am I doing something wrong? Every time I export from 3DS Max (specifically max 2016) I get this error when importing a nodetable.


    Not sure if this is the right place to ask, but it's got me stumped and was working yesterday.

    EDIT: Seemed to fix it. Reverted to an older version of 3DS Max.
  2. PkR


    SADX Dreamcast Conversion, The Emeralds' Awakening
    Hey, so I finally managed to rip model data from SA1 DLCs. Turns out it's just a PRS compressed binary at the end of the decrypted VMS file. After you decompress it, you can look it through for NJS_OBJECTs and open them in SAMDL with the key of CCA4000.

    Here's a rip of SA1 DLC content with binaries, models, textures and sounds/music, which has the decrypted DLCs and a script to rip data from them. Includes an ancient PVRViewer tool that can actually open those VQ-encoded textures. Sound data is in the original DSF format (foobar2000/winamp with plugins can play that), here's a separate archive of that data converted to WAV. The WAV music files have proper cue points for looping. Also check out Hidekazu Yukawa (Mr. SEGA)'s ridiculous "yuss" voice clip.

    Old guide on how to rip models, textures and other data from SA1 DLCs:
    First you need to decrypt the VMS file. sonicblur wrote a tool to decrypt them, get it here and decrypt the original VMS file.

    The decrypted VMS file is pretty straightforward. It contains the name of the DLC, the icon, DLC event-related text strings, textures (PVM), sometimes music/sound data (MLT archives), and at the very bottom there's a PRS-compressed binary file with model data, probably code too.

    How to rip textures
    The easiest way for now is to use SWAT's Universal PVR Extractor. Just run "pvrext -e decrypted_VMS_filename destination_folder". You'll get the PVRs extracted, though their original names won't be retained. They will still work with the ripped models if you build a PVM out of them using ArchiveTool from SA Tools - just make sure the order is the same. If you want to rip the PVM archive straight from the DLC file with filenames as-is, read on.
    Note that some textures in the DLCs are VQ encoded, and the tools don't like them sometimes. You may want to convert them to a different PVR format before trying to load them in SA Tools.

    How to rip MLT files, PVM files and the PRS archive
    This is a pretty dumb and inelegant way of doing it, but until an automatic tool is made you can just open the decrypted VMS file in a hex editor and look for headers. So let's say you want to rip the music file from the Christmas 98 DLC. At 0x78E0 you can see a bunch of data that begins with "SMLT" - this is the header of an MLT archive. Now look for "ENDB" and go to the last "ENDB" you can find, which would be at 0xA728. I think this is where the MLT file ends, but there's additional 20 bytes after that until the PRS file at 0xA740. You can cut the area between 0x78E0 and 0xA740 using a hex editor and save as an MLT file.

    Same thing for PVM archives, just look for "PVMH" and you'll be at the start of the PVM file. Use Universal PVR Extractor on the VMS file and look at offset.txt that it produces. Take the offset of the last texture and add its size (second number) to it and you get a decimal offset of where the PVM file ends. For example for Christmas 99 the header would be at 0x1840 and the end would be at 0x5BE0 (20416+3104 from offset.txt converted to hex). If you go to 0x5BE0 you'll see that it's the start of some other data. This is actually the PRS-compressed binary. So if you cut out everything before 0x5BE0 and save the file as christmas.prs or whatever, you can decompress it using prsdec to get the binary. In most cases the PRS file is immediately after the last texture, though in the Christmas 98 DLC it's after the MLT file.

    How to find models in the binary
    So you've decompressed the PRS file and got a "raw" binary. If you open it in a hex editor you can immediately see it has model data that begins with the usual stuff - materials, UVs etc. Look for a series of three "00 00 80 3F" near the bottom to find the NJS_OBJECT struct of the root model. For example in the Christmas 99 binary it's at 0x1990. This is the address of the model, which you can open in SAMDL. Set the key to CCA4000 and the address to 1990 and you get this:
    The infamous 99 DLC tree straight from the DLC file! Now all you need to do is rebuild or rip the PVM file to get this:

    I'm really excited that we can finally rip this stuff and possibly recreate the DLCs as SADX mods. I hope the more experienced SADX hackers chime in and write automatic tools to make ripping this stuff easier.

    EDIT: I managed to rip the Christmas 98 binary too:
  3. Sappharad


    I don't mind, but there's no danger of my original link dying in the near future.
    Pretty much everything I've uploaded since 2003 has remained at the same URLs since then, and I have multiple backups of everything for those times when shit happens and I have to start fresh for some reason or another.

    Congrats on documenting some of this stuff. I was hoping the decryptor would result in someone with lots of time to try and do something with the downloads, since the SA1 downloads were one of my favorite things about the DC version that hasn't been explored to it's full potential. I still wish that someday we could make our own, like people did with PSO download quests.
  4. PkR


    SADX Dreamcast Conversion, The Emeralds' Awakening
    Samba GP DLC recreated in SADX.
    • Works with or without Dreamcast mods
    • Adds posters around Station Square advertising the extra track that show messages when you touch them
    • Adds a Samba GP gate behind the Twinkle Park entrance like in the original DLC
    • When racing the extra course as Sonic, the music changes to "Super Sonic Racing" like in the original
    • Other characters have the regular Twinkle Circuit music, but their Twinkle Circuit courses are replaced with unused DLC tracks if you go through the Samba GP gate
    • You can still play the original Twinkle Circuit by using the regular entrance
    Known minor issues: 1) Hint messages fade out a bit too fast; 2) When you beat the Samba GP course and the continue screen shows up, it may go to the main menu if you pick "Quit". But if you pick "Continue" and exit through the pause menu, you'll be back in Station Square.

    If anyone is planning to recreate more DLCs, I'd suggest naming the DLLs like the original DLC downloads (e.g. SONICADV_001 or SONICADV_510). I've implemented a check in this mod that detects if such DLLs are loaded and disables the code for compatibility. I intend to use this check in the future to avoid compatibility issues when several DLCs are loaded at the same time.

    EDIT: Interesting coincidence. The server with the mods went down minutes after I made this post. Here's an alternative download link.
  5. Speeps


    Well that's great. If you've got "Thing that may or may not say something after being touched" down you shouldn't have too much trouble with about 90% of the DLCs.

    Are there any plans on making English versions of the Japanese-only packs? My girlfriend translated them all a while ago if that's the case.
  6. PkR


    SADX Dreamcast Conversion, The Emeralds' Awakening
    I'm actually a part-time translator, but thanks for the offer :v:
    I want to do some of the fun ones like Christmas and Halloween, the competitive ones are more tedious and I'm not sure whether I would implement them as missions (which is likely gonna be a pain) or make them work independently without the timer, like the Samba GP mod.
    I'm currently running a poll to see what DLCs people are interested in, so you can vote if you want to see something in particular.
  7. azureinferno


    That definitely sounds like it would be cool if someone figured out how to pull it off. How many blocks did the PSO custom quests usually take up - did people manage to figure out how to add new models into the game? The page for SA1DC DLC on the main wiki shows that most of the DLC files took up 20-25% of the space on a regular VMU, and the first Christmas one takes up nearly 45% of the usual 200 block limit.
  8. Diablohead


    Indie dev Oldbie
    Near London
    That's great, I always felt bummed out about not being able to play the dlc tracks because I never kept the downloaded vmu files back in the day (even though I have like 11 vmu's)
  9. azureinferno


    If anybody is wondering - yes, it IS possible to kill a Chaos Chao in SA1DC by allowing its HP to reach zero. As if it wasn't already easy enough to kill Chao in this game.

    I've heard that the original Chao A-Life system used in SA1DC differs immensely from the future versions, but this stuff is all so weird. It doesn't look like the glitch that allows you to reuse animals or Chaos Drives works in the Dreamcast version, as a Chao's interactions with animals and fruit are all based on contact and can even do so while sleeping (which immediately awakens them). Big and Gamma appear to be generally incapable of giving Chao fruit and animals unless they are in the middle of placing them down due to their size - I don't think they have this problem in SADX, much like Eggman in SA2/SA2B.

    While I haven't seen it work with animals yet, it's possible to stockpile a truckload of coconuts within minutes and force feed a Chao all of them one by one simply by pushing one into the other because of these factors. If a Chao is in contact with a fruit, it appears it will immediately attempt to consume it. You can pretty much bypass the whole four fruits equals immediate sleep thing easily this way, especially if you can keep pushing more fruit into the Chao. Take a newborn, stick a dozen or so of these things into it and it'll evolve almost instantaneously. A Chao that gets hit by a falling coconut will often eat its assailant upon impact, which should alleviate the HP loss it takes.

    The Mystic Ruins and Egg Carrier gardens are absolute messes in the Dreamcast version. In the former, Chao frequently spawn in places where they're either unreachable or seemingly stuck within the area's geometry and it's even easier to kill yourself on this version than it is on SADX. You can throw Chao off the edge, but they won't despawn like fruit or animals. In the latter, the positioning of the entrance teleporter and the platform it rests on combined with the way animals behave will cause them to run into the nearby sea or underneath the platform within seconds, leaving most of them unable to be given to Chao as they very quickly bypass the rather small player confines and swim much further away. Going underneath the platform causes your character to completely spaz out, and at the very least Big frequently starts looping into his landing animation and becomes fun to control when he gets near most of the decorations on the sand.

    The more I experience the SA1DC Chao Gardens, the more it occurs to me that SADX seems like it uses some unholy combination of the SA1 and SA2 Chao systems and animations. Petting isn't present in SA1DC (all three action buttons pick up/put down Chao while Y won't execute attacks), which might explain why petting a Chao in SADX does next to nothing most of the time. Reminds me why I don't get why they didn't try to redo the game's animation issue-riddled cutscenes for DX and try do what they did for SA2's cutscenes. Then again, it's not like they rectified the NPCs' arbitrary models and polygons either.

    The game doesn't appear to attempt to load Chao Adventure onto a VMU if something like Chao Editor is already loaded onto it, but does end up loading the Chao onto the .VMS file. Maybe that's just because of a VMU minigame limit, but I want to try load another minigame onto a VMU and then see what happens if a Chao is then deposited into it - if it'll work provided there's enough space, if the resultant .VMS is Chao Adventure's, and if so which minigame takes priority on the VMU's minigame icon (which I can't test as I don't have a physical Dreamcast and VMU). It's easy enough to load the .VMS files onto a VMU .BIN with VMU Explorer, but the emulation is something else. Dream Explorer apparently tends to act iffy with NullDC, I have no clue on how to run the computer version of SoftVMS, and ElysianVMU currently isn't capable of saving onto .VMS files.
  10. PkR


    SADX Dreamcast Conversion, The Emeralds' Awakening
    Y2K DLC recreated in SADX
    Please enable only one DLC mod at a time, otherwise they won't load.
    The rings are in the same locations as in the Dreamcast game. I've recreated all ring positions/rotations manually, so it isn't 100% accurate to the original, but still very close.
    I used this video as a reference, so the mod contains all rings shown in the video + one more in Sonic's Final Egg 1 which the author seems to have missed.
    Rings spawn in all Action Stages except Speed Highway 1 (Sonic), Casino 1 (Sonic) and pinball stages, Lost World 3, Ice Cap 2 and Final Egg 3 (Gamma). There are also no rings in minigames, boss battles and Adventure Fields except Station Square (main area only). Windy Valley 1 and Red Mountain 2 have unique ring placements for Sonic and Gamma's versions of the stage. Same for Lost World 2 as Sonic/Knuckles and Final Egg 1 as Sonic/Amy. Let me know if you find any rings in the original game that aren't in the mod.
    Have fun!
  11. Turbohog


    This is pretty neat! It's cool to have an easy way to play some of the original DLC. Great work as always PkR.
  12. Blue Spikeball

    Blue Spikeball

    Good job! :thumbsup: I've been contemplating attempting to port the DLC but never got around to it. Nice to know someone else is willing to do it. That way I don't have to ;)
    (Not to mention that I don't even know if I would have been able to. I'm not very savvy on editing and porting of SADX objects :v:)

    Two questions about the Y2K DLC:
    1) What's the reason the rings had to be manually placed? Is it that the data in the DLC files is still not fully understood, so it's currently unknown where the rings' position values are located?
    2) Would it be possible to make the rings solid like in the Dreamcast version?
  13. PkR


    SADX Dreamcast Conversion, The Emeralds' Awakening
    Both I guess? I looked through the binary and found a bunch of floats, but they didn't make much sense as coordinates or rotation values. So it was easier to just do it all manually rather than figure it out.
    The ones placed on the ground are solid, but for the ones rotating in the air I disabled collision on purpose. They're very glitchy even in the original, it's nearly impossible to touch them as Gamma for example.
  14. Blue Spikeball

    Blue Spikeball

    I see. Perhaps it would be possible to get the rings' positions by running the DLC in a Dreamcast emulator and looking at the memory?

    Failing that, I could try finding all rings in the Dreamcast version to see if there are any missing ones. I was planning to re-play the SA1 DLC challenges sometime anyway, so I guess this is as good a time as any to search for the Millennium Rings again.

    In that case, may I request an alternate version that keeps all rings solid like in the original? For me, part of the fun was standing on top of the rings as Sonic and exploiting their curvature with the Spindash to reach high places :v:

    Unrelated, but here's a bug report about the Enhanced Emerald Coast mod: The distortion effect in the sea looks glitchy, as only a section of it tends to get distorted. Beyond a certain point, the sea is unaffected by it, resulting in a gap.
  15. PkR


    SADX Dreamcast Conversion, The Emeralds' Awakening
    Maybe. This isn't something I'd be interested to do, but if you end up finding anything please post here because it may help with figuring out the other DLC stuff.
    Assuming you have Visual Studio and everything, you can disable the if condition by commenting out or deleting lines 183, 184 and 189 in Y2K.cpp. That will make all rings solid.
    This is just the way the original wave effect works, which I described here in the part about enhancements. It's actually a bit better than in SA1 now because I used a few UV workarounds to make the ocean look less jittery, also in my implementation the "big" ocean doesn't disappear behind Sonic during the wave effect, and when it ends there is no visible model swap. The gaps, however, are still there because the high-poly ocean model is small and doesn't connect with the rest of the ocean. Other than remodeling the high-poly ocean and rewriting the code for the whole thing the only "fix" I can think of is using vertex welding, the same way body parts are connected in character models. However, I know next to nothing about that stuff.
  16. Rudie Radio Waves

    Rudie Radio Waves

    Many a game.
    I have an issue to report: SADX crashes while selecting a menu option. I ran the game executable as admin, and the following message popped up:

    (I translated the Italian parts of the error message)

    Code (Text):
    1. Le informazioni su come richiamare il debug JIT (Just-In-Time) anziché questa finestra
    2. sono riportate in fondo al messaggio. ("the information on how to call back the JIT debug instead of this window is shown at the bottom of this message")
    4. ************** Testo dell'eccezione **************
    5. System.InvalidOperationException: Errore di WaitForInputIdle.  È possibile che il processo non abbia un'interfaccia grafica. (WaitForInputIdle error. It's possibile the process may not have a graphic interface.)
    6.    in System.Diagnostics.Process.WaitForInputIdle(Int32 milliseconds)
    7.    in SADXModManager.MainForm.saveAndPlayButton_Click(Object sender, EventArgs e) in E:\AutoBuild\sadx-mod-loader\SADXModManager\MainForm.cs:riga 798 (line 798)
    8.    in System.Windows.Forms.Control.OnClick(EventArgs e)
    9.    in System.Windows.Forms.Button.OnClick(EventArgs e)
    10.    in System.Windows.Forms.Button.WndProc(Message& m)
    11.    in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    12.    in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    13.    in System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    16. ************** Assembly caricati **************
    17. mscorlib
    18.     Versione assembly:
    19.     Versione Win32: 4.7.2114.0 built by: NET47REL1LAST
    20.     Base di codice: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
    21. ----------------------------------------
    22. SADXModManager
    23.     Versione assembly:
    24.     Versione Win32:
    25.     Base di codice: file:///C:/Users/Michele/Desktop/sadx/Sonic%20Adventure%20DX/SADXModManager.exe
    26. ----------------------------------------
    27. System.Windows.Forms
    28.     Versione assembly:
    29.     Versione Win32: 4.7.2114.0 built by: NET47REL1LAST
    30.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    31. ----------------------------------------
    32. System
    33.     Versione assembly:
    34.     Versione Win32: 4.7.2114.0 built by: NET47REL1LAST
    35.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    36. ----------------------------------------
    37. System.Drawing
    38.     Versione assembly:
    39.     Versione Win32: 4.7.2114.0 built by: NET47REL1LAST
    40.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    41. ----------------------------------------
    42. System.Configuration
    43.     Versione assembly:
    44.     Versione Win32: 4.7.2053.0 built by: NET47REL1
    45.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    46. ----------------------------------------
    47. System.Core
    48.     Versione assembly:
    49.     Versione Win32: 4.7.2114.0 built by: NET47REL1LAST
    50.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
    51. ----------------------------------------
    52. System.Xml
    53.     Versione assembly:
    54.     Versione Win32: 4.7.2114.0 built by: NET47REL1LAST
    55.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    56. ----------------------------------------
    57. Microsoft.GeneratedCode
    58.     Versione assembly:
    59.     Versione Win32: 4.7.2114.0 built by: NET47REL1LAST
    60.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    61. ----------------------------------------
    62. System.resources
    63.     Versione assembly:
    64.     Versione Win32: 4.6.1055.0 built by: NETFXREL2
    65.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.resources/v4.0_4.0.0.0_it_b77a5c561934e089/System.resources.dll
    66. ----------------------------------------
    67. System.Windows.Forms.resources
    68.     Versione assembly:
    69.     Versione Win32: 4.6.1055.0 built by: NETFXREL2
    70.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_it_b77a5c561934e089/System.Windows.Forms.resources.dll
    71. ----------------------------------------
    72. mscorlib.resources
    73.     Versione assembly:
    74.     Versione Win32: 4.6.1055.0 built by: NETFXREL2
    75.     Base di codice: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_it_b77a5c561934e089/mscorlib.resources.dll
    76. ----------------------------------------
    78. ************** Debug JIT **************
    79. Per abilitare il debug JIT, è necessario impostare il valore
    80. jitDebugging nella sezione del file di configurazione
    81. dell'applicazione o del computer (machine.config).
    82. L'applicazione inoltre deve essere compilata con il debug
    83. abilitato.
    85. Ad esempio:
    87. <configuration>
    88.     < jitDebugging="true" />
    89. </configuration>
    91. Quando il debug JIT è abilitato, tutte le eccezioni non gestite
    92. vengono inviate al debugger JIT registrato nel computer,
    93. anziché essere gestite da questa finestra di dialogo.
    Does this have anything to do with the DS3 controller I'm using? For reference, here's a list of the mods I'm using:

    Code (Text):
    1. Mod1=SADXFE
    2. Mod2=input-mod
    3. Mod3=sadx-dc-lighting
    4. Mod4=adx music
    5. Mod5=DC_Bosses
    6. Mod6=DC_Casinopolis
    7. Mod7=DC_EggCarrier
    8. Mod8=DC_EmeraldCoast
    9. Mod9=DC_FinalEgg
    10. Mod10=DC_General
    11. Mod11=DC_HotShelter
    12. Mod12=DC_IceCap
    13. Mod13=DC_LostWorld
    14. Mod14=DC_MysticRuins
    15. Mod15=DC_Past
    16. Mod16=DC_RedMountain
    17. Mod17=DC_SkyDeck
    18. Mod18=DC_SpeedHighway
    19. Mod19=DC_StationSquare
    20. Mod20=DC_SubGames
    21. Mod21=DC_TwinklePark
    22. Mod22=DC_WindyValley
    23. Mod23=OptionalMods\\Cowgirl
    24. Mod24=OptionalMods\\RevertECDrawDistance
    25. Mod25=OptionalMods\\TrainDaytime
    26. Mod26=SETFixes
    27. Mod27=SoundOverhaul
    28. Mod28=ECGardenOceanFix
    29. Mod29=OptionalMods\\DisableSA1Titlescreen
    30. Mod30=HD_DCStyle
    31. Mod31=DisableUpgradeModels
    32. Mod32=DC_Branding
    Thank you in advance.
  17. Dark Sonic

    Dark Sonic

    Working on my art!
    It's possible you didn't update the dll file associated with the lantern lighting mod. I know that caused the game to crash on me under similar circumstances.
  18. MainMemory


    Kate the Wolf Tech Member
    That error message only means the mod manager timed out while waiting for the game to get properly started, it has no relation to why the game crashed.
  19. Rudie Radio Waves

    Rudie Radio Waves

    Many a game.
    Yeah, I think updating the dll is what fixed it.

    Oops. Sorry about that.

    Thank you both!
  20. PkR


    SADX Dreamcast Conversion, The Emeralds' Awakening
    You might want to remove DisableSA1TitleScreen and Casinopolis Cowgirl since those do nothing now. You can toggle the SA1 title screen and the cowgirl via config.ini in DC_Branding and DC_Casinopolis folders.
    Also HD GUI should be listed after DC Branding. With your current mod order a lot of HD textures are being replaced by Dreamcast resolution textures.