PS2 Savedata

From PS3 Developer wiki
Jump to: navigation, search

Common terms used in this page[edit]


  • <userid> The number assigned by the system to this user when his account was created (is a counter). Stored in XRegistry.sys, e.g: 00000001
  • <SAVEDATA_DIRECTORY> Name of the folder where the savedata files are stored, composed by TITLE_ID + some variable characters added by the game, e.g: BLES00001-nick01save01
  • <TITLE_ID> Name of the folder where the game was installed (different than the TITLE_ID in his PARAM.SFO that refers to the original ID when the game was released years ago as a disc)
  • <virtual_memcard> The name assigned to the card when it was created from the "Memory Card Utility (PS/PS2)" in XMB
  • Any_Other_Files Represents all the other files in the folder generated by the game with any filename and filextensions that are dependant of each game and can vary, e.g: "PROFILE.BIN"(in PS3 Game Saves) or "SECURE.BIN" (in Minis Game Saves) etc...
  • <MC_Save_ID> Identifyer of each Game Save of a PS1 or PS2 Memory Card. Used as the file name when a single Game Save is exported to USB, e.g: BESLES-53702535953.PSV
  • MC_Slot Inside a PS1 or PS2 Memory card, real or virtual, every one of the savedata items represented with an icon, A single savedata can use one or several slots in PS1, and always only one slot in PS2
  • PARAM.SFO Information about the Game Save. This one is never encrypted.
  • PARAM.PFD Signatures of some of the other files in the folder.

Game Saves PS2[edit]

Memory Card Utility (PS PS2).jpg

Saved Data Utility (PS2).jpg
Storage Media Path Import/Export file conversions
Internal HDD dev_hdd0/savedata/vmc/<virtual_memcard>.VM2
Internal HDD
Only "PS2 Classics"
dev_hdd0/home/<userid>/ps2emu2_savedata/<TITLE_ID>/ICON0.PNG Copied from dev_hdd0/game/<TITLE_ID>/ICON0.PNG
dev_hdd0/home/<userid>/ps2emu2_savedata/<TITLE_ID>PARAM.SFO Copied from dev_hdd0/game/<TITLE_ID>/PARAM.SFO ?
dev_hdd0/home/<userid>/ps2emu2_savedata/<TITLE_ID>/SCEVMC0.VME Copied from dev_hdd0/game/<TITLE_ID>/USRDIR/SAVEDATA/SCEVMC0.VME
dev_hdd0/home/<userid>/ps2emu2_savedata/<TITLE_ID>/SCEVMC1.VME Copied from dev_hdd0/game/<TITLE_ID>/USRDIR/SAVEDATA/SCEVMC1.VME
External USB dev_usb0/PS3/EXPORT/PSV/<Save_ID>.PSV When exporting to USB the MC_Slot is extracted from VM2 an saved individually as a PSV
External USB
Only "PS2 Classics"
dev_usb0/PS3/EXPORT/PS2SD/<TITLE_ID>/ICON0.PNG Copied from the savedata folder
dev_usb0/PS3/EXPORT/PS2SD/<TITLE_ID>PARAM.SFO Added a signature at the end of the file (out of the SFO structure)
dev_usb0/PS3/EXPORT/PS2SD/<TITLE_ID>/SCEVMC0.VME
dev_usb0/PS3/EXPORT/PS2SD/<TITLE_ID>/SCEVMC1.VME
External MC mc_root/ Raw copy from/to a real PS2 Memory Card using a Memory Card Adapter

Memory Card Formats PS2[edit]

Memory card PS2 (original)[edit]

The PS2 memory card file system has a fairly simple design, with some allowances made for the limitations of flash memory. It's overall structure is similar to the well known MS-DOS FAT file system. It uses a file allocation table (FAT) to keep track of allocated space and a hierarchical directory system where all of a file's metadata is stored in it's directory entry. Like the FAT file system, which groups disk sectors into clusters, the PS2 memory card file system groups flash memory pages in to clusters. On standard PS2 memory cards, the cluster size 1024 bytes, or 2 pages long.

  • The Superblock

The key to the PS2 memory card file system is the superblock. Located in the first page of the memory, this is the only part of the file system with a fixed location. While some things like the do end up in fixed locations on standard 8M memory cards, you shouldn't rely on this.

