7/09/2006

PARAM.SFO Header Format


PARAM.SFO (Space Flight Operations? Similar meanning with what this file for.)

PARAM.SFO 是執行 .PSP 時的各種設定值, 例如: 可執行的地區(Region), 此程式的種類等等
下圖為其主要格式:



PARAM.SFO 是以 Key Name -> Key Value 為一組 Key Pair 的方式來儲存這些設定值的

現在以 2.71 Updater 的 PARAM.SFO 為例子, 來介紹其 Header 格式:

一開始 20 bytes 如下:

00000000h: 00 50 53 46 = .PSF -> File Identifier
00000004h: 01 01 00 00 = 0x00000101 -> PSF Version Number (Version 5 ?)
00000008h: 44 01 00 00 = 0x00000144 -> Offset of Key Name Table
0000000Ch: f0 01 00 00 = 0x000001f0 -> Offset of Key Value Table
00000010h: 13 00 00 00 = 0x00000013 -> Number of Key Pairs
(0x00000013 = 19組 Key)

接著以每16 bytes來描述一組 Key 的實際長度與類別, 所以 19組 Key 共有
304 Bytes(= 19 * 16 Bytes), 下面只介紹第一組為範例說明這 16 Bytes 的定義:

00000014h: 00 00 -> Offset of the Key Name in the Key Table
=> 第一組 Key 的 Key Name 是從 Key Name Table 的第 0 個 byte 開始
00000016h: 04 -> Unknown, always 4. (Maybe alignment? Or bitmask?)
=> 這個 Byte 可能是為了 Alignment, 但目前都是 4, 但是我個人認為這應該是 bitmask.
00000017h: 04 -> Datatype of the Key Value
=> 0x00 -> Binary data
=> 0x02 -> Text data (UTF-8 string with null-terminated)
=> 0x04 -> Signed Integer data (32bits)
00000018h: 04 00 00 00 -> Length of the Key Value
=> Key Value 的長度, 未加上 padding (in bytes)
0000001Ch: 04 00 00 00 -> Length of (Key Value + Padding)
=> Key Value + Padding 的長度 (in bytes)
00000020h: 00 00 00 00 -> Offset of the Key Value in the Key Value Table
=> 第一組 Key 的 Key Value 是從 Key Value Table 的第 0 個 byte 開始

沒有留言: