Actions

Difference between revisions of "Sonic R/Technical information/Windows PC"

From Sonic Retro

(Additional info)
(Dumped my research of Sonic R's RAM values.)
Line 32: Line 32:
  
 
What this does is it disables the function calls to get the system time and replaces them with known values that are guaranteed to work on modern systems.
 
What this does is it disables the function calls to get the system time and replaces them with known values that are guaranteed to work on modern systems.
 +
 +
==RAM Locations==
 +
These values are absolute from base of RAM; a value of 0x400001 is equal to sonicr.exe+0x000001.
 +
 +
===Global Variables===
 +
{| class="prettytable"
 +
! Address || Data Type || Description || Notes
 +
|-
 +
| 0x501718||Word||Knuckles jump height||This and the next 3 are part of a set of variables that control how the
 +
 +
characters act. It's referred to by both the player and the AI (with the exception of turn speed).
 +
|-
 +
| 0x50172E||Word||Amy top speed||
 +
|-
 +
| 0x501731||Word||Amy accel||
 +
|-
 +
| 0x501734||Word||Sonic turn speed||
 +
|-
 +
| 0x504278||Dword||CD Check||1 if CD present, 0 if not. Largely useless after game boots.
 +
|-
 +
| 0x540064||Dword Pointer||AI RAM Location||Memory address of the current level's AI data (copied into RAM from
 +
 +
the AI file.)
 +
|-
 +
| 0x625BFC||Word||File Open?||Forcing to 0 makes RI load without objects. I'm not sure why.
 +
|-
 +
| 0x630144||Dword||Full Screen Mode?||Seems to be a canned feature. Crashes the game when not 0.
 +
|-
 +
| 0x630148||Dword||Native Software Render Mode?||Probably related to ancient software 3D drivers for Windows 95.
 +
|-
 +
| 0x675907||Array (10 bytes)||Function Key States||Array of F1-F10, 0 being unpressed and 0x80 being pressed.
 +
|-
 +
| 0x68AF34||Dword||Sound Test Selection||Selection for the Sound Test option on the Options menu.
 +
|-
 +
| 0x68AF38||Dword||Music Test Selection||Selection for the Music Test option on the Options menu.
 +
|-
 +
| 0x68AFB8||Dword||1P Ready||Controls whether or not the player has selected his/her character. If less than 4
 +
 +
players, the unused players are automatically set to 1.
 +
|-
 +
| 0x68AFBC||Dword||2P Ready||
 +
|-
 +
| 0x68AFC0||Dword||3P Ready||
 +
|-
 +
| 0x68AFC4||Dword||4P Ready||
 +
|-
 +
| 0x6d9A38||Dword||Seconds Since Race Start||Used to control camera position, and “READY” “SET” “GO!” indicators, among
 +
 +
other things.
 +
|-
 +
| 0x6DD860||Dword||Render Mode||0 if ? (makes D3D not load new textures), 1 if standard D3D, 2 if DDraw
 +
|-
 +
| 0x6E9898||Dword||Set X Resolution To...||Sometimes forcing this to a value w/ Cheat Engine and toggling the resolution back and forth will make this resolution stick. It usually does not.
 +
|-
 +
| 0x6E989C||Word||Set Y Resolution To...||
 +
|-
 +
| 0x6E98B4||Dword||Color Depth?||Possible values 8 and 16. D3D is always 16.
 +
|-
 +
| 0x6E98DC||Dword||Visible Screen Width||Width of screen excluding borders added in options.
 +
|-
 +
| 0x6E9908||Dword||No. of Game Windows||Number of windows to show. Don't set to higher than there is screen space for; exit level, set, and reenter level instead.
 +
|-
 +
| 0x6E991C||Dword||2P HUD Split style||0 is horizontal, 1 is vertical. Doesn't seem to effect anything besides HUD elements and borders, actual window positions are determined by something else.
 +
|-
 +
| 0x6E9958||Float||Camera Angle Float?||A float of some sort determining some sort of camera angle.
 +
|-
 +
| 0x6E9C90||Dword||Viewport X (RO)||X-position of camera.
 +
|-
 +
| 0x6E9C94||Dword||Viewport Y (RO)||Y-position of camera.
 +
|-
 +
| 0x6E9C98||Dword||Viewport Z (RO)||Z-position of camera.
 +
|-
 +
| 0x6E9CDC||Dword||Current FPS||How many frames the game renders in a second. Does not count frames skipped by user choice.
 +
|-
 +
| 0x6E9D00||Dword||Frames Rendered Lifetime||Probably the frames rendered since the game first starts.
 +
|-
 +
| 0x6EAD30||Dword||# Parts in course||Range 0-until it crashes. Tells the game how many level parts it should render. Typical values ~500-~1000, depending on the complexity of the level.
 +
|-
 +
| 0x713060||Dword||Model Count||Number of character models. Should be 10 on vanilla copies of the game.
 +
|-
 +
| 0x713064||Dword||Model Limb Count||Number of movable parts in all character models. Should be 115 in vanilla copies of the game.
 +
|-
 +
| 0x713068||Dword||Model Vertex Count||Number of vertexes in all character models. Should be 3349 in vanilla copies of the game.
 +
|-
 +
| 0x713070||Dword||Model Polygon Count||Number of polygons (tris and quads) in all character models. Should be 1917 in vanilla copies of the game.
 +
|-
 +
| 0x713074||Dword||Model Frame Count||Number of total animation frames for all characters. Should be 15974 in vanilla copies of the game.
 +
|-
 +
| 0x8F6C28||Dword||Footstep/Shadow texture page||Offset for textures used in character footsteps and shadows. Should be 11.
 +
|-
 +
| 0x8F6C38||Dword||Pause Menu/MP Number Texture Page||Offset for textures used in pause menu and multiplayer-specific HUD elements. Should be 11.
 +
|-
 +
| 0x8F6C3C||Dword||HUD texture page||Offset for textures used in HUD elements. Should be 14.
 +
|-
 +
| 0x8F6C48||Dword||Menu Texture Page||Offset for textures used in menu screens. Should be 11.
 +
|-
 +
| 0x8FB35C||Dword||Draw Distance 2||Unknown use
 +
|-
 +
| 0x8FB360||Dword||Draw Distance 3||Unknown use
 +
|-
 +
| 0x8FB364||Float||Draw Distance Fog Value?||Controls fog distance, but not render distance.
 +
|-
 +
| 0x8FB68C||Dword||Frames Rendered Scene||Frames rendered since the start of the race/menu/etc.
 +
|-
 +
| 0x8FB690||Dword||Frames Rendered Lifetime||Frames rendered since the start of the game.
 +
|-
 +
| 0x8FB80C||Dword||Frame Limiter Multiplier||How many frames to skip before rendering another one. 0 is 30FPS, 1 is 15 FPS, etc.
 +
|-
 +
| 0x8FB8E4||Dword||Demo Mode||Tells if the game is currently in demo. 0: No demo. 1: Title screen demo. 2: Replay demo.
 +
|-
 +
| 0x8FB8EC||Word||Current Course||Current course. 1: Resort Island. 2: Radical City 3: Reactive Factory. 4: Regal Ruin. 5: Radiant Emerald. Changing during gameplay WILL crash game.
 +
|-
 +
| 0x8FB950||Dword||HUD Style||The current HUD/game mode.
 +
* 0 - GP Mode
 +
* 1 - Multiplayer
 +
* 2 - Time Attack
 +
* 3 - VS. Challenge
 +
* 4+ - Time Attack
 +
|-
 +
| 0x8FB954||Dword||Time Attack Submode||The current time attack submode
 +
* 0 - Normal
 +
* 1 - Reverse
 +
* 2 - Tag 4
 +
* 3 - Balloon Hunt
 +
|-
 +
| 0x8FD444||Dword||Game Difficulty||Difficulty of game. Range 0-2.
 +
|-
 +
| 0x8FD448||Dword||Ghost On/Off||Toggles time attack ghost saving/loading. 0 is off, 1 is on.
 +
|-
 +
| 0x8FD44C||Dword||Weather Option||Chosen weather conditions.
 +
* 0 - Random
 +
* 1 - Clear
 +
* 2 - Rain
 +
* 3 - Snow
 +
|-
 +
| 0x8FD450||Dword||Catchup On/Off||Toggles rubber band AI (although it seems largely ignored if difficulty is not on hard.) 0 is off. 1 is on.
 +
|-
 +
| 0x8FD454||Dword||Guide On/Off||Toggles the trail of sparkles in time attack mode showing you where to go. 0 is off, 1 is on.
 +
|-
 +
| 0x8FD458||Dword||Minimap On/Off||Toggles the minimap in the corner. 0 is off, 1 is on.
 +
|-
 +
| 0x8FD45C||Dword||2P Split Option||Changes which way the subscreens in 2 player mode are oriented. 0 is Horizontal, 1 is Vertical.
 +
|-
 +
| 0x8FD468||Dword||Screen Y Resolution Option||The number shown on the resolution option. Does not actually modify the resolution.
 +
|-
 +
| 0x8FD46A||Dword||Screen X Resolution Option||
 +
|-
 +
| 0x8FD46C||Dword||Color Depth||Number of bits of color information. Can be 8 or 16. Only option in D3D mode is 16.
 +
|-
 +
| 0x8FD470||Dword||Alpha Blending On/Off||
 +
|-
 +
| 0x8FD474||Dword||Unused Option||Probably unused, but it is saved/loaded like all the other options.
 +
|-
 +
| 0x8FD478||Dword||Interlace On/Off||Ddraw mode only. Toggles whether or not to skip every other line. 0 is off, 1 is on.
 +
|-
 +
| 0x8FD480||Dword||Draw Distance||Option for the draw distance. In D3D mode this can go up to the max value, but doing go in Ddraw mode will make frames take years to render.
 +
|-
 +
| 0x8FD484||Dword||Window||Size of the screen. 4 is full resolution, 0 is smallest size.
 +
|-
 +
| 0x8FD488||Dword||Track Shading On/Off||Ddraw mode only. Toggles whether or not to tint the track.
 +
|-
 +
| 0x8FD490||Dword||Unknown Option||No idea what this does, but it seems to be referred to by everything.
 +
|-
 +
| 0x8FD494||Dword||Stereo On/Off||Toggles stereo sound. Considering all the sound effects are mono, this might be an attempt at 3D sound.
 +
|-
 +
| 0x8FD498||Dword||Vocals On/Off||Toggles vocals in the soundtrack. This is done by adding 6 to the current sound if it's a song.
 +
|-
 +
| 0x8FD49C||Dword||SFX Volume||Volume of the sound effects. Range 0-8, 0 being off (or really quiet, not sure) and 8 being maximum.
 +
|-
 +
| 0x8FD4A0||Dword||Music On/Off||Toggles CD audio in the game.
 +
|-
 +
| 0x901C10||Dword||Pause Screen Selection||Selection on the Pause menu.
 +
* 0 - Continue
 +
* 1 - Retry
 +
* 2 - Retire
 +
|-
 +
| 0x901C30||Byte||Game Paused||Whether or not the game is paused. When the game is pause the only thing that happens is that it renders things and checks for input, so it's really useful for debugging.
 +
|-
 +
| 0x901C44||Dword||Screen Transition Coverage (Maxes out before -255)||How much of the screen the wobbly inverted oval thing covers. In the negative, for some reason.
 +
|-
 +
| 0x901C48||Dword||Screen Transition State||State of the screen transitions.
 +
* 0 - not transitioning
 +
* 1 - fading out
 +
* 2 - fading in
 +
|-
 +
| 0x901C70||Dword||No. Characters Tagged/Tokens||Range 0-5.
 +
|-
 +
| 0x901C78||Dword||Emerald Collected||Number of the last emerald collected by P1.
 +
|-
 +
| 0x901C84||Dword||Victory screen timer||Time remaining until the victory screen fades out and kicks you to results. Range 1-infinity, 0 being regular gameplay.
 +
|-
 +
| 0x901CC4||Dword||Time Until Race Start||Time remaining until the game starts. Also controls “READY” “SET” “GO” indicators, etc. Counts down.
 +
|-
 +
| 0x901CC8||Dword||GO! image size||Size of the “GO” image before the race starts. Setting this too high makes it upside down and small, for some reason.
 +
|-
 +
| 0x9020D8||Binary(3)||LBrake Pushed||Toggles for which keys are pushed or unpushed.
 +
|-
 +
| 0x9020D8||Binary(6)||Camera Pushed||
 +
|-
 +
| 0x9020D8||Binary(7)||RBrake Pushed||
 +
|-
 +
| 0x9020D9||Binary(0)||Spindash Pushed||
 +
|-
 +
| 0x9020D9||Binary(1)||Unknown Pushed||
 +
|-
 +
| 0x9020D9||Binary(2)||Jump Pushed||
 +
|-
 +
| 0x9020D9||Binary(3)||Start Pushed||
 +
|-
 +
| 0x9020D9||Binary(4)||Forward Pushed||
 +
|-
 +
| 0x9020D9||Binary(5)||Down Pushed||
 +
|-
 +
| 0x9020D9||Binary(6)||Left Pushed||
 +
|-
 +
| 0x9020D9||Binary(7)||Right Pushed||
 +
|-
 +
| 0x902140||Dword||Camera X Position||X-position of camera.
 +
|-
 +
| 0x902144||Dword||Camera Elevation||Elevation of camera from water level. Negative values not allowed.
 +
|-
 +
| 0x902148||Dword||Camera Z Position||Z position of camera
 +
|-
 +
| 0x90214E||Dword||Camera X-Z Rotation||X-Z Rotation of camera from 0-4096.
 +
|-
 +
| 0x902152||Word||Camera Tilt||Tilt of camera relative to the player. 0 is forward, - is down. + is up.
 +
|-
 +
| 0x92528C||Dword||Options Screen Selection||Selection on the Options screen and usually anything else vertical.
 +
|-
 +
| 0x925298||Dword||Something with Menu (Super Sonic Selector)||On Character Select Screen, setting this from 0 is 40 changes Sonic to Super Sonic. And 80 sets his icon to Tails...
 +
|-
 +
| 0x9252B4||Dword||Main Menu Option||Selection for the Menu screen and usually anything else horizontal.
 +
|-
 +
| 0x9252B8||Dword||Horis-Menu Screenpos Loc||Current location on screen of the selector on the menu. Range 0 to 320.
 +
|-
 +
| 0x9252BC||Dword||Horis-Menu Screenpos Dest||Where the selector plans on going.
 +
|-
 +
| 0x9252C0||Dword||Horis-Menu Screenpos ?||Doesn't seem to effect anything...
 +
|-
 +
| 0x9252DC||Dword||1P Controller Type||Type of controller used in multiplayer. Format is 0x000A000B, where A is 0 for keyboard and 1 for joystick and B is the port number of joystick or key binding for keyboard.
 +
|-
 +
| 0x9252E0||Dword||2P Controller Type||
 +
|-
 +
| 0x9252E4||Dword||3P Controller Type||
 +
|-
 +
| 0x9252E8||Dword||4P Controller Type||
 +
|-
 +
| 0x94BCF4||Dword||Weather||Current weather, regardless of option.  Ignored in Time Attack mode for some reason.
 +
* 0 - clear
 +
* 1 - rain
 +
* 2 - snow
 +
* 3+ - clear
 +
|-
 +
| 0x94BCF8||Dword||Time of Day||Time of day. Mostly effects graphics.
 +
* 0 - sunrise
 +
* 1 - day.
 +
* 2 - sunset.
 +
* 3 - night.
 +
|}
 +
 +