Block Nº Cluster Nº Page Nº Offset Length Name Example Description
0
superblock
0 0 0x000000 0x01C (28 bytes) magic Sony PS2 Memory Card Format Memory Card identifyer
0x00001C 0x00C (12 bytes) version 1.2.0.0 Memory Card format version. (1.2.0.0 = full support for bad_block_table map)
0x000028 0x002 (2 bytes) page_len 512 Page size in bytes (without ECC)
0x00002A 0x002 (2 bytes) pages_per_cluster 2 Number of pages in a cluster
0x00002C 0x002 (2 bytes) pages_per_block 16 Number of pages in an block
0x00002E 0x002 (2 bytes) not used FF00
0x000030 0x004 (4 bytes) clusters_total 8192 Total number of clusters
0x000034 0x004 (4 bytes) alloc_start 41 First allocatable cluster number. Cluster values in the FAT and directory entries are relative to this
0x000038 0x004 (4 bytes) alloc_end 8135 Cluster offset number after the highest allocatable cluster. Relative to alloc_start. Not used.
0x00003C 0x004 (4 bytes) cluster_rootdir 0 Cluster offset of the first cluster of the root directory. Relative to alloc_start. Must be zero.
0x000040 0x004 (4 bytes) bblock1 1023 Backup1 block number
0x000044 0x004 (4 bytes) bblock2 1022 Backup2 block number
0x000050 0x080 (128 bytes) ind_fat_table 8 Indirect FAT Table cluster number
0x0000D0 0x080 (128 bytes) bad_block_table -1 Bad blocks table (damaged blocks index)
0x000150 0x001 (1 byte) card_type 2 Memory card type (2 = PS2 memory card)
000x0151 0x001 (1 byte) card_flags 0x52 Memory Card features (0x01 = ECC support, 0x08 = Bad Block support, 0x10 = Erased state zeroed)
0x000152 0x002 (2 byte) not used FF
0x000154 0x0BC (188 bytes) unknown
0x000200 0x010 (16 bytes) ECC Error Correction Code. The last 16 bytes of all the pages are reserved for this code. See explain below
1 not used
Up to 7 Up to 15 not used
1 8
ind_fat_table
16 0x002100 0x210 (528 bytes) Indirect FAT Table FAT File System
17
9 18 0x002520 0x210 (528 bytes) FAT Table
19
Up to 15 Up to 31
Up to 4
5 40 80
81
41
alloc_start
cluster_rootdir
82 0x00A920 0x210 (528 bytes) Allocatable Clusters
83
Up to 47 Up to 95
Up to 1004
1005 8040 16080
16081
8041 16082 0x819120 0x210 (528 bytes) Reserved Clusters
16083
Up to 8047 Up to 16095
Up to 1021
1022
bblock2
8176
alloc_end
16352 0x83BE00 0x210 (528 bytes) Temporal Data Backup Block 2
Used to store the number of the block that is going to be programmed
16353
Up to 8183 Up to 16367
1023
bblock1
8184 16368 0x83DF00 0x210 (528 bytes) Temporal Data Backup Block 1
Used to store a copy of the data that is going to be programmed to a block
16369
Up to 8191
clusters_total
Up to 16383

A standard Ps2 Memory Card is composed by 1024 blocks, each block contains 16 pages of 528 bytes, for a total of 528*16*1024=8.650.752 bytes (0x840000)

Total ECC data is 16*16*1024=262.144 bytes

This gives an available space to store data of: Total-ECC = 8650752-262144 = 8388608 bytes = 8mb

  • Backup Blocks

Two complete blocks are reserved to deal with the possibility of the memory card being removed by the user when data is being saved. Writing data to card requires erasing and reprogramming an entire block

Before writing a block, both bblock1 and bblock2 are erased. Then a copy of the new data that is going to be written is stored in bblock1, and the number of the block that is going to be written is stored in bblock2. The block being programmed is then erased and writed. Finally, bblock2 is erased

Recovery caused by removal of the memory card is implemented whenever a memory card is inserted into the PS2 by checking bblock2, if it's not erased, then programming is assumed to have not been completed. The contents of bblock1 are then copied to the block given in bblock2. Then bblock2 is erased

  • Error Correction Code (ECC)

The data area of each page (512 bytes) is divided into 128 byte long chunks and for each chunk a simple [20-bit Hamming code] is calculated and stored in three bytes

