Editing Resource Container CXML (RCO, QRC, Theme Files, RAF, CXML)
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: | ||
== RCO == | == RCO == | ||
*In PSvita the RCO's uses a cxml structure, with a header size of 0x50 and the magic identifyer '''RCOF''' | *In PSvita the RCO's uses a cxml structure, with a header size of 0x50 and the magic identifyer '''RCOF''' | ||
Line 9: | Line 7: | ||
[http://www.file-upload.net/download-9992747/Desktop.rar.html Some RCO as Reference] | [http://www.file-upload.net/download-9992747/Desktop.rar.html Some RCO as Reference] | ||
{| class="wikitable" style="font-size:x-small;" | {| class="wikitable" style="font-size:x-small;" | ||
Line 40: | Line 34: | ||
| 0x24 || 0x04 || F1 01 00 00 || Strings table size || in PS3 = Integer array size | | 0x24 || 0x04 || F1 01 00 00 || Strings table size || in PS3 = Integer array size | ||
|- bgcolor="#ffeebb" | |- bgcolor="#ffeebb" | ||
| 0x28 || 0x04 || D0 18 00 00 || | | 0x28 || 0x04 || D0 18 00 00 || overlapped (not used, but present in the header to keep the structure standards) || in PS3 = Float array absolute start offset | ||
|- bgcolor="#ffeebb" | |- bgcolor="#ffeebb" | ||
| 0x2C || 0x04 || 00 00 00 00 || | | 0x2C || 0x04 || 00 00 00 00 || empty || in PS3 = Float array size | ||
|- bgcolor="#ffee99" | |- bgcolor="#ffee99" | ||
| 0x30 || 0x04 || D0 18 00 00 || | | 0x30 || 0x04 || D0 18 00 00 || Styles ID INT table absolute start offset || in PS3 = File table absolute start offset | ||
|- bgcolor="#ffee99" | |- bgcolor="#ffee99" | ||
| 0x34 || 0x04 || 34 00 00 00 || | | 0x34 || 0x04 || 34 00 00 00 || Styles ID INT table size || in PS3 = File table size | ||
|- bgcolor="#ffee77" | |- bgcolor="#ffee77" | ||
| 0x38 || 0x04 || 10 19 00 00 || Integer array absolute start offset || in PS3 = Unknown area absolute start offset | | 0x38 || 0x04 || 10 19 00 00 || Integer array absolute start offset || in PS3 = Unknown area absolute start offset | ||
Line 68: | Line 62: | ||
==XML implicit structure Overview== | ==XML implicit structure Overview== | ||
namespace cxml | namespace cxml | ||
{ | |||
struct Header { /*header of a cxml document*/ | |||
char magic[4]; | |||
int version; | |||
int tree_offset; | |||
int tree_size; | |||
int idstrtable_offset; | |||
int idstrtable_size; | |||
int idinttable_offset; | |||
int idinttable_size; | |||
int stringtable_offset; | |||
int stringtable_size; | |||
int styleidtable_offset; | |||
int styleidtable_size; | |||
int intarraytable_offset; | |||
int intarraytable_size; | |||
int floatarraytable_offset; | |||
int floatarraytable_size; | |||
int filetable_offset; | |||
int filetable_size; | |||
}; | |||
struct ChildElementBin | |||
{ | |||
int name; | |||
int attr_num; | |||
int parent; | |||
int prev; | |||
int next; | |||
int first_child; | |||
int last_child; | |||
}; | |||
struct BrotherElementBin | |||
{ | |||
int name; | |||
int attr_num; | |||
int parent; | |||
int prev; | |||
int next; | |||
}; | |||
struct AttributeBin | |||
{ | |||
int INTEGER = 1; | |||
int FLOAT = 2; | |||
int STRING = 3; | |||
int unk = 4; | |||
int STYLE_ID = 5; | |||
int INTEGER_ARRAY = 6; | |||
int FLOAT_ARRAY = 7; | |||
int DATA = 8; | |||
int ID_STR_REF = 9; | |||
int ID_STR_NO_REF = 10; | |||
int ID_INT_REF = 11; | |||
int ID_INT_NO_REF = 12; | |||
int name; | |||
int type; | |||
struct StringData | |||
{ | |||
int offset; | |||
int len; | |||
}; | |||
struct IntArrayData | |||
{ | |||
int offset; | |||
int num; | |||
}; | |||
struct FloatArrayData | |||
{ | |||
int offset; | |||
int num; | |||
}; | |||
struct FileData | |||
{ | |||
int offset; | |||
int size; | |||
}; | |||
union | |||
{ | |||
int i; | |||
float f; | |||
StringData s; | |||
IntArrayData ia; | |||
FloatArrayData fa; | |||
FileData file; | |||
int id; | |||
int idref; | |||
}; | |||
}; | |||
struct IDBin | |||
{ | |||
int entity_offset; | |||
char id[0]; | |||
}; | |||
enum AllocationType | |||
{ | |||
AllocationType_Alloc_Tree, | |||
AllocationType_Alloc_IDSTRTable, | |||
AllocationType_Alloc_IDINTTable, | |||
AllocationType_Alloc_StringTable, | |||
AllocationType_Alloc_IntArrayTable, | |||
AllocationType_Alloc_FloatArrayTable, | |||
AllocationType_Alloc_FileTable, | |||
AllocationType_Alloc_StyleIDTable, | |||
AllocationType_Free_Tree, | |||
AllocationType_Free_IDSTRTable, | |||
AllocationType_Free_IDINTTable, | |||
AllocationType_Free_StringTable, | |||
AllocationType_Free_IntArrayTable, | |||
AllocationType_Free_FloatArrayTable, | |||
AllocationType_Free_FileTable, | |||
AllocationType_AFree_StyleIDTable, | |||
}; | |||
enum AccessMode | |||
{ | |||
AccessMode_ReadWrite, | |||
AccessMode_ReadOnly_File, | |||
AccessMode_ReadOnly_Memory, | |||
}; | |||
class Document { | |||
public: | |||
typedef void (*Allocator)( AllocationType type, void * userdata, void * old_addr, unsigned int required_size, void ** addr, unsigned int * size ); | |||
private: | |||
AccessMode access_mode; | |||
Header header; | |||
char * tree; | |||
unsigned int tree_capacity; | |||
char * idstrtable; | |||
unsigned int idstrtable_capacity; | |||
char * idinttable; | |||
unsigned int idinttable_capacity; | |||
char * stringtable; | |||
unsigned int stringtable_capacity; | |||
int * intarraytable; | |||
unsigned int intarraytable_capacity; | |||
float * floatarraytable; | |||
unsigned int floatarraytable_capacity; | |||
char * filetable; | |||
unsigned int filetable_capacity; | |||
char * styleidtable; | |||
unsigned int styleidtable_capacity; | |||
Allocator allocator; | |||
void * allocator_userdata; | |||
}; | |||
class Element { | |||
private: | |||
Document * doc; | |||
int offset; | |||
}; | |||
class Attribute { | |||
private: | |||
Document * doc; | |||
int element_offset; | |||
int offset; | |||
}; | |||
}; | }; | ||
Line 282: | Line 245: | ||
| 0x08 || 0x04 || Parent relative offset in '''TOC''' | | 0x08 || 0x04 || Parent relative offset in '''TOC''' | ||
|- | |- | ||
| 0x0C || 0x04 || Previous | | 0x0C || 0x04 || Previous Brother relative offset in '''TOC''' | ||
|- | |- | ||
| 0x10 || 0x04 || Next | | 0x10 || 0x04 || Next Brother relative offset in '''TOC''' | ||
|- | |- | ||
| 0x14 || 0x04 || First child relative offset in '''TOC''' | | 0x14 || 0x04 || First child relative offset in '''TOC''' | ||
Line 290: | Line 253: | ||
| 0x18 || 0x04 || Last child relative offset in '''TOC''' | | 0x18 || 0x04 || Last child relative offset in '''TOC''' | ||
|} | |} | ||
{| class="wikitable" style="text-align:center;" | {| class="wikitable" style="text-align:center;" | ||
|+ CXML | |+ CXML Brother Element definition | ||
! Offset !! Length !! usage | ! Offset !! Length !! usage | ||
|- | |- | ||
Line 303: | Line 264: | ||
| 0x08 || 0x04 || Parent relative offset in '''TOC''' | | 0x08 || 0x04 || Parent relative offset in '''TOC''' | ||
|- | |- | ||
| | | 0x1C || 0x04 || Previous Brother relative offset in '''TOC''' | ||
|- | |- | ||
| 0x10 || 0x04 || Next | | 0x10 || 0x04 || Next Brother relative offset in '''TOC''' | ||
|} | |} | ||
*NOTE: The '''Child Element''' defination describe the Child Element and his Attributes where the '''Brother Element''' describe the Brother Element and his Attributes. | |||
So the full order to read will be '''Child Element''' >>> '''Attributes''', '''Brother Element''' >>> '''Attributes'''. The Root (so offset 0x00) of any SonyPlaystation Resource file always start's with a Child element to read. | |||
NOTE: | |||
===Attribute=== | ===Attribute=== | ||
{| class="wikitable" style="text-align:center;" | {| class="wikitable" style="text-align:center;" | ||
|+ CXML Attribute definitions | |+ CXML Attribute definitions | ||
Line 321: | Line 278: | ||
|- | |- | ||
! Attribute type<BR />(offset 0x4, length 0x4) | ! Attribute type<BR />(offset 0x4, length 0x4) | ||
! 1<BR />(Single Integer) !! 2<BR />(Single Float) !! 3<BR />(String) !! 4<BR />( | ! 1<BR />(Single Integer) !! 2<BR />(Single Float) !! 3<BR />(String) !! 4<BR />(analysing...) !! 5<BR />(ID STYLE) !! 6<BR />(Integer Array) !! 7<BR />(Float Array) !! 8<BR />(File) !! 9<BR />(ID STR w lpb Ref) !! A<BR />(ID STR wo lpb Ref) !! B<BR />(ID INT w lpb Ref) !! C<BR />(ID INT wo lpb Ref) | ||
|- | |- | ||
! variable 1<BR />(offset 0x8, length 0x4) | ! variable 1<BR />(offset 0x8, length 0x4) | ||
| Integer value || Float value || '''Strings Table''' offset || | | Integer value || Float value || '''Strings Table''' offset || analysing... || '''ID STYLE Table''' offset || '''Integer Arrays Table''' offset || '''Float Arrays Table''' offset || '''Files Table''' offset || '''ID STR Table''' offset || '''ID STR Table''' offset || '''ID INT Table''' offset || '''ID INT Table''' offset | ||
|- | |- | ||
! variable 2<BR />(offset 0xC, length 0x4) | ! variable 2<BR />(offset 0xC, length 0x4) | ||
| {{cellcolors|#ffaaaa}} Not used <abbr title="(always 0 in the samples found)">(always 0)</abbr> || {{cellcolors|#ffaaaa}} Not used <abbr title="(always 0 in the samples found)">(always 0)</abbr> || String length || | | {{cellcolors|#ffaaaa}} Not used <abbr title="(always 0 in the samples found)">(always 0)</abbr> || {{cellcolors|#ffaaaa}} Not used <abbr title="(always 0 in the samples found)">(always 0)</abbr> || String length || analysing... || Nr. of int's to read (always 4) || Nr. of int's to read || Nr. of float's to read || File size || {{cellcolors|#ffaaaa}} Not used <abbr title="(always 0 in the samples found)">(always 0)</abbr> || {{cellcolors|#ffaaaa}} Not used <abbr title="(always 0 in the samples found)">(always 0)</abbr> || {{cellcolors|#ffaaaa}} Not used <abbr title="(always 0 in the samples found)">(always 0)</abbr> || {{cellcolors|#ffaaaa}} Not used <abbr title="(always 0 in the samples found)">(always 0)</abbr> | ||
|} | |} | ||
* w = with || wo = without || lpb = loopback | * w = with || wo = without || lpb = loopback | ||
Line 335: | Line 292: | ||
ZLIB Compressed level 9 (only container) | ZLIB Compressed level 9 (only container) | ||
==== RCOF | ==== RCOF ==== | ||
RCOF ('''R'''esources '''C'''ontainer | RCOF ('''R'''esources '''C'''ontainer '''F'''lat?) | ||
*Example from FW?? notification_settings_plugin.rco: | *Example from FW?? notification_settings_plugin.rco: | ||
Line 348: | Line 304: | ||
|- | |- | ||
| Magic || 0x00 || 0x04 || {{cellcolors|#666666|#ffffff}} 52 43 4F 46 || 'RCOF' | | Magic || 0x00 || 0x04 || {{cellcolors|#666666|#ffffff}} 52 43 4F 46 || 'RCOF' | ||
|- | |- | ||
| Version || 0x04 || 0x04 || {{cellcolors|#888888|#ffffff}} 00 00 01 10* || CXML version '1.10' | | Version || 0x04 || 0x04 || {{cellcolors|#888888|#ffffff}} 00 00 01 10* || CXML version '1.10' | ||
Line 380: | Line 322: | ||
**one of the "not used table" (at offset 0x18D0 with a size of 0) is placed before an used table (also at offset 0x18D0 but with a size of 0x34) | **one of the "not used table" (at offset 0x18D0 with a size of 0) is placed before an used table (also at offset 0x18D0 but with a size of 0x34) | ||
'''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''' | ||
'''00000000''' <span style="background:#666666;">52 43 4F 46</span> <span style="background:#666666;">10 01 00 00</span> <span style="background:#ff8888;">50 00 00 00</span> <span style="background:#ff8888;">2C 15 00 00</span> RCOF....P...,... | '''00000000''' <span style="background:#666666;">52 43 4F 46</span> <span style="background:#666666;">10 01 00 00</span> <span style="background:#ff8888;">50 00 00 00</span> <span style="background:#ff8888;">2C 15 00 00</span> RCOF....P...,... | ||
Line 387: | Line 329: | ||
'''00000030''' <span style="background:#ffee99;">D0 18 00 00</span> <span style="background:#ffee99;">34 00 00 00</span> <span style="background:#ffee77;">10 19 00 00</span> <span style="background:#ffee77;">2C 00 00 00</span> Ð...4.......,... | '''00000030''' <span style="background:#ffee99;">D0 18 00 00</span> <span style="background:#ffee99;">34 00 00 00</span> <span style="background:#ffee77;">10 19 00 00</span> <span style="background:#ffee77;">2C 00 00 00</span> Ð...4.......,... | ||
'''00000040''' <span style="background:#ffee55;">40 19 00 00</span> <span style="background:#ffee55;">8C 00 00 00</span> <span style="background:#ffee33;">D0 19 00 00</span> <span style="background:#ffee33;">60 89 00 00</span> @...Œ...Ð...`‰.. | '''00000040''' <span style="background:#ffee55;">40 19 00 00</span> <span style="background:#ffee55;">8C 00 00 00</span> <span style="background:#ffee33;">D0 19 00 00</span> <span style="background:#ffee33;">60 89 00 00</span> @...Œ...Ð...`‰.. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 416: | Line 359: | ||
| empty || 0x2C || 0x04 || {{cellcolors|#ffeebb}} 00 00 00 00 || Not used | | empty || 0x2C || 0x04 || {{cellcolors|#ffeebb}} 00 00 00 00 || Not used | ||
|- | |- | ||
| | | Styles ID Integer Table Offset || 0x30 || 0x04 || {{cellcolors|#ffee99}} 00 00 18 D0* || | ||
|- | |- | ||
| | | Styles ID Integer Table Size || 0x34 || 0x04 || {{cellcolors|#ffee99}} 00 00 00 34* || | ||
|- | |- | ||
| Integer Array Table Offset || 0x38 || 0x04 || {{cellcolors|#ffee77}} 00 00 19 10* || | | Integer Array Table Offset || 0x38 || 0x04 || {{cellcolors|#ffee77}} 00 00 19 10* || | ||
Line 433: | Line 376: | ||
|- | |- | ||
|} | |} | ||
* reversed little endian | * reversed little endian | ||
*Notes | *Notes | ||
**The sizes doesn't includes the (possible) padding at the end of all tables | **The sizes doesn't includes the (possible) padding at the end of all tables | ||
===Tree Table=== | ===Tree Table=== | ||
Line 503: | Line 392: | ||
| 0x08 || 0x04 || FF FF FF FF || Parent | | 0x08 || 0x04 || FF FF FF FF || Parent | ||
|- | |- | ||
| 0x0C || 0x04 || FF FF FF FF || Previous | | 0x0C || 0x04 || FF FF FF FF || Previous Brother | ||
|- | |- | ||
| 0x10 || 0x04 || FF FF FF FF || Next | | 0x10 || 0x04 || FF FF FF FF || Next Brother | ||
|- | |- | ||
| 0x14 || 0x04 || 00 00 00 3C || First Child within the root Element <resource> (which will also our Next '''Child Element''' to read) | | 0x14 || 0x04 || 00 00 00 3C || First Child within the root Element <resource> (which will also our Next '''Child Element''' to read) | ||
Line 533: | Line 422: | ||
| 0x44 || 0x04 || 00 00 00 00 || Parent (Offset within XML Table, pointing to Root Element) | | 0x44 || 0x04 || 00 00 00 00 || Parent (Offset within XML Table, pointing to Root Element) | ||
|- | |- | ||
| 0x48 || 0x04 || FF FF FF FF || Previous | | 0x48 || 0x04 || FF FF FF FF || Previous Brother | ||
|- | |- | ||
| 0x4C || 0x04 || 00 00 07 88 || Next | | 0x4C || 0x04 || 00 00 07 88 || Next Brother | ||
|- | |- | ||
| 0x50 || 0x04 || 00 00 00 58 || First Child | | 0x50 || 0x04 || 00 00 00 58 || First Child | ||
Line 547: | Line 436: | ||
| 0x60 || 0x04 || 00 00 00 3C || Parrent <stringtable> | | 0x60 || 0x04 || 00 00 00 3C || Parrent <stringtable> | ||
|- | |- | ||
| 0x64 || 0x04 || FF FF FF FF || Previous | | 0x64 || 0x04 || FF FF FF FF || Previous Brother | ||
|- | |- | ||
| 0x68 || 0x04 || 00 00 00 B4 || Next | | 0x68 || 0x04 || 00 00 00 B4 || Next Brother | ||
|- | |- | ||
| 0x6C || 0x04 || FF FF FF FF || First Child | | 0x6C || 0x04 || FF FF FF FF || First Child | ||
Line 606: | Line 495: | ||
===String Table=== | ====String Table==== | ||
from [http://www.file-upload.net/download-9994498/string_table.rar.html notification_settings_plugin.rco] FW?? | from [http://www.file-upload.net/download-9994498/string_table.rar.html notification_settings_plugin.rco] FW?? | ||
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 doesn't makes differences of the "directory hierarchy" of the tags neither is specified 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) | 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 doesn't makes differences of the "directory hierarchy" of the tags neither is specified 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) | ||
Line 649: | Line 538: | ||
**The integer values and text strings of some attributes tags from the xml (e.g: "themename=mytheme", or "fontcolor=2") are stored in this area too at the right of his tag, the presence of an integer value displaces the next tag (this only happens in themes and rafs, not in QRC, RCO files so is added here as a note but is very important for the structure of the other containers when using "byte counters" to locate the tags) | **The integer values and text strings of some attributes tags from the xml (e.g: "themename=mytheme", or "fontcolor=2") are stored in this area too at the right of his tag, the presence of an integer value displaces the next tag (this only happens in themes and rafs, not in QRC, RCO files so is added here as a note but is very important for the structure of the other containers when using "byte counters" to locate the tags) | ||
=== | ===ID Table=== | ||
In a '''Vita RCO''' we have '''3''' diffrent '''ID Tables''' which we will take a deeper look now. | In a '''Vita RCO''' we have '''3''' diffrent '''ID Tables''' which we will take a deeper look now. | ||
Line 700: | Line 586: | ||
'''00000090''' FF FF FF FF <span style="background:#ffff66;">20 41 32 74</span> ÿÿÿÿ.A2t | '''00000090''' FF FF FF FF <span style="background:#ffff66;">20 41 32 74</span> ÿÿÿÿ.A2t | ||
====ID | ====ID Style==== | ||
from [http://www.file-upload.net/download-9994521/id_styletable.rar.html notification_settings_plugin.rco] FW?? | from [http://www.file-upload.net/download-9994521/id_styletable.rar.html notification_settings_plugin.rco] FW?? | ||
Line 712: | Line 598: | ||
'''00000020''' <span style="background:#ffff66;">DA 39 A3 EE 20 2F 57 0C 86 D6 DE 69 22 43 90 D9</span> Ú9£î./W.†ÖÞi"C.Ù | '''00000020''' <span style="background:#ffff66;">DA 39 A3 EE 20 2F 57 0C 86 D6 DE 69 22 43 90 D9</span> Ú9£î./W.†ÖÞi"C.Ù | ||
'''00000030''' <span style="background:#ffff66;">DD 31 50 3B</span> Ý1P; | '''00000030''' <span style="background:#ffff66;">DD 31 50 3B</span> Ý1P; | ||
===Integer Array=== | ===Integer Array=== | ||
Line 751: | Line 638: | ||
==Summary== | ==Summary== | ||
So what of old but still handy [ | ==Other Usefull Links== | ||
So what of old but still handy [http://psxsdk.googlecode.com/svn/!svn/bc/13/trunk/tools/ VAG2WAV WAV2VAG Source] |