Post Reply 
A peak at the PTF format
Author Message
ZiNgA BuRgA
Smart Alternative

Posts: 17,020.1878
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 445.8087
Offline
Post: #1
A peak at the PTF format
Just managed to have a look at the PTF format that Sony introduces with their release of 3.70.

Haven't had the time to look through everything, but I think I've got the basic file structure (it's not very difficult ;)).  It seems to contain a lot of RLZ compressed files (they all appear to actually be GIM images).

Anyways, on with the structure, for anyone interested :P

The real data starts at 0x100 - before that, well, it's just ASCII and null characters... >_>

At 0x100, there's the 0x20 byte PTF header - all it contains are pointers to the various sections of the file.  Currently, only 5 sections exist (thus 5 pointers).

Now, for each section, there's a 0x20 byte header, with 4 values, taking up 0xC bytes (the rest of the 0x20 bytes are just nulls).  [the first section obviously appears at 0x100+0x20 = 0x120]
0x00: Appears to be the number of the current section (ie, first section = 0x00, second section = 0x01, etc)
0x02: Number of entries in the current section
0x04: Offset to the first Entry header in the next section, relative to the absolute offset of the first Entry header of the current section
0x08: Absolute offset of the first entry in the current section

Now under each section, there's a number of entries.  Each entry has a 0x20 header, followed by the data, which is RLZ compressed.  The header has 4 values, taking up 0x10 bytes (again, the rest is just nulls).  [the first entry obviously appears at 0x100+0x20+0x20 = 0x140]
0x00: Icon ID
0x04: Image type - exactly the same as the image type flag for image resources in RCO files:
  • 0x00 = PNG
  • 0x01 = JPEG
  • 0x02 = TIFF
  • 0x03 = GIF
  • 0x04 = BMP
  • 0x05 = GIM
Note that only GIMs are ever used, and a BMP for the background.  The other file types don't appear in PTF files.  Unfortunately, only GIM transparency is supported.
0x06: Compression flag?  0x01 = RLZ compressed, 0x00 = uncompressed?
0x08: Size of the data (compressed)
0x0C: Size of the data (uncompressed)




Attached is a PTF to RCO converter.  Note that this does NOT generate flashable RCOs.  After conversion, you'll need to run the RCO through Resurssiklunssi to decompress it.  After that, you can view and extract the contents, but there's really little other use.
Have fun :P
UPDATE: do not use below file, use this instead

.rar  ptf2rco.rar (Size: 8.83 KB / Downloads: 5296)


Alternatively, you may wish to download a hexed copy (with two messages replaced) of the program, which includes a (what seems to be) modified (probably SFO/PNGs replaced) version of Resurssiklunssi from QJ.
Or, if you to stick your own name in the program, the source file is included.  However, if you lack the knowledge on how to compile the program, you can hex the program yourself - the "By" line is at 0x2230 in the EXE, the "conversion complete" message is stored at 0x25D4.  Happy hexing! :)

(Note, you may want to hex other messages as well to make it seem less obvious)
(This post was last modified: 05/05/2009 05:26 AM by ZiNgA BuRgA.)
12/09/2007 04:55 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Pirata Nervo
NervOS Developer

Posts: 699.4765
Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
Offline
Post: #2
RE: A peak at the PTF format
kool :great:

12/09/2007 05:27 AM
Visit this user's website Find all posts by this user Quote this message in a reply
dedat
I also poo when hungry.

Posts: 1,319.1315
Threads: 32
Joined: 14th Apr 2007
Reputation: 1.65351
E-Pigs: 3.5147
Offline
Post: #3
RE: A peak at the PTF format
so does this mean, if you have time wee might be seeing a PTF editor 1.0 ZiNgA?
but your probably busy at uni at the moment right?
12/09/2007 07:01 AM
Find all posts by this user Quote this message in a reply
matchung
Turok Makto