The first byte contains the column (or bit-wise) parity bits, with the even groups in the lower nibble and the odd groups in the upper nibble. The second and third bytes contain the even and odd groups respectively for the line (or byte-wise) parity bits

The 3 ECC bytes for each of the 4 chunks are stored in order in the page's spare area for a total of 12 bytes


Source: [PlayStation 2 Memory Card File System - By Ross Ridge]

Virtual Memory Card PS2 (.VM2)[edit]

File structure is the same than a "original PS2 memory card", there are not apparent differences

  • Speculation

Last place to store a PS3 identifyer is inside the FAT filesystem ?... maybe there is none

PS2 Single Save ? (.PSV)[edit]

Virtual Memory Card Encrypted (.VME)[edit]

When exporting Game Saves for "PS2 classics" (CATEGORY 2P) to a external USB drive there is a "rare" PARAM.SFO exported. This PARAM.SFO seems to be a copy of the main PARAM.SFO from the installed game folder with an added "signature" "injected" at the end of the file (out of his structure) with a lenght of 20 bytes. Is supposed to be a security feature when exporting the gamesave, is not confirmed if this PARAM.SFO (with the injected "signature" out of his structure) exists in the internal HDD (when importing, or present at some time with the "PS2 virtual memory cards").

Wrote by ps3hen in ps3hax forums

PSN PS2 games do not save to VM cards in the same way to original PS2 games and PS1 games do
Each user who plays a PSN PS2 Game and makes a save, generates two VM cards (one for each slot) especially for that user account, for that game.
Each time the game is loaded the user selected VM cards(chosen from the VMC ulitity) are um-mounted and the user's save file for that game mounts the dedicated PS2 VM cards to the PS3 Virtual MC slots.
When the game is quit, the dedicated VM cards are un-mounted. But for some reason the user selected VM cards are not re-mounted, this is when I knew they mounted dedicated VM cards for each save.

The save file structure goes like this:
/PS3/EXPORT/PS2SD/XXXX11111/ICON0.PNG
                                            PARAM.SFO
                                            SCEVMC0.VME
                                            SCEVMC1.VME

Side note: "XXXX11111" will be different to the Title ID inside the Param.sfo. Inside the Param.sfo is the original title ID of the game when it was a PS2 Disc Game.

The black area of the param.sfo is only in the exported save file of the PS2 game
Also if the black area is not present in the save param.sfo, the PS3 considers it corrupt
Also if the PSN title id, used as the name for directory on the USB (/PS3/EXPORT/PS2SD/<PSN title id>/) is changed it is considered corrupt

Memory Card Tools PS2[edit]

[mymc]

mymc is a public domain command line utility for working with PlayStation 2 memory card images (.ps2) as used by the PlayStation 2 emulator PCSX2.
It allows save files in the MAX Drive (.max), EMS (.psu), SharkPort (.sps), X-Port (.xps) and Code Breaker (.cbs) formats to be imported directly into these images.
It can also export save files in eiter the MAX Drive and EMS formats. See the README.txt file included in the distribution below for more details. 

Extracting and Injecting single PS2 Game Saves in PC[edit]

The method is the same one used in PS1, see: Extracting and Injecting single PS1 Game Saves in PC , but here the file format is: .VM2 (a virtual PS2 memory card in PS3 format), and .PS2 (a 1:1 raw copy of a PS2 memory card). Both are the same

The PC program to manage this .PS2 memory cards is "mymc" and also can be generated by the emulator "PCSX2". See: http://wiki.pcsx2.net/index.php?title=Memcard

  • External forums manuals:

http://psx-scene.com/forums/f177/tutorial-ps2-psu-saves-ps3-internal-memory-card-without-memory-card-adaptor-103436/

Editing PS2 Game Saves icons in PC[edit]

In PS2 save Games the icon is a file with the extension .icn (any name is valid), is "linked" to the save game by the file icon.sys. The PC program "PS2 SaveBuilder v0.8" can generate this 2 files (included a black default icon)... the icon can be replaced later.

The format supports 3D objects (e.g: save games of tomb raider with a figurine of lara croft)

The program "bmp2icon.exe by sjeep" can generate a .icn in the correct format for importing to "PS2 SaveBuilder v0.8", additionally it can add a 3d object where your image is applyed as a texture over the faces of a basic 3D object, the options are: 3D rectangle, 3D cube, of flat square

The source image to importing in "bmp2icon.exe by sjeep" must be a 24-bit 128x128 pixel .BMP