forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PS3 themes

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Development
View previous topic :: View next topic  
Author Message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Fri Nov 09, 2007 7:40 am    Post subject: PS3 themes Reply with quote

The ps3 theme compiler available here was written in Python and turned into a Windows executable using "py2exe". If you take p3tcompiler.exe and extract 1705167 bytes starting at offset 2165248 then you get a zip file containing the compiled Python 2.5 code (.pyo).

I haven't managed to get it to run on Linux, because of some character set nonsense, but it should be doable. My python2.5 also seems to have some trouble finding modules named .pyo, but deals with .pyc, so I tested with something like:
Code:
for i in $(find . -name '*.pyo'); do ln -sf $(basename $i) ${i%%pyo}pyc ; done
python2.5 ./p3tcompiler.pyc sample/01/sample.xml

There are online services that will decompile Python 2.5 .pyo for money, but I think free tools only go up to 2.3.
Back to top
View user's profile Send private message
ps2asker



Joined: 12 Nov 2007
Posts: 7

PostPosted: Mon Nov 12, 2007 3:10 pm    Post subject: Reply with quote

Nice find, Would it be possible to use this code to reverse the process?(extract the theme)
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Mon Nov 12, 2007 5:25 pm    Post subject: Reply with quote

Sure, the first step would be to decompile the pyo and figure out how it works. I don't know enough about python bytecode to extend "decompyler" to work with 2.5..
Back to top
View user's profile Send private message
almar



Joined: 13 Nov 2007
Posts: 3

PostPosted: Tue Nov 13, 2007 10:27 pm    Post subject: Reply with quote

Ive replicated your steps(partly independant). I also found out that the program packs all the files at the end, so i managed to inject a file of my own after the conversion to gim. I analysed it with a hex editor and found out that the beginning part(the strange pattern) the changes are minor. I think files are recognizable with 78 DA DD hex codes. For example in the example theme icon.gim is at offset 243Co, so a comparison can be made. I found out that the file got bigger, this is kind of strange since the complete record of gim's is bigger than the p3t file.(i probably made a mistake but the rest of the resulting p3t file is identical to the standard one)So there must be some kind of compression, but i couldnt find out which one, winrar doesnt recognize the resulting file. Maybe some kind of custom compression? But then it might be possible this is also used in pkg files or other ps3 related files so it would really help is somebody figured out how to decompile the pyo files that are found in the p3tcompiler.exe.
Back to top
View user's profile Send private message
codelogic



Joined: 10 Nov 2007
Posts: 10

PostPosted: Thu Nov 15, 2007 11:43 am    Post subject: Disassembly Reply with quote

I was able to disassemble (not decompile) p3tcompiler into python bytecode. Looks like the actual packing is done in cxml.

Here's the program I wrote to disassemble it

Code:

#!/usr/bin/python                                                                                                                                                                     

import zipimport
import dis

# change to full path of exe                                                                                                                                                         
z = zipimport.zipimporter("p3tcompiler.exe")

cxml = z.load_module("cxml")
p3tcompiler = z.load_module("p3tcompiler")

dis.dis(cxml)


Last edited by codelogic on Thu Nov 15, 2007 11:55 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
codelogic



Joined: 10 Nov 2007
Posts: 10

PostPosted: Thu Nov 15, 2007 11:45 am    Post subject: Reply with quote

Ok, I guess there's a message limit so I can't paste the disassembly directly.

Here are the links

Disassembly of p3tcompiler.pyo

and

Disassembly of cxml.pyo
Back to top
View user's profile Send private message Visit poster's website
unsolo



Joined: 16 Apr 2007
Posts: 155
Location: OSLO Norway

PostPosted: Thu Nov 15, 2007 7:51 pm    Post subject: Reply with quote

Using either spu's or the RSX access one should be able to render a "clone" one day in other-os which also uses custom textures.

My idea is to make users enter a familiar other-os enviroment were we can have open media center's ++

Perhaps someone wants to start working on it :)
_________________
Don't do it alone.
Back to top
View user's profile Send private message
almar



Joined: 13 Nov 2007
Posts: 3

PostPosted: Thu Nov 15, 2007 10:08 pm    Post subject: Reply with quote

unsolo whats your opinion of the used compression/encryption?
Back to top
View user's profile Send private message
codelogic



Joined: 10 Nov 2007
Posts: 10

PostPosted: Sat Nov 17, 2007 5:52 pm    Post subject: Theme extractor Reply with quote

If anyone's interested in a theme extractor, it's available here.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group