Editing Pikmin 2 save file

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{DISPLAYTITLE:''Pikmin 2'' save file}}
+
Data about the ''Pikmin 2'' save file format. The following info was taken from the PAL version of ''Pikmin 2'' based on a .gci save taken from Dolphin.
Data about the ''Pikmin 2'' save file format. The following info was taken from the US version of ''Pikmin 2'' based on a <code>.gci</code> save taken from Dolphin. This data applies to all GameCube versions of the game, the only difference being the region code on the 4th byte of the file
 
  
 
{{todo|Figure out how to decrypt save files for the NPC version}}
 
{{todo|Figure out how to decrypt save files for the NPC version}}
 +
{{todo|Check if this info applies to the JP version of Pikmin 2 on GC}}
  
The save file contains save data for each of the 3 save slot used in-game. The data of such a save slot starts with the 8 byte magic word string <code>PlVa0003</code> and is <code>0xC000</code> bytes (49152 bytes in decimal) long. Directly after the string follows a byte which has the slot number of the save (<code>0x00</code> for first slot, <code>0x01</code> for second, <code>0x02</code> for third). The last 4 bytes of the slot data contain the checksum calculated for the preceding slot data. The checksum is detailed in [[#Checksum|this section]].
+
The save file contains save data for each of the 3 save slot used in-game. The data of such a save slot starts with the 8 byte string <code>PlVa0003</code> and is 0xC000 bytes (49152 bytes in decimal) long. Directly after the string follows a byte which has the slot number of the save (<code>0x00</code> for first slot, <code>0x01</code> for second, <code>0x02</code> for third). The last 4 bytes of the slot data contain the checksum calculated for the preceding slot data. The checksum is calculated according to this method: http://hitmen.c02.at/files/yagcd/yagcd/chap12.html#sec12.5
  
== Addresses ==
+
Addresses of interest relative to the start of the string:
Addresses of interest relative to the start of the save slot (i.e. the start of the magic word string):
 
  
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
 
! Address || Size || Description
 
! Address || Size || Description
|-
 
| <code>0x13</code> || 1 byte
 
| When this byte is set to 0 the save file is considered new
 
 
|-
 
|-
 
| <code>0x14</code> || 4 bytes
 
| <code>0x14</code> || 4 bytes
Line 27: Line 23:
 
| Integer representing the time (in minutes) played on the save file as shown on the file select screen.
 
| Integer representing the time (in minutes) played on the save file as shown on the file select screen.
 
|-  
 
|-  
| <code>0x53</code> || array of 2, 4 byte integers followed by a 1 byte bitmask
+
| <code>0x164</code> || {{unsure|array of 4 bytes and 1 byte separators, unsure of length}}
| 4 byte integer representing the count of enemies killed, followed by a 4 byte integer of Pikmin lost to the said enemy, followed by a 1 byte bitmask <code>0b1</code> representing that the enemy has been unlocked in the Piklopedia and <code>0b10</code> representing that the enemy has been viewed in the Piklopedia.
+
| Appears to be 4 byte enemy data of pikmin lost and enemies killed to said enemy, {{unsure|followed by a 1 byte separator}} {{todo|Figure this out}}
 
|-  
 
|-  
| <code>0x3E9</code> || 4 bytes
+
| <code>0x3ED</code> || 1 byte
| Actual day count the game registers, differing from what is displayed on the file select screen if only one of the two addresses is edited.
+
| Treasure gauge as shown in the HUD. This counts as an Exploration Kit Item on the pause screen, but does not collect the treasure itself. Value of <code>0x5</code> makes it active. {{todo|Figure out if other exploration kit items appear before or after this one}}
 
|-  
 
|-  
| <code>0x3ED</code> || 2 bytes
+
| <code>0x4D0</code> || 188 byte array
| Bitmask for Exploration Kit items and their activity. The least significant bit represents the EK item with an internal ID of <code>0</code> When the bit is set to 1, the item is active. This activity does not reflect the treasure being collected.
+
| 1 byte each represents the treasure as accessed on the area select screen. Treasures appear to follow their internal IDs for order. These are all the treasures not part of the Exploration Kit. Non-zero values mean collected. {{todo|find if there is a difference between the value being <code>0x2</code> or the more common <code>0x6</code>}}
|-
+
| <code>0x58D</code> || 13 byte array
| <code>0x3F1</code> || 21 length 4 byte array
+
| Same as above, only for Exploration Kit treasures including The Key
| Pikmin types that fall from the sky during entering and exiting a cave. Editing this value on a save file that is on the area select screen will result in the Pikmin falling from the sky upon entering an area. The Pikmin types are organized into groups of three, with the first integer representing a leaf Pikmin, the second a bud Pikmin, and the third a flower Pikmin. The Pikmin types in the array are ordered Blue, Red, Yellow, Purple, White, Bulbmin, and an unused Pikpik carrot.
 
|-
 
| <code>0x479</code> || 21 length 4 byte array
 
| Same as above but for Pikmin in the Onions and Ship. When either Bulbmin or Pikpik carrots are added the total number of Pikmin is increased however as they have no Onions there is no way to access them.
 
|-
 
| <code>0x4CF</code> || 188 length 1 byte array
 
| 1 byte each represents the treasure as accessed on the area select screen. Treasures appear to follow their [[Pikmin 2 identifiers|internal IDs]] for order. These are all the treasures not part of the Exploration Kit (nor The Key). Non-zero values mean collected. 02 means that the treasure will appear with "New" in the Piklopedia, while 06 means its old.
 
|-
 
| <code>0x58D</code> || 13 length 1 byte array
 
| Same as above, only for Exploration Kit treasures including The Key.
 
|-
 
| <code>0x7D3</code> || 4 bytes
 
| Integer count of how much Ultra-spicy spray the player has. (The game treats it as a signed integer but it appears to be displayed as an unsigned integer, but the game only shows the last three digits of the number)
 
|-
 
| <code>0x7D7</code> || 4 bytes
 
| Integer count of how much Ultra-bitter spray the player has. (The game treats it as a signed integer but it appears to be displayed as an unsigned integer, but the game only shows the last three digits of the number)
 
|-
 
| <code>0x7E7</code> || 1 byte
 
| Bitstream representing progress in Valley of Repose. If the least significant bit is set to 1 it plays the unlock fanfare next time the save is loaded. If the next bit is set to 1 then the fanfare won't play. {{todo|Figure out what the other bits control}}
 
|-
 
| <code>0x7E8</code> || 1 byte
 
| Used for the above ground treasure counter for the Valley of Repose on the map screen.
 
|-
 
| <code>0x7E9</code> || 1 byte
 
| Same as <code>0x7E7</code> but for the Awakening Wood.
 
|-
 
| <code>0x7EA</code> || 1 byte
 
| Used for the above ground treasure counter for the Awakening Wood on the map screen.
 
|-
 
|-
 
| <code>0x7EB</code> || 1 byte
 
| Same as <code>0x7E7</code> but for the Perplexing Pool.
 
|-
 
| <code>0x7EC</code> || 1 byte
 
| Used for the above ground treasure counter for the Perplexing Pool on the map screen.
 
|-
 
|-
 
| <code>0x7ED</code> || 1 byte
 
| Same as <code>0x7E7</code> but for the Wistful Wild.
 
|-
 
| <code>0x7EE</code> || 1 byte
 
| Used for the above ground treasure counter for the Wistful Wild on the map screen.
 
|-
 
| <code>0x834</code> || 4 bytes
 
| Actual Poko count the game registers, differing from what is displayed on the file select screen if only one of the two addresses is edited.
 
 
|}
 
|}
  
