Param.sfo: Difference between revisions

From PSP Developer wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
==Description==
== Description ==
'''SFO''' ('''S'''ystem '''F'''ile '''O'''bject) are used in folders which content needs to be displayed in the [[XMB]].


*The values contained in a SFO can be simplyfied as inputs/outputs for/from the content:
'''SFO''' ('''S'''ystem '''F'''ile '''O'''bject) 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.
**Boot modifyers (most of the int32 datas) that are sent to the content when is executed to activate specific features or settings (e.g. audio and video modes of a game).
 
*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).
**Information texts (most of the utf8 datas) about the content and its restrictions (e.g. title and version of a game).


'''SFX''' ('''S'''ystem '''F'''ile in '''X'''ML format) is similar than SFO but without the data related to its structure (the SFO metadata that has no real value).
'''SFX''' ('''S'''ystem '''F'''ile in '''X'''ML 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 2 formats is direct because the important values contained in both formats are the same ('''version''', '''param_key''', '''param_fmt''', '''param_max_len''' & '''param_data''').
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.
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==
== Internal Structure ==
===header===
 
=== Header ===
 
At offset 0x0, length 0x14 (20 bytes)
At offset 0x0, length 0x14 (20 bytes)
{{Boxcode|content=<syntaxhighlight lang="c">
{{Boxcode|content=<syntaxhighlight lang="c">
Line 26: Line 29:
</syntaxhighlight>}}
</syntaxhighlight>}}


===index_table===
=== 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.
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'''
Every entry belongs to a '''key''' name in the '''key_table''' and defines a '''data''' area in the '''data_table'''.


{{Boxcode|content=<syntaxhighlight lang="c">
{{Boxcode|content=<syntaxhighlight lang="c">
Line 48: Line 52:
! In SFO !! In SFX
! In SFO !! In SFX
|-
|-
| 04 00 || {{no}}? || {{cellcolors|brown|yellow}} 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 [[Trophy files|Trophies]]). See {{talk}} page
| 04 00 || {{no}}? || {{cellcolors|brown|yellow}} 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 [[Trophy files|Trophies]]). See {{talk}} page.
|-
|-
| 04 02 || utf8 || {{cellcolors|brown|white}} utf8 || utf8 character string, NULL terminated (0x00) || Can be used any character from the system [[XMB Fonts|fonts]]. The NULL byte is counted as part of the used bytes in '''len'''
| 04 02 || utf8 || {{cellcolors|brown|white}} utf8 || utf8 character string, NULL terminated (0x00) || Can be used any character from the system [[XMB Fonts|fonts]]. The NULL byte is counted as part of the used bytes in '''len'''.
|-
|-
| 04 04 || int32 || {{cellcolors|black|lime}} 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)
| 04 04 || int32 || {{cellcolors|black|lime}} 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===
===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)
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===
===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 availables for being used). This entries can be considered reserved, and are marked with a '''len''' = 0 in the associated entry in the '''index_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==
==Internal Structure Examples==
Both example files (SFO & 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 bigger difference between SFO and SFX is SFX doesnt contains:
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
**SFO header
**Key and Data offsets
**Key and Data offsets
**Data used length
**Data used length


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


Line 120: Line 126:
|}
|}


===SFX===
=== SFX ===
{{Boxtip3|content= SFX are used in some disc with special content<br />SFX Can be used as "templates" to generate SFO files<br />SFX Can be created using a SFO as the "source". See: [[Dev_Tools#SFO2SFX|SFO2SFX]]}}
 
{{Boxtip3|content= SFX are used in some disc with special content<br />
SFX can be used as "templates" to generate SFO files<br />
SFX can be created using a SFO as the "source". See: [[Dev_Tools#SFO2SFX|SFO2SFX]]}}


{{Boxcode|content=<syntaxhighlight lang="xml">
{{Boxcode|content=<syntaxhighlight lang="xml">
Line 133: Line 142:
**The function of '''add_hidden="false"''' is unknown
**The function of '''add_hidden="false"''' is unknown


==Parameters Descriptions==
== Parameters Descriptions ==


===BOOTABLE===
===BOOTABLE===
{{Boxinfo3|content='''param_fmt''': Int32<br />'''param_max_len''': 4 <br />'''param_len''': 4}}
{{Boxinfo3|content='''param_fmt''': Int32<br />'''param_max_len''': 4 <br />'''param_len''': 4}}


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


====CATEGORY====<!--Will Need some help on this as i only know of one currently UG which should be for GAMES-->
{{Boxinfo3|content='''param_fmt''': utf8-S<br />'''param_max_len''':4<br />'''param_len''': 4}}
{{Boxinfo3|content='''param_fmt''': utf8-S<br />'''param_max_len''':4<br />'''param_len''': 4}}


Category Table Needed Here i currently only have one PSP sfo
A category table is needed here.
 
UG - PSP GAME ?
UG - PSP GAME ?



Latest revision as of 20:01, 20 December 2024

Description[edit | edit source]

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[edit | edit source]

Header[edit | edit source]

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

index_table[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Template:Boxtip3

Template:Boxcode

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

Parameters Descriptions[edit | edit source]

BOOTABLE[edit | edit source]

Template:Boxinfo3

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

CATEGORY[edit | edit source]

Template:Boxinfo3

A category table is needed here.

UG - PSP GAME ?

DISC_ID[edit | edit source]

DISC_NUMBER[edit | edit source]

DISC_TOTAL[edit | edit source]

DISC_VERSION[edit | edit source]

PARENTAL_LEVEL[edit | edit source]

PSP_SYSTEM_VER[edit | edit source]

REGION[edit | edit source]

TITLE[edit | edit source]

VIDEO_CONTENTS[edit | edit source]