Editing Qt Resource Container (QRC)
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: | ||
[[Category:Software]] | |||
location: /dev_flash/vsh/resource/qgl | |||
== General format == | |||
QGL ('''Q'''t '''G'''raphics '''L'''ibrary) based in [http://en.wikipedia.org/wiki/Qt_%28framework%29 Qt framework] and [http://en.wikipedia.org/wiki/OpenGL OpenGL] | |||
=== QRCC === | |||
QRCC ('''Q'''t '''R'''esources '''C'''ontainer '''C'''ompressed) | |||
QRC file ZLIB Compressed level 9. | |||
== | *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:#6666ff;">00 00 28 00</span> <span style="background:#00ff00;">78 DA</span> QRCC..(.xÚ | |||
=== | {| class="wikitable sortable" | ||
|- | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Name''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Offset''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Size''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Example''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Remark''' | |||
|- | |||
| <span style="background:#ff6666;">Magic header || 0x00 || 0x04 || 51 52 43 43 || 'QRCC' | |||
|- | |||
| <span style="background:#6666ff;">size of ZLIB unpacked (QRCF) file || 0x04 || 0x04 || 00 00 28 00 || | |||
|- | |||
| <span style="background:#00FF00;">ZLIB header || 0x08 || 0x02 || 78 DA || default/max level 9 | |||
|- | |||
|} | |||
=== | === QRCF === | ||
QRCF ('''Q'''t '''R'''esources '''C'''ontainer '''F'''lat?) | |||
QRC "container" with an structure similar than themes .p3t | |||
=== | ====Main Header==== | ||
* | *Example from fw 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 46 00 00 01 10 00 00 00 40 00 00 02 CC</span> QRCF.......@..%| | |||
'''00000010''' <span style="background:#66ff66;">00 00 03 10 00 00 01 2B</span> <span style="background:#ffff66;">00 00 04 40 00 00 00 1B</span> ..%À......9Ð.... | |||
'''00000020''' <span style="background:#ffff66;">00 00 04 60</span> 00 00 00 00 <span style="background:#ffff66;">00 00 04 60</span> 00 00 00 00 ..9ð......9ð.... | |||
'''00000030''' <span style="background:#ffff66;">00 00 04 60 00 00 23 A0</span> 00 00 00 00 00 00 00 00..9ð..@p........ | |||
=== | {| class="wikitable sortable" | ||
|- | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Name''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Offset''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Size''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Example''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Remark''' | |||
|- | |||
| <span style="background:#ff6666;">Magic || 0x00 || 0x04 || 51 52 43 46 || 'QRCF' | |||
|- | |||
| <span style="background:#ff6666;">Version || 0x04 || 0x04 || 00 00 01 10 || | |||
|- | |||
| <span style="background:#ff6666;">Data table start offset || 0x08 || 0x04 || 00 00 00 40 || | |||
|- | |||
| <span style="background:#ff6666;">Data table size || 0x0C || 0x04 || 00 00 02 CC || | |||
|- | |||
| <span style="background:#66ff66;">Filename table start offset || 0x10 || 0x04 || 00 00 03 10 || | |||
|- | |||
| <span style="background:#66ff66;">Filename table size || 0x14 || 0x04 || 00 00 01 2B || without the padding at the end | |||
|- | |||
| <span style="background:#ffff66;">File table header start offset || 0x18 || 0x04 || 00 00 04 40 || | |||
|- | |||
| <span style="background:#ffff66;">File table header size || 0x1C || 0x04 || 00 00 00 1B || without the padding at the end | |||
|- | |||
| <span style="background:#ffff66;">File table start offset || 0x20 || 0x04 || 00 00 04 60 || | |||
|- | |||
| ''Not used'' || 0x24 || 0x04 || 00 00 00 00 || | |||
|- | |||
| <span style="background:#ffff66;">File table start offset || 0x28 || 0x04 || 00 00 04 60 || | |||
|- | |||
| ''Not used'' || 0x2C || 0x04 || 00 00 00 00 || | |||
|- | |||
| <span style="background:#ffff66;">File table start offset || 0x30 || 0x04 || 00 00 04 60 || | |||
|- | |||
| <span style="background:#ffff66;">File table size || 0x34 || 0x04 || 00 00 23 A0 || | |||
|- | |||
| ''Not used'' || 0x38 || 0x04 || 00 00 00 00 || | |||
|- | |||
| ''Not used'' || 0x3C || 0x04 || 00 00 00 00 || | |||
|- | |||
|} | |||
== | ====Data Table==== | ||
Default entry size is 60 bytes (0x3C), but the first entry is smaller, the last entry is a bit special because is not linked to a file, and it looks like there is a padding at the end of the table | |||
Offset (without the 0x40 header in all qrc files) | |||
http://666kb.com/i/cib5c7q4y7rpcx9x1.gif | |||
{| class="wikitable" | |||
|- | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Offset''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Size''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Example''' | |||
| style="background-color:#515243; color:#FFFFFF;" |'''Remark''' | |||
|- | |||
| 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 of the first entry inside datatable (0 + size of first entry) | |||
|- | |||
| 0x34 || 0x04 || xx xx xx xx || size body data table | |||
|- | |||
| 0x38 || 0x04 || 00 00 00 0F || similar all qrc files | |||
|- | |||
| 0x3F || 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 second entry inside datatable (first entry offset + 0x3C) | |||
|- | |||
| 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 || similar all qrc files | |||
|- | |||
| 0x60 || 0x04 || 00 00 01 50 || size of first file without padding | |||
|- | |||
| 0x64 || 0x04 || 00 00 00 18 || similar all qrc files | |||
|- | |||
| 0x68 || 0x04 || 00 00 00 07 || similar all qrc files | |||
|- | |||
| 0x6C || 0x08 || 00 00 00 00 00 00 00 00 || similar all qrc files | |||
|- | |||
| 0x74 || 0x04 || 00 00 00 0F || 00 00 00 1B on icontex.qrc | |||
|- | |||
| 0x78 || 0x04 || 00 00 00 02 || 00 00 00 01 on icontex.qrc | |||
|- | |||
| 0x7C || 0x04 || 00 00 00 1C || 00 01 55 D4 on icontex.qrc (size of .dds uncompressed) | |||
|- | |||
| 0x80 || 0x04 || 00 00 00 38 || | |||
|- | |||
| 0x84 || 0x04 || 00 00 00 B0 || start offset of the third entry inside datatable (second entry offset + 0x3C) | |||
|- | |||
| 0x88 || 0x08 || FF FF FF FF FF FF FF FF || 00 00 00 03 00 00 00 1C on icontex.qrc | |||
|- | |||
| 0x90 || 0x04 || 00 00 00 14 || 00 00 00 38 on icontex.qrc | |||
|- | |||
| 0x94 || 0x04 || 00 00 00 06 || 00 00 00 D0 on icontex.qrc | |||
|- | |||
| 0x98 || 0x04 || xx xx xx xx || size first file (not on icontex.qrc: FF FF FF FF) | |||
|- | |||
| 0X9c || 0X04 || xx xx xx xx || size second file (not on icontex.qrc: FF FF FF FF) | |||
|- | |||
|} | |||
== | ====Filename Table==== | ||
Each entry is composed by: | |||
= | {| class="wikitable" | ||
|- | |||
! Offset !! Length !! Example !! Name !! Notes | |||
|- | |||
| 0x0 || 0x4 || 00000038 || '''Data Table entry offset''' || Same value than in the '''Data Table''' | |||
|- | |||
| 0x4 || ''variable'' || lib/rhm/Clear.fpo || '''File name''' || | |||
|- | |||
| ''variable'' || 0x1 || 00 || '''NULL byte''' || | |||
|} | |||
*The end of the table has a padding to align to 0x10 bytes | |||
*''' | ====File Table==== | ||
The table starts with 0x20 bytes, are always present in all the .qrc files | |||
'''Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F''' | |||
'''00000440''' <span style="background:#ffff66;">71 72 63 00 66 69 6C 65 2D 74 61 62 6C 65 00 66</span> qrc.file-table.f | |||
'''00000450''' <span style="background:#ffff66;">69 6C 65 00 73 72 63 00 69 64 00</span> <span style="background:#ff6666;">00 00 00 00 00</span> ile.src.id...... | |||
*Marked in red: padding to align to 0x10 bytes | |||
After this, the files are concatenated in the same order than in the '''Filename Table''' | |||
== QRC files == | |||
{| class="wikitable" | |||
|- | |||
! Container Name !! File contents !! Firmware changes !! Notes | |||
|- | |||
! [[canyon.qrc]] | |||
| ? || ? || ? | |||
|- | |||
! [[earth.qrc]] | |||
| ? || ? || ? | |||
|- | |||
! [[icons.qrc]] | |||
| MNU (22)<br />DDS (1)<br />BMP (1)<br />FPO (33)<br />VPO (3) || ? || ? | |||
|- | |||
! [[icontex.qrc]] | |||
| DDS (71) || ? || ? | |||
|- | |||
! [[lines.qrc]] | |||
| ELF (2)<br />FPO (47)<br />VPO (11)<br />MNU (69)<br />DDS (24)<br />TGA (6) || ? || ? | |||
|- | |||
! [[raf.qrc]] | |||
| BIN (1)<br />FPO (20)<br />VPO (2) || ? || ? | |||
|- | |||
! [[rhm.qrc]] | |||
| FPO (8)<br />VPO (3) || ? || ? | |||
|- | |||
! [[store.qrc]] | |||
| FPO (41)<br />VPO (13)<br />MNU (20)<br />DDS (5)<br />GTF (1) || ? || ? | |||
|} | |||
*File formats: | |||
**ELF (Executable and Linkable Format) See Specifications here: | |||
[http://www.sco.com/developers/gabi/latest/ch4.eheader.html ELF Header] | |||
[http://www.openwatcom.com/ftp/devel/docs/elf-64-gen.pdf ELF-64 Object File Format] | |||
**BIN (Binary) | |||
**MNU ? | |||
**FPO (Fragment program objects) | |||
**VPO (Vertex program objects) | |||
**PATH (Camera path) | |||
**DUMP ? | |||
**TXT ? | |||
**INI ? | |||
**[http://en.wikipedia.org/wiki/DirectDraw_Surface DDS] (Direct draw surface) | |||
**[http://en.wikipedia.org/wiki/BMP_file_format BMP] (Bitmap) | |||
**[http://en.wikipedia.org/wiki/Truevision_TGA TGA] (Targa) | |||
**[http://en.wikipedia.org/wiki/JPEG JPEG] (Joint Photographic Experts Group) | |||
== Tools == | |||
===ZLIB archivers=== | |||
QRC files are compressed in ZLIB, and has 8 bytes added at the start of the file. To be able to use a generic zlib archiver is needed to remove this 8 bytes (and is needed to add them in the last step when rebuilding the QRC file) | |||
====SimplyZip==== | |||
Windows archiver able to extract and create zlib files. http://www.paehl.de/cms/simplyzip | |||
*Usage: | |||
**Open the program and click in the tab at top: [External progs] ---> [ZLIB (pack/unpack)] | |||
**A window opens where you can select the file | |||
**Choose [Decompress] or [Compress], then click in [Start] | |||
==== QGL converter ==== | |||
This tool can decompress a QRCC to QRCF and compress a QRCF to QRCC (it crops/generates the first 8 bytes and manages the zlib decompression/compression) | |||
https://raw.github.com/wargio/ps3tools/master/QGL.c (just run make to compile it) | |||
=== QRC Extractors === | === QRC Extractors === | ||
After the ZLIB decompression (needed for all .qrc files except icontex.qrc) the contents can be extracted individually using different tools | After the ZLIB decompression (needed for all .qrc files except icontex.qrc) the contents can be extracted individually using different tools | ||
* | *Notes | ||
**Some of the images are inverted vertically (only .dds?) | |||
==== P3Textractor ==== | |||
Is posible to use a theme extractor to extract the contents from .qrc files, but first is needed to replace the characters '''/''' by '''_''' of the text strings inside the '''Name table''' with a hexeditor (e.g: the string '''override/black/ICONS.mnu''' needs to be replaced by '''override_black_ICONS.mnu''') | |||
This patching of the text strings can be automated by selecting the whole '''Name table''' in hexeditor and the function "replace string" (replacing the text string '''/''' by '''_''' automatically only in the selected area) | |||
P3Textractor manual: http://www.psdevwiki.com/ps3/Themes_(.p3t)#P3Textractor | |||
*Notes | |||
**P3Textractor renames .dds file extensions to .gim in the extraction process... so is needed to change back the file extensions manually to .dds for further edits in other programs | |||
**This same trick with P3Textractor can be used with .raf files | |||
=== Raw extractors === | |||
==== Generic Tiny little extractor ==== | |||
Theses generic tiny little tools extract '''blindly''' (they just don t want to stop) & embedded (and so, output bigger files when it s not) files and are means to be tiny and independent. Extremely Heavily based on an [http://www.ps3devwiki.com/wiki/Talk:Content_Information_Files MPO splitter] by Christian Steinruecken. Formats supported DDS/MNU/JPG/MPO/PNG (and virtually any other by modifying the source code) | |||
http://rghost.net/49340892 (include Code-Compile-Credit. Drag and drop your file into them) & | |||
mirror links: http://mir.cr/0R78ED3U | |||
=== QRC Compilers === | === QRC Compilers === | ||
There are no .qrc | There are no compilers for .qrc files, the commonly used method consist in patching settings values in text strings (or to inject the modded files) with a hexeditor over the original .qrc file | ||
This limits the mods to patches than never exceeeds the size of the original data... in the case of patching an area with an smaller patch is recommended to fill the original "trash" data with zeroes | |||
==== Patching strings in hexeditor ==== | |||
Mostly used with the settings inside .mnu files | |||
First extract the files with some of the extractor tool, open the .mnu files in notepad++ to be able to read the settings in a easy way | |||
Select the string you want to modify and "copy" his name | |||
Open the .qrc file in hexeditor (after ZLIB decompression if needed) and use the search funtion to locate the string you copyed previously | |||
*Notes | |||
**Most of the settings inside .mnu files are repeated several times inside the .qrc file because are used in several .mnu files... be sure to patch the correct .mnu file by comparing the rest of the data at his side | |||
==== Injecting files in hexeditor ==== | |||
Similar than patching a text string, but with a bigger chunk of data |