don't click here

Well, here it is folks.

Discussion in 'Engineering & Reverse Engineering' started by Dude, Sep 23, 2004.

  1. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    Version 3.
    *digs out pages of hand-written notes* boy, this one is gonna be a long haul. Anyway, lets get crackin.

    Part 1 : The Format

    All objects are stored in binary files in the game's /system dir. ALL object files start with "set" and the number/letter code afterward, which I will touch upon later.

    Here's the outline of the format.

    // Block 1 : The header
    // The file is split into "object definition" blocks, each totaling $20 (0x20/32 dec) bytes
    // The header simply states how many blocks are to be read. This is an important
    // Value, and is quite versatile.
    longword objectnum; // Defines howmany blocks to read
    void null; // Covers the reast over the header, 20($1C) bytes long, and fills the restt
    // of the block

    // Part 2 : Definitions
    // Each "block" ($20/32 dec bytes afterward) defines all of the properties for ONE
    // object that is to be placed in the level.
    byte type; // Determines what kind of object to place
    byte null; // nothing
    byte null; // nothing
    byte xrot; // Object's x-rotation
    byte null; // nothing
    byte yrot; // Object's y-rotation
    byte null; // Nothing
    byte zrot; // Object's z-rotation
    float xpos; // Object's x-position
    float ypos; // Object's Y-position
    float zpos; // Object's Z-position
    float attrib1; // Misc. attribute/flag. Dependant on type;
    float attrib2; // Misc. attribute/flag. Dependant on type;
    float attrib3; // Misc. attribute/flag. Dependant on type;

    Part 3 : Tricks
    The objectnum value is quite actually quite versatile, contrary to what one may think. Remember, the game will ONLY read how many objects you tell it to. So you can decrease the number, and objects will be removed (in inverse order, starting with last object first), without having to delete the data. You can utilize this to test and see where an object file is crashing, or add text/data to the end of the file, either to store old builds, or just add an easter egg for the more technically inclined user.

    Part 4 : Getting values
    While typing in random numbers is GREAT if you're a masochist, most of us normal developers prefer to get their numbers from the game itself. There are 2 ways to do this. The first, and easiest, is to become acquainted with a memory editing/viewing package (read : I use cheat engine for this), and refrence the adresses :

    03B2CAB0 (x-position of character)
    03B2CAB4 (y-position of character)
    03B2CAB8 (z-position of character)
    (all floats)

    These adresses will always display the user's current position in a level.

    Another method I'm looking into, is ripping an obj file from either the DC geometry file, and finding the coordinates in a model editor, or doing the same, but from sonic.exe
    One last thing you'll need before you can sucessfully edit a file, is a list of availiable/working object types. Fortunately for you, one of my ongoing projects, is to sequentially document the object types in every level. The project doesn't have its own homepage atm, but here's a temp place with some (outdated =P) lists.
    *clock*


    Part 5 : Final tips
    Before I close, I'd like to touch upon 2 final topics. One being the filenaming system the game uses, and the other being a short list of universal object types.
    In SA, filenames work in a fashion much like ths one :
    type/level/character.extension

    Types documented :

    CAM - Camera binary
    SET - Object binary

    Levels : Action Stages are numbered with the appropriate segment (level part) following suit immediately afterward. ALL FILENAME NUMBERS ARE DECIMAL VALUES. No matter how used you are to using hex values to designate levels during memory editing, the filenames are always decimal. No exceptions.
    Other levels (boss, adv, etc) are actually given a name, instead of being numbered.

    The character designations are one letter, as follows :
    A- Amy
    B - Big
    E - E102 Gamma
    K - Knucles
    M - Tails
    S - Sonic

    And the final thing for this guide, is the universal (or close to it) object types. These are USUALLY universal, but technically still level-specific. They're just the same for damn near all the levels. BUT, they are different (as proven by the final boss' object set)
    Said common types are as follows :

    00. Ring
    01. Spring
    02. Spring
    03. Dash Panel
    04. Spinning Spike Ball + Chain
    05. Falling Spike Ball
    06. Spikes
    07. Nothing
    08. Egg prison
    09. Switch
    0A. Plant
    0B. Dash hoop
     
  2. LOst

    LOst

    Tech Member
    4,891
    8
    18
    I have SADX if that's what this guide is for. I kinda gave up on the game after one time playing it.

    I don't like running around as Sonic on the streets among humans. That's stupid.


    If it had some kind of noclip cheat or level debug, I would give it more time, but right now I just feel that game should be left to die with the time.
     
  3. Rika Chou

    Rika Chou

    Tech Member
    5,276
    169
    43
    SA is the best of the 3-D game. Running around among humans isn't too stupid, as Dr.Robotnik is a human.

    Anyway, Great job, Dude! If I ever get into SA hacking I am sure this will come in handy.
     
  4. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    You can enable a noclip/debug collision hull rendering mode through memory editing. I'll grab the values and adresses in a sec.

    And yes rika, I agree. SA was the better of the new genre. I loved exploring in the adv field, the mayan influence, and the overall story, something that was new in a sonic game at the time.

    Oh, and if you want to enable debug mode, hotfix 03B29D08 to "1" of sonic.exe (full version, jpn and cracked exes. Dunno about the EU ones.) What this will do, is it will let you fly anywhere (use b to reset to spawnpoint, use x to fly up and down, and use the control stick to manuver on the x/z plane). All object-placed collision hulls will be rendered as semi-transparent multi-colored boxes. All objects stop moving, and some will revert to a "disabled" position. If you pass by certain objects, info about them is displayed in text format onscreen.

    [IMPORTANT EDIT]I just updated the object block - I accidentally missed and misnamed a few floats. Everything should be fixed now[/IMPORTANT EDIT]