SADX/SA1 Hacking/Modding

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

  1. Dude

    Dude

    Tech Member
    3,137
    0
    0
    Southbridge, MA
    Random VR/AR trash
    Well, no one has offered to help us, so we haven't made much progress. I had something that was almost generating useful strip data from within SADXLVL, but due to a source control mistake I accidentally blew away that version. It actually seems more likely to me for an experienced d3d hacker to add support for new model types than it would be for us to get the originals working with full support.

    However, to answer your question, having this would only mean that we can implement more complex models without the game slowing down. You may have noticed that in some areas of beta windy valley act 1 (specifically the part near the stairs) the game tends to get kind of slow. In SADX you can already import just about whatever you want, it's just importing the models in the most wasteful way possible. In sa2 however, that wasteful method of importing is no longer supported.

    Actually, if we do manage to get a custom model format implemented, we could use a hybrid solution:
    - visual models with strips imported with the custom format
    - collision models imported from STRIPE/HTGEN output

    This would make the levels have twice as many models, however each model exported would be as efficient as it could be. Considering that most modern games force this dichotomy between visual and collision meshes and I don't think it's the worst solution.
     
  2. Pexs

    Pexs

    Otherwise known as Spex Member
    Oh. I just remembered. The source for Brawlbox and Fiachra's SM64DSE (Super Mario 64 DS Editor) both use Tristrips.

    In case you wanted examples, or something. Fiachra usually hangs out on the Kuribo64 forums (mostly focused on Mario game hacking). Brawlbox has been handled by quite a few coders, namely Kryal, Bero, Blackjax96, LibertyErnie, and SammiHusky. Blackjax and Sammi (who are the ones I'd recommend asking, if you ever need to ask for help) usually hang out on the KC-MM forums (mostly focused on Super Smash Bros. Brawl hacking). Blackjax himself would probably be best to ask to port code for you, but there's a fair chance he wouldn't. In any case, asking can't hurt, right?
     
  3. SF94

    SF94

    Tech Member
    775
    2
    18
    Utah
    SA1/2 hax
    While working on porting my changes in SADX Fixed Edition back over to the PC SET files, I realized SADXLVL2 doesn't retain the "clip" setting for each individual object upon save, thus nullifying one of the primary reasons for porting my changes over. Fortunately, I fixed that, and fixing the SET files won't be much of a problem with SADXLVL2's features. That's only related to what I figured out, though.

    The "clip level" in the config file isn't just a clip level. It flat out permanently hides certain objects as opposed to changing the distance at which they're displayed. So I went through all of the commonly used values (as far as I know) in Emerald Coast, and they appeared to be 0x00, 0x10, 0x20, and 0x80.

    When the clip value is 0x00, the object is always displayed. At 0x10, the object is only displayed on the furthest clip level ("high"). At 0x20, the object is displayed at the medium clip level and high, and at 0x80, the effect is the same as 0x00. Anything above 0x80 (128) will hide the object from all configurations. In terms of the effect in-game, in-between values round down to the lowest boundary (0x11 -> 0x10). Here's some images illustrating that:

    EDIT: It honestly could be that these are "flags", but as far as I've seen throughout Sonic Adventure, there are no other flag values used other than the ones I specifically mentioned. Maybe they were used for debug mode stuff.

    In each image, there are 6 item capsules, but not all of them display.

    High (cliplevel=0 in sonicdx.ini):
    [​IMG]

    Medium (cliplevel=1 in sonicdx.ini):
    [​IMG]

    Low: (cliplevel=2 in sonicdx.ini. You can also see it does more than just adjust the draw distance; look at the windows!)
    [​IMG]

    Figured this might be useful to somebody, as well as function partially a SADX:FE progress report. Some interesting stuff is afoot.
     
  4. muteKi

    muteKi

    Fuck it Member
    7,573
    2
    18
    Yeah, that's definitely the case; check out the fire hydrants in At Dawn on lower clip levels. (Actually you can't -- they don't show up!)
     
  5. ShadowBlitz

    ShadowBlitz

    Member
    12
    0
    1
  6. Woofmute

    Woofmute

    Y and -Y and XYZ-X-Y-Z. Member
    184
    0
    16
    Hacking and researching Rez.
    Found a new little thing in the initial Japanese release of Sonic Adventure.
    These are addresses in RAM. (Use 2C instead of 8C for Demul and Cheat Engine)

    Code (Text):
    1. 8C84F4C4 Current Menu ID
    2. 8C84F4C8 Previous Menu ID
    3. 8C84F4D4 Hedgehog Hammer title when 01 (nothing else)
    4. 8C84F4D8 Next Menu ID
    5.  
    6. 00 TGS Mode
    7. 01 Char Select
    8. 02 File Select
    9. 03 Trial Mode (Sub Game?)
    10. 04 VMU Select
    11. 05 Sound Test
    12. 06 Title
    13. 07 Main Menu
    14. 08 Options Menu
    15. 09 "Game Bug" screen
    16. 0A Trial Mode (Levels?)
    17. 0B TGS Mode
    18. 0C TGS Mode
    19. 0D Normal loading screen
    20. 0E Black screen
    21. 0F Black screen
    22. 10 Black screen
    23. FF TGS Mode
    24.  
    The "Game Bug" screen isn't something I've seen before.

    [​IMG]

    Currently, pressing A, B, X or Start takes you to the character select screen. And that's all I've found with it.
    Other controllers don't seem to have any affect on this.

    And again, TGS mode seems to use a different location in RAM for it's menu ID's. I want to figure this out because it might lead to finding more menus in the Autodemo.

    EDIT:

    Code (Text):
    1. 8C7A97D0 TGS Menu ID
    2. 8C7A97E8 Title Timeout Countdown
    3.  
    4. 00 Dev Level Select
    5. 01 Title
    6. 02 Now Loading
    7. 03 White Loading to 09
    8. 04 White Loading Screen
    9. 05 White Loading to 10
    10. 06 White Loading Screen
    11. 07 White Loading to 10
    12. 08 Now Loading
    13. 09 Character Select
    14. 0A Goes to 00
    15. 0B Goes to 00
    16. 0C Station Square
    17. 0D Chao Garden SS
    18. 0E Goes to 00
    19. 0F Black loading to title demos
    20. 10 Tutorial 1
    21. 11 Tutorial 2
    22. 12 Goes to 00
    23. FF Goes to 00
     
  7. SF94

    SF94

    Tech Member
    775
    2
    18
    Utah
    SA1/2 hax
    SA Tools (but mostly SADXLVL2) update!

    Funny story. So back before SADXLVL required you to split all of the data out of SADX, a majority of the objects in most stages displayed (e.g rings, dash panels, etc). I initially set out to get those same objects displaying in SADXLVL2, but I got a little sidetracked...

    New SADXLVL2 features:
    • A new "Quick Start" dialog has been implemented which displays all your recent projects. It opens at startup, although it isn't yet configurable.
    • A new level select dialog also opens immediately after that. It is a level editor, after all.
    • When importing, exporting, saving, or loading a stage, a progress dialog is displayed instead of the whole program just hanging until it's done.
    • When importing any models, assuming your texture names match those inside the PVM, the textures will be automatically assigned to the materials for those models.
    • When any object (that doesn't have a code file) fails to load a model or a texture, the program will log those objects and tell you what's wrong instead of just throwing an exception.
    • Many of the objects that displayed in the old SADXLVL now display in SADXLVL2, albeit not entirely correctly (as some require code files, and this is where I got lazy).
    • Camera pan, zoom, object translation and transformation speeds can all be adjusted by pressing + or - on your numpad.
    • You can import multiple models (OBJ, nodetable) simultaneously.
    • You can change character item layouts by pressing Control+Tab, Control+Shift+Tab, or by clicking their icons on the upper right of the window.
    • When editing materials, you can cycle through all the textures in the material by pressing Control+Tab or Control+Shift+Tab.

    Bug/efficiency fixes:
    • Significantly increased performance by enabling hardware processing and not re-drawing the scene twice because there's a gizmo onscreen :v:
    • You can now resize the window and retain the ability to click on things in the scene.
    • All changes made in the material editor now display in the scene immediately upon change.
    • When changing the texture in a material using the material editor, the currently assigned texture is selected so you know where you are, so to speak. This feature has been around for a while, but it was left incomplete--I just cleaned it up and got it working.

    General SA Tools changes:
    • Changed directory structure of split objects and such. If you update SA Tools in an existing project, you will need to re-split.

    I feel like I'm forgetting something. Either way though, I'm still working on things, so expect bugs (or debugging features I forgot to remove), but also more features!

    Download here
     
  8. ShadowBlitz

    ShadowBlitz

    Member
    12
    0
    1
    Oh man, I really do have to mess with this later. The multi .obj import makes some things I was doing a lot more convenient and the other changes sound very, very nice.

    But am I the only one who gets a corrupted SA Tools.7z though? It could just be me, but it doesn't seem to open/extract with winrar or 7zip itself even. Regardless, when I'm done with exams this week I'll probably put some time into working on something or other with this.
     
  9. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,373
    43
    28
    SonLVL
    Sorry about that, my auto-build program crashed mid-upload. I re-ran it and everything should be fine now.
     
  10. SF94

    SF94

    Tech Member
    775
    2
    18
    Utah
    SA1/2 hax
    http://www.youtube.com/watch?v=97gYEfNPwwU

    Another one of those cases where I tried to understand a function but just ended up rewriting it :eng101: (see also: xinput mod)

    It's a lot of fun to play around with. It's really hard to get a lot of air time though, because everything is very much considered solid in SADX (For example: if you stand still and let animals force you to collect them, they actually will nudge you a little bit). In some cases (which show up in the video), hitting an enemy or capsule at just the right angle will send you ricocheting in some random direction. If I could fix that, maybe it'd work out better.

    I actually started working on this in SA2, and I could very likely complete that, but I don't think there are as many opportunities to use it in SA2 in comparison to SA1 as a whole... which isn't to say SA1 has very many in the first place.

    Related: This is part of the same hack I'm putting together. Did this a year and a few days ago.

    http://www.youtube.com/watch?v=XdOuI__K83k

    The layout was just so that I could test it out. But, water running! Fun!

    Edit: Curse you, />!
     
  11. SF94

    SF94

    Tech Member
    775
    2
    18
    Utah
    SA1/2 hax
  12. chaoscollector

    chaoscollector

    Member
    14
    0
    0
    Hey guys, fairly new at this! Used to hack the game years and years ago but have only just begun to do so again, though I'd start by checking out SA Tools and I'm sure this will be an incredibly simple answer but why do most models with custom PVMs appear transparent in SADXLVL2? I vaguely remember this happening in the original SADXLVL but I think I overcame it by just clicking a model (this would usually make its texture appear)
    Not necessarily urgently looking for a fix since I can always just use the original PVM and edit the level before the textures but just wondered why it happens? Thanks in advance!
     
  13. Dude

    Dude

    Tech Member
    3,137
    0
    0
    Southbridge, MA
    Random VR/AR trash
    screenshots?
     
  14. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,373
    43
    28
    SonLVL
    If I had to guess, either the tool you used to make your PVMs is buggy, or Puyo Tools (which SADXLVL2 uses to read PVMs) is buggy. Can you view the textures in PVMEditSharp (in SA Tools)?
     
  15. chaoscollector

    chaoscollector

    Member
    14
    0
    0
    [​IMG]
    Shows up like this!

    And Just gave it a try with PVMEditsharp, sure enough all edited textures came up transparent, which I'm assuming means the PVM tool was buggy right? This is a PVM from years ago I'm using so it wouldn't surprise me if that's the case!
     
  16. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,373
    43
    28
    SonLVL
    It really could be either one that's buggy. If the PVM shows up ingame, though, then we can assume that Puyo Tools is the buggy one. You may want to contact Yoshi 15 or file an issue on GitHub, including an example of a PVM that doesn't work.

    If you still have the old tools, you might be able to extract the textures and then import them into a new PVM with PVMEditSharp.
     
  17. chaoscollector

    chaoscollector

    Member
    14
    0
    0
    Unfortunately I don't still have the old tools! I think I'll try making a new PVM when I've got the time using PVMEditSharp (I'm not too bothered about keeping this old one) and see if that displays okay in SADXLVL2, thanks for your help!

    EDIT: Does anybody happen to know if I can export a single object using SADXLVL2? I've only figured out how to export an entire level so far, I'm trying to get the boat from casinopolis exported as a .obj file?
     
  18. Strife

    Strife

    Member
    1,918
    20
    18
    United States
    Freedom Planet 2
    I'm having trouble getting Sonic's version of Speed Highway to work with Tails. I took the following files:

    CAM0400S.BIN, CAM0401S.BIN, CAM0402S.BIN, CAMMI0402S.BIN, PRMMI0400S.BIN, PRMMI0401S.BIN, PRMMI0402S.BIN, SET0400S.BIN, SET0402S.BIN

    And replaced the S at the end of the filenames with M. This successfully loads Sonic's object and camera data, but the helicopters that normally appear for him are missing and the transition to the second area doesn't work. (When Tails reaches the building where this normally takes place, it's a dead end.) Is there something I missed?

    Notably, doing this same trick for the other stages that Tails plays through has been successful; By borrowing Sonic's layout files and modifying the .exe to have him start in the first Act, he can play through his first four stages exactly as Sonic would.
     
  19. Dude

    Dude

    Tech Member
    3,137
    0
    0
    Southbridge, MA
    Random VR/AR trash
    No, the level transition triggers aren't part of the object layout (usually). They're hard-coded. If you go through the disassembly though, you could look at the speed highway code and patch that.
     
  20. Strife

    Strife

    Member
    1,918
    20
    18
    United States
    Freedom Planet 2
    Ah, I thought that might be the case. If I get bored someday, maybe I can try to figure out where it says that the trigger only exists for Sonic and make it render for all characters instead.