Param.sfo

From PSP Developer wiki
Revision as of 20:01, 20 December 2024 by CelesteBlue (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

SFO (System File Object) are files used in folders whose content needs to be displayed in the PSP XMB. It is also present on PS3, PS Vita and PS4.

  • The values contained in a SFO can be simplified as inputs/outputs for/from the content:
    • Boot modifyers (most of the int32 datas) that are sent to the content when it is executed to activate specific features or settings (e.g. audio and video modes of a game).
    • Information texts (most of the utf8 datas) about the content and its restrictions (e.g. title and version of a game).

SFX (System File in XML format) is similar than SFO but without the data related to its structure (the SFO metadata that has no real value).

The conversion between the two formats is direct because the important values contained in both formats are the same (version, param_key, param_fmt, param_max_len and param_data).

SFO's and SFX's can be chained in a structure of subfolders where the "main" SFO activates a special subfolder, and the subfolder contains another SFO that activates another subfolder and so on.

Internal Structure

Header

At offset 0x0, length 0x14 (20 bytes) Template:Boxcode

index_table

At offset 0x14, composed by a number of entries defined with tables_entries in the header, each entry is 0x10 length (16 bytes). Values are in Little Endian.

Every entry belongs to a key name in the key_table and defines a data area in the data_table.

Template:Boxcode

Data Types
fmt Data Type Description Notes
In SFO In SFX
04 00 No? Template:Cellcolors utf8-S utf8 Special Mode, NOT NULL terminated Used in SFO's generated by the system and/or linked to an user (Game Saves and Trophies). See Template:Talk page.
04 02 utf8 Template:Cellcolors utf8 utf8 character string, NULL terminated (0x00) Can be used any character from the system fonts. The NULL byte is counted as part of the used bytes in len.
04 04 int32 Template:Cellcolors int32 integer 32 bits unsigned Allways has a length of 4 bytes in len and max_len (even in the case some bytes are not used, all them are marked as used).

key_table

Composed by a number of key entries defined with tables_entries in the header, are short utf8 strings in capitals, NULL terminated (0x00), and ordered alphabetically (from A to Z). This alphabetically order defines the order of the associated entries in the other two tables (index_table, and data_table).

The end offset of this table needs to be aligned to a multiply of 32bits (4 bytes), this is made with a padding at the end of key_table when needed (in a few SFO's the table is aligned naturally as a coincidence caused by the length of the key names used, when this happens there is no padding needed).

data_table

Composed by a number of data entries defined with tables_entries in the header, every entry in this table is defined by the associated entry in the index_table by using: fmt, len, max_len, and offset. There is no padding between entries neither at the end of this table.

Some data entries can be filled with zeroes (not used, but available for being used). This entries can be considered reserved, and are marked with len = 0 in the associated entry in the index_table.

Internal Structure Examples

Both example files (SFO and SFX) are hand made (the structure is correct but are only a minimal example). Both contains the same info but in different format: only 1 entry (TITLE_ID) and the value for this entry (BLUS12345).

  • The biggest difference between SFO and SFX is that SFX does not contain:
    • SFO header
    • Key and Data offsets
    • Data used length

This structure was taken from PS3 SFO There is no TITLE_ID inside PSP SFO

SFO

Offset(h) 00 01 02 03  04 05 06 07  08 09 0A 0B  0C 0D 0E 0F
     0x00 00 50 53 46  01 01 00 00  24 00 00 00  30 00 00 00 | .PSF....$...0... |
     0x10 01 00 00 00  00 00 04 02  0A 00 00 00  0F 00 00 00 | ................ |
     0x20 00 00 00 00  54 49 54 4C  45 5F 49 44  00 00 00 00 | ....TITLE_ID.... |
     0x30 42 4C 55 53  31 32 33 34  35 00 00 00  00 00 00 00 | BLUS12345....... |
Areas Offset Size Name Example Notes
header 0x00 0x04 magic PSF
0x04 0x04 version 01 01 00 00 1.01
0x08 0x04 key_table_start 24 00 00 00 Absolute start offset of key_table = 0x24
0x0C 0x04 data_table_start 30 00 00 00 Absolute start offset of data_table = 0x30
0x10 0x04 tables_entries 01 00 00 00 Number of entries in index_table, key_table, and data_table = 1
index_table 0x14 0x02 key_1_offset 00 00 key_1 relative offset. (Absolute start offset of key_1) - (Absolute start offset of key_table) = 0x24-0x24 = 0
0x16 0x02 data_1_fmt 04 02 data_1 data type = utf8
0x18 0x04 data_1_len 0A 00 00 00 data_1 used length (BLUS12345 = 9 bytes + 1 byte NULL termination) = 10 bytes
0x1C 0x04 data_1_max_len 0F 00 00 00 data_1 total length. TITLE_ID is always = 16 bytes
0x20 0x04 data_1_offset 00 00 00 00 data_1 relative offset. (Absolute start offset of data_1) - (Absolute start offset of data_table) = 0x30-0x30 = 0
key_table 0x24 0x09 key_1 TITLE_ID Relative offset defined in the index_table
padding 0x2D 0x03 padding 00 00 00 9 bytes used by the previous entries + 3 padding = 12 (aligned to 4 bytes)
data_table 0x30 0x0F data_1 BLUS12345 Data type, used length, total length, and relative offset defined in the index_table

SFX

Template:Boxtip3

Template:Boxcode

  • Notes
    • The function of add_hidden="false" is unknown

Parameters Descriptions

BOOTABLE

Template:Boxinfo3

This flag tells the PSP if the game is bootable or not?

CATEGORY

Template:Boxinfo3

A category table is needed here.

UG - PSP GAME ?

DISC_ID

DISC_NUMBER

DISC_TOTAL

DISC_VERSION

PARENTAL_LEVEL

PSP_SYSTEM_VER

REGION

TITLE

VIDEO_CONTENTS