== Checksum ==
+
The following Python script (requires Python >3.4) assists with calculating the checksum for the data in a save slot: https://gist.github.com/RenolY2/e0d93dde832b63f9197ef60861f22d89 Not recalculating and fixing the checksum results in the game detecting the modified save slot as being corrupted (but if you have any unmodified save slots, those will still work fine).
The checksum of a save slot is calculated according to [http://hitmen.c02.at/files/yagcd/yagcd/chap12.html#sec12.5 this method].
 
 
 
[https://gist.github.com/RenolY2/e0d93dde832b63f9197ef60861f22d89 This Python script] (requires Python >3.4) assists with calculating the checksum for the data in a save slot. Not recalculating and fixing the checksum results in the game detecting the modified save slot as being corrupted (but if you have any unmodified save slots, those will still work fine).
 
  
 
Very careful editing might allow you to fool the corruption detection without having to recalculate the value: Due to the checksum being an additive one, {{unsure|if you increase one value by 1 and decrease a different value by 1, the checksum should still remain valid.}}
 
Very careful editing might allow you to fool the corruption detection without having to recalculate the value: Due to the checksum being an additive one, {{unsure|if you increase one value by 1 and decrease a different value by 1, the checksum should still remain valid.}}

Please note that all contributions to Pikmin Technical Knowledge Base are considered to be released under the Creative Commons Attribution-ShareAlike (see Pikmin Technical Knowledge Base:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Templates used on this page: