Difference between revisions of "Save File (OKAMI) File Format"
Jump to navigation
Jump to search
The following article is currently a Work In Progress and will have more details soon.
The following article is currently a Work In Progress and will have more details soon.
The following article is currently a Work In Progress and will have more details soon. The following article is currently a Work In Progress and will have more details soon.
Heinermann (talk | contribs) (→Texture Data: more info on texture stuff) |
Heinermann (talk | contribs) (→Character Stats: fix a field size) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 17: | Line 17: | ||
! Offset !! Type !! Size !! Description | ! Offset !! Type !! Size !! Description | ||
|- | |- | ||
| 0x0000 || uint32_t || 4 || 00 00 40 40 | | 0x0000 || <code>uint32_t</code> || 4 || 00 00 40 40 | ||
|- | |- | ||
| 0x0004 || uint32_t || 4 || Area name string ID | | 0x0004 || <code>uint32_t</code> || 4 || Area name string ID | ||
|- | |- | ||
| 0x0008 || uint64_t || 8 || Slot checksum | | 0x0008 || <code>uint64_t</code> || 8 || Slot checksum | ||
|- | |- | ||
| 0x0010 || uint64_t || 8 || Save time RTC (result of <code>wk::OSGetTimeRTC</code> from <code>flower_kernel.dll</code>) | | 0x0010 || <code>uint64_t</code> || 8 || Save time RTC (result of <code>wk::OSGetTimeRTC</code> from <code>flower_kernel.dll</code>) | ||
|- | |- | ||
| 0x0018 || [[#Character Stats|CharacterStats]] || 0x48 || Character Stats such as health, food, praise, godhood, position, and some unlocks. | | 0x0018 || <code>[[#Character Stats|CharacterStats]]</code> || 0x48 || Character Stats such as health, food, praise, godhood, position, and some unlocks. | ||
|- | |- | ||
| 0x60 || [[#Tracker Data|TrackerData]] || 0x80 || Tracking information such as first-time item acquisition, logbook, bestiary, time played, etc. | | 0x60 || <code>[[#Tracker Data|TrackerData]]</code> || 0x80 || Tracking information such as first-time item acquisition, logbook, bestiary, time played, etc. | ||
|- | |- | ||
| 0xE0 || [[#Collection Data|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. | | 0xE0 || <code>[[#Collection Data|CollectionData]]</code> || 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 || | | 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 || uint32_t[83][16] || 0x14C0 || | | 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 || uint32_t || 4 || unknown | | 0x713C || <code>uint32_t</code> || 4 || unknown | ||
|- | |- | ||
| 0x7140 || [[#Texture Data|TextureData]] || 0x10160 || Texture information for drawn in-game art. i.e. the Imp Mask drawn in the Moon Cave. | | 0x7140 || <code>[[#Texture Data|TextureData]]</code> || 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. | |||
<pre> | |||
bool IsBitSet(uint32_t *data, uint32_t index) { | |||
return (data[index / 32] & (0x80000000 >> (index % 32))) != 0; | |||
} | |||
</pre> | |||
The logic can be verified by using the [[Item Table]] IDs on the first item acquisition bitfield. | |||
=== Character Stats === | === Character Stats === | ||
Line 45: | Line 57: | ||
! Save Offset !! Relative Offset !! Type !! Size !! Description | ! Save Offset !! Relative Offset !! Type !! Size !! Description | ||
|- | |- | ||
| 0x0018 || 0x00 || uint16_t || 2 || Current [[health]] | | 0x0018 || 0x00 || <code>uint16_t</code> || 2 || Current [[health]] | ||
|- | |- | ||
| | | 0x001A || 0x02 || <code>uint16_t</code> || 2 || Max health | ||
|- | |- | ||
| | | 0x001C || 0x04 || <code>uint16_t</code> || 2 || Current [[Food Points|food]] (Astral Pouch) | ||
|- | |- | ||
| | | 0x001E || 0x06 || <code>uint16_t</code> || 2 || Max food (Astral Pouch) | ||
|- | |- | ||
| | | 0x0020 || 0x08 || <code>uint16_t</code> || 2 || unknown | ||
|- | |- | ||
| | | 0x0022 || 0x0A || <code>uint16_t</code> || 2 || Current [[praise]] | ||
|- | |- | ||
| | | 0x0024 || 0x0C || <code>uint16_t</code> || 2 || Total praise | ||
|- | |- | ||
| | | 0x0026 || 0x0E || <code>uint16_t</code> || 2 || unknown (padding?) | ||
|- | |- | ||
| | | 0x0028 || 0x10 || <code>uint32_t[1]</code> || 4 || [[#Bitfields|Bitmask]] for dojo techniques unlocked | ||
|- | |- | ||
| | | 0x002C || 0x14 || <code>uint32_t</code> || 4 || 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 | ||
|- | |- | ||
| | | 0x0033 || 0x1B || <code>uint8_t</code> || 1 || unknown (padding?) | ||
|- | |- | ||
| | | 0x0034 || 0x1C || <code>uint16_t</code> || 2 || [[Godhood Points]] | ||
|- | |- | ||
| | | 0x0036 || 0x1E || <code>uint16_t</code> || 2 || unknown (padding?) | ||
|- | |- | ||
| | | 0x0038 || 0x20 || <code>uint32_t[2]</code> || 8 || Weapons upgraded. | ||
|- | |- | ||
| | | 0x0040 || 0x28 || <code>uint16_t</code> || 2 || Vengeance Slip (deflect enemy attacks) timer. | ||
|- | |- | ||
| | | 0x0042 || 0x2A || <code>uint16_t</code> || 2 || Steel Fist Sake (attack boost) timer. | ||
|- | |- | ||
| | | 0x0044 || 0x2C || <code>uint16_t</code> || 2 || Steel Soul Sake (defense boost) timer. | ||
|- | |- | ||
| | | 0x0046 || 0x2E || <code>uint16_t</code> || 2 || unknown (padding?) | ||
|- | |- | ||
| | | 0x0048 || 0x30 || <code>float[3]</code> || 0xC || x, y, z | ||
|- | |- | ||
| | | 0x0054 || 0x3C || <code>float[3]</code> || 0xC || u, v, w | ||
|} | |} | ||
Line 106: | Line 110: | ||
{{WIP}} | {{WIP}} | ||
=== | === Map Data === | ||
{ | {| class="wikitable" | ||
! 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 Kamiki is a bitfield, index 0 on Shinshu is a counter. | |||
|- | |||
| 0x80 || <code>uint32_t[3]</code> || 0xC || [[#Bitfields|Bitfield]] for revealing buried objects. Shares same ID with collected object bitfield. | |||
|- | |||
| 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. | |||
|- | |||
| 0x9C || <code>uint32_t</code> || 0x4 || Time of day. Usually synchronized with world time of day. | |||
|- | |||
| 0xA0 || <code>uint32_t[3]</code> || 0xC || Bitfield for map areas restored. | |||
|- | |||
| 0xAC || <code>uint32_t[1]</code> || 0x4 || Bitfield for trees bloomed. | |||
|- | |||
| 0xB0 || <code>uint32_t[1]</code> || 0x4 || Bitfield for cursed trees bloomed (the ones that throw cursed fruit at you). | |||
|- | |||
| 0xB4 || <code>uint32_t[4]</code> || 0x10 || Bitfield for fixed fights cleared. Maybe other uses. | |||
|- | |||
| 0xC4 || <code>uint32_t[2]</code> || 0x8 || Bitfield for whether NPCs have more to say. | |||
|- | |||
| 0xCC || <code>uint32_t[2]</code> || 0x8 || Unknown Bitfield related to NPCs. Same IDs as above. | |||
|- | |||
| 0xD4 || <code>uint32_t[2]</code> || 0x8 || Bitfield for maps explored (i.e. dungeons). | |||
|- | |||
| 0xDC || <code>uint32_t[1]</code> || 0x4 || Unknown Bitfield. | |||
|- | |||
| 0xE0 || <code>uint32_t[1]</code> || 0x4 || Unknown Bitfield. | |||
|} | |||
=== Texture Data === | === Texture Data === | ||
Line 113: | Line 147: | ||
! Save Offset !! Relative Offset !! Type !! Size !! Description | ! Save Offset !! Relative Offset !! Type !! Size !! Description | ||
|- | |- | ||
| 0x7140 || 0x00 || uint8_t[0x8000] || 0x8000 || Texture 1 Image bits (4 bits per pixel) (256x256) | | 0x7140 || 0x00 || <code>uint8_t[0x8000]</code> || 0x8000 || Texture 1 Image bits (4 bits per pixel) (256x256) | ||
|- | |- | ||
| 0xF140 || 0x8000 || uint32_t[16] || 0x40 || Texture 1 unknown colour information | | 0xF140 || 0x8000 || <code>uint32_t[16]</code> || 0x40 || Texture 1 unknown colour information | ||
|- | |- | ||
| 0xF180 || 0x8040 || uint32_t[16] || 0x40 || Texture 1 unknown colour information | | 0xF180 || 0x8040 || <code>uint32_t[16]</code> || 0x40 || Texture 1 unknown colour information | ||
|- | |- | ||
| 0xF1C0 || 0x8080 || hx::Texture[2] || 0x30 || Texture 1 unknown | | 0xF1C0 || 0x8080 || <code>hx::Texture[2]</code> || 0x30 || Texture 1 unknown | ||
|- | |- | ||
| 0xF1F0 || 0x80B0 || uint8_t[0x8000] || 0x8000 || Texture 2 Image bits (4 bits per pixel) (256x256) | | 0xF1F0 || 0x80B0 || <code>uint8_t[0x8000]</code> || 0x8000 || Texture 2 Image bits (4 bits per pixel) (256x256) | ||
|- | |- | ||
| 0x171F0 || 0x100B0 || uint32_t[16] || 0x40 || Texture 2 unknown colour information | | 0x171F0 || 0x100B0 || <code>uint32_t[16]</code> || 0x40 || Texture 2 unknown colour information | ||
|- | |- | ||
| 0x17230 || 0x100F0 || uint32_t[16] || 0x40 || Texture 2 unknown colour information | | 0x17230 || 0x100F0 || <code>uint32_t[16]</code> || 0x40 || Texture 2 unknown colour information | ||
|- | |- | ||
| 0x17270 || 0x10130 || hx::Texture[2] || 0x30 || Texture 2 unknown | | 0x17270 || 0x10130 || <code>hx::Texture[2]</code> || 0x30 || Texture 2 unknown | ||
|} | |} |
Latest revision as of 02:14, 27 June 2025
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.
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
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 | uint16_t |
2 | unknown |
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 | Weapons upgraded. |
0x0040 | 0x28 | uint16_t |
2 | Vengeance Slip (deflect enemy attacks) timer. |
0x0042 | 0x2A | uint16_t |
2 | Steel Fist Sake (attack boost) timer. |
0x0044 | 0x2C | uint16_t |
2 | Steel Soul Sake (defense boost) timer. |
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
Collection Data
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. 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 (the ones that throw cursed fruit at you). |
0xB4 | uint32_t[4] |
0x10 | Bitfield for fixed fights 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. Same IDs as above. |
0xD4 | uint32_t[2] |
0x8 | Bitfield for maps explored (i.e. dungeons). |
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 |