XDBF: Difference between revisions

From Xenon Wiki
Jump to navigation Jump to search
imported>Godzcheater
m (→‎Header: 0x1178747992 != 0x58444246)
imported>Tuxuser
Line 117: Line 117:


+ 24, 24 is the length of the header.
+ 24, 24 is the length of the header.
[[Category:File formats]]
[[Category:Xbox360_System_Software]]

Revision as of 00:14, 7 January 2014

XDBF (XboxDataBaseFormat) files are used by the Xbox 360 as a generic database of sorts. It is used as the format for GPD (Gamer Profile Data) and SPA (Statistics, Presence and Achievements) files. SPA files are linked into an Xbox 360 executable during compilation and are used by the dashboard to generate the GPD, Save Game(STFS) Meta-Data and Images. In the XAM the DataFile class handles all of the operations associated with these files.

Header

Total length: 24 bytes (0x18)

Byte ordering: Dependant on magic.(!If the magic is little endian then the hole file is (GFWL), if it's big (Xbox) then the hole file is!)

Offset Length Type Information
0x0 0x4 ascii string Magic (0x58444246(1480868422))
0x4 0x4 unsigned int Version (0x10000)
0x8 0x4 unsigned int Entry Table Length (in number of entries)
0xC 0x4 unsigned int Entry Count
0x10 0x4 unsigned int Free Space Table Length (in number of entries)
0x14 0x4 unsigned int Free Space Table Entry Count

Entry Table Length and Free Space Table Length will be a multiple of 512 more often than not, this is just Xbox's preferred values, but it will read the file if you decrease them to make the size of the file smaller, alot smaller.

Entry Table

The Entry Table is made up of different entries, each one under a different namespace and ID. Then the Table is just Null until the start of Free Space Table (End of Entry Table).

Entry Structure

Total length: 18 bytes (0x12)

Offset Length Type Information
0x0 0x2 unsigned short Namespace (see GPD or SPA)
0x2 0x8 unsigned long ID
0xA 0x4 unsigned int OffsetSpecifier
0xE 0x4 unsigned int Length

Free Space Table

The Free Space Table is used to map out the unused space within the file. It is updated whenever a change is made, as the last entry contains information about the entire file. Each entry within the Free Space Table is composed of the OffsetSpecifier in the file and how much space is unused there(Length). The final entry in the free space table is calculated by making the value of the OffsetSpecifier being the size of the entries data (length of the entire file - beginning of the entry data), with the Length being the negative of that and -1 (e.g., 2345 and -2344), the simplest way to get the negative version is * -1 then -1.

Free Space Entry Structure

Total length: 8 bytes

Offset Length Type Information
0x0 0x4 unsigned int OffsetSpecifier
0x4 0x4 unsigned int Length

Entry Data Offset

To work out the real entry data offset, times the Entry Table Length by 0x12, then times the Free Space Table Length by 0x8 and add the results both together, then add 0x18. This is where the beginning of the entry data begins, then add the OffsetSpecifier by the entry to get the real offset. Here is a example,

(((Entry Table Length * 18) + (Free Space Table Length * 8)) + 24) + OffsetSpecifier

Just to explain a bit more,

Entry Table Length * 18, 18 being the length of each entry, this will workout the actual length of the entry table.

Free Space Table Length * 8, 8 being the length of each free space entry, workout the actual length of the free space table.

+ 24, 24 is the length of the header.