=== Player-Specific Variables ===
 +
{| class="prettytable"
 +
! Offset||P1 Address||Data Type||Description||Notes
 +
|-
 +
| 0||0x8FD4F4||Dword|| X Position||0 is center of map. Goes up by large amounts.
 +
|-
 +
| 4||0x8FD4F8||Dword|| Y Position||0 is water level. To go up, subtract. You can't go down.
 +
|-
 +
| 8||0x8FD4Fc||Dword|| Z Position||0 is center of map. Goes up by large amounts.
 +
|-
 +
| C||0x8FD500||Dword|| YZ Rotation||Max is 4096. Slowly reverts itself if not locked into extreme values.
 +
|-
 +
| 10||0x8FD504||Dword|| XZ Rotation||
 +
|-
 +
| 14||0x8FD508||Dword|| XY Rotation||
 +
|-
 +
| 18||0x8FD50C||Dword|| Ring Count||Max 999. Adding more makes the game subtract back down.
 +
|-
 +
| 1C||0x8FD510||Dword|| Animation Frame? (RO)||
 +
|-
 +
| 20||0x8FD514||Dword|| X Position Mirror [???]||Not sure what these are for.
 +
|-
 +
| 24||0x8FD518||Dword|| Y Position Mirror [???]||
 +
|-
 +
| 28||0x8FD51C||Dword|| Z Position Mirror [???]||
 +
|-
 +
| 2C||0x8FD520||Dword|| X Momentum||Higher values = faster speed. Goes negative, too. Given in relation to world, not player.
 +
|-
 +
| 30||0x8FD524||Dword|| Y Momentum||
 +
|-
 +
| 34||0x8FD528||Dword|| Z Momentum||
 +
|-
 +
| 38||0x8FD52C||Dword|| Y Position Mirror 2||Not sure what this is for.
 +
|-
 +
| 40||0x8FD534||Word|| In Water?||0 = No, 1 = Yes.
 +
|-
 +
| 42||0x8FD536||Word|| Time Until Sink||The higher this is, the longer it takes Sonic/etc. to sink. Instead they just kind of splash through the top of the water ala the shallow water in Super Mario Kart.
 +
|-
 +
| 44||0x8FD538||Dword|| Forwards Momentum RO||Momentum in terms of the character.
 +
|-
 +
| 4C||0x8FD540||Dword|| Distance on Track [?]||Used to calculate race rankings. As such it isn't calculated in Time Attack mode. Goes up by large amounts the further along the track you go. Does not take lap number into account if you've forced it to another number, weirdly enough.
 +
|-
 +
| 50||0x8FD544||Word|| Lap 1 Time||1 is ~1/60 of a second. Causes Game Over once the sum of Laps 1-3 reaches 212400 (1 hour).
 +
|-
 +
| 54||0x8FD548||Word|| Lap 2 Time||
 +
|-
 +
| 58||0x8FD54C||Word|| Lap 3 Time||
 +
|-
 +
| 5C||0x8FD550||Word||Current Place (Center/Player)||Range 1-5. Game won't yell at you if it isn't so, but it'll crash on results screen if not in range 0-6.
 +
|-
 +
| 5E||0x8FD552||Word||Current Lap (Center/Player)||Range 0-3. Setting to 3 instantly loads results screen.
 +
|-
 +
| 64||0x8FD558||Word|| Most Recent Item||Seems to only effect the icons that shows you what item you got.
 +
*0 - Nothing
 +
*1 - Speed Shoes
 +
*2 - 5 Ring
 +
*3 - 10 Ring
 +
*4 - 20 Ring
 +
*5 - Water Shield
 +
*6 - Electric Shield
 +
*Above - Garbage graphics.
 +
|-
 +
| 66||0x8FD55A||Word|| Item Get Cooldown Time||Affects how long until the item box can be used again, and also how long the icon is on screen.
 +
|-
 +
| 68||0x8FD55C||Word|| Water splash timer [?]||Setting this and water depth to highish values causes a “burrowing” effect. Strange.
 +
|-
 +
| 6A||0x8FD55E||Word|| Depth into water||Range 0-6. 6 is fully submerged, 0 is on land.
 +
|-
 +
| 6C||0x8FD560||Word|| Pressing Forward||Changes to 0x0000FFFF when the forward key or the accelerate/back key is pressed.
 +
|-
 +
| 70||0x8FD564||Word|| Camera XZ Rotation||Range 0-4096. Not sure what the difference between this and the global one is, as they're both obeyed.
 +
|-
 +
| 72||0x8FD566||Word|| Ground Flag||1 = on ground, 0 = in air.
 +
|-
 +
| 74||0x8FD568||Word||Tails/Knuckles flight mode||When Tails/(Metal) Knux, set to 0xFFFF when jumping up in air, 2 when flying/gliding, and 0 when falling/on ground.
 +
|-
 +
| 76||0x8FD58A||Word||Time in air||Time spent flying in air. Tails stops flying around 62.
 +
|-
 +
| 78||0x8FD58C||Word||Jumping/Char Select Animation||Animation sequence played both when jumping and on the character select screen.
 +
Note that some of these animations crash with Amy, Robotnik and some of the metal characters. Also some animations after 7 crash on the character select screen.
 +
*0 - Running
 +
*1 - Jumping
 +
*2 - Standing
 +
*3 - Skid right
 +
*4 - Skid left
 +
*5 - Hit by bomb/Falling
 +
*6 - Victory
 +
*7 - Lose
 +
*8 - Recover from left skid.
 +
*9 - Recover from right skid.
 +
*10 - Duck
 +
*11 - Recover from duck
 +
*12 - Alternate running?
 +
*13 - Falling forwards?
 +
*14 - Falling forwards?
 +
*15 - Falling
 +
*16 - Springing
 +
*17 - Stretching
 +
*18+ - Character specific?
 +
|-
 +
| 7C||0x8FD590||Dword||Animation Frame (??)||Frame of the animation being played. May or may not be a pointer.
 +
|-
 +
| 80||0x8FD594||Dword|| Loop Mode||If this is 1 while not on a loop, Sonic will just randomly warp across the terrain until he goes out of bounds and crashes.
 +
|-
 +
| 90||0x8FD5A4||Word|| Above Geometry||Is 1 if the player is above some sort of level geometry, 0 if on flat ground or water.
 +
|-
 +
| 92||0x8FD5A6||Word|| Above Geometry Mirror||
 +
|-
 +
| 94||0x8FD5A8||Dword|| Jump Angle?||Might be the angle you jump at when standing still. Unknown format.
 +
|-
 +
| 98||0x8FD5AC||Dword|| Slope Angle?||Might be the angle of the floor below you. 0 seems to be flat ground. Positive values seem to be downward slopes and negative upwards. Unknown format.
 +
|-
 +
| 9C||0x8FD5B0||Dword|| Loop ?||
 +
|-
 +
| A0||0x8FD5B4||Dword|| Loop XZ Pos||Location left/right while on a loop.
 +
|-
 +
| A4||0x8FD5B8||Dword|| Loop Distance||Distance completed on the loop.
 +
|-
 +
| A8||0x8FD5BC||Dword|| Loop ?||
 +
|-
 +
| AC||0x8FD5C0||Dword|| Loop XZ Momenteum||Left/Right movement momemteum.
 +
|-
 +
| B0||0x8FD5C4||Dword|| Loop Momenteum||Forwards/Backwards momentum on the loop.
 +
|-
 +
| B4||0x8FD5C8||Word|| Drift Direction?||0xFE00 if drifing right, 0x0200 if drifting left. Unknown purpose.
 +
|-
 +
| D0||0x8FD5E4||Word|| Always 1||Not sure what this is for.
 +
|-
 +
| D2||0x8FD5E6||Word|| Identity||Effects everything besides the character model, including animations, icons, control, etc. Range 0-9.
 +
|-
 +
| 10C||0x8FD610||0xA4 (164) Bytes|| Unused Area Start||Wiped at beginning of each round. Definitely unused.
 +
|-
 +
| 1E0||0x8FD6D4||Dword||Player Model||Range 0-9, 0 being Sonic, 9 being SS.
 +
|-
 +
| 1EC||0x8FD6E0||Dword|| Running Animation||Animation frame being played. Range 0-maximum frame count for the player. Probably corresponds with the loaded files.
 +
|}
 +
 +
Total length: 0x71C bytes
 +
  
 
==Save Files==
 
==Save Files==

Revision as of 16:34, 15 June 2014

Sonicretro-round.svg This short article is in need of work. You can help Sonic Retro by adding to it.

This is the Sonic Community Hacking Guide for the PC Version of Sonic R.

Fixing Startup Crash

Sonic R's startup code attempts to divide a value by the time elapsed for a given function. On reasonably fast computers (basically anything with a CPU newer than Pentium 4), this results in a division by zero. This can be fixed with a simple binary edit.
Sonic Retro
[source]

(Note: This hack assumes you're using the original executable without network support. The network version doesn't seem to work on NT-based Windows systems to begin with.)

In a hex editor, go to offset 0x70584. Replace these bytes: 00070584: 2e ff 15 8c 05 95 00 call cs:[0x95058c]

with these bytes: 00070584: b8 31 00 00 00 mov eax, 0x31 00070589: 90 nop 0007058A: 90 nop

Next, go to offset 0x705A0. Replace these bytes: 000705A0: 2e ff 15 8c 05 95 00 call cs:[0x95058c]

with these bytes: 000705A0: b8 01 00 00 00 mov eax, 0x01 000705A5: 90 nop 000705A6: 90 nop

What this does is it disables the function calls to get the system time and replaces them with known values that are guaranteed to work on modern systems.

