Pikmin 2 save file

From Pikmin Technical Knowledge Base
Revision as of 17:15, 14 November 2018 by (talk)
Jump to: navigation, search

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.

To do: Figure out how to decrypt save files for the NPC version

To do: 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 string PlVa0003 and is 0xC000 bytes (49152 bytes in decimal) long. Directly after the string follows a byte which has the slot number of the save (0x00 for first slot, 0x01 for second, 0x02 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 of interest relative to the start of the string:

Address Size Description
0x14 4 bytes Integer representing the day count as shown on the file select screen (might not be permanent, i.e. overwritten when you end a day normally.)
0x2C 4 bytes Integer representing the Poko count as shown on the file select screen.
0x30 4 bytes Integer representing the treasure count as shown on the file select screen. Usually the same as the amount of treasures as accessed on the Area Select Screen.
0x3C 4 bytes Integer representing the time (in minutes) played on the save file as shown on the file select screen.
0x164 array of 4 bytes and 1 byte separators, unsure of length[unsure] Appears to be 4 byte enemy data of pikmin lost and enemies killed to said enemy, followed by a 1 byte separator[unsure]

To do: Figure this out

0x3ED 1 byte 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 0x5 makes it active.

To do: Figure out if other exploration kit items appear before or after this one

0x4D0 188 byte array 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.

To do: find if there is a difference between the value being 0x2 or the more common 0x6

0x58D 13 byte array Same as above, only for Exploration Kit treasures including The Key

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).

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, if you increase one value by 1 and decrease a different value by 1, the checksum should still remain valid.[unsure]