Sonic the hedgehog 2

How to easily place an object by hex

Posted by Weird Person on May 21 2005.
I wrote this tutorial for Mac users... and Windows users. Why Windows users too if they have SonED? Simple, SonED can't change the Sprite Programming! (It can? I didn't found a option to do it.) So I had to change it by hex!

And That's another good thing in Placing a Object by Hex, you see in run-time how the Placed Object will work. That's a lot of help.
What you will need:

Sonic 2 Rom in Any format. (For Play)
Sonic 2 Rom in Binary Format. (For Edit)
Any Hex Editor.
Know about the Hexadecimal Base.
Know about the Debug Mode Cheat. (If you don't know, I'll say it.)

The Debug Mode Cheat is a Trick used to place a Object in the Field, To use this cheat you must do The following steps:

In Sonic 2 Options, Play The Songs 19,65,09,17.
Press Start.
When "1 Player" is selected, Press A button + Start.
You'll Enter the Level Select Screen.
In The Sound Test of Level Select Screen , Play the Date of Releasing of Sonic 2, err... I mean, play the songs 1,9,9,2,1,1,2,4.
(1992/11/24 , Funny no? It's the release date of Sonic 2.)
You'll listen the Sound of Sonic Collecting a Ring, Select a Level (The Level you're going to Edit.) and press A + Start.

To use the Debug Mode Cheat you have to do the Following:

Press B to select a Object to Place.
Press C to place the selected Object.
Press A to go to the next object.

I Hope you got it.

Next to the Score, There are many Hexadecimals values right? I Made a Picture for you understand It, so I'm not going to fell Guilty if you don't understand.



Piece of cake right? So, now edit!

First, Keep in Mind you're not creating a new object, you're replacing a object alredy placed by a new object (Sonic Hachelle-Bee alredy said how to place a new object... but here I'm only teaching how to replace objects.)

To Edit, It take 6 Bytes, the 1st Two are the X Position of The Object, And The 2nd Two Bytes are the Y position of the Object. (That's The reason of Debug Mode is Useful!) The 5th Byte is a reference to the ROM know what function use to The Sprite in The Sprite List Array.

Before I say the offset where you have to place all the stuff above, let's make a little exercise:

Play the Sonic 2 with the Debug Mode Cheat.
Now, Go to The Emerald Hill Zone and Stay in the Place of The following Picture:



Like you see, The Object is at $0228 and $027D.

Here's A list of offsets where you will edit: (I'll explain how to edit!)

Emerald Hill Zone:
$E684A until $E6B7A

Metropolis Zone:
$E6F34, $E73C0 until $E78EE (this one for both acts 3 and 4)

Wing Fortress Zone :
$E7F48 until $E82FC

Hill Top Zone :
$E8302 until $E8668

Hidden Palace Zone:
$E8C80 until $E8D94 (no objects)

Oil Ocean Zone:
$E8DA0 until $E9214

Mystic Cave Zone:
$E968E until $E99A0

Casino Night Zone:
$E9D1E until $EA3D8

Chemical Plant Zone:
$EA9D2 until $EAD6E

Death Egg Zone:
$EB230 until $EB254

Aquatic Ruin Zone:
$EB25A until $EB6A4

Sky Chase Zone:
$EBBDE until $EBD4C

These are the Offsets where the game will find the coordinates of where place and what place, the format is the Following: (each [] means a byte and each letter means an Hex value.)

[XX][XX][YY][YY][TT][SS]

The X means the X position of the Object, You alredy have it, Remember that value in Debug Mode?
The Y means the Y position of the Object, You alredy have it, remember that value in Debug Mode?

The T and the S means the Type and the Subtype of the object, these bytes are necessary for the game know what place, you don't have it right? okay, What we want place? a Red Spring for send Sonic up, The values are $41, (The Type) and $00 (The Subtype).

So, We have the X Position, The Y Position, The Type, The Subtype. What have to be do now? Insert these Values in the offset with the Array of the objects of Emerald Hill Zone! So Insert in the offset $E684A the values $0228 (the X Position),$027D (The Y Position), $41 (The Type) , $00 (The Subtype).

So... Edit the Run (and disable the emulator routine for the Checksum! otherwise you'll have Red Screen...) and run your ROM. What Happend? A Red Spring in a weird place in EHZ! Notice Coconuts (Above the Spring in that picture...) Disappeared, why? because it's the 1st object in the table of objects of Emerald Hill Zone, and He was replaced by that Red Spring.

Of course, probably Red Springs isn't everthing you want place, so I made a List of Types (and his respectives subtypes) for you test, look here for see a lot of objects that can be placed.

I'll add more objects, but I think you can do a lot with this list.


Back to: Sonic the hedgehog 2
Table of contents