RAM Locations

These values are absolute from base of RAM; a value of 0x400001 is equal to sonicr.exe+0x000001.

Global Variables

Address Data Type Description Notes
0x501718 Word Knuckles jump height This and the next 3 are part of a set of variables that control how the

characters act. It's referred to by both the player and the AI (with the exception of turn speed).

0x50172E Word Amy top speed
0x501731 Word Amy accel
0x501734 Word Sonic turn speed
0x504278 Dword CD Check 1 if CD present, 0 if not. Largely useless after game boots.
0x540064 Dword Pointer AI RAM Location Memory address of the current level's AI data (copied into RAM from

the AI file.)

0x625BFC Word File Open? Forcing to 0 makes RI load without objects. I'm not sure why.
0x630144 Dword Full Screen Mode? Seems to be a canned feature. Crashes the game when not 0.
0x630148 Dword Native Software Render Mode? Probably related to ancient software 3D drivers for Windows 95.
0x675907 Array (10 bytes) Function Key States Array of F1-F10, 0 being unpressed and 0x80 being pressed.
0x68AF34 Dword Sound Test Selection Selection for the Sound Test option on the Options menu.
0x68AF38 Dword Music Test Selection Selection for the Music Test option on the Options menu.
0x68AFB8 Dword 1P Ready Controls whether or not the player has selected his/her character. If less than 4

