User:Crabb/GunstarSuperHeroes
a very nice GBA game. this is just some notes in case someone wants to go dig and find more unused content. once i figure out exactly something works, i'll post it to the main page.
if you find anything nice that isn't here, feel free to edit!
Memory Layout
Brief intro, GBA has 2 main areas of RAM; IWRAM (32 KB) and EWRAM (256 KB). IWRAM is faster to access than EWRAM, so most of the data there contains data that requires quick access (ex. objects & player)
Important note about data in IWRAM GSH often does some type of allocation with data in IWRAM, so don't expect data there to always be in the same location. to help with this, EWRAM often contains pointers to where data should be in IWRAM.
EWRAM
Addresses here are relative to EWRAM's start. (@ 0x02000000)
Offset | Type | Description |
---|---|---|
0x02:92C4 | u32 | Pointer to player's Gunstar struct. |
IWRAM
Addresses here are relative to IWRAM's start. (@ 0x03000000)
Offset | Description |
---|---|
0x07F4 | BIOS vector/interrupt handler. |
0x2540 | Shot/object table. (※ Offset may change.) |
Gunstar Struct
the struct that contains... you! this is just a rough map of the player's struct.
Offset | Name | Type | Description |
---|---|---|---|
0x0072 | input_table | u16[0xF0] | Contains a FIFO of the gunstar's previously pressed inputs. Each entry is a button/d-pad press. |
0x016D | shottype | u8 | The gunstar's current shot type. |
0x017C | position | vec2.f16 | Contains a 16.16 fixed-point vector of the gunstar's current position. |
0x0184 | velocity | vec2.f16 | Gunstar's current velocity. |
0x01BD | shottype_index | u8 | The gunstar's shot type index. The game finds the shot type to use by reading shottype_table[shottype_index]. |
0x01BE | shottype_table | u8[3] | A table, with each value being the currently equipped shot type for that slot. For Red, it'd be [01 02 04], and for Blue, [03 02 04] |
banter
- shot type 0 is unused, but functional. it uses the same EX attack as Red's Force, and there doesn't seem to be any known issues when using it.
Object Table
each object should occupy around 0xC0(?) bytes. most of this is just the result of poking around with RAM editors, so it may not be completely accurate.
※ contents of each object changes depending on the type, but the first 0x10 bytes seem to have the same purpose across every object.
Offset | Name | Type | Description |
---|---|---|---|
0x0008 | type | u16 |
the object's type(?). for example, D1C5 == yellow's ship. |
0x0010 | position | vec2.f16 |
contains the object's 2D position. |
0x0020 | velocity | vec2.f16 |
contains the object's 2D velocity. |
0x0028 | time | u16 |
the time the object's been alive, in frames. (※ Only for Red's A shot.) |