RAM map (Boktai 2): Difference between revisions

From Boktai Hacking Wiki
No edit summary
No edit summary
Line 2: Line 2:


= EWRAM =
= EWRAM =
{| class="wikitable"
|-
! Address || Type || Description
|-
| 0x0200184c || || Is full moon (*0x030047f6 == 4)
|-
| 0x02001469 || i8 || High-level solar sensor state: 0=disabled, 1=waiting for enable, 2=enabled. When going through a screen transition, this will change from 2 -> 0 -> 1 -> 2.
|-
| 0x0200146c || i16 || High-level solar sensor: Calibrated level (0=dark, 140=max brightness. Calibrated level = calibration - raw level, then clamp to 0-140)
|-
| 0x02001470 || i16 || High-level solar sensor delay: Used for delaying the state 0 -> 1 and 1 -> 2 transitions
|}


== Stat struct ==
== Stat struct ==
Line 7: Line 19:
|-
|-
! Offset || Type || Description
! Offset || Type || Description
|-
| 0x30 || i16[3] || Django(& Sabata?) position
|-
|-
| 0x50 || i32 || Total EXP
| 0x50 || i32 || Total EXP
Line 12: Line 26:
| 0x54 || i32 || Magic inventory (bitmask)
| 0x54 || i32 || Magic inventory (bitmask)
|-
|-
| 0x242 || i16 || Current [[Maps (Boktai 2)|Map ID]]
| 0x23a || i16 || Solar bank interest rate (stored as <code>(1+r)*64<code>, e.g. 14.0625% = 73)
|-
| 0x242 || i16 || Current [[Maps (Boktai 2)|map ID]]
|-
| 0x254 || i16 || Current [[Maps (Boktai 2)#Areas|area ID]]
|-
|-
| 0x24c || i32 || Current map's init script ID
| 0x24c || i32 || Current map's init script ID
Line 18: Line 36:


== World struct ==
== World struct ==
''Note:'' In the Japanese version, this struct is laid out slightly differently.
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 37: Line 57:
! Address || Type || Description
! Address || Type || Description
|-
|-
| 0x030016c0 || byte[0x28] || Global save data, loaded from save file @ 0x00-0x28
| 0x030026b4 || i32 || Solar sensor interface: State (0=measuring, 1=resetting, 2=idle)
|-
|-
| ... 0x030016d8 || u16 || [[Downloadable_events|Unlock Blindbox Lv. 3 event]]
| 0x030026b8 || i32 || Solar sensor interface: Counter (0-511, counts half-cycles of the 74LV4040 counter chip)
|-
|-
| ... 0x030016da || u16 || [[Downloadable_events|Unlock Blindbox Lv. 4 event]]
| 0x030026c0 || i32 || Solar sensor interface: shift out (next value to be written to GPIO_DATA)
|-
|-
| ... 0x030016dc || u16 || [[Downloadable_events|Unlock Blindbox Lv. 5 & valentine's day event]]
| 0x03002cb8 || code* || Pointer to TM3 interrupt handler
|-
|-
| ... 0x030016de || u16 || [[Downloadable_events|Unlock Something has happened to ???'s body event]]
| 0x03002cf0 || i32 || Frames since reset
|-
| 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 0x0203da00 on hard reset (but moves on soft resets)
Line 52: Line 74:
|-
|-
| 0x030046a0 || void* || Pointer to [[#World struct]], defaults to 0x0203c400 on hard reset (but moves on soft resets)
| 0x030046a0 || void* || Pointer to [[#World struct]], defaults to 0x0203c400 on hard reset (but moves on soft resets)
|-
| 0x030047a8 || struct* || Pointer to [[#Global save data]] (always 0x030016c0)
|-
|-
| 0x030046b8 || i32 || [[Random number generator|RNG index]]
| 0x030046b8 || i32 || [[Random number generator|RNG index]]
|-
| 0x030047e0 || u32 || RTC date (BCD, yyyymmdd)
|-
| 0x030047e4 || u8 || RTC hours
|-
| 0x030047e5 || u8 || RTC minutes
|-
| 0x030047e6 || u8 || RTC seconds
|-
| 0x030047cc || i32 || Solar sensor interface: Timer interval (TM3CNT_LO will be set to -this value)
|-
| 0x030047f6 || i32 || Current moon phase
|-
| 0x030057b8 || i32 || Solar sensor interface: Is enabled (true/false)
|-
| 0x030057bc || i32 || Solar sensor interface: Last result (GPIO_DATA & 8)
|-
| 0x030057c8 || i32 || Solar sensor interface: Raw level (counter / 2 when GPIO_DATA & 8 becomes nonzero. 0=max brightness, 255=dark)
|}
== Global save data ==
{| class="wikitable"
|-
! Offset || Type || Description
|-
| 0x00 || i32 || Global frame counter
|-
| 0x04 || i32 || Solar sensor calibration (<code>raw level - 2</code> at time of calibration)
|-
| 0x18 || u16 || [[Downloadable_events|Unlock Blindbox Lv. 3 event]]
|-
| 0x1a || u16 || [[Downloadable_events|Unlock Blindbox Lv. 4 event]]
|-
| 0x1c || u16 || [[Downloadable_events|Unlock Blindbox Lv. 5 & valentine's day event]]
|-
| 0x1e || u16 || [[Downloadable_events|Unlock Something has happened to ???'s body event]]
|}
|}


Line 60: Line 121:


[[Save data checksums]]
[[Save data checksums]]
= Version differences =
''TODO''
WORLD block is different


[[Category:Documentation]]
[[Category:Documentation]]
[[Category:Boktai 2]]
[[Category:Boktai 2]]

Revision as of 18:44, 8 August 2024

This is the RAM map for Boktai 2 (U).

EWRAM

Address Type Description
0x0200184c Is full moon (*0x030047f6 == 4)
0x02001469 i8 High-level solar sensor state: 0=disabled, 1=waiting for enable, 2=enabled. When going through a screen transition, this will change from 2 -> 0 -> 1 -> 2.
0x0200146c i16 High-level solar sensor: Calibrated level (0=dark, 140=max brightness. Calibrated level = calibration - raw level, then clamp to 0-140)
0x02001470 i16 High-level solar sensor delay: Used for delaying the state 0 -> 1 and 1 -> 2 transitions

Stat struct

Offset Type Description
0x30 i16[3] Django(& Sabata?) position
0x50 i32 Total EXP
0x54 i32 Magic inventory (bitmask)
0x23a i16 Solar bank interest rate (stored as (1+r)*64, e.g. 14.0625% = 73)
0x242 i16 Current map ID
0x254 i16 Current area ID
0x24c i32 Current map's init script ID

World struct

Note: In the Japanese version, this struct is laid out slightly differently.

Offset Type Description
0x1e8 i16 Current door ID

Scratch struct

Offset Type Description

IWRAM

Address Type Description
0x030026b4 i32 Solar sensor interface: State (0=measuring, 1=resetting, 2=idle)
0x030026b8 i32 Solar sensor interface: Counter (0-511, counts half-cycles of the 74LV4040 counter chip)
0x030026c0 i32 Solar sensor interface: shift out (next value to be written to GPIO_DATA)
0x03002cb8 code* Pointer to TM3 interrupt handler
0x03002cf0 i32 Frames since reset
0x030045a0 void* Bytecode: Program counter
0x03004690 void* Pointer to #Scratch struct, defaults to 0x0203da00 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)
0x030046a0 void* Pointer to #World struct, defaults to 0x0203c400 on hard reset (but moves on soft resets)
0x030047a8 struct* Pointer to #Global save data (always 0x030016c0)
0x030046b8 i32 RNG index
0x030047e0 u32 RTC date (BCD, yyyymmdd)
0x030047e4 u8 RTC hours
0x030047e5 u8 RTC minutes
0x030047e6 u8 RTC seconds
0x030047cc i32 Solar sensor interface: Timer interval (TM3CNT_LO will be set to -this value)
0x030047f6 i32 Current moon phase
0x030057b8 i32 Solar sensor interface: Is enabled (true/false)
0x030057bc i32 Solar sensor interface: Last result (GPIO_DATA & 8)
0x030057c8 i32 Solar sensor interface: Raw level (counter / 2 when GPIO_DATA & 8 becomes nonzero. 0=max brightness, 255=dark)

Global save data

Offset Type Description
0x00 i32 Global frame counter
0x04 i32 Solar sensor calibration (raw level - 2 at time of calibration)
0x18 u16 Unlock Blindbox Lv. 3 event
0x1a u16 Unlock Blindbox Lv. 4 event
0x1c u16 Unlock Blindbox Lv. 5 & valentine's day event
0x1e u16 Unlock Something has happened to ???'s body event

EEPROM

TODO

Save data checksums