Editing CXML Containers
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
=Description= | =Description= | ||
=Container Structure= | =Container Structure= | ||
==XML implicit structure Overview== | ==XML implicit structure Overview== | ||
==Container Common Structure== | ==Container Common Structure== | ||
===Main Header=== | ===Main Header=== | ||
The header contains an | The header contains an identifyer of the container (magic), his version, and allows to store the "absolute start offset" and "size" of 7 tables (or areas) | ||
When a "not used table" is placed before a "used table"... the start offset of the "not used table" and his size (as zero) are stored in the main header to preserve his position in the structure. The "used table" that comes later starts in the same offset than the | When a "not used table" is placed before a "used table"... the start offset of the "not used table" and his size (as zero) are stored in the main header to preserve his position in the structure. The "used table" that comes later starts in the same offset than the previouslly "not used table" (an intuitive way to think in this is imagining are overlapped because starts in the same position but only the one at the top is used) | ||
*The container format is generic (used also by .RAF and .P3T with some variations) so the usage of this tables can vary, in this example there are 3 "not used tables": | *The container format is generic (used also by .RAF and .P3T with some variations) so the usage of this tables can vary, in this example there are 3 "not used tables": | ||
Line 301: | Line 29: | ||
| Magic || 0x00 || 0x04 || {{cellcolors|#666666|#ffffff}} 51 52 43 46 || 'QRCF' | | Magic || 0x00 || 0x04 || {{cellcolors|#666666|#ffffff}} 51 52 43 46 || 'QRCF' | ||
|- | |- | ||
| Version || 0x04 || 0x04 || {{cellcolors|#888888|#ffffff}} 00 00 01 10 || | | Version || 0x04 || 0x04 || {{cellcolors|#888888|#ffffff}} 00 00 01 10 || | ||
|- | |- | ||
| Tree Table Offset || 0x08 || 0x04 || {{cellcolors|#dddd66}} 00 00 00 40 || | | Tree Table Offset || 0x08 || 0x04 || {{cellcolors|#dddd66}} 00 00 00 40 || | ||
Line 334: | Line 62: | ||
*Notes | *Notes | ||
**The sizes | **The sizes doesnt includes the (posible) padding at the end of all tables | ||
===Tree Table=== | ===Tree Table=== | ||
Line 344: | Line 72: | ||
! Offset !! Size !! Example !! Remark | ! Offset !! Size !! Example !! Remark | ||
|- | |- | ||
| 0x00 || | | 0x00 || 0x08 || 00 00 00 00 00 00 00 00 || similar all qrc files | ||
|- | |- | ||
| | | 0x08 || 0x08 || FF FF FF FF FF FF FF FF || similar all qrc files | ||
|- | |- | ||
| | | 0x10 || 0x04 || FF FF FF FF || similar all qrc files | ||
|- | |- | ||
| | | 0x14 || 0x04 || 00 00 00 1C || similar all qrc files | ||
|- | |- | ||
| | | 0x18 || 0x04 || 00 00 00 1C || similar all qrc files | ||
|- | |- | ||
| | | 0x1C || 0x04 || 00 00 00 04 || similar all qrc files | ||
|- | |- | ||
| | | 0x20 || 0x08 || 00 00 00 00 00 00 00 00 || similar all qrc files | ||
|- | |- | ||
| | | 0x28 || 0x08 || FF FF FF FF FF FF FF FF || similar all qrc files | ||
|- | |- | ||
| | | 0x30 || 0x04 || 00 00 00 38 || similar all qrc files: start offset Tree Table | ||
|- | |- | ||
| | | 0x34 || 0x04 || xx xx xx xx || size body Tree Table | ||
|- | |- | ||
| | | 0x38 || 0x04 || 00 00 00 0F || similar all qrc files | ||
|- | |- | ||
| | | 0x3C || 0x04 || 00 00 00 02 || 00 00 00 03 on icontex.qrc | ||
|- | |- | ||
| | | 0x40 || 0x04 || 00 00 00 1C || similar all qrc files | ||
|- | |- | ||
| | | 0x44 || 0x04 || FF FF FF FF || similar all qrc files | ||
|- | |- | ||
| | | 0x48 || 0x04 || 00 00 00 74 || 00 00 00 84 on icontex.qrc : start offset of the Filename pointer entry inside ID Table | ||
|- | |- | ||
| | | 0x4C || 0x08 || FF FF FF FF FF FF FF FF || similar all qrc files | ||
|- | |- | ||
| | | 0x54 || 0x04 || 00 00 00 14 || similar all qrc files | ||
|- | |- | ||
| | | 0x58 || 0x04 || 00 00 00 06 || similar all qrc files | ||
|- | |- | ||
| | | 0x5C || 0x04 || 00 00 00 00 || offset of first File Data | ||
|- | |- | ||
| | | 0x60 || 0x04 || 00 00 01 50 || size of first File Data | ||
|- | |- | ||
| | | 0x64 || 0x04 || 00 00 00 18 || similar all qrc files | ||
|- | |- | ||
| | | 0x68 || 0x04 || 00 00 00 07 || similar all qrc files | ||
|- | |- | ||
| | | 0x6C || 0x04 || 00 00 00 00 || offset of first filename within the ID Table | ||
|- | |- | ||
| | | 0x70 || 0x04 || 00 00 00 00 || on icontex here are additional 16 bytes | ||
|- | |- | ||
| | | 0x74 || 0x04 || 00 00 00 0F || similar all qrc files | ||
|- | |- | ||
| | | 0x78 || 0x04 || 00 00 00 02 || similar all qrc files | ||
|- | |- | ||
| | | 0x7C || 0x04 || 00 00 00 1C || similar all qrc files | ||
|- | |- | ||
| | | 0x80 || 0x04 || 00 00 00 38 || Filename pointer of the first file for the ID Table | ||
|- | |- | ||
| | | 0x84 || 0x04 || 00 00 00 B0 || start offset of the next entry for the Filename pointer within the ID Table | ||
|- | |- | ||
|} | |} | ||
On icontex.qrc there are additional 16 bytes added on offset 0x70 within the '''Tree Table | On icontex.qrc there are additional 16 bytes added on offset 0x70 within the '''Tree Table''' | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset !! Size !! Example !! Remark | ! Offset !! Size !! Example !! Remark | ||
|- | |- | ||
| 0x74 || 0x04 || 00 00 00 1B || | | 0x70 || 0x04 || 00 00 00 00 || on icontex.qrc | ||
|- | |||
| 0x74 || 0x04 || 00 00 00 1B || on icontex.qrc | |||
|- | |||
| 0x78 || 0x04 || 00 00 00 01 || on icontex.qrc | |||
|- | |||
| 0x7C || 0x04 || 00 01 55 D4 || on icontex.qrc (size of .dds uncompressed) | |||
|- | |||
| 0x80 || 0x04 || 00 00 00 00 || similar all qrc files | |||
|- | |||
| 0x84 || 0x04 || 00 00 00 0F || similar all qrc files | |||
|- | |- | ||
| | | 0x88 || 0x04 || 00 00 00 02 || similar all qrc files | ||
|- | |- | ||
| | | 0x8C || 0x04 || 00 00 00 1C || similar all qrc files | ||
|- | |- | ||
| | | 0x90 || 0x04 || 00 00 00 38 || Filename pointer of the first file for the ID Table | ||
|- | |||
| 0x94 || 0x04 || 00 00 00 B0 || start offset of the next entry for the Filename pointer within the Tree Table | |||
|- | |- | ||
|} | |} | ||
Line 422: | Line 162: | ||
Every <file> inside <file-table> has assigned 2 attributes in the xml used to create the container: "src" (includes full path + file name + file extension), and "id" (only file name), plus the attribute "size" in QRCF_2 that is added by the program that creates the container ("size" is not present in the original .xml but added automatically when the container is created, this only happens in QRCF_2 and themes and is related with the per-file compression) | Every <file> inside <file-table> has assigned 2 attributes in the xml used to create the container: "src" (includes full path + file name + file extension), and "id" (only file name), plus the attribute "size" in QRCF_2 that is added by the program that creates the container ("size" is not present in the original .xml but added automatically when the container is created, this only happens in QRCF_2 and themes and is related with the per-file compression) | ||
*For QRCF_1 containers only is stored the "src" (the file "id" is missing | *For QRCF_1 containers only is stored the "src" (the file "id" is missing althougth can be deduced from the "src") | ||
*For QRCF_2 and P3T themes only is stored the "id" (the file "src" is missing so there is no way to read the original path or file extension from the container) | *For QRCF_2 and P3T themes only is stored the "id" (the file "src" is missing so there is no way to read the original path or file extension from the container) | ||
{{Boxcode| | {{Boxcode|content=<syntaxhighlight lang="xml"> | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
<qrc> | <qrc> | ||
Line 454: | Line 194: | ||
===String Table=== | ===String Table=== | ||
This area is composed by a consecutive list of all the tags (elements or attributes) from the xml that was used to create the container. Are stored "from-top-to-bottom" in the exact same order that they was ordered in the xml ( | This area is composed by a consecutive list of all the tags (elements or attributes) from the xml that was used to create the container. Are stored "from-top-to-bottom" in the exact same order that they was ordered in the xml (althougth it looks in some cases the theme compiler reorders them to his convenience). This list doesnt makes differences of the "directory hierarchy" of the tags neither is specifyed if the tag is an element or an attribute (this parent-child hierarchy is defined in other place of the container by making references to this area by using "byte counters" to locate a tag) | ||
In all the .qrc files (QRCF_1) except icontex.qrc (QRCF_2). The only difference is QRCF_2 adds the "size" to all the <file> elements (added by the container creator, related with the "per-file" compression) | In all the .qrc files (QRCF_1) except icontex.qrc (QRCF_2). The only difference is QRCF_2 adds the "size" to all the <file> elements (added by the container creator, related with the "per-file" compression) | ||
Line 478: | Line 218: | ||
==Summary== | ==Summary== | ||
===Table Description=== | ===Table Description=== | ||
<span style="background:#66ff66;">First Element</span> (in root of xml) Points to a Offset within '''Tree Table''' which represents a string | |||
<span style="background:#e6ec8b;">Last Element</span> (in root of xml) Points to a Offset within '''Tree Table''' which represents a string | |||
<span style="background:#ccd815;">Element Pointer</span> Points to a Offset within '''String Table''' which represents a string | |||
<span style="background:#ffff66;">Previous Element</span> Points to a Offset within '''Tree Table''' which represents a string | |||
<span style="background:#ff6666;">Next Element</span> Points to a Offset within '''Tree Table''' which represents a string | |||
<span style="background:#66ff66;">First Element</span> | |||
<span style="background:#e6ec8b;">Last Element</span> | |||
<span style="background:#ccd815;">Element Pointer</span> | |||
<span style="background:#43BFC7;">Attribute Counter</span> Integer value which describe the amount of Attributes for the current processing Element | |||
<span style="background:#9AFEFF;">Parent</span> Points to a Offset within '''Tree Table''' which represents a string and describe the Parent Element | |||
<span style="background:#ffff66;">Previous Element</span> (also used as a 4 byte long value which points to a Filename within '''ID Table''') | |||
<span style="background:#ff6666;">Next Element</span> (also used as a 4 byte long value which points to a Filename within '''ID Table''') | |||
<span style="background:#cef2ce;">First Entry</span> Points to a Offsset within '''Tree Table''' which describe the first file of current processing Element | |||
<span style="background:#5CB3FF;">Last Entry</span> Points to a Offsset within '''Tree Table''' which describe the last file of current processing Element | |||
<span style="background:#ccd815;">Element Pointer</span> | |||
<span style="background:#FCDFFF;">Typ Descriptor</span> A Integer value which describe the Typ of the Attribute | |||
<span style="background:#6666ff;">Offset of Filedata</span> A Integer value, points to a Offset within '''File Table''' which describe the Start of a File to read from | |||
<span style="background:#2bffb3;">Size of Filedata</span> A Integer value which describe the Length of the File to read from '''File Table''' | |||
<span style="background:#ccd815;">Element Pointer</span> | |||
<span style="background:#FCDFFF;">Typ Descriptor</span> | |||
<span style="background:#00FFFF;">ID Offset</span> A Integer value which describe the Offset of a Filename within '''ID Table''' | |||
''' Tree Table of rhm.qrc ID Table of rhm.qrc''' | ''' Tree Table of rhm.qrc ID Table of rhm.qrc''' | ||
Line 534: | Line 316: | ||
| 0x00000006 || '''File''' || Composed of '''Offset''' and '''Size''' each 4 bytes long | | 0x00000006 || '''File''' || Composed of '''Offset''' and '''Size''' each 4 bytes long | ||
|- | |- | ||
| 0x00000007 || '''ID | | 0x00000007 || '''ID''' || Composed of '''Offset''' and '''Size''' each 4 bytes long | ||
|- | |- | ||
|} | |} | ||
The Typ '''File''' is used to descripe two integer values, the Offset and Size for a File which will be readed from '''File Table'''. The Typ '''ID | The Typ '''File''' is used to descripe two integer values, the Offset and Size for a File which will be readed from '''File Table'''. The Typ '''ID''' is used to descripe the Offset of a Filename within the '''ID Table'''. The Size value from '''ID'''' seems not to be used in Containers. | ||
==Container Structure variations== | |||
===QRC=== | |||
==== QRCC ==== | |||
QRCC ('''Q'''t '''R'''esources '''C'''ontainer '''C'''ompressed) | |||
QRC file ZLIB Compressed level 9. | |||
<span style="background:# | *Example from 3.55 rhm.qrc: | ||
'''Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F''' | |||
'''00000000''' <span style="background:#ff6666;">51 52 43 43</span> <span style="background:#8888ff;">00 00 28 00</span> <span style="background:#00ff00;">78 DA</span> QRCC..(.xÚ | |||
{| class="wikitable" | |||
|- | |||
! Name !! Offset !! Size !! Example !! Remark | |||
|- | |||
| Magic || 0x00 || 0x04 || {{cellcolors|#ff6666}} 51 52 43 43 || 'QRCC' | |||
|- | |||
| QRCF decompressed size || 0x04 || 0x04 || {{cellcolors|#8888ff}} 00 00 28 00 || The size of the QRCF file generated when a QRCC is decompressed | |||
|- | |||
| compressed QRCF || 0x08 || ''varies, up to the end of the QRCC file'' || {{cellcolors|#00FF00}} 78 DA... || QRCF file start offset, compressed with ZLIB | |||
|- | |||
|} | |||
*Notes | |||
**The first 2 bytes of the compressed QRCF is the ZLIB header, in this example: 0x78DA | |||
**default/max level 9 | |||
==== QRCF ==== | |||
QRCF ('''Q'''t '''R'''esources '''C'''ontainer '''F'''lat?) | |||
===P3T=== | |||
=== P3TF === | === P3TF === | ||
P3TF ('''P'''laystation '''3''' '''T'''heme '''F'''lat?) | P3TF ('''P'''laystation '''3''' '''T'''heme '''F'''lat?) | ||
Line 650: | Line 420: | ||
! Offset !! Size !! Example !! Remark | ! Offset !! Size !! Example !! Remark | ||
|- | |- | ||
| 0x00 || | | 0x00 || 0x08 || 00 00 00 00 00 00 00 00 || similar all p3t files | ||
|- | |- | ||
| | | 0x08 || 0x08 || FF FF FF FF FF FF FF FF || similar all p3t files | ||
|- | |- | ||
| 0x10 || 0x04 || FF FF FF FF || | | 0x10 || 0x04 || FF FF FF FF || similar all p3t files | ||
|- | |- | ||
| 0x14 || 0x04 || 00 00 00 1C || First Element within the root Element (p3t) | | 0x14 || 0x04 || 00 00 00 1C || First Element within the root Element (p3t) | ||
Line 664: | Line 430: | ||
| 0x18 || 0x04 || 00 00 18 B4 || Last Element within the root Element (p3t) | | 0x18 || 0x04 || 00 00 18 B4 || Last Element within the root Element (p3t) | ||
|- | |- | ||
| 0x1C || 0x04 || 00 00 00 06 || | | 0x1C || 0x04 || 00 00 00 06 || First Element (Offset within '''String Table''', in this case it will be <infotable>) | ||
|- | |- | ||
| | | 0x20 || 0x08 || 00 00 00 00 00 00 00 00 || similar all p3t files | ||
|- | |- | ||
| 0x28 || 0x04 || FF FF FF FF || Previous ELement | | 0x28 || 0x04 || FF FF FF FF || Previous ELement | ||
Line 678: | Line 442: | ||
| 0x34 || 0x04 || 00 00 01 60 || Last Entry | | 0x34 || 0x04 || 00 00 01 60 || Last Entry | ||
|- | |- | ||
| 0x38 || 0x04 || 00 00 00 10 || | | 0x38 || 0x04 || 00 00 00 10 || Element Pointer (Offset within '''String Table''', in this case it will be <info>) | ||
|- | |- | ||
| 0x3C || 0x04 || 00 00 00 0D || Attribute Counter (0x0D == 13, the 13 Attributes of <info> Element) | | 0x3C || 0x04 || 00 00 00 0D || Attribute Counter (0x0D == 13, the 13 Attributes of <info> Element) | ||
Line 693: | Line 457: | ||
|- | |- | ||
|} | |} | ||
====String Table==== | ====String Table==== | ||
This area is composed by a consecutive list of all the tags (elements or attributes) from the xml that was used to create the container. Are stored "from-top-to-bottom" in the exact same order that they was ordered in the xml (althougth it looks in some cases the theme compiler reorders them to his convenience). This list | This area is composed by a consecutive list of all the tags (elements or attributes) from the xml that was used to create the container. Are stored "from-top-to-bottom" in the exact same order that they was ordered in the xml (althougth it looks in some cases the theme compiler reorders them to his convenience). This list doesnt makes differences of the "directory hierarchy" of the tags neither is specifyed if the tag is an element or an attribute (this parent-child hierarchy is defined in other place of the container by making references to this area by using "byte counters" to locate a tag) | ||
'''Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F''' | '''Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F''' | ||
Line 741: | Line 506: | ||
'''00000040''' 69 63 6F 6E 5F 6D 75 73 69 63 00 00 00 02 F8 69 icon_music....øi | '''00000040''' 69 63 6F 6E 5F 6D 75 73 69 63 00 00 00 02 F8 69 icon_music....øi | ||
'''00000050''' 63 6F 6E 5F 76 69 64 65 6F 00 00 00 03 44 69 63 con_video....Dic | '''00000050''' 63 6F 6E 5F 76 69 64 65 6F 00 00 00 03 44 69 63 con_video....Dic | ||
'''00000060''' 6F 6E 5F 67 61 6D 65 00 | '''00000060''' 6F 6E 5F 67 61 6D 65 00 on_game | ||
====File Table==== | ====File Table==== | ||
The files are not concatenated in the same order than in the '''Tree Table''' & '''ID Table'''. There are even some file within the '''File Table''' which are not contained in '''ID Table'''(anim.raf, authoricon, ect.,...). | The files are not concatenated in the same order than in the '''Tree Table''' & '''ID Table'''. There are even some file within the '''File Table''' which are not contained in '''ID Table'''(anim.raf, authoricon, ect.,...). | ||
===RAF=== | ===RAF=== | ||
=Examples= | =Examples= | ||
==QRC== | ==QRC== | ||
==P3T== | ==P3T== | ||
==RAF== | ==RAF== | ||
=Tools= | =Tools= | ||
. | |||
.. | |||
... | |||
{{File Formats}} | {{File Formats}} | ||
<noinclude>[[Category:Main]]</noinclude> | <noinclude>[[Category:Main]]</noinclude> |