Posts: 1,744.2413
Threads: 180
Joined: 5th Mar 2007
Reputation: -1.62846
E-Pigs: 162.3154
Offline
Post: #4
RE: A peak at the PTF format
cool,,,, new rcoeditor will come?
12/09/2007 07:35 AM
Visit this user's website Find all posts by this user Quote this message in a reply
lupus
Existential Entity

Posts: 14.1172
Threads: 3
Joined: 16th Mar 2007
Reputation: 1.25679
E-Pigs: 1.4489
Offline
Post: #5
RE: A peak at the PTF format
not RCO, PTFEditor :)
12/09/2007 07:57 AM
Find all posts by this user Quote this message in a reply
SchmilK
Noob

Posts: 4,695.1280
Threads: 358
Joined: 16th Apr 2007
Reputation: 0.38918
E-Pigs: 81.8122
Offline
Post: #6
RE: A peak at the PTF format
Hot dang!  Very nice finds dude!!

limneosgreen Wrote:Take my advice, don't try to install custom themes ... it's possible to brick ur psp.. why just don't change wallpaper
12/09/2007 08:55 AM
Find all posts by this user Quote this message in a reply
lupus
Existential Entity

Posts: 14.1172
Threads: 3
Joined: 16th Mar 2007
Reputation: 1.25679
E-Pigs: 1.4489
Offline
Post: #7
RE: A peak at the PTF format
Quote:I've been messing around a bit with the official theme files released for firmware 3.70 and I managed to split them apart into their various sections. I still have NO clue what the sections are, but I know for sure that the file is not encrypted, the data can be edited without corrupting the theme, the file has to be ≤512KB in size, and it is copied in its entirety into a file in flash (0, 1, 2, 3; I don't know which).

You can pad on as much data as you want, random or otherwise, up to exactly 512KB. You can even replace bits of one theme with bits of another so long as the stuff you're replacing is bigger than the stuff you're copying over it and you null out the trailing data to the end of the section. For example, I copied the 'classy pink' icon over the 'cookies' icon and it showed up with the 'classy pink' icon in the theme selector.

There doesn't even seem to be a checksum on the data in the theme header...

I made a tool for splitting the files apart. There seem to be three different types of section; they all have the same first two bytes (0xD9, 0x6B) preceded by either 0x05, 0x06, or 0x07 and followed by a header that is different depending on the section type.

Hope this inspires people to figure these out even more  I've attached the two currently existing official themes for testing purposes.
source: http://forums.qj.net/f-psp-development-f...20841.html
12/09/2007 09:18 AM
Find all posts by this user Quote this message in a reply
u_c_taker
hacks=drama

Posts: 3,185.2011
Threads: 102
Joined: 29th Jan 2007
Reputation: -1.03084
E-Pigs: 36.7855
Offline
Post: #8
RE: A peak at the PTF format
well so a ptf editor means official flashless customization

12/09/2007 11:01 AM
Find all posts by this user Quote this message in a reply
SchmilK
Noob

Posts: 4,695.1280
Threads: 358
Joined: 16th Apr 2007
Reputation: 0.38918
E-Pigs: 81.8122
Offline
Post: #9
RE: A peak at the PTF format
it still flashes.  On the official playstation board 3.70 firmware thread i thought i read that on the phatty it will install to flash1 and on the slim it installs to flash0.  But all the themes will be stored in ms:\psp\themes\

limneosgreen Wrote:Take my advice, don't try to install custom themes ... it's possible to brick ur psp.. why just don't change wallpaper
12/09/2007 11:21 AM
Find all posts by this user Quote this message in a reply
UncertainGod
Illogical mindfuckery

Posts: 1,492.4476
Threads: 88
Joined: 16th Aug 2007
Reputation: -8.70083
E-Pigs: 7.1412
Offline
Post: #10
RE: A peak at the PTF format
The current theme you use will be installed to flash just like Schmilk says.
12/09/2007 11:26 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: