RAM map (Boktai 2): Difference between revisions

No edit summary
Heap, camera, time
 
(20 intermediate revisions by 2 users not shown)
Line 2: Line 2:


= EWRAM =
= EWRAM =
{| class="wikitable"
{| class="wikitable exportable"
|-
|-
! Address || Type || Description
! Address || Type || Description
|-
| 0x02000000 || || [[Heap]] (129 KiB)
|-
|-
| 0x0200184c || || Is full moon (*0x030047f6 == 4)
| 0x0200184c || || Is full moon (*0x030047f6 == 4)
Line 18: Line 20:


== Stat struct ==
== Stat struct ==
{| class="wikitable"
Access this struct via 0x030046a0. Size: 0x958 bytes. See also: [[Inventory (Boktai 2)]].
 
{| class="wikitable exportable"
|-
|-
! Offset || Type || Description
! Offset || Type || Description
Line 26: Line 30:
| 0x30 || i16[3] || Django(& Sabata?) position
| 0x30 || i16[3] || Django(& Sabata?) position
|-
|-
| 0x40 || i16 || Current level
| 0x40 || i16 || Current level*
|-
|-
| 0x42 || i16 || Allocatable stat points
| 0x42 || i16 || Allocatable stat points
Line 34: Line 38:
| 0x50 || i32 || Total EXP
| 0x50 || i32 || Total EXP
|-
|-
| 0x54 || i32 || Magic inventory (bitmask)
| 0x54 || i32 || Magic [[Inventory (Boktai 2)|inventory]] (bitmask)
|-
|-
| 0x70 || i16[48] || Item [[Inventory (Boktai 2)|inventory]] slots
| 0x70 || i16[48] || Item inventory slots
|-
|-
| 0xd0 || i16[48] || Item inventory durability
| 0xd0 || i16[48] || Item inventory durability
Line 42: Line 46:
| 0x130 || i16[16] || Key item inventory
| 0x130 || i16[16] || Key item inventory
|-
|-
| 0x150 || i16[32] || Accessory inventory
| 0x150 || i16[32] || Protector inventory
|-
|-
| 0x23a || i16 || Solar bank interest rate (stored as <code>(1+r)*64<code>, e.g. 14.0625% = 73)
| 0x23a || i16 || Solar bank interest rate (stored as <code>(1+r)*64</code>, e.g. 14.0625% = 73). Defaults to 65 when starting a new game. When the date changes, the rate will change to <code>65 + ([[#STAT_2b4|IGT_frame_counter]] XOR [[#IWRAM_47e6|RTC_seconds]]) mod 13</code> (effectively uniformly distributed in the interval [1.5625%, 20.3125%]).
|-
|-
| 0x242 || i16 || Current [[Maps (Boktai 2)|map ID]]
| 0x242 || i16 || Current [[Maps (Boktai 2)|map ID]]
Line 53: Line 57:
|-
|-
| 0x24c || i32 || Current map's init script ID
| 0x24c || i32 || Current map's init script ID
|-
| id="STAT_2b4" | 0x2b4 || i32 || IGT frame counter for this save file
|-
|-
| 0x2c0 || || Django: Kaamos progress
| 0x2c0 || || Django: Kaamos progress
Line 61: Line 67:
|-
|-
| 0x2ce || || Sabata: Kaamos status
| 0x2ce || || Sabata: Kaamos status
|-
| 0x3bc || i32 || Solar Station
|-
|-
| 0x3d0 || struct[16] || [[Inventory (Boktai 2)#Weapons|Weapon inventory]]
| 0x3d0 || struct[16] || [[Inventory (Boktai 2)#Weapons|Weapon inventory]]
|-
| 0x910 || i32 || Solar Bank
|}
|}
''* <small>Sabata's level is always Django's level +10. His stats are also spread evenly. Each point is added in the following order : VIT > SPR > STR > AGI > Repeat.</small>''


== World struct ==
== World struct ==
''Note:'' In the Japanese version, this struct is laid out slightly differently.
Access this struct via 0x03004698. Size: 0x400 bytes. ''Note:'' In the Japanese version, this struct is laid out slightly differently.


{| class="wikitable"
{| class="wikitable exportable"
|-
|-
! Offset || Type || Description
! Offset || Type || Description
|-
| 0x172 || u8[4] || Remains stone tablet locations (0=NW ... 8=SE)
|-
| 0x17d || u8 || Spiral tower axe+ puzzle: Sabata's amount
|-
| 0x17e || u8 || Spiral tower axe+ puzzle: Django's amount
|-
| 0x17f || u8 || Spiral tower axe+ puzzle: Django's direction (0=North, 1=South)
|-
| 0x180 || u8 || Spiral tower axe+ puzzle: Sabata's direction (0=East, 1=West)
|-
| 0x1ac:0 || bit || House of Time: Present/past flag
|-
|-
| 0x1e8 || i16 || Current door ID
| 0x1e8 || i16 || Current door ID
Line 76: Line 99:


== Scratch struct ==
== Scratch struct ==
{| class="wikitable"
Access this struct via 0x03004690.
 
{| class="wikitable exportable"
|-
|-
! Offset || Type || Description
! Offset || Type || Description
Line 83: Line 108:
= IWRAM =
= IWRAM =


{| class="wikitable"
{| class="wikitable exportable"
|-
|-
! Address || Type || Description
! Address || Type || Description
Line 99: Line 124:
| + 0x364 || i32[2] || Current HP/ENE
| + 0x364 || i32[2] || Current HP/ENE
|-
|-
| 0x03002cb8 || code* || Pointer to TM3 interrupt handler
| 0x03002cb4 || code* || Pointer to SIO IRQ handler
|-
| 0x03002cb8 || code* || Pointer to TM3 IRQ handler
|-
| 0x03002ce4 || i32 || MusicPlayer2000 VBlank IRQ done flag (set by VBlank IRQ handler to 1 after calling MP2K_SoundVSync(), but before video processing)
|-
|-
| 0x03002cf0 || i32 || Frames since reset
| 0x03002cf0 || i32 || Frames since reset
|-
| 0x03003540 || |i16[3] || [[Coordinate systems|Camera]] position in world space
|-
| 0x03003548 || i16 || Tile map X coordinate in view space
|-
| 0x0300354a || i16 || Tile map Y coordinate in view space
|-
| 0x030044bc || u32 || [[Actor]] disable flags
|-
| 0x030044e0 || u16 || Keypad: down buttons (active-high)
|-
| 0x030044e2 || u16 || Keypad: pressed buttons (down current frame, up on previous frame)
|-
| 0x030044e4 || u16 || Keypad: released buttons (up on current frame, down on previous frame)
|-
| 0x03004520 || Array || [[Actor]] list
|-
|-
| 0x030045a0 || void* || [[Bytecode]]: Program counter
| 0x030045a0 || void* || [[Bytecode]]: Program counter
|-
|-
| 0x03004690 || void* || Pointer to [[#Scratch struct]], defaults to 0x0203da00 on hard reset (but moves on soft resets)
| 0x03004690 || void* || Pointer to [[#Scratch struct]], defaults to 0x0203e200 on hard reset (but moves on soft resets)
|-
|-
| 0x03004698 || void* || Pointer to [[#Stat struct]], defaults to 0x0203e200 on hard reset (but moves on soft resets)
| 0x03004694 || void* || Pointer to backup of the world struct (created on screen transitions, reloaded on death, saved to save file when saving)
|-
|-
| 0x030046a0 || void* || Pointer to [[#World struct]], defaults to 0x0203c400 on hard reset (but moves on soft resets)
| 0x03004698 || void* || Pointer to [[#World struct]], defaults to 0x0203da00 on hard reset (but moves on soft resets)
|-
| 0x0300469c || void* || Pointer to backup of the stat struct
|-
| 0x030046a0 || void* || Pointer to [[#Stat struct]], defaults to 0x0203c400 on hard reset (but moves on soft resets)
|-
|-
| 0x030047a8 || struct* || Pointer to [[#Global save data]] (always 0x030016c0)
| 0x030047a8 || struct* || Pointer to [[#Global save data]] (always 0x030016c0)
|-
|-
| 0x030046b8 || i32 || [[Random number generator|RNG index]]
| 0x030046b8 || i32 || [[Random number generator|RNG index]]
|-
| 0x030047c8 || i16[3] || [[Coordinate systems|Camera]] position in view space
|-
| 0x030047d0 || Camera* || Pointer to camera actor
|-
|-
| 0x030047e0 || u32 || RTC date (BCD, yyyymmdd)
| 0x030047e0 || u32 || RTC date (BCD, yyyymmdd)
Line 121: Line 174:
| 0x030047e5 || u8 || RTC minutes
| 0x030047e5 || u8 || RTC minutes
|-
|-
| 0x030047e6 || u8 || RTC seconds
| id="IWRAM_47e6" | 0x030047e6 || u8 || RTC seconds
|-
| 0x030047e7 || u8 || RTC frames
|-
|-
| 0x030047cc || i32 || Solar sensor interface: Timer interval (TM3CNT_LO will be set to -this value)
| 0x030047cc || i32 || Solar sensor interface: Timer interval (TM3CNT_LO will be set to -this value)
|-
| 0x030047ea || u8 || [[Time|Sunrise]] hours
|-
| 0x030047eb || u8 || Sunrise minutes
|-
| 0x030047ec || u8 || Sunset hours
|-
| 0x030047ed || u8 || Sunset minutes
|-
| 0x030047f0 || u8 || Hours until sunset
|-
| 0x030047f1 || u8 || Minutes until sunset
|-
| 0x030047f2 || u8 || Hours until sunrise
|-
| 0x030047f3 || u8 || Minutes until sunrise
|-
|-
| 0x030047f6 || i32 || Current moon phase
| 0x030047f6 || i32 || Current moon phase
|-
| 0x030047f8 || i32 || [[Time|Region]] latitude
|-
| 0x030047fc || i32 || Region longitude
|-
| 0x03004800 || i32 || Region time zone offset
|-
|-
| 0x030057b8 || i32 || Solar sensor interface: Is enabled (true/false)
| 0x030057b8 || i32 || Solar sensor interface: Is enabled (true/false)
Line 132: Line 209:
|-
|-
| 0x030057c8 || i32 || Solar sensor interface: Raw level (counter / 2 when GPIO_DATA & 8 becomes nonzero. 0=max brightness, 255=dark)
| 0x030057c8 || i32 || Solar sensor interface: Raw level (counter / 2 when GPIO_DATA & 8 becomes nonzero. 0=max brightness, 255=dark)
|-
| 0x03007ff0 || void* || MusicPlayer2000: Pointer to sound buffer
|}
|}


== Global save data ==
== Global save data ==


{| class="wikitable"
{| class="wikitable exportable"
|-
|-
! Offset || Type || Description
! Offset || Type || Description
Line 143: Line 222:
|-
|-
| 0x04 || i32 || Solar sensor calibration (<code>raw level - 2</code> at time of calibration)
| 0x04 || i32 || Solar sensor calibration (<code>raw level - 2</code> at time of calibration)
|-
| 0x0b || u8 || Daylight savings time active
|-
|-
| 0x18 || u16 || [[Downloadable_events|Unlock Blindbox Lv. 3 event]]
| 0x18 || u16 || [[Downloadable_events|Unlock Blindbox Lv. 3 event]]