players, the unused players are automatically set to 1.

0x68AFBC Dword 2P Ready
0x68AFC0 Dword 3P Ready
0x68AFC4 Dword 4P Ready
0x6d9A38 Dword Seconds Since Race Start Used to control camera position, and “READY” “SET” “GO!” indicators, among

other things.

0x6DD860 Dword Render Mode 0 if ? (makes D3D not load new textures), 1 if standard D3D, 2 if DDraw
0x6E9898 Dword Set X Resolution To... Sometimes forcing this to a value w/ Cheat Engine and toggling the resolution back and forth will make this resolution stick. It usually does not.
0x6E989C Word Set Y Resolution To...
0x6E98B4 Dword Color Depth? Possible values 8 and 16. D3D is always 16.
0x6E98DC Dword Visible Screen Width Width of screen excluding borders added in options.
0x6E9908 Dword No. of Game Windows Number of windows to show. Don't set to higher than there is screen space for; exit level, set, and reenter level instead.
0x6E991C Dword 2P HUD Split style 0 is horizontal, 1 is vertical. Doesn't seem to effect anything besides HUD elements and borders, actual window positions are determined by something else.
0x6E9958 Float Camera Angle Float? A float of some sort determining some sort of camera angle.
0x6E9C90 Dword Viewport X (RO) X-position of camera.
0x6E9C94 Dword Viewport Y (RO) Y-position of camera.
0x6E9C98 Dword Viewport Z (RO) Z-position of camera.
0x6E9CDC Dword Current FPS How many frames the game renders in a second. Does not count frames skipped by user choice.
0x6E9D00 Dword Frames Rendered Lifetime Probably the frames rendered since the game first starts.
0x6EAD30 Dword # Parts in course Range 0-until it crashes. Tells the game how many level parts it should render. Typical values ~500-~1000, depending on the complexity of the level.
0x713060 Dword Model Count Number of character models. Should be 10 on vanilla copies of the game.
0x713064 Dword Model Limb Count Number of movable parts in all character models. Should be 115 in vanilla copies of the game.
0x713068 Dword Model Vertex Count Number of vertexes in all character models. Should be 3349 in vanilla copies of the game.
0x713070 Dword Model Polygon Count Number of polygons (tris and quads) in all character models. Should be 1917 in vanilla copies of the game.
0x713074 Dword Model Frame Count Number of total animation frames for all characters. Should be 15974 in vanilla copies of the game.
0x8F6C28 Dword Footstep/Shadow texture page Offset for textures used in character footsteps and shadows. Should be 11.
0x8F6C38 Dword Pause Menu/MP Number Texture Page Offset for textures used in pause menu and multiplayer-specific HUD elements. Should be 11.
0x8F6C3C Dword HUD texture page Offset for textures used in HUD elements. Should be 14.
0x8F6C48 Dword Menu Texture Page Offset for textures used in menu screens. Should be 11.
0x8FB35C Dword Draw Distance 2 Unknown use
0x8FB360 Dword Draw Distance 3 Unknown use
0x8FB364 Float Draw Distance Fog Value? Controls fog distance, but not render distance.
0x8FB68C Dword Frames Rendered Scene Frames rendered since the start of the race/menu/etc.
0x8FB690 Dword Frames Rendered Lifetime Frames rendered since the start of the game.
0x8FB80C Dword Frame Limiter Multiplier How many frames to skip before rendering another one. 0 is 30FPS, 1 is 15 FPS, etc.
0x8FB8E4 Dword Demo Mode Tells if the game is currently in demo. 0: No demo. 1: Title screen demo. 2: Replay demo.
0x8FB8EC Word Current Course Current course. 1: Resort Island. 2: Radical City 3: Reactive Factory. 4: Regal Ruin. 5: Radiant Emerald. Changing during gameplay WILL crash game.
0x8FB950 Dword HUD Style The current HUD/game mode.
  • 0 - GP Mode
  • 1 - Multiplayer
  • 2 - Time Attack
  • 3 - VS. Challenge
  • 4+ - Time Attack
