Actions

Sonic Advance 3/Technical information/RAM Editing

From Sonic Retro

Revision as of 14:23, 1 October 2020 by Ccawley2011 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Back to: Sonic Advance 3/Technical information.
Sonicretro-round.svg This article needs cleanup.

This article needs to be edited to conform to a higher standard of article quality.
After the article has been cleaned up, you may remove this message. See How to Edit a Page for help.

Sonic Advance 3
Technical information
Main article
ROM Portion
Editing the ROM
Sprites
Sound Test
Sound and Music List
Dynamic Text
Zones
Music
Hidden Level Select Menu
Special Stages
RAM Portion
RAM Editing
See Also
SCHG How-to topics
Sonic Advance PalTool
Sonic Advance 3 Tools
VBASDL

Here you'll find some interesting RAM locations which values can be altered in order to get a certain thing. This is like changing a byte in a savestate. These locations can be used in Memory Viewer and Cheat List from VBA

I'll list the addresses, how bytes they use and a brief description. Numbers between parenthesis refer to partner character. Example: 030015EA(173A) means that the address that changes the partner character is 0300173A.

Location Size Description
0300094C 2 bytes Rings
030015EA(173A) 1 byte Character
030015EB(173B) 1 byte Character flag
030015F0(1740) 2 bytes Character state
030015F2(1742) 2 bytes Character state
030015F4(1744) 2 bytes Sprite state
03001612(1762) 2 bytes Time until going into "wait state"
03001D38 4 bytes Pos X (horizontal)
03001D3C 4 bytes Pos Y (vertical)
03000552 7 bytes SP keys (1 byte per zone)
030008A9 1 byte Zone
030008AA 1 byte Act
030008AE 1 byte Scene flag
030008B4 2 bytes Button flag - A
030008B6 2 bytes Button flag - B
030008B8 2 bytes Button flag - R
0300094E 2 bytes Timer (units in 1/100th of second)
03000954 1 byte Lives
03004532 1 byte Level title (bottom right corner)
03004874 2 bytes Rings in special stage
030008C8 2 bytes Restarting position X
030008CC 2 bytes Restarting position Y
03000541 1 byte Zone access flag
03000559 7 bytes Zone completion flags (1 byte per zone)
03000562 1 byte Emerald flag
03000927 1 byte SP key flag

Rings and time

Two bytes. In the side of the timer, it increases 1 at every 1/100 of second, until reaching the maximum value of 8C9Fh, that is equal to 9:59:99. The timer is present even in the Zone Map, Sonic Factory and Chao's Playground, but with the difference to a normal Act that it's invisible and death is disabled. In the time until going into "wait state", it decreases instead of increasing. When it reaches zero, the character enters into "waiting" animation.

Character

Just a single byte. Sonic=00, Cream=01, Tails=02, Knuckles=03 and Amy=04. The same order from Sonic Advance 2. Changing its value will give the result instantly. If the player makes both the main character and partner the same, then they are going to have problems using Tag Actions, in most cases the game will lock up, with the exception of Cream & Cream and Sonic & Sonic. The lock up is due to the fact that a character does not have a programmed state that is supposed to be used when performing a Tag Action with himself/herself.

Character & sprite state

State means an sprite (or sprites) that appears performing some animation. If you know MUGEN (how CNS and AIR files work) then you know what I'm talking about. Character states indicate which animation the character is doing (standing, looking up, looking down, running, etc). Sprite states indicate which animation the game must show in order to fit the char state (and the current char, because it's pretty stupid/pointless having Knuckles appear when you try to jump with Cream, for instance :P). Char state 0 is standing on foot. For Sonic, both states (char & sprite) are the same. But with Cream, sprite state for char state 0 is A3h. Every single object in the game that belongs to GBA's OBJ layer has a sprite state. And in case you're wondering, yes, you can force an object to appear in place of your character with VBA's cheat mode, simulating debug mode, and release a screenshot in order to have about 1 billion stupid kiddies bumping your topic in a forum. So everything that appears in VBA's OAM viewer and uses sprite palette has a sprite state. With Sonic and the cheat, using the attack with B will "force" the sprite to appear. Here comes a cool cheat: 030015F4:0516. You'll turn into G-mel and then turn back to normal. Only few states allow you to come back to normal, otherwise game crashes. There is a total of 1524 sprite states, from 0 to 1523. Some doesn't have data, but 1524 is the max number of states that is actually supported by SA3. Do you remember what I said above about using the same char as main and partner? Let's use Tails & Tails as example. The "jumping-over-Tails" char state is 5Bh. When Tails performs that, sprite state is set to 1A1h(417), and if you check this out in the ROM the pointers for that state will be empty (zero) in all of its mappings. Attempting to read data beyond range and pointing to invalid data are the two things that make games crash.

