SILKPADD: Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
(wip)
 
Line 46: Line 46:
====Data types====
====Data types====
All data entries starts with 4 bytes that indicates the length of the text string that comes inmediatly after, so the first bytes that needs to be processed are the 4 bytes + the lenght indicated by that 4 bytes
All data entries starts with 4 bytes that indicates the length of the text string that comes inmediatly after, so the first bytes that needs to be processed are the 4 bytes + the lenght indicated by that 4 bytes
=====Text string=====
This is the most basic example, the entry can be identifyed as a "text string" because is null terminated (note how the '''text_string_lenght'''=5 of the example below includes the null byte 0x00 at the end)
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000  00 00 00 05 54 65 73 74 00                      ....Test.


{| class="wikitable"
{| class="wikitable"
Line 53: Line 60:
| 0x00 || 0x04 || 00 00 00 05 || '''text_string_lenght''' ||  
| 0x00 || 0x04 || 00 00 00 05 || '''text_string_lenght''' ||  
|-
|-
| 0x04 || ''varies'' || 54 65 73 74 00 || '''text_string''' || This string indicates the data entry type
| 0x04 || ''varies'' || 54 65 73 74 || '''text_string''' || This string indicates the data entry type
|-
| ''varies'' || 0x01 || 00 || '''null''' || This is the null termination of the previous string
|}
|}


