don't click here

How To: Edit SADX Object Layouts

Discussion in 'Engineering & Reverse Engineering' started by Harmony Friends, Dec 27, 2008.

Thread Status:
Not open for further replies.
  1. Harmony Friends

    Harmony Friends

    it's the whole gang Oldbie
    Dude has passed on some tricks of the trade to me in order to edit the object layouts... the basic information is on the wiki, but without a cohesive tutorial, it's confusing to most people. So grab your hex editors, kids, and let's get hacking!

    Tools You'll Need
    a hex editor (I use Hex Workshop)
    Cheat Engine


    ----------------------------

    I Can Has Find The Level Layouts?
    Level layouts are stored as .bin files in the /system/ directory of the SADX folder. They're always in a specific format. Refer to this section of the wiki to find the file you want to edit.

    Once you've got your file, open it with your hex editor. Now... I want you to blank it. (Make a backup first.) We'll add new objects instead.

    ----------------------------

    How Does I Has Place Objects?
    Now, the object format. Every file starts with a 32 byte (20 in hex) header in the following format, where red is an unsigned long containing the total amount of objects in the level.

    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


    (If you ever forget the amount of objects, take the offset of the very last object, divide in hex by 20, and convert to decimal.)

    Then, each object takes this format:

    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


    The first byte is the object type. You can find what byte corresponds to each object here.
    You can leave the next byte alone.
    This unsigned short is the X rotation of the object in BAMS (Binary Angle Measurement System).
    This unsigned short is the Y rotation of the object in BAMS.
    This unsigned short is the Z rotation of the object in BAMS.
    To convert from degrees to BAMS: (degrees * 182) = BAMS.
    This float is the X position of the object.
    This float is the Y position of the object.
    This float is the Z position of the object.
    This section is for the object's specific properties. Refer to later in this guide to set these. This section does not apply to most objects.

    So, now that we've got that business out of the way, let's get to actually placing objects. Open up SADX and put the focus on it in Cheat Engine (click the little rainbow bordered icon in the upper left). Now, click "add address manually" and add these values:

    Sonic X - 03B2CAB0
    Sonic Y - 03B2CAB4
    Sonic Z - 03B2CAB8

    Now, start a level in SADX and play around. You'll notice the values changing. Move Sonic (or whatever char) to the position you want to place your new object at. Pause the game, and paste the values from Cheat Engine into the floats I specified earlier. Save, and then quit/start the level again, and voila! Your object is there.

    ----------------------------

    I'm In Ur Base, Editin Ur Advanced Objects

    Item Box:

    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


    Change this float to a specific type for each item box. For the list of item box types, go here.

    ----------------------------

    Jump Pad:

    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


    This float is the number of the jump pad (1-5, 0 is end).
    This float is the number of the destination jump pad (2-5, 0 is end).

    ----------------------------

    Rocket:

    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


    This float is the X coordinate of the rocket's destination.
    This float is the Y coordinate of the rocket's destination.
    This float is the Z coordinate of the rocket's destination.

    ----------------------------

    Special Thanks
    DUDE. He taught me everything I know about SADX hacking. If it wasn't for him, this guide doesn't exist.
    Sega, for making such hackable games. :)

    ----------------------------

    Does this make everything more clear for people? I hope now that this info is out there, people will go out and start making their own real SADX hacks. If you need anything clarified, post and I'll help you out. Peace out!
     
  2. Thanks, although I have no plans to hack SADX yet, this will be helpful. Did you put this on the wiki yet? :)
     
  3. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.
    Much better guide than mine. Good job.



    Feel free to replace mine on the wiki with that.
     
  4. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
    I bet the object type is 16-bit and since all types are under 256 the second byte is always 0. Am I right?
     
  5. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    No, but you'd be right about all the object types being under 255.

    The second byte is interpreted differently depending on the object, and its usage is fairly unclear, but I've noticed that it *usually* is a 'detail level' flag, so that if you turn the clip level down, certain items won't be drawn. Its so that slower PCs have less objects to render.

    Also: Bad hinchy, the object parameters are always floats. ALWAYS! Even with the item box. Change that or I will =P

    Also #2 - I've wanted to make my own object editor tool for awhile now, but I lack the programming skill to do the whole thing myself. I've seen one or two editors out there, but they were either crappy or impossible to find. So I'd like to collab with a programmer to make an editor program that doesn't suck, and to make the workflow faster.Perhaps even one with a 3d renderer that can import obj files? I could assemble level rips so people wouldn't have to walk everywhere to get their coordinates. And so you could also associate a model with an object type.
     
  6. muteKi

    muteKi

    Fuck it Member
    7,850
    131
    43
    Ah, right! Some things that come to mind for me in this regard are like fire hydrants or whatever in the final part of Speed Highway.
     
  7. Sintendo

    Sintendo

    Member
    249
    0
    16
    I might start working on a very basic editor. My programming skills are fairly limited though, so it'll probably just have a very basic UI and someone else will have to do the 3D renderer and stuff. I'd rather see someone who knows what he's doing make one, though.
     
  8. Harmony Friends

    Harmony Friends

    it's the whole gang Oldbie
    Fixed, thanks for the tip off.
     
  9. flarn2006

    flarn2006

    Member
    280
    3
    18
    If you just want to play around with the different objects, this is for you.
     
  10. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.

    Not really, it crashed every 2 seconds, doing it in SADX for the PC is much easier.


    Also that needs a modded gamecube, it doesn't run well emulated, crashed 99% of the time.
     
  11. Azu

    Azu

    I must be stupid. Member
    What do you mean convert the values to float?

    This?
    3041.9853515625
    -1159.99450683594
    720.708190917969
     
  12. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    Convert what values to floats? What are you trying to do?
     
  13. Azu

    Azu

    I must be stupid. Member
    I want to place an Rocket pad.

    "Sonic X - 03B2CAB0
    Sonic Y - 03B2CAB4
    Sonic Z - 03B2CAB8

    Now, start a level in SADX and play around. You'll notice the values changing. Move Sonic (or whatever char) to the position you want to place your new object at. Pause the game, and paste the values from Cheat Engine into the floats I specified earlier. Save, and then quit/start the level again, and voila! Your object is there."

    What does that mean?
     
  14. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    yeah, but you shouldn't need to convert anything, the data inspector in hex workshop should do that for you.

    see the 4 bytes in the outline earlier that color match to "This float is the X position of the object" ? put the value of "Sonic X - 03B2CAB0" in there, and likewise with the y and z coordinates
     
  15. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.
    It's the red, green, and blue highlighted bytes. Select them, and copy/paste the value from cheat engine into the value as a float.(The r,g,b that is 4 bytes long each.
     
  16. Diablohead

    Diablohead

    Indie dev Oldbie
    1,898
    87
    28
    Near London
    games
    You're puzzled about the bold part? Cheat engine can show lots of runtime values and all that, dunno how to set it up for this though.
     
  17. Azu

    Azu

    I must be stupid. Member
    Okay, nothing appears. I tired to add a rocket and there's nothing here.

    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0E 00 00 00 E6 B2 00 00 45 10 DD 50 C4 A3 20 00
    44 44 D2 35 45 94 6E 4A C4 E7 D7 23 45 62 D0 75
    I'm editing Speed Highway.
     
  18. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    Don't know where those coordinates are but um... why are you trying to rotate the rocket? They rotate themselves.

    Try this for your object... if this doesn't work, then you're placing it out in the middle of nowhere. I didn't check the coordinates.

    Code (Text):
    1. 0E0000000000000010DD50C4A320004444D23545000000000000000000000000
     
  19. Azu

    Azu

    I must be stupid. Member
    Should be here.
    [​IMG]
    [​IMG]

    And two questions, is there 100% save file? And what's with the camera? Is always pointed at Sonic's feet, even in Free camera mode. I'm using a PS2 controller.
     
  20. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    Ah I kinda suspected you'd be using long ints instead of floats - where your coordinate data types in cheat engine say '4 bytes', double click and change to 'float'. Then you should have a useable result.

    Also, make sure you set your line length in hex workshop to 32 (0x20). That'll make it so that each line is a new object, and one object per line.
     
Thread Status:
Not open for further replies.