0x8FB954 Dword Time Attack Submode The current time attack submode
  • 0 - Normal
  • 1 - Reverse
  • 2 - Tag 4
  • 3 - Balloon Hunt
0x8FD444 Dword Game Difficulty Difficulty of game. Range 0-2.
0x8FD448 Dword Ghost On/Off Toggles time attack ghost saving/loading. 0 is off, 1 is on.
0x8FD44C Dword Weather Option Chosen weather conditions.
  • 0 - Random
  • 1 - Clear
  • 2 - Rain
  • 3 - Snow
0x8FD450 Dword Catchup On/Off Toggles rubber band AI (although it seems largely ignored if difficulty is not on hard.) 0 is off. 1 is on.
0x8FD454 Dword Guide On/Off Toggles the trail of sparkles in time attack mode showing you where to go. 0 is off, 1 is on.
0x8FD458 Dword Minimap On/Off Toggles the minimap in the corner. 0 is off, 1 is on.
0x8FD45C Dword 2P Split Option Changes which way the subscreens in 2 player mode are oriented. 0 is Horizontal, 1 is Vertical.
0x8FD468 Dword Screen Y Resolution Option The number shown on the resolution option. Does not actually modify the resolution.
0x8FD46A Dword Screen X Resolution Option
0x8FD46C Dword Color Depth Number of bits of color information. Can be 8 or 16. Only option in D3D mode is 16.
0x8FD470 Dword Alpha Blending On/Off
0x8FD474 Dword Unused Option Probably unused, but it is saved/loaded like all the other options.
0x8FD478 Dword Interlace On/Off Ddraw mode only. Toggles whether or not to skip every other line. 0 is off, 1 is on.
0x8FD480 Dword Draw Distance Option for the draw distance. In D3D mode this can go up to the max value, but doing go in Ddraw mode will make frames take years to render.
0x8FD484 Dword Window Size of the screen. 4 is full resolution, 0 is smallest size.
0x8FD488 Dword Track Shading On/Off Ddraw mode only. Toggles whether or not to tint the track.
0x8FD490 Dword Unknown Option No idea what this does, but it seems to be referred to by everything.
0x8FD494 Dword Stereo On/Off Toggles stereo sound. Considering all the sound effects are mono, this might be an attempt at 3D sound.
0x8FD498 Dword Vocals On/Off Toggles vocals in the soundtrack. This is done by adding 6 to the current sound if it's a song.
0x8FD49C Dword SFX Volume Volume of the sound effects. Range 0-8, 0 being off (or really quiet, not sure) and 8 being maximum.
0x8FD4A0 Dword Music On/Off Toggles CD audio in the game.
0x901C10 Dword Pause Screen Selection Selection on the Pause menu.
  • 0 - Continue
  • 1 - Retry
  • 2 - Retire
0x901C30 Byte Game Paused Whether or not the game is paused. When the game is pause the only thing that happens is that it renders things and checks for input, so it's really useful for debugging.
0x901C44 Dword Screen Transition Coverage (Maxes out before -255) How much of the screen the wobbly inverted oval thing covers. In the negative, for some reason.
0x901C48 Dword Screen Transition State State of the screen transitions.
  • 0 - not transitioning
  • 1 - fading out
  • 2 - fading in