=====Text string=====
=====HTML (stored as a single text string=====
This is the most basic example, the entry can be identifyed as a "text string" because is null terminated (note how the text_string_lenght=5 includes the null byte 0x00 at the end)
The fileformat allows to store HTML files as standard string data, null terminated (so it falls under the same characteristics as a standard text string). Because this reason, the only way to identify it in PC s by reading the first bytes of the string (if it starts with '''<nowiki><!DOCTYPE HTML</nowiki>''' is a HTML)
 
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
 
00000000  00 00 00 05 54 65 73 74 00                      ....Test.


To extract the data as a HTML file is needed to remove the null byte at the end (and the null byte at the end needs to be added when the HTML file is injected back)




<nowiki>
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000  00 00 03 A9 3C 21 44 4F 43 54 59 50 45 20 48 54  ...©<!DOCTYPE HT
00000010  4D 4C 20 50 55 42 4C 49 43 20 22 2D 2F 2F 57 33  ML PUBLIC "-//W3
00000020  43 2F 2F 44 54 44 20 48 54 4D 4C 20 34 2E 30 20  C//DTD HTML 4.0
00000030  54 72 61 6E 73 69 74 69 6F 6E 61 6C 2F 2F 45 4E  Transitional//EN
00000040  22 3E 0A 09 09 09 09 09 3C 48 54 4D 4C 3E 0A 09  ">......<HTML>..
00000050  09 09 09 09 3C 48 45 41 44 3E 0A 09 09 09 09 09  ....<HEAD>......
00000060  09 3C 73 74 79 6C 65 3E 0A 09 09 09 09 09 09 61  .<style>.......a
00000070  3A 6C 69 6E 6B 09 09 09 7B 66 6F 6E 74 3A 38 70  :link...{font:8p
00000080  74 2F 31 31 70 74 20 76 65 72 64 61 6E 61 3B 20  t/11pt verdana;
00000090  63 6F 6C 6F 72 3A 72 65 64 7D 0A 09 09 09 09 09  color:red}......
000000A0  09 61 3A 76 69 73 69 74 65 64 09 09 7B 66 6F 6E  .a:visited..{fon
000000B0  74 3A 38 70 74 2F 31 31 70 74 20 76 65 72 64 61  t:8pt/11pt verda
000000C0  6E 61 3B 20 63 6F 6C 6F 72 3A 23 34 65 34 65 34  na; color:#4e4e4
000000D0  65 7D 0A 09 09 09 09 09 09 3C 2F 73 74 79 6C 65  e}.......</style
000000E0  3E 0A 09 09 09 09 09 09 3C 6D 65 74 61 20 48 54  >.......<meta HT
000000F0  54 50 2D 45 51 55 49 56 3D 22 43 6F 6E 74 65 6E  TP-EQUIV="Conten
00000100  74 2D 54 79 70 65 22 20 43 6F 6E 74 65 6E 74 3D  t-Type" Content=
00000110  22 74 65 78 74 2D 68 74 6D 6C 3B 20 63 68 61 72  "text-html; char
00000120  73 65 74 3D 57 69 6E 64 6F 77 73 2D 31 32 35 32  set=Windows-1252
00000130  22 3E 0A 09 09 09 09 09 09 3C 74 69 74 6C 65 3E  ">.......<title>
00000140  4E 65 74 77 6F 72 6B 20 45 72 72 6F 72 3C 2F 74  Network Error</t
00000150  69 74 6C 65 3E 0A 09 09 09 09 09 3C 2F 48 45 41  itle>......</HEA
00000160  44 3E 0A 0A 09 09 09 09 09 3C 42 4F 44 59 3E 0A  D>.......<BODY>.
00000170  09 09 09 09 09 09 3C 54 41 42 4C 45 20 77 69 64  ......<TABLE wid
00000180  74 68 3D 22 34 30 30 22 20 63 65 6C 6C 70 61 64  th="400" cellpad
00000190  64 69 6E 67 3D 22 33 22 20 63 65 6C 6C 73 70 61  ding="3" cellspa
000001A0  63 69 6E 67 3D 22 35 22 3E 0A 09 09 09 09 09 09  cing="5">.......
000001B0  20 20 3C 74 72 3E 0A 09 09 09 09 09 09 09 3C 74    <tr>........<t
000001C0  64 20 69 64 3D 22 74 61 62 6C 65 50 72 6F 70 73  d id="tableProps
000001D0  22 20 76 61 6C 69 67 6E 3D 22 74 6F 70 22 20 61  " valign="top" a
000001E0  6C 69 67 6E 3D 22 6C 65 66 74 22 3E 3C 2F 74 64  lign="left"></td
000001F0  3E 0A 09 09 09 09 09 09 09 3C 74 64 20 69 64 3D  >........<td id=
00000200  22 74 61 62 6C 65 50 72 6F 70 73 32 22 20 61 6C  "tableProps2" al
00000210  69 67 6E 3D 22 6C 65 66 74 22 20 76 61 6C 69 67  ign="left" valig
00000220  6E 3D 22 6D 69 64 64 6C 65 22 20 77 69 64 74 68  n="middle" width
00000230  3D 22 34 35 30 22 3E 3C 68 31 20 69 64 3D 22 74  ="450"><h1 id="t
00000240  65 78 74 53 65 63 74 69 6F 6E 31 22 0A 09 09 09  extSection1"....
00000250  09 09 09 09 73 74 79 6C 65 3D 22 43 4F 4C 4F 52  ....style="COLOR
00000260  3A 20 62 6C 61 63 6B 3B 20 46 4F 4E 54 3A 20 31  : black; FONT: 1
00000270  38 70 74 20 76 65 72 64 61 6E 61 22 3E 3C 73 70  8pt verdana"><sp
00000280  61 6E 20 69 64 3D 22 65 72 72 6F 72 54 65 78 74  an id="errorText
00000290  22 3E 54 68 65 20 70 61 67 65 20 63 61 6E 6E 6F  ">The page canno
000002A0  74 20 62 65 20 64 69 73 70 6C 61 79 65 64 2E 3C  t be displayed.<
000002B0  2F 73 70 61 6E 3E 3C 2F 68 31 3E 3C 2F 74 64 3E  /span></h1></td>
000002C0  0A 09 09 09 09 09 09 20 20 3C 2F 74 72 3E 0A 09  .......  </tr>..
000002D0  09 09 09 09 09 20 20 3C 74 72 3E 0A 09 09 09 09  .....  <tr>.....
000002E0  09 09 09 3C 74 64 20 69 64 3D 22 74 61 62 6C 65  ...<td id="table
000002F0  50 72 6F 70 73 57 69 64 74 68 22 20 77 69 64 74  PropsWidth" widt
00000300  68 3D 22 34 30 30 22 20 63 6F 6C 73 70 61 6E 3D  h="400" colspan=
00000310  22 32 22 3E 3C 66 6F 6E 74 0A 09 09 09 09 09 09  "2"><font.......
00000320  09 73 74 79 6C 65 3D 22 43 4F 4C 4F 52 3A 20 62  .style="COLOR: b
00000330  6C 61 63 6B 3B 20 46 4F 4E 54 3A 20 31 31 70 74  lack; FONT: 11pt
00000340  20 76 65 72 64 61 6E 61 22 3E 0A 09 09 09 09 09  verdana">......
00000350  09 09 4E 65 74 77 6F 72 6B 20 65 72 72 6F 72 20  ..Network error
00000360  6F 63 63 75 72 72 65 64 2E 3C 2F 66 6F 6E 74 3E  occurred.</font>
00000370  3C 2F 74 64 3E 0A 09 09 09 09 09 09 20 20 3C 2F  </td>.......  </
00000380  74 72 3E 0A 09 09 09 09 09 09 3C 2F 54 41 42 4C  tr>.......</TABL
00000390  45 3E 0A 09 09 09 09 09 3C 2F 42 4F 44 59 3E 0A  E>......</BODY>.
000003A0  09 09 09 09 09 3C 2F 48 54 4D 4C 3E 00          .....</HTML>.
</nowiki>


{| class="wikitable"
|-
! Offset !! Length !! Example !! Name !! Notes
|-
| 0x00 || 0x04 || 00 00 03 A9 || '''text_string_lenght''' ||
|-
| 0x04 || ''varies'' || this is the HTML file... long || '''text_string''' || This string indicates the data entry type (the first bytes are '''<nowiki><!DOCTYPE HTML</nowiki>''' for this entry type)
|-
| ''varies'' || 0x01 || 00 || '''null''' || This is the null termination at the end of the HTML file (needed to remove to extract the data as a HTML file)
|}


{{File Formats}}
{{File Formats}}
<noinclude>[[Category:Main]]</noinclude>
<noinclude>[[Category:Main]]</noinclude>

Revision as of 13:46, 4 October 2018

Structure

Header

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000  53 49 4C 4B 50 41 44 44 00 00 0C 00 00 00 00 00  SILKPADD........
Offset Length Example Name Notes
0x00 0x04 53 49 4C 4B silk_signature By now this 2 are represented in wiki separated just incase the format allows for other variants, like SILKFLAT, SILKCRAP, or any other names, but maybe the 8 bytes are processed together
0x04 0x04 50 41 44 44 padd_signature
0x08 0x02 00 00 unknown Always zeroes
0x0A 0x02 0C 00 entry_amount Number of entries in the file (in little endian)
0x0C 0x04 00 00 00 00 padding ? Always zeroes

Index table

At offset 0x10 starts the index table, every entry has 0xC byes. All values in the table are in little endian. There is no gap or padding at the end of this index table

Example of the first entry in CEHtmlApi.bin

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000010  B9 0B 00 00 A0 00 00 00 9B 00 00 00              ¹... ...›...
Offset Length Example Name Notes
0x00 0x04 B9 0B 00 00 entry_id And unique ID for the entry, used by the web browser to identify and to access the data
0x04 0x04 A0 00 00 00 data_offset Absolute offset of the data (either a string or a file)
0x08 0x04 9B 00 00 00 data_lenght Size of the data

Data table

At this point is unknown if the PS3 parses every one of the datas in a specific way based on his type because the IDs of them are hardcoded in the .sprx (so the sprx knows well what to do with them defore reading them), or the data is identifyed by reading the first bytes. Anyway, to manage the datas in PC is needed to read the first bytes because in PC we are not using a database with all the IDs (so we dont know what to do with them before reading them). This identification method is what is explained here in wiki

Data types

All data entries starts with 4 bytes that indicates the length of the text string that comes inmediatly after, so the first bytes that needs to be processed are the 4 bytes + the lenght indicated by that 4 bytes

Text string

This is the most basic example, the entry can be identifyed as a "text string" because is null terminated (note how the text_string_lenght=5 of the example below includes the null byte 0x00 at the end)

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000  00 00 00 05 54 65 73 74 00                       ....Test.
Offset Length Example Name Notes
0x00 0x04 00 00 00 05 text_string_lenght
0x04 varies 54 65 73 74 text_string This string indicates the data entry type
varies 0x01 00 null This is the null termination of the previous string
HTML (stored as a single text string

The fileformat allows to store HTML files as standard string data, null terminated (so it falls under the same characteristics as a standard text string). Because this reason, the only way to identify it in PC s by reading the first bytes of the string (if it starts with <!DOCTYPE HTML is a HTML)

To extract the data as a HTML file is needed to remove the null byte at the end (and the null byte at the end needs to be added when the HTML file is injected back)


Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00000000 00 00 03 A9 3C 21 44 4F 43 54 59 50 45 20 48 54 ...©<!DOCTYPE HT 00000010 4D 4C 20 50 55 42 4C 49 43 20 22 2D 2F 2F 57 33 ML PUBLIC "-//W3 00000020 43 2F 2F 44 54 44 20 48 54 4D 4C 20 34 2E 30 20 C//DTD HTML 4.0 00000030 54 72 61 6E 73 69 74 69 6F 6E 61 6C 2F 2F 45 4E Transitional//EN 00000040 22 3E 0A 09 09 09 09 09 3C 48 54 4D 4C 3E 0A 09 ">......<HTML>.. 00000050 09 09 09 09 3C 48 45 41 44 3E 0A 09 09 09 09 09 ....<HEAD>...... 00000060 09 3C 73 74 79 6C 65 3E 0A 09 09 09 09 09 09 61 .<style>.......a 00000070 3A 6C 69 6E 6B 09 09 09 7B 66 6F 6E 74 3A 38 70 :link...{font:8p 00000080 74 2F 31 31 70 74 20 76 65 72 64 61 6E 61 3B 20 t/11pt verdana; 00000090 63 6F 6C 6F 72 3A 72 65 64 7D 0A 09 09 09 09 09 color:red}...... 000000A0 09 61 3A 76 69 73 69 74 65 64 09 09 7B 66 6F 6E .a:visited..{fon 000000B0 74 3A 38 70 74 2F 31 31 70 74 20 76 65 72 64 61 t:8pt/11pt verda 000000C0 6E 61 3B 20 63 6F 6C 6F 72 3A 23 34 65 34 65 34 na; color:#4e4e4 000000D0 65 7D 0A 09 09 09 09 09 09 3C 2F 73 74 79 6C 65 e}.......</style 000000E0 3E 0A 09 09 09 09 09 09 3C 6D 65 74 61 20 48 54 >.......<meta HT 000000F0 54 50 2D 45 51 55 49 56 3D 22 43 6F 6E 74 65 6E TP-EQUIV="Conten 00000100 74 2D 54 79 70 65 22 20 43 6F 6E 74 65 6E 74 3D t-Type" Content= 00000110 22 74 65 78 74 2D 68 74 6D 6C 3B 20 63 68 61 72 "text-html; char 00000120 73 65 74 3D 57 69 6E 64 6F 77 73 2D 31 32 35 32 set=Windows-1252 00000130 22 3E 0A 09 09 09 09 09 09 3C 74 69 74 6C 65 3E ">.......<title> 00000140 4E 65 74 77 6F 72 6B 20 45 72 72 6F 72 3C 2F 74 Network Error</t 00000150 69 74 6C 65 3E 0A 09 09 09 09 09 3C 2F 48 45 41 itle>......</HEA 00000160 44 3E 0A 0A 09 09 09 09 09 3C 42 4F 44 59 3E 0A D>.......<BODY>. 00000170 09 09 09 09 09 09 3C 54 41 42 4C 45 20 77 69 64 ......<TABLE wid 00000180 74 68 3D 22 34 30 30 22 20 63 65 6C 6C 70 61 64 th="400" cellpad 00000190 64 69 6E 67 3D 22 33 22 20 63 65 6C 6C 73 70 61 ding="3" cellspa 000001A0 63 69 6E 67 3D 22 35 22 3E 0A 09 09 09 09 09 09 cing="5">....... 000001B0 20 20 3C 74 72 3E 0A 09 09 09 09 09 09 09 3C 74 <tr>........<t 000001C0 64 20 69 64 3D 22 74 61 62 6C 65 50 72 6F 70 73 d id="tableProps 000001D0 22 20 76 61 6C 69 67 6E 3D 22 74 6F 70 22 20 61 " valign="top" a 000001E0 6C 69 67 6E 3D 22 6C 65 66 74 22 3E 3C 2F 74 64 lign="left"></td 000001F0 3E 0A 09 09 09 09 09 09 09 3C 74 64 20 69 64 3D >........<td id= 00000200 22 74 61 62 6C 65 50 72 6F 70 73 32 22 20 61 6C "tableProps2" al 00000210 69 67 6E 3D 22 6C 65 66 74 22 20 76 61 6C 69 67 ign="left" valig 00000220 6E 3D 22 6D 69 64 64 6C 65 22 20 77 69 64 74 68 n="middle" width 00000230 3D 22 34 35 30 22 3E 3C 68 31 20 69 64 3D 22 74 ="450"><h1 id="t 00000240 65 78 74 53 65 63 74 69 6F 6E 31 22 0A 09 09 09 extSection1".... 00000250 09 09 09 09 73 74 79 6C 65 3D 22 43 4F 4C 4F 52 ....style="COLOR 00000260 3A 20 62 6C 61 63 6B 3B 20 46 4F 4E 54 3A 20 31  : black; FONT: 1 00000270 38 70 74 20 76 65 72 64 61 6E 61 22 3E 3C 73 70 8pt verdana"><sp 00000280 61 6E 20 69 64 3D 22 65 72 72 6F 72 54 65 78 74 an id="errorText 00000290 22 3E 54 68 65 20 70 61 67 65 20 63 61 6E 6E 6F ">The page canno 000002A0 74 20 62 65 20 64 69 73 70 6C 61 79 65 64 2E 3C t be displayed.< 000002B0 2F 73 70 61 6E 3E 3C 2F 68 31 3E 3C 2F 74 64 3E /span></h1></td> 000002C0 0A 09 09 09 09 09 09 20 20 3C 2F 74 72 3E 0A 09 ....... </tr>.. 000002D0 09 09 09 09 09 20 20 3C 74 72 3E 0A 09 09 09 09 ..... <tr>..... 000002E0 09 09 09 3C 74 64 20 69 64 3D 22 74 61 62 6C 65 ...<td id="table 000002F0 50 72 6F 70 73 57 69 64 74 68 22 20 77 69 64 74 PropsWidth" widt 00000300 68 3D 22 34 30 30 22 20 63 6F 6C 73 70 61 6E 3D h="400" colspan= 00000310 22 32 22 3E 3C 66 6F 6E 74 0A 09 09 09 09 09 09 "2"><font....... 00000320 09 73 74 79 6C 65 3D 22 43 4F 4C 4F 52 3A 20 62 .style="COLOR: b 00000330 6C 61 63 6B 3B 20 46 4F 4E 54 3A 20 31 31 70 74 lack; FONT: 11pt 00000340 20 76 65 72 64 61 6E 61 22 3E 0A 09 09 09 09 09 verdana">...... 00000350 09 09 4E 65 74 77 6F 72 6B 20 65 72 72 6F 72 20 ..Network error 00000360 6F 63 63 75 72 72 65 64 2E 3C 2F 66 6F 6E 74 3E occurred.</font> 00000370 3C 2F 74 64 3E 0A 09 09 09 09 09 09 20 20 3C 2F </td>....... </ 00000380 74 72 3E 0A 09 09 09 09 09 09 3C 2F 54 41 42 4C tr>.......</TABL 00000390 45 3E 0A 09 09 09 09 09 3C 2F 42 4F 44 59 3E 0A E>......</BODY>. 000003A0 09 09 09 09 09 3C 2F 48 54 4D 4C 3E 00 .....</HTML>.

Offset Length Example Name Notes
0x00 0x04 00 00 03 A9 text_string_lenght
0x04 varies this is the HTML file... long text_string This string indicates the data entry type (the first bytes are <!DOCTYPE HTML for this entry type)
varies 0x01 00 null This is the null termination at the end of the HTML file (needed to remove to extract the data as a HTML file)