Character flag

This is a single flag that tells the game how a character must act. With this, you can freeze your main character and even control the partner character. I guess this flag is widely used in multiplayer mode for obvious reasons. When 05 (main char), gameplay is normal. You can "control" the partner by setting his/hers flag to 07.

Pos X / Y

4 bytes. Hex view is highly recomended. But surprise, surprise! The corner of the screen isn't 00000000! It's FFFF... something, that is, lower than zero. PosX increases from left to right and PosY increases from above to below. Forcing a position with cheats doesn't work, and I don't know why. I bet nobody has found a use for this.

Zone and Act, level title

Zone: starts at 00 - Route 99 and ends in 06 - Chaos Angel. 07 is Altar Emerald and 08 is Nonaggression. If you're in a zone and you change its byte to another zone, the next part will be based on the new zone. For instance, being in Route 99, changing map byte to 04 and jumping at act 1 ring. You'll be at Twinkle Snow Act 1. The expression "next part" includes map, Chao's Playground, Sonic Factory, acts, bosses and Special Stages. The act byte just says which "part" of the zone you are. Altar Emerald causes a bunch of problems when accessed through "unofficial" methods. About the level title, it changes instantly, without need of going to another "part".

Scene flag

This is really a useful flag! It makes more than give you the current zone and act. It also handles which kind of "scene" you are. 01 is Sonic Factory (precisely from Route 99), and that results in disabling of tag action. 48h is Nonaggression. Example: if you clear an act and then change the scene flag to 48h, the ending sequence with all emeralds will appear. Another example: if you enter Sonic Factory and change scene flag to 02 (Route 99 Map) then you'll be able to use tag action. One more: turn on the timer and ring counter in Sonic Factory, Chao's and map scene by changing scene flag to a value that belongs to an act.

Button flag

It's just about what action is attributed to a button.

0001: jump
0002: attack
0100: partner

Other values will likely result in nothing. "Duplications" don't work - i.e. you can't have two buttons to do the same thing. I wonder how or when it'll be possible to use L button...

Restarting position

2 bytes for X/Y position. It's used to place your character somewhere after you lose a life. The values used here are "compatible" with the starting pos values from Zones subsection at ROM section.

Zone access flag

This 8-bit flag tells the game how many Zones are available through the Sonic Factory. 00 means that no Zones will be available and 07 means that all Zones will be available. For example, if the flag value is 05, all Zones up to Zone 5 will be available. In other words, if the player is in the Sonic Factory from Zone 3, the teleport boxes for Zones 1, 2, 4 and 5 will be active.

Zone completion flags

These flags tell the game which Acts are complete or not. When playing a completed Act, the pause graphic will change and an option to go back will be available. I know this can be explained at binary level, but right now I can't think anything better than this:

Flag value Act 1 Act 2 Act 3
00 - 08 Incomplete Incomplete Incomplete
01 - 09 Passed Incomplete Incomplete
02 - 0A Incomplete Passed Incomplete
03 - 0B Passed Passed Incomplete
04 - 0C Incomplete Incomplete Passed
05 - 0D Passed Incomplete Passed
06 - 0E Incomplete Passed Passed
07 - 0F Passed Passed Passed

Values from 00 to 07 mean Boss Act incomplete. Values from 08 to 0F mean otherwise. However the Boss Act can only be accessed when all three Acts are complete (07 or 0F).

Chaos Emerald flag

At least, I figured the "binary spirit" embed in this one. In order to check how many Chaos Emeralds you have, convert the flag value to binary and read it from right to left, as if it would be from Zone 1 to Zone 7. All Emeralds is 7Fh (01111111) and no Emeralds is 0 (00000000). Let's say the current flag value is 47h. Converting it to binary (01000111) and then checking out will reveal that Emeralds from Zones 1, 2, 3 and 7 were gotten. This flag works in Chao's Playground regardless of how many Chao have been found.

Special Key flag

This value is set to 1 when the player collects a Special Key in an Act. The end-of-level results screen checks this flag to add 1 Special Key to the player's count.

References


Sonic Advance 3
SonicAdvance3 title.png

Main page
Comparisons
Maps
Credits


Manuals
Promotional material
Magazine articles
Reception


Development
Hidden content
Bugs
Technical information

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