0x901C70 Dword No. Characters Tagged/Tokens Range 0-5.
0x901C78 Dword Emerald Collected Number of the last emerald collected by P1.
0x901C84 Dword Victory screen timer Time remaining until the victory screen fades out and kicks you to results. Range 1-infinity, 0 being regular gameplay.
0x901CC4 Dword Time Until Race Start Time remaining until the game starts. Also controls “READY” “SET” “GO” indicators, etc. Counts down.
0x901CC8 Dword GO! image size Size of the “GO” image before the race starts. Setting this too high makes it upside down and small, for some reason.
0x9020D8 Binary(3) LBrake Pushed Toggles for which keys are pushed or unpushed.
0x9020D8 Binary(6) Camera Pushed
0x9020D8 Binary(7) RBrake Pushed
0x9020D9 Binary(0) Spindash Pushed
0x9020D9 Binary(1) Unknown Pushed
0x9020D9 Binary(2) Jump Pushed
0x9020D9 Binary(3) Start Pushed
0x9020D9 Binary(4) Forward Pushed
0x9020D9 Binary(5) Down Pushed
0x9020D9 Binary(6) Left Pushed
0x9020D9 Binary(7) Right Pushed
0x902140 Dword Camera X Position X-position of camera.
0x902144 Dword Camera Elevation Elevation of camera from water level. Negative values not allowed.
0x902148 Dword Camera Z Position Z position of camera
0x90214E Dword Camera X-Z Rotation X-Z Rotation of camera from 0-4096.
0x902152 Word Camera Tilt Tilt of camera relative to the player. 0 is forward, - is down. + is up.
0x92528C Dword Options Screen Selection Selection on the Options screen and usually anything else vertical.
0x925298 Dword Something with Menu (Super Sonic Selector) On Character Select Screen, setting this from 0 is 40 changes Sonic to Super Sonic. And 80 sets his icon to Tails...
0x9252B4 Dword Main Menu Option Selection for the Menu screen and usually anything else horizontal.
0x9252B8 Dword Horis-Menu Screenpos Loc Current location on screen of the selector on the menu. Range 0 to 320.
0x9252BC Dword Horis-Menu Screenpos Dest Where the selector plans on going.
0x9252C0 Dword Horis-Menu Screenpos ? Doesn't seem to effect anything...
0x9252DC Dword 1P Controller Type Type of controller used in multiplayer. Format is 0x000A000B, where A is 0 for keyboard and 1 for joystick and B is the port number of joystick or key binding for keyboard.
0x9252E0 Dword 2P Controller Type
0x9252E4 Dword 3P Controller Type
0x9252E8 Dword 4P Controller Type
0x94BCF4 Dword Weather Current weather, regardless of option. Ignored in Time Attack mode for some reason.
  • 0 - clear
  • 1 - rain
  • 2 - snow
  • 3+ - clear
0x94BCF8 Dword Time of Day Time of day. Mostly effects graphics.
  • 0 - sunrise
  • 1 - day.
  • 2 - sunset.
  • 3 - night.

Player-Specific Variables

Offset P1 Address Data Type Description Notes
0 0x8FD4F4 Dword X Position 0 is center of map. Goes up by large amounts.
4 0x8FD4F8 Dword Y Position 0 is water level. To go up, subtract. You can't go down.
8 0x8FD4Fc Dword Z Position 0 is center of map. Goes up by large amounts.
C 0x8FD500 Dword YZ Rotation Max is 4096. Slowly reverts itself if not locked into extreme values.
10 0x8FD504 Dword XZ Rotation
14 0x8FD508 Dword XY Rotation
18 0x8FD50C Dword Ring Count Max 999. Adding more makes the game subtract back down.
1C 0x8FD510 Dword Animation Frame? (RO)
20 0x8FD514 Dword X Position Mirror [???] Not sure what these are for.
24 0x8FD518 Dword Y Position Mirror [???]
28 0x8FD51C Dword Z Position Mirror [???]
2C 0x8FD520 Dword X Momentum Higher values = faster speed. Goes negative, too. Given in relation to world, not player.
30 0x8FD524 Dword Y Momentum
34 0x8FD528 Dword Z Momentum
38 0x8FD52C Dword Y Position Mirror 2 Not sure what this is for.
40 0x8FD534 Word In Water? 0 = No, 1 = Yes.
42 0x8FD536 Word Time Until Sink The higher this is, the longer it takes Sonic/etc. to sink. Instead they just kind of splash through the top of the water ala the shallow water in Super Mario Kart.
44 0x8FD538 Dword Forwards Momentum RO Momentum in terms of the character.
4C 0x8FD540 Dword Distance on Track [?] Used to calculate race rankings. As such it isn't calculated in Time Attack mode. Goes up by large amounts the further along the track you go. Does not take lap number into account if you've forced it to another number, weirdly enough.
50 0x8FD544 Word Lap 1 Time 1 is ~1/60 of a second. Causes Game Over once the sum of Laps 1-3 reaches 212400 (1 hour).
54 0x8FD548 Word Lap 2 Time
58 0x8FD54C Word Lap 3 Time
5C 0x8FD550 Word Current Place (Center/Player) Range 1-5. Game won't yell at you if it isn't so, but it'll crash on results screen if not in range 0-6.
5E 0x8FD552 Word Current Lap (Center/Player) Range 0-3. Setting to 3 instantly loads results screen.
64 0x8FD558 Word Most Recent Item Seems to only effect the icons that shows you what item you got.
  • 0 - Nothing
  • 1 - Speed Shoes
  • 2 - 5 Ring
  • 3 - 10 Ring
  • 4 - 20 Ring
  • 5 - Water Shield
  • 6 - Electric Shield
  • Above - Garbage graphics.
66 0x8FD55A Word Item Get Cooldown Time Affects how long until the item box can be used again, and also how long the icon is on screen.
68 0x8FD55C Word Water splash timer [?] Setting this and water depth to highish values causes a “burrowing” effect. Strange.
6A 0x8FD55E Word Depth into water Range 0-6. 6 is fully submerged, 0 is on land.
6C 0x8FD560 Word Pressing Forward Changes to 0x0000FFFF when the forward key or the accelerate/back key is pressed.
70 0x8FD564 Word Camera XZ Rotation Range 0-4096. Not sure what the difference between this and the global one is, as they're both obeyed.
72 0x8FD566 Word Ground Flag 1 = on ground, 0 = in air.
74 0x8FD568 Word Tails/Knuckles flight mode When Tails/(Metal) Knux, set to 0xFFFF when jumping up in air, 2 when flying/gliding, and 0 when falling/on ground.
76 0x8FD58A Word Time in air Time spent flying in air. Tails stops flying around 62.
78 0x8FD58C Word Jumping/Char Select Animation Animation sequence played both when jumping and on the character select screen.

