Editing PlayStation archive (PSARC)
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 19: | Line 19: | ||
=Structure= | =Structure= | ||
See | See {{Talk}} page | ||
==Header== | ==Header== | ||
PSARC header example: | PSARC header example: | ||
Line 36: | Line 35: | ||
| style="background-color:#66ff66;" | 0x04 || style="background-color:#66ff66;" | 0x04 || '''version''' || 00 01 00 04 || v1.4 || First 2 bytes is the '''major version''', next 2 bytes is the '''minor version''' | | style="background-color:#66ff66;" | 0x04 || style="background-color:#66ff66;" | 0x04 || '''version''' || 00 01 00 04 || v1.4 || First 2 bytes is the '''major version''', next 2 bytes is the '''minor version''' | ||
|- | |- | ||
| style="background-color:#ffff66;" | 0x08 || style="background-color:#ffff66;" | 0x04 || ''' | | style="background-color:#ffff66;" | 0x08 || style="background-color:#ffff66;" | 0x04 || '''compression type''' || 7A 6C 69 62 || zlib || '''zlib''' (default)<br>'''lzma''' | ||
|- | |- | ||
| style="background-color:#6666ff;" | 0x0C || style="background-color:#6666ff;" | 0x04 || ''' | | style="background-color:#6666ff;" | 0x0C || style="background-color:#6666ff;" | 0x04 || '''toc length''' || 00 01 23 BA || 0x123BA || | ||
|- | |- | ||
| style="background-color:#dd00dd;" | 0x10 || style="background-color:#dd00dd;" | 0x04 || ''' | | style="background-color:#dd00dd;" | 0x10 || style="background-color:#dd00dd;" | 0x04 || '''toc entry size''' || 00 00 00 1E || 30 Bytes || Default is 30 bytes | ||
|- | |- | ||
| style="background-color:#dddd00;" | 0x14 || style="background-color:#dddd00;" | 0x04 || ''' | | style="background-color:#dddd00;" | 0x14 || style="background-color:#dddd00;" | 0x04 || '''toc entries''' || 00 00 09 16 || 1 manifest + 2325 files || The '''manifest''' is always included as the first file in the archive without an assigned ID | ||
|- | |- | ||
| style="background-color:#dddddd;" | 0x18 || style="background-color:#dddddd;" | 0x04 || ''' | | style="background-color:#dddddd;" | 0x18 || style="background-color:#dddddd;" | 0x04 || '''block size''' || 00 01 00 00 || 65536 Bytes || Default is 65536 bytes | ||
|- | |- | ||
| style="background-color:#d0000d;" | 0x1C || style="background-color:#d0000d;" | 0x04 || ''' | | style="background-color:#d0000d;" | 0x1C || style="background-color:#d0000d;" | 0x04 || '''archive flags''' || 00 00 00 02 || Absolute paths || 0 = '''relative''' paths (default)<br>1 = '''ignorecase''' paths<br>2 = '''absolute''' paths | ||
|} | |} | ||
Line 65: | Line 64: | ||
==TOC Table== | ==TOC Table== | ||
==Blocks info table== | ==Blocks info table== | ||
==File table== | ==File table== | ||
Line 137: | Line 101: | ||
==PSARC Extractor== | ==PSARC Extractor== | ||
By Insomniac @ xentax forums, download link: http://www.ps3hax.net/downloads.php?do=file&id=452 and http://www.modcontrol.com/Board/pc-tools/28869-psarc-ps3-extractor.html | |||
By Insomniac @ xentax forums, download link: | |||
'''Usage:''' | '''Usage:''' | ||
Line 164: | Line 127: | ||
==PSARC== | ==PSARC== | ||
1.60.008 SDK : x | 1.60.008 SDK : x | ||
1.92.001 SDK : x | 1.92.001 SDK : x | ||
Line 174: | Line 136: | ||
4.50.001 SDK : psarc-1310.001 (C++), built on Nov 16 2011 at 03:31:36 | 4.50.001 SDK : psarc-1310.001 (C++), built on Nov 16 2011 at 03:31:36 | ||
*From xentax forums: http://forum.xentax.com/viewtopic.php?p=44228&sid=0a7b5167ba4599f71f85471119c918a6#p44228 Download link: | *From xentax forums: http://forum.xentax.com/viewtopic.php?p=44228&sid=0a7b5167ba4599f71f85471119c918a6#p44228 Download link: http://www.mediafire.com/?o3wy35uublreh | ||
===help=== | ===help=== | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe --help | '''C:\>psarc.exe --help''' | ||
usage: | '''usage:''' | ||
psarc verb [options] [file...] | psarc verb [options] [file...] | ||
psarc --xml=XMLFILE | psarc --xml=XMLFILE | ||
verbs: | '''verbs:''' | ||
create Create an archive. (default) | create Create an archive. (default) | ||
extract Extract contents of an existing archive. | extract Extract contents of an existing archive. | ||
Line 191: | Line 153: | ||
dtd Display a DTD describing psarc's XML input syntax. | dtd Display a DTD describing psarc's XML input syntax. | ||
general options: | '''general options:''' | ||
-h, --help Show this help message and exit. | -h, --help Show this help message and exit. | ||
--version Display version and exit. | --version Display version and exit. | ||
Line 200: | Line 162: | ||
--xml=XMLFILE XML list of actions to perform. | --xml=XMLFILE XML list of actions to perform. | ||
create options: | '''create options:''' | ||
-oFILE, --output=FILE Archive filename to create. | -oFILE, --output=FILE Archive filename to create. | ||
-IINPUTFILE, --inputfile=INPUTFILE Inputfile listing files to archive. Consider --xml instead, which gives you more control. | -IINPUTFILE, --inputfile=INPUTFILE Inputfile listing files to archive. Consider --xml instead, which gives you more control. | ||
Line 219: | Line 181: | ||
--mergedups Compare the content of all files, and merge identical files so that only one copy of the data is included. | --mergedups Compare the content of all files, and merge identical files so that only one copy of the data is included. | ||
extract options: | '''extract options:''' | ||
--input=FILE Archive to extract files from. (default is first file argument) | --input=FILE Archive to extract files from. (default is first file argument) | ||
--to=DIRECTORY Directory to write extracted files to. (default is current directory) | --to=DIRECTORY Directory to write extracted files to. (default is current directory) | ||
}} | |||
===dtd=== | ===dtd=== | ||
Line 229: | Line 191: | ||
The output of this command is a layout that defines the structure of an .xml document. See: http://www.w3schools.com/DTD/ | The output of this command is a layout that defines the structure of an .xml document. See: http://www.w3schools.com/DTD/ | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe dtd | '''C:\>psarc.exe dtd'''<nowiki> | ||
<!ELEMENT psarc (create|extract)+> | <!ELEMENT psarc (create|extract)+> | ||
Line 283: | Line 245: | ||
skipmissingfiles (true|false) "false" | skipmissingfiles (true|false) "false" | ||
overwrite (true|false) "false"> | overwrite (true|false) "false"> | ||
</ | </nowiki>}} | ||
*DTD Notes: | *DTD Notes: | ||
Line 298: | Line 260: | ||
To use an .xml is needed to prepare it based in this layout | To use an .xml is needed to prepare it based in this layout | ||
{{ | {{Boxframe2|content= | ||
This is the xml representation of the DTD layout containing all the elements and attributes availables together, is only for wiki purpose | |||
{{Boxcode|content=<syntaxhighlight lang="xml"> | |||
<psarc> | <psarc> | ||
<create archive="" absolute="false" ignorecase="false" mergedups="false" stripall="false" blocksize="65536" jobs="" skipmissingfiles="false" format="psarc" overwrite="false"> | <create archive="" absolute="false" ignorecase="false" mergedups="false" stripall="false" blocksize="65536" jobs="" skipmissingfiles="false" format="psarc" overwrite="false"> | ||
Line 315: | Line 279: | ||
*The purpose of this XML is to use it as a base layout containing all, but is not posible to use it like that, is needed to delete the tags that are not needed for a specific case, the ones that are incompatibles with other tags, and is needed to add paths, etc... | *The purpose of this XML is to use it as a base layout containing all, but is not posible to use it like that, is needed to delete the tags that are not needed for a specific case, the ones that are incompatibles with other tags, and is needed to add paths, etc... | ||
*Some attributes appears as common in the DTD for "create" and "extract" but are not common, some of them has been deleted to avoid mistakes... but probably is needed to delete some more | *Some attributes appears as common in the DTD for "create" and "extract" but are not common, some of them has been deleted to avoid mistakes... but probably is needed to delete some more | ||
}} | |||
When the xml is ready you can run it this way: | When the xml is ready you can run it this way: | ||
{{Keyboard|content= | {{Keyboard|content= | ||
'''C:\>psarc.exe --xml=C:\DTD_Layout.xml''' | |||
}} | |||
The options '''--verbose''', '''--debug''', and '''--quiet''' cant be used inside the xml, so if needed are specifyed in the command line, this way: | The options '''--verbose''', '''--debug''', and '''--quiet''' cant be used inside the xml, so if needed are specifyed in the command line, this way: | ||
{{Keyboard|content= | {{Keyboard|content= | ||
'''C:\>psarc.exe --debug --xml=C:\DTD_Layout.xml''' | |||
}} | |||
===verify=== | ===verify=== | ||
Line 326: | Line 295: | ||
*Output info per-file is: Validating <file ID/number>: - file path inside psarc archive - (file original size in bytes) | *Output info per-file is: Validating <file ID/number>: - file path inside psarc archive - (file original size in bytes) | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe verify "C:\psarctests\source files\test.psarc" | '''C:\>psarc.exe verify "C:\psarctests\source files\test.psarc"''' | ||
Verifying C:\psarctests\source files\test.psarc | Verifying C:\psarctests\source files\test.psarc | ||
Validating 1: dummy.txt (0 bytes) | Validating 1: dummy.txt (0 bytes) | ||
Line 334: | Line 303: | ||
Validating 4: PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142 bytes) | Validating 4: PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142 bytes) | ||
Archive OK | Archive OK | ||
}} | |||
===dump=== | ===dump=== | ||
Line 340: | Line 309: | ||
*Output info per-file is: file path inside psarc archive - file original size - file compressed size - file block start offset ? | *Output info per-file is: file path inside psarc archive - file original size - file compressed size - file block start offset ? | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe dump "C:\psarctests\source files\test.psarc" | '''C:\>psarc.exe dump "C:\psarctests\source files\test.psarc"''' | ||
Dumping C:\psarctests\source files\test.psarc | Dumping C:\psarctests\source files\test.psarc | ||
dummy.txt os=0 cs=0 fb=1 | dummy.txt os=0 cs=0 fb=1 | ||
Line 347: | Line 316: | ||
JPGfolder1/JPGfolder2/Image2.jpg os=12524 cs=209 fb=97 | JPGfolder1/JPGfolder2/Image2.jpg os=12524 cs=209 fb=97 | ||
PNGfolder1/PNGfolder2/PNGfolder3/Image3.png os=6142 cs=6142 fb=98 | PNGfolder1/PNGfolder2/PNGfolder3/Image3.png os=6142 cs=6142 fb=98 | ||
}} | |||
===list=== | ===list=== | ||
Line 354: | Line 323: | ||
*In the compression percentage: 100% is no reduction, 0% is a huge reduction | *In the compression percentage: 100% is no reduction, 0% is a huge reduction | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe list "C:\psarctests\source files\test.psarc" | '''C:\>psarc.exe list "C:\psarctests\source files\test.psarc"''' | ||
Listing C:\psarctests\source files\test.psarc | Listing C:\psarctests\source files\test.psarc | ||
dummy.txt (0/0 100%) | dummy.txt (0/0 100%) | ||
Line 361: | Line 330: | ||
JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | ||
PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142/6142 100%) | PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142/6142 100%) | ||
}} | |||
{{Boxframe2|content= | {{Boxframe2|content= | ||
{{Boxtip1|content=Is posible to generate a text file containing the output of the '''list''' command by using the character '''>''' (right arrow) and the path/name of the destination file, this is usefull to convert the generated file to a '''filelist.txt''' for rebuilding the psarc archive later}} | {{Boxtip1|content=Is posible to generate a text file containing the output of the '''list''' command by using the character '''>''' (right arrow) and the path/name of the destination file, this is usefull to convert the generated file to a '''filelist.txt''' for rebuilding the psarc archive later}} | ||
{{Keyboard|content= | {{Keyboard|content='''C:\>psarc.exe list "C:\psarctests\source files\test.psarc" > c:\psarctests\filelist.txt'''}} | ||
}} | }} | ||
Line 380: | Line 349: | ||
Note in the next examle the file dummy.txt (located in the root of the folder in windows, so considered first) has been archived after BMPfolder1 | Note in the next examle the file dummy.txt (located in the root of the folder in windows, so considered first) has been archived after BMPfolder1 | ||
{{Boxcode| | {{Boxcode|content=CREATE by_directory.xml<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<create archive="C:\psarctests\by_directory.psarc" absolute="false" ignorecase="false"> | <create archive="C:\psarctests\by_directory.psarc" absolute="false" ignorecase="false"> | ||
Line 389: | Line 358: | ||
</psarc> | </psarc> | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe --xml="c:\psarctests\CREATE by_directory.xml" | '''C:\>psarc.exe --xml="c:\psarctests\CREATE by_directory.xml"''' | ||
Strip: C:\psarctests\source files\test | Strip: C:\psarctests\source files\test | ||
Flags: relative | Flags: relative | ||
Line 412: | Line 381: | ||
99.9%: Compression Ratio | 99.9%: Compression Ratio | ||
9: Compression Level | 9: Compression Level | ||
C:\>psarc.exe list C:\psarctests\by_directory.psarc | '''C:\>psarc.exe list C:\psarctests\by_directory.psarc''' | ||
Listing C:\psarctests\by_directory.psarc | Listing C:\psarctests\by_directory.psarc | ||
BMPfolder1/Image1.bmp (8018/6220854 0%) | BMPfolder1/Image1.bmp (8018/6220854 0%) | ||
Line 418: | Line 387: | ||
JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | ||
PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (157/6142 2%) | PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (157/6142 2%) | ||
}} | |||
====create by filelist==== | ====create by filelist==== | ||
Line 438: | Line 407: | ||
The psarc archive is created by using the filelist as the '''--inputfile''' and uses an explicit path to '''--strip''' from every file inside the filelist, this way: | The psarc archive is created by using the filelist as the '''--inputfile''' and uses an explicit path to '''--strip''' from every file inside the filelist, this way: | ||
{{Keyboard|content= | {{Keyboard|content='''C:\>psarc.exe create --strip="C:\psarctests\source files\test" --output=C:\psarctests\by_filelist.psarc --inputfile="C:\psarctests\source files\filelist.txt"'''}} | ||
Or you can prepare an .xml that contains the path to the filelist.txt | Or you can prepare an .xml that contains the path to the filelist.txt | ||
{{Boxcode| | {{Boxcode|content=CREATE by_filelist.xml<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<create archive="C:\psarctests\by_filelist.psarc" absolute="false" ignorecase="false"> | <create archive="C:\psarctests\by_filelist.psarc" absolute="false" ignorecase="false"> | ||
Line 452: | Line 421: | ||
Then run the contents of the .xml this way: | Then run the contents of the .xml this way: | ||
{{Keyboard|content= | {{Keyboard|content='''C:\>psarc.exe --xml="c:\psarctests\CREATE by_filelist.xml"'''}} | ||
The output of the tool is the same in both cases (except the InputFile not present when using an xml) | The output of the tool is the same in both cases (except the InputFile not present when using an xml) | ||
{{Keyboard|content= | {{Keyboard|content= | ||
Strip: C:\psarctests\source files\test | Strip: C:\psarctests\source files\test | ||
Flags: relative | Flags: relative | ||
Line 481: | Line 450: | ||
99.9%: Compression Ratio | 99.9%: Compression Ratio | ||
9: Compression Level | 9: Compression Level | ||
C:\>psarc.exe list C:\psarctests\by_filelist.psarc | '''C:\>psarc.exe list C:\psarctests\by_filelist.psarc''' | ||
Listing C:\psarctests\by_filelist.psarc | Listing C:\psarctests\by_filelist.psarc | ||
dummy.txt (0/0 100%) | dummy.txt (0/0 100%) | ||
Line 487: | Line 456: | ||
JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | ||
PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (157/6142 2%) | PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (157/6142 2%) | ||
}} | |||
====create by file==== | ====create by file==== | ||
Line 498: | Line 467: | ||
The other per-file attribute avoids the tool to output an error in the case the file dummy.txt is missing in the source folder | The other per-file attribute avoids the tool to output an error in the case the file dummy.txt is missing in the source folder | ||
{{Boxcode| | {{Boxcode|content=CREATE by_file.xml<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<create archive="C:\psarctests\by_file.psarc" absolute="false" ignorecase="false"> | <create archive="C:\psarctests\by_file.psarc" absolute="false" ignorecase="false"> | ||
Line 511: | Line 480: | ||
</psarc> | </psarc> | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe --xml="c:\psarctests\CREATE by_file.xml" | C:\>psarc.exe --xml="c:\psarctests\CREATE by_file.xml" | ||
Strip: C:\psarctests\source files\test | Strip: C:\psarctests\source files\test | ||
Line 537: | Line 506: | ||
99.8%: Compression Ratio | 99.8%: Compression Ratio | ||
9: Compression Level | 9: Compression Level | ||
C:\>psarc.exe list C:\psarctests\by_file.psarc | '''C:\>psarc.exe list C:\psarctests\by_file.psarc''' | ||
Listing C:\psarctests\by_file.psarc | Listing C:\psarctests\by_file.psarc | ||
dummy.txt (0/0 100%) | dummy.txt (0/0 100%) | ||
Line 543: | Line 512: | ||
JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | ||
PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142/6142 100%) | PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142/6142 100%) | ||
}} | |||
Batch. This is an useless example to show how the .psarcs are created sequentially and how to create several .psarc's with only one .xml, it uses all default values for compressions, formats, flags etc... | Batch. This is an useless example to show how the .psarcs are created sequentially and how to create several .psarc's with only one .xml, it uses all default values for compressions, formats, flags etc... | ||
Line 549: | Line 518: | ||
In step 1 it creates an egg.psarc containing a dummy.txt. In step 2 it creates a chiken.psarc containing the egg.psarc made in step 1. In step 3 it creates an egg.psarc containing the chicken.psarc made in step 2 (egg.psarc created in step 3 overwrites egg.psarc made in step 1) | In step 1 it creates an egg.psarc containing a dummy.txt. In step 2 it creates a chiken.psarc containing the egg.psarc made in step 1. In step 3 it creates an egg.psarc containing the chicken.psarc made in step 2 (egg.psarc created in step 3 overwrites egg.psarc made in step 1) | ||
{{Boxcode| | {{Boxcode|content=CREATE by_file_paradox<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<create archive="C:\psarctests\egg.psarc"> | <create archive="C:\psarctests\egg.psarc"> | ||
Line 567: | Line 536: | ||
</psarc> | </psarc> | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe --xml="c:\psarctests\CREATE by_file_paradox.xml" | '''C:\>psarc.exe --xml="c:\psarctests\CREATE by_file_paradox.xml"''' | ||
Strip: C:\psarctests\source files\test | Strip: C:\psarctests\source files\test | ||
Flags: relative | Flags: relative | ||
Line 625: | Line 594: | ||
-44.8%: Compression Ratio | -44.8%: Compression Ratio | ||
9: Compression Level | 9: Compression Level | ||
C:\>psarc.exe list C:\psarctests\egg.psarc | '''C:\>psarc.exe list C:\psarctests\egg.psarc | ||
Listing C:\psarctests\egg.psarc | Listing C:\psarctests\egg.psarc | ||
chicken.psarc (143/174 82%) | chicken.psarc (143/174 82%) | ||
C:\>psarc.exe list C:\psarctests\chicken.psarc | '''C:\>psarc.exe list C:\psarctests\chicken.psarc | ||
Listing C:\psarctests\chicken.psarc | Listing C:\psarctests\chicken.psarc | ||
egg.psarc (69/105 65%) | egg.psarc (69/105 65%) | ||
}} | |||
---- | ---- | ||
Line 649: | Line 618: | ||
When using this options the command line output is the same, there is no mention of wich files are stripped, overwritten, or missing in the extraction process | When using this options the command line output is the same, there is no mention of wich files are stripped, overwritten, or missing in the extraction process | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe extract --input="C:\psarctests\source files\test.psarc" --to="C:\psarctests\test" | '''C:\>psarc.exe extract --input="C:\psarctests\source files\test.psarc" --to="C:\psarctests\test"''' | ||
Extracting: dummy.txt (0 bytes) | Extracting: dummy.txt (0 bytes) | ||
Extracting: BMPfolder1/Image1.bmp (6220854 bytes) | Extracting: BMPfolder1/Image1.bmp (6220854 bytes) | ||
Extracting: JPGfolder1/JPGfolder2/Image2.jpg (12524 bytes) | Extracting: JPGfolder1/JPGfolder2/Image2.jpg (12524 bytes) | ||
Extracting: PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142 bytes) | Extracting: PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142 bytes) | ||
C:\>psarc.exe extract --overwrite --strip-all --skip-missing-files --input="C:\psarctests\source files\test.psarc" --to="C:\psarctests\test" | '''C:\>psarc.exe extract --overwrite --strip-all --skip-missing-files --input="C:\psarctests\source files\test.psarc" --to="C:\psarctests\test"''' | ||
Extracting: dummy.txt (0 bytes) | Extracting: dummy.txt (0 bytes) | ||
Extracting: BMPfolder1/Image1.bmp (6220854 bytes) | Extracting: BMPfolder1/Image1.bmp (6220854 bytes) | ||
Extracting: JPGfolder1/JPGfolder2/Image2.jpg (12524 bytes) | Extracting: JPGfolder1/JPGfolder2/Image2.jpg (12524 bytes) | ||
Extracting: PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142 bytes) | Extracting: PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142 bytes) | ||
}} | |||
'''extract all (xml)''' | '''extract all (xml)''' | ||
{{Boxcode| | {{Boxcode|content=EXTRACT all.xml<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<extract archive="C:\psarctests\source files\test.psarc" to="C:\psarctests\all"> | <extract archive="C:\psarctests\source files\test.psarc" to="C:\psarctests\all"> | ||
Line 670: | Line 639: | ||
</psarc> | </psarc> | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe --xml="c:\psarctests\EXTRACT all.xml" | '''C:\>psarc.exe --xml="c:\psarctests\EXTRACT all.xml"''' | ||
Extracting: dummy.txt (0 bytes) | Extracting: dummy.txt (0 bytes) | ||
Extracting: BMPfolder1/Image1.bmp (6220854 bytes) | Extracting: BMPfolder1/Image1.bmp (6220854 bytes) | ||
Extracting: JPGfolder1/JPGfolder2/Image2.jpg (12524 bytes) | Extracting: JPGfolder1/JPGfolder2/Image2.jpg (12524 bytes) | ||
Extracting: PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142 bytes) | Extracting: PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142 bytes) | ||
}} | |||
====extract by file==== | ====extract by file==== | ||
This extraction method is only available when using an xml because command line doesnt allows to specify files inside the archive | This extraction method is only available when using an xml because command line doesnt allows to specify files inside the archive | ||
{{Boxcode| | {{Boxcode|content=EXTRACT by_file.xml<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<extract archive="C:\psarctests\source files\test.psarc" to="C:\psarctests\by_file"> | <extract archive="C:\psarctests\source files\test.psarc" to="C:\psarctests\by_file"> | ||
Line 688: | Line 657: | ||
</psarc> | </psarc> | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
{{Keyboard|content= | {{Keyboard|content= | ||
C:\>psarc.exe --xml="c:\psarctests\EXTRACT by_file.xml" | '''C:\>psarc.exe --xml="c:\psarctests\EXTRACT by_file.xml"''' | ||
Extracting: BMPfolder1/Image1.bmp (6220854 bytes) | Extracting: BMPfolder1/Image1.bmp (6220854 bytes) | ||
}} | |||
When extracting single files is also posible to use the same attributes availables in command line, and attributes per-file, but they uses different names inside the xml (see the DTD example) | When extracting single files is also posible to use the same attributes availables in command line, and attributes per-file, but they uses different names inside the xml (see the DTD example) | ||
{{Boxcode| | {{Boxcode|content=<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<extract archive="C:\psarctests\source files\test.psarc" to="C:\psarctests\by_file" stripall="true" skipmissingfiles="false" overwrite="true"> | <extract archive="C:\psarctests\source files\test.psarc" to="C:\psarctests\by_file" stripall="true" skipmissingfiles="false" overwrite="true"> | ||
Line 706: | Line 675: | ||
**The element "extract" uses the attribute '''archive''' but could be replaced by '''input''', in this case are exactly the same and both will work, actually '''--input''' is the same option used in comand line but the examples in wiki uses the name '''archive''' because is more intuitive (is also used as an attribute for "create" and in both cases is refered to the compressed archive.psarc). Both (archive and input) appears in the DTD as optional (#IMPLIED) but only one of them can be used in the xml | **The element "extract" uses the attribute '''archive''' but could be replaced by '''input''', in this case are exactly the same and both will work, actually '''--input''' is the same option used in comand line but the examples in wiki uses the name '''archive''' because is more intuitive (is also used as an attribute for "create" and in both cases is refered to the compressed archive.psarc). Both (archive and input) appears in the DTD as optional (#IMPLIED) but only one of them can be used in the xml | ||
**The element "file" uses the attribute '''archivepath''' but could be replaced by '''path''', in this case are exactly the same and both will work, but the examples in wiki uses the name '''archivepath''' because is more intuitive (is refered to the path of a file inside archive.psarc). Both (archivepath and path) appears in the DTD as optional (#IMPLIED) but only one of them can be used in the xml | **The element "file" uses the attribute '''archivepath''' but could be replaced by '''path''', in this case are exactly the same and both will work, but the examples in wiki uses the name '''archivepath''' because is more intuitive (is refered to the path of a file inside archive.psarc). Both (archivepath and path) appears in the DTD as optional (#IMPLIED) but only one of them can be used in the xml | ||
==Total Commander plugin== | ==Total Commander plugin== | ||
Line 742: | Line 683: | ||
Download link: http://aldostools.org/ps3_psarc_gui.rar | Download link: http://aldostools.org/ps3_psarc_gui.rar | ||
=Rebuilding PSARC files= | =Rebuilding PSARC files= | ||
Line 754: | Line 689: | ||
This need to preserve the original positions of all the files inside the archive in the practise means there are only 2 methods to rebuild a psarc: "by filelist" or "by file". For both is needed to create a list of files | This need to preserve the original positions of all the files inside the archive in the practise means there are only 2 methods to rebuild a psarc: "by filelist" or "by file". For both is needed to create a list of files | ||
{{ | {{Boxframe1|content='''Rebuilding PSARC files, step-by-step summary''' | ||
* Step 1 - Identify compression method, archive flags, and verify default structure sizes | * Step 1 - Identify compression method, archive flags, and verify default structure sizes | ||
* Step 2 - Identify if per-file compression was used <!-- and dupes ---> | * Step 2 - Identify if per-file compression was used <!-- and dupes ---> | ||
** Step 3a - If per-file compression was not used, rebuild with the method "by filelist" or "by file" | ** Step 3a - If per-file compression was not used, rebuild with the method "by filelist" or "by file" | ||
** Step 3a - If per-file compression was used, rebuild with the method "by file" | ** Step 3a - If per-file compression was used, rebuild with the method "by file" | ||
}} | }} | ||
Line 771: | Line 704: | ||
Most important ones are the '''<span style="background:#ffff66;">compression method</span>''' (zlib/lzma) and the '''<span style="background:#d0000d;">archive flags</span>''' (relative/absolute, and ignorecase), this settings will be used when rebuilding from command line or from xml this way: | Most important ones are the '''<span style="background:#ffff66;">compression method</span>''' (zlib/lzma) and the '''<span style="background:#d0000d;">archive flags</span>''' (relative/absolute, and ignorecase), this settings will be used when rebuilding from command line or from xml this way: | ||
{{Boxcode| | {{Boxcode|content=<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<create archive="C:\psarctests\by_file.psarc" absolute="true" ignorecase="true"> | <create archive="C:\psarctests\by_file.psarc" absolute="true" ignorecase="true"> | ||
Line 779: | Line 712: | ||
The other values in the header that needs to be verifyed are the '''<span style="background:#dd00dd;">TOC entry size</span>''' and the '''<span style="background:#dddddd;">Block size</span>''', is needed to know if the original psarc we are trying to rebuild uses the default values (all i found used defaults), otherway is posible to use non-default values this way: <!-- not sure if is posible to change the "TOC entry size" --> | The other values in the header that needs to be verifyed are the '''<span style="background:#dd00dd;">TOC entry size</span>''' and the '''<span style="background:#dddddd;">Block size</span>''', is needed to know if the original psarc we are trying to rebuild uses the default values (all i found used defaults), otherway is posible to use non-default values this way: <!-- not sure if is posible to change the "TOC entry size" --> | ||
{{Boxcode| | {{Boxcode|content=<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<create archive="C:\psarctests\by_file.psarc" absolute="true" ignorecase="true" blocksize="65536"> | <create archive="C:\psarctests\by_file.psarc" absolute="true" ignorecase="true" blocksize="65536"> | ||
Line 788: | Line 721: | ||
'''Step2''' | '''Step2''' | ||
Now is needed to know if the psarc uses per-file compression (if some of the files inside the archive | Now is needed to know if the psarc uses per-file compression (if some of the files inside the archive ara compressed, and others are not compressed) | ||
This is important to know wich rebuild method will be used in the next step, is needed to make a --list command with psarc tool and store the output of the command as a .txt | This is important to know wich rebuild method will be used in the next step, is needed to make a --list command with psarc tool and store the output of the command as a .txt | ||
Line 798: | Line 731: | ||
**If there some files with the 100%, normal sizes (not minimal), using the same file extension, and can be identifyed (like audio or video formats) then you have a psarc with per-file compression | **If there some files with the 100%, normal sizes (not minimal), using the same file extension, and can be identifyed (like audio or video formats) then you have a psarc with per-file compression | ||
**If all the files appears as 100% it means the psarc has been created with the compression attibute set as "false" this way: | **If all the files appears as 100% it means the psarc has been created with the compression attibute set as "false" this way: | ||
{{Boxcode| | {{Boxcode|content=<syntaxhighlight lang="xml"> | ||
<psarc> | <psarc> | ||
<create archive="C:\psarctests\by_file.psarc" absolute="true" ignorecase="true" blocksize="65536"> | <create archive="C:\psarctests\by_file.psarc" absolute="true" ignorecase="true" blocksize="65536"> | ||
Line 818: | Line 751: | ||
**Ape Escape target.psarc includes "dupes" (or duplicated files) in the TOC (table of contents) of the psarc archive. This method used at creation time basically works by making several entries of the TOC to point to the same file, this way a single file inside the psarc is indexed several times in the TOC and can be accessed from several different paths/filenames. The only way to identify this dupes before extraction is by reading the TOC of the psarc for all the files and compare wich position are pointing to. As an example the original size of target.psarc is 328mb... after a "standard" extraction is 2.52GB (this extraction doesnt identify the dupes so are extracted several times under different paths/filenames)... if you try to rebuild it again his final size will be much bigger than the original target.psarc | **Ape Escape target.psarc includes "dupes" (or duplicated files) in the TOC (table of contents) of the psarc archive. This method used at creation time basically works by making several entries of the TOC to point to the same file, this way a single file inside the psarc is indexed several times in the TOC and can be accessed from several different paths/filenames. The only way to identify this dupes before extraction is by reading the TOC of the psarc for all the files and compare wich position are pointing to. As an example the original size of target.psarc is 328mb... after a "standard" extraction is 2.52GB (this extraction doesnt identify the dupes so are extracted several times under different paths/filenames)... if you try to rebuild it again his final size will be much bigger than the original target.psarc | ||
==Generating a filelist.txt or xml by using regular expressions== | |||
*The file paths inside filelist.txt or inside an xml admits 2 formats: | *The file paths inside filelist.txt or inside an xml admits 2 formats: | ||
Line 828: | Line 761: | ||
The output of the '''list''' command has some characters that are needed ro remove or replace, the purpose of automatizing this process by using regular expressions is because usually psarc files contains thousand of files, the examples used here are commands for fnr.exe (find and replace tool) and contains regular expressions (to search) and a character strings (to replace) | The output of the '''list''' command has some characters that are needed ro remove or replace, the purpose of automatizing this process by using regular expressions is because usually psarc files contains thousand of files, the examples used here are commands for fnr.exe (find and replace tool) and contains regular expressions (to search) and a character strings (to replace) | ||
First generate a .txt file containing the output of the '''list''' comand | |||
{{Keyboard|content='''C:\>psarc.exe list "C:\psarctests\source files\test.psarc" > "C:\psarctests\filelist.txt"'''}} | |||
{{Keyboard|content= | |||
The file generated by the list command will have this content (note there is en empty line at the end): | The file generated by the list command will have this content (note there is en empty line at the end): | ||
Listing C:\psarctests\source files\test.psarc | Listing C:\psarctests\source files\test.psarc | ||
Line 849: | Line 769: | ||
JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | JPGfolder1/JPGfolder2/Image2.jpg (209/12524 1%) | ||
PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142/6142 100%) | PNGfolder1/PNGfolder2/PNGfolder3/Image3.png (6142/6142 100%) | ||
*''' | *'''Replacing slashes''' | ||
find: | |||
/ | |||
replace by: | |||
\\ | |||
The resulting file: | The resulting file: | ||
Listing C:\psarctests\source files\test.psarc | |||
dummy.txt (0/0 100%) | dummy.txt (0/0 100%) | ||
BMPfolder1 | BMPfolder1\Image1.bmp (8018/6220854 0%) | ||
JPGfolder1 | JPGfolder1\JPGfolder2\Image2.jpg (209/12524 1%) | ||
PNGfolder1 | PNGfolder1\PNGfolder2\PNGfolder3\Image3.png (6142/6142 100%) | ||
*'''Removing first line''' | |||
find: | |||
*''' | Listing.*\n | ||
replace by: | |||
find | sourcepath | ||
The resulting file: | The resulting file: | ||
sourcepathdummy.txt (0/0 100%) | |||
BMPfolder1 | BMPfolder1\Image1.bmp (8018/6220854 0%) | ||
JPGfolder1 | JPGfolder1\JPGfolder2\Image2.jpg (209/12524 1%) | ||
PNGfolder1 | PNGfolder1\PNGfolder2\PNGfolder3\Image3.png (6142/6142 100%) | ||
*'''Removing parenthesis''' | |||
find: (note there is an space as the first character to find) | |||
\(.*\)\r\n | |||
replace by: | |||
\r\nsourcepath | |||
The resulting file: | |||
sourcepathdummy.txt | |||
sourcepathBMPfolder1\Image1.bmp | |||
sourcepathJPGfolder1\JPGfolder2\Image2.jpg | |||
sourcepathPNGfolder1\PNGfolder2\PNGfolder3\Image3.png | |||
sourcepath | |||
*''' | *'''Removing last line''' | ||
find: | find: | ||
\r\nsourcepath$ | |||
replace by: | replace by: nothing, the resulting file: | ||
sourcepathdummy.txt | |||
sourcepathBMPfolder1\Image1.bmp | |||
sourcepathJPGfolder1\JPGfolder2\Image2.jpg | |||
sourcepathPNGfolder1\PNGfolder2\PNGfolder3\Image3.png | |||
Now you can replace '''sourcepath''' by the folder path where the psarc contents are decompressed, e.g: '''C:\psarctests\source files\test\''', remember this is exactly the part of the path that is needed to '''strip''' later (because we dont want to include our local path '''C:\psarctests\source files\test\''' inside the manifest) | |||
The resulting file: | The resulting file: | ||
C:\psarctests\source files\test\dummy.txt | C:\psarctests\source files\test\dummy.txt | ||
Line 915: | Line 821: | ||
C:\psarctests\source files\test\JPGfolder1\JPGfolder2\Image2.jpg | C:\psarctests\source files\test\JPGfolder1\JPGfolder2\Image2.jpg | ||
C:\psarctests\source files\test\PNGfolder1\PNGfolder2\PNGfolder3\Image3.png | C:\psarctests\source files\test\PNGfolder1\PNGfolder2\PNGfolder3\Image3.png | ||
And thats all, this is a perfect filelist.txt that can be used for the rebuild method '''by filelist''' (usefull when the psarc doesnt uses per-file compression) | |||
---- | ---- | ||
The way to create an xml is pretty similar... | |||
The | |||
=Games or Apps using PSARC files= | =Games or Apps using PSARC files= | ||
Line 1,178: | Line 870: | ||
|- | |- | ||
| TEXTURES.PSARC || || || || || || || | | TEXTURES.PSARC || || || || || || || | ||
|- | |- | ||
| Motorstorm Pacific Rift || ? || || || || || || || | | Motorstorm Pacific Rift || ? || || || || || || || | ||
Line 1,204: | Line 894: | ||
|- | |- | ||
| All others || 00010003 || zlib || 0000001E || 00010000 || 00000003 (ignorecase + absolute) || compress all || | | All others || 00010003 || zlib || 0000001E || 00010000 || 00000003 (ignorecase + absolute) || compress all || | ||
|- | |- | ||
| The Last Of Us || All ? || 00010003 || zlib || 0000001E || 00010000 || 00000000 (no flags) || || | | The Last Of Us || All ? || 00010003 || zlib || 0000001E || 00010000 || 00000000 (no flags) || || | ||
Line 1,240: | Line 920: | ||
|- | |- | ||
! TITLE !! PSARC files || Version<BR />(offset 0x04) !! Compression<BR />(offset 0x08) !! TOC entry size<BR />(offset 0x10) !! Block Size<BR />(offset 0x18) !! Flags<BR />(offset 0x1C) | ! TITLE !! PSARC files || Version<BR />(offset 0x04) !! Compression<BR />(offset 0x08) !! TOC entry size<BR />(offset 0x10) !! Block Size<BR />(offset 0x18) !! Flags<BR />(offset 0x1C) | ||
|- | |- | ||
| VidZone || vidzone*.db.psarc || 00010004 || zlib || 0000001E || 00010000 || 00000000 (no flags) || compress all || Vidzone is a web service, the .psarc is hosted in the web | | VidZone || vidzone*.db.psarc || 00010004 || zlib || 0000001E || 00010000 || 00000000 (no flags) || compress all || Vidzone is a web service, the .psarc is hosted in the web | ||
|} | |} | ||
Line 1,263: | Line 931: | ||
{{File Formats}} | {{File Formats}} | ||
<noinclude> | <noinclude>[[Category:Main]]</noinclude> | ||
[[Category:Main]] | |||
</noinclude> |