Difference between revisions of "Save File (OKAMI) File Format"

From Ōkami Speedrun Wiki
Jump to navigation Jump to search
(add map struct and formatting)
(→‎Character Stats: main and sub weapon)
 
(3 intermediate revisions by the same user not shown)
Line 33: Line 33:
| 0x1290 || <code>[[#Map Data|MapData]][83]</code> || 0x49EC || Persistent map flags and values (more map flags in [[#Collection Data|CollectionData]]). Index is the [[Map Table]] vanilla index.
| 0x1290 || <code>[[#Map Data|MapData]][83]</code> || 0x49EC || Persistent map flags and values (more map flags in [[#Collection Data|CollectionData]]). Index is the [[Map Table]] vanilla index.
|-
|-
| 0x5C7C || <code>uint32_t[83][16]</code> || 0x14C0 || [[#Conversation Data|Conversation dialog bits]]. 512 bits per map. If a bit is set, then the dialog has been completed before. First index is the [[Map Table]] vanilla index. Second is the bitfield index.
| 0x5C7C || <code>uint32_t[83][16]</code> || 0x14C0 || Conversation dialog bits. 512 bits per map. If a bit is set, then the dialog has been completed before. First index is the [[Map Table]] vanilla index. Second is the bitfield index.
|-
|-
| 0x713C || <code>uint32_t</code> || 4 || unknown
| 0x713C || <code>uint32_t</code> || 4 || unknown
Line 75: Line 75:
| 0x0026 || 0x0E || <code>uint16_t</code> || 2 || unknown (padding?)
| 0x0026 || 0x0E || <code>uint16_t</code> || 2 || unknown (padding?)
|-
|-
| 0x0028 || 0x10 || <code>uint32_t[2]</code> || 8 || Bitmask for dojo techniques unlocked
| 0x0028 || 0x10 || <code>uint32_t[1]</code> || 4 || [[#Bitfields|Bitmask]] for dojo techniques unlocked
|-
|-
| 0x0030 || 0x18 || <code>uint8_t</code> || 1 || unknown
| 0x002C || 0x14 || <code>uint32_t</code> || 4 || unknown
|-
|-
| 0x0031 || 0x19 || <code>uint8_t</code> || 1 || unknown
| 0x0030 || 0x18 || <code>uint8_t</code> || 1 || Main weapon equipped.
|-
| 0x0031 || 0x19 || <code>uint8_t</code> || 1 || Sub weapon equipped.
|-
|-
| 0x0032 || 0x1A || <code>uint8_t</code> || 1 || unknown
| 0x0032 || 0x1A || <code>uint8_t</code> || 1 || unknown
Line 114: Line 116:
! Relative Offset !! Type !! Size !! Description
! Relative Offset !! Type !! Size !! Description
|-
|-
| 0x00 || <code>uint32_t[32]</code> || 0x80 || Map specific data, not shared like the remaining structure. For example index 0 on Kimiki is a bitfield, index 0 on Shinshu is a counter.
| 0x00 || <code>uint32_t[32]</code> || 0x80 || Map specific data, not shared like the remaining structure. For example index 0 on Kamiki is a bitfield, index 0 on Shinshu is a counter.
|-
|-
| 0x80 || <code>uint32_t[3]</code> || 0xC || [[#Bitfields|Bitfield]] for revealing buried objects. Usually shares same ID with collected object bitfield.
| 0x80 || <code>uint32_t[3]</code> || 0xC || [[#Bitfields|Bitfield]] for revealing buried objects. Usually shares same ID with collected object bitfield.
|-
|-
| 0x8C || <code>uint32_t[3]</code> || 0xC || [[#Bitfields|Bitfield]] for collected objects. Includes chests, permanent fruit, blooming clovers.
| 0x8C || <code>uint32_t[3]</code> || 0xC || Bitfield for collected objects. Includes chests, permanent fruit, blooming clovers.
|-
|-
| 0x98 || <code>uint32_t[1]</code> || 0x4 || Unknown.
| 0x98 || <code>uint32_t[1]</code> || 0x4 || Unknown.
Line 124: Line 126:
| 0x9C || <code>uint32_t</code> || 0x4 || Time of day. Usually synchronized with world time of day.
| 0x9C || <code>uint32_t</code> || 0x4 || Time of day. Usually synchronized with world time of day.
|-
|-
| 0xA0 || <code>uint32_t[3]</code> || 0xC || [[#Bitfields|Bitfield]] for map areas restored.
| 0xA0 || <code>uint32_t[3]</code> || 0xC || Bitfield for map areas restored.
|-
|-
| 0xAC || <code>uint32_t[1]</code> || 0x4 || [[#Bitfields|Bitfield]] for trees bloomed.
| 0xAC || <code>uint32_t[1]</code> || 0x4 || Bitfield for trees bloomed.
|-
|-
| 0xB0 || <code>uint32_t[1]</code> || 0x4 || [[#Bitfields|Bitfield]] for cursed trees bloomed in Hana Valley.
| 0xB0 || <code>uint32_t[1]</code> || 0x4 || Bitfield for cursed trees bloomed in Hana Valley.
|-
|-
| 0xB4 || <code>uint32_t[4]</code> || 0x10 || [[#Bitfields|Bitfield]] for Hell Gates cleared. Maybe other uses.
| 0xB4 || <code>uint32_t[4]</code> || 0x10 || Bitfield for Hell Gates cleared. Maybe other uses.
|-
|-
| 0xC4 || <code>uint32_t[2]</code> || 0x8 || [[#Bitfields|Bitfield]] for whether NPCs have more to say.
| 0xC4 || <code>uint32_t[2]</code> || 0x8 || Bitfield for whether NPCs have more to say.
|-
|-
| 0xCC || <code>uint32_t[2]</code> || 0x8 || Unknown [[#Bitfields|Bitfield]] related to NPCs.
| 0xCC || <code>uint32_t[2]</code> || 0x8 || Unknown Bitfield related to NPCs.
|-
|-
| 0xD4 || <code>uint32_t[2]</code> || 0x8 || Unknown [[#Bitfields|Bitfield]].
| 0xD4 || <code>uint32_t[2]</code> || 0x8 || Unknown Bitfield.
|-
|-
| 0xDC || <code>uint32_t[1]</code> || 0x4 || Unknown [[#Bitfields|Bitfield]].
| 0xDC || <code>uint32_t[1]</code> || 0x4 || Unknown Bitfield.
|-
|-
| 0xE0 || <code>uint32_t[1]</code> || 0x4 || Unknown [[#Bitfields|Bitfield]].
| 0xE0 || <code>uint32_t[1]</code> || 0x4 || Unknown Bitfield.
|}
|}



Latest revision as of 07:48, 26 June 2025

The following article is currently a Work In Progress and will have more details soon.


Note: This page pertains to Reverse Engineering of Okami File Formats.

Save File

The save file is exactly 2 846 400 bytes (2.71MB), with a fixed allocation of 30 save slots.

Okami HD save file information is located at Steam/userdata/<user-id>/587620/remote/Steam/OKAMI.

Save Slot

Each save slot is 94880 (0x172A0) bytes.

Save Slot Format
Offset Type Size Description
0x0000 uint32_t 4 00 00 40 40
0x0004 uint32_t 4 Area name string ID
0x0008 uint64_t 8 Slot checksum
0x0010 uint64_t 8 Save time RTC (result of wk::OSGetTimeRTC from flower_kernel.dll)
0x0018 CharacterStats 0x48 Character Stats such as health, food, praise, godhood, position, and some unlocks.
0x60 TrackerData 0x80 Tracking information such as first-time item acquisition, logbook, bestiary, time played, etc.
0xE0 CollectionData 0x11B0 Items collected, inventory, current map, travel guides and various tomes collected, time and day, brush techniques, map states, rejuvenated areas, animals fed, money, demon fangs, enemies slain, etc.
0x1290 MapData[83] 0x49EC Persistent map flags and values (more map flags in CollectionData). Index is the Map Table vanilla index.
0x5C7C uint32_t[83][16] 0x14C0 Conversation dialog bits. 512 bits per map. If a bit is set, then the dialog has been completed before. First index is the Map Table vanilla index. Second is the bitfield index.
0x713C uint32_t 4 unknown
0x7140 TextureData 0x10160 Texture information for drawn in-game art. i.e. the Imp Mask drawn in the Moon Cave.

Bitfields

Bit access by id is done a specific way, using arrays of 32-bit integers and testing bits from highest to lowest.

The following is an example of how to test a bit at a specific index.

bool IsBitSet(uint32_t *data, uint32_t index) {
    return (data[index / 32] & (0x80000000 >> (index % 32))) != 0;
}

The logic can be verified by using the Item Table IDs on the first item acquisition bitfield.

Character Stats

The following article is currently a Work In Progress and will have more details soon.


Save Offset Relative Offset Type Size Description
0x0018 0x00 uint16_t 2 Current health
0x001A 0x02 uint16_t 2 Max health
0x001C 0x04 uint16_t 2 Current food (Astral Pouch)
0x001E 0x06 uint16_t 2 Max food (Astral Pouch)
0x0020 0x08 uint8_t 1 unknown
0x0021 0x09 uint8_t 1 unknown (padding?)
0x0022 0x0A uint16_t 2 Current praise
0x0024 0x0C uint16_t 2 Total praise
0x0026 0x0E uint16_t 2 unknown (padding?)
0x0028 0x10 uint32_t[1] 4 Bitmask for dojo techniques unlocked
0x002C 0x14 uint32_t 4 unknown
0x0030 0x18 uint8_t 1 Main weapon equipped.
0x0031 0x19 uint8_t 1 Sub weapon equipped.
0x0032 0x1A uint8_t 1 unknown
0x0033 0x1B uint8_t 1 unknown (padding?)
0x0034 0x1C uint16_t 2 Godhood Points
0x0036 0x1E uint16_t 2 unknown (padding?)
0x0038 0x20 uint32_t[2] 8 unknown
0x0040 0x28 uint16_t 2 unknown
0x0042 0x2A uint16_t 2 unknown
0x0044 0x2C uint16_t 2 unknown
0x0046 0x2E uint16_t 2 unknown (padding?)
0x0048 0x30 float[3] 0xC x, y, z
0x0054 0x3C float[3] 0xC u, v, w

Tracker Data

The following article is currently a Work In Progress and will have more details soon.


Collection Data

The following article is currently a Work In Progress and will have more details soon.


Map Data

Relative Offset Type Size Description
0x00 uint32_t[32] 0x80 Map specific data, not shared like the remaining structure. For example index 0 on Kamiki is a bitfield, index 0 on Shinshu is a counter.
0x80 uint32_t[3] 0xC Bitfield for revealing buried objects. Usually shares same ID with collected object bitfield.
0x8C uint32_t[3] 0xC Bitfield for collected objects. Includes chests, permanent fruit, blooming clovers.
0x98 uint32_t[1] 0x4 Unknown.
0x9C uint32_t 0x4 Time of day. Usually synchronized with world time of day.
0xA0 uint32_t[3] 0xC Bitfield for map areas restored.
0xAC uint32_t[1] 0x4 Bitfield for trees bloomed.
0xB0 uint32_t[1] 0x4 Bitfield for cursed trees bloomed in Hana Valley.
0xB4 uint32_t[4] 0x10 Bitfield for Hell Gates cleared. Maybe other uses.
0xC4 uint32_t[2] 0x8 Bitfield for whether NPCs have more to say.
0xCC uint32_t[2] 0x8 Unknown Bitfield related to NPCs.
0xD4 uint32_t[2] 0x8 Unknown Bitfield.
0xDC uint32_t[1] 0x4 Unknown Bitfield.
0xE0 uint32_t[1] 0x4 Unknown Bitfield.

Texture Data

Save Offset Relative Offset Type Size Description
0x7140 0x00 uint8_t[0x8000] 0x8000 Texture 1 Image bits (4 bits per pixel) (256x256)
0xF140 0x8000 uint32_t[16] 0x40 Texture 1 unknown colour information
0xF180 0x8040 uint32_t[16] 0x40 Texture 1 unknown colour information
0xF1C0 0x8080 hx::Texture[2] 0x30 Texture 1 unknown
0xF1F0 0x80B0 uint8_t[0x8000] 0x8000 Texture 2 Image bits (4 bits per pixel) (256x256)
0x171F0 0x100B0 uint32_t[16] 0x40 Texture 2 unknown colour information
0x17230 0x100F0 uint32_t[16] 0x40 Texture 2 unknown colour information
0x17270 0x10130 hx::Texture[2] 0x30 Texture 2 unknown