Note that some of these animations crash with Amy, Robotnik and some of the metal characters. Also some animations after 7 crash on the character select screen.

  • 0 - Running
  • 1 - Jumping
  • 2 - Standing
  • 3 - Skid right
  • 4 - Skid left
  • 5 - Hit by bomb/Falling
  • 6 - Victory
  • 7 - Lose
  • 8 - Recover from left skid.
  • 9 - Recover from right skid.
  • 10 - Duck
  • 11 - Recover from duck
  • 12 - Alternate running?
  • 13 - Falling forwards?
  • 14 - Falling forwards?
  • 15 - Falling
  • 16 - Springing
  • 17 - Stretching
  • 18+ - Character specific?
7C 0x8FD590 Dword Animation Frame (??) Frame of the animation being played. May or may not be a pointer.
80 0x8FD594 Dword Loop Mode If this is 1 while not on a loop, Sonic will just randomly warp across the terrain until he goes out of bounds and crashes.
90 0x8FD5A4 Word Above Geometry Is 1 if the player is above some sort of level geometry, 0 if on flat ground or water.
92 0x8FD5A6 Word Above Geometry Mirror
94 0x8FD5A8 Dword Jump Angle? Might be the angle you jump at when standing still. Unknown format.
98 0x8FD5AC Dword Slope Angle? Might be the angle of the floor below you. 0 seems to be flat ground. Positive values seem to be downward slopes and negative upwards. Unknown format.
9C 0x8FD5B0 Dword Loop ?
A0 0x8FD5B4 Dword Loop XZ Pos Location left/right while on a loop.
A4 0x8FD5B8 Dword Loop Distance Distance completed on the loop.
A8 0x8FD5BC Dword Loop ?
AC 0x8FD5C0 Dword Loop XZ Momenteum Left/Right movement momemteum.
B0 0x8FD5C4 Dword Loop Momenteum Forwards/Backwards momentum on the loop.
B4 0x8FD5C8 Word Drift Direction? 0xFE00 if drifing right, 0x0200 if drifting left. Unknown purpose.
D0 0x8FD5E4 Word Always 1 Not sure what this is for.
D2 0x8FD5E6 Word Identity Effects everything besides the character model, including animations, icons, control, etc. Range 0-9.
10C 0x8FD610 0xA4 (164) Bytes Unused Area Start Wiped at beginning of each round. Definitely unused.
1E0 0x8FD6D4 Dword Player Model Range 0-9, 0 being Sonic, 9 being SS.
1EC 0x8FD6E0 Dword Running Animation Animation frame being played. Range 0-maximum frame count for the player. Probably corresponds with the loaded files.

Total length: 0x71C bytes


Save Files

These files can be found in the .\save directory with filenames in the format r##.sav
This is an incomplete listing of the locations inside these files:

Offset Type Description
4 Byte Resort Island Unlocked (def. 1)
  • 0 - Locked
  • 1 - Unlocked
  • 2 - 1st Place
8 Byte Radical City Unlocked (def. 1)
C Byte Reactive Factory Unlocked (def. 1)
10 Byte Regal Ruin Unlocked (def. 1)
14 Byte Radiant Emerald Unlocked (def. 0)
18 Byte Sonic Unlocked (def. 2)
  • 0 - Hidden
  • 1 - Locked
  • 2 - Unlocked
1C Byte Tails Unlocked (def. 2)
20 Byte Knuckles Unlocked (def. 2)
24 Byte Amy Unlocked (def. 2)
28 Byte Robotnik Unlocked (def. 1)
2C Byte Metal Sonic Unlocked (def. 0)
30 Byte Tails Doll Unlocked (def. 0)
34 Byte Metal Knuckles Unlocked (def. 0)
38 Byte Eggrobo Unlocked (def. 0)
3C Byte Super Sonic Unlocked (def. 0)
40 Byte Blue Emerald Collected
  • 0 - Not Collected
  • 2 - Collected
44 Byte Green Emerald Collected
48 Byte Purple Emerald Collected
4C Byte Yellow Emerald Collected
50 Byte Orange Emerald Collected
54 Byte Red Emerald Collected
58 Byte White Emerald Collected

sonicr.inf

This file, located in the main folder, stores various settings. Note that despite the extension inf, it is not an actual inf file, and should NOT be opened with Notepad.

Offset Type Description
0 Byte Difficulty
  • 00 - Easy
  • 01 - Normal
  • 02 - Hard
4 Byte Ghost Toggle
  • 00 - Off
  • 01 - On
8 Byte Weather
  • 00 - Random
  • 01 - Clear
  • 02 - Rain
  • 03 - Snow
C Byte Catch Up Toggle
  • 00 - Off
  • 01 - On
10 Byte Guide Toggle
  • 00 - Off
  • 01 - On
14 Byte Map Toggle
  • 00 - Off
  • 01 - On
28 Byte Color
  • 08 - 8-bit
  • 10 - 16-bit
18 Byte 2P Split
  • 00 - Horizontal
  • 01 - Vertical
2C Byte Alpha Blending
  • 00 - Off
  • 01 - On
34 Byte Interlace
  • 00 - Off
  • 01 - On
3C Byte Draw Distance
  • 00 - Very Near
  • 01 - Near
  • 02 - Medium
  • 03 - Far
  • 04 - Very Far
  • 10 - Max. Draw Distance
40 Byte Screen Size
  • 00 - Very Small
  • 01 - Small
  • 02 - Medium
  • 03 - Large
  • 04 - Full Screen
44 Byte Track Shading
  • 00 - Off
  • 01 - On
50 Byte Stereo Toggle
  • 00 - Off
  • 01 - On
54 Byte Vocals Toggle
  • 00 - Off
  • 01 - On
58 Byte SFX Volume (00-08)
5C Byte Music Toggle
  • 00 - Off
  • 01 - On
Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information