Advertising (This ad goes away for registered users. You can Login or Register)

PGD shenanigans

Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Post Reply
doctorgoat
Posts: 264
Joined: Sat Jan 03, 2015 12:19 am

PGD shenanigans

Post by doctorgoat » Sat Feb 28, 2015 10:01 pm

I'm working on something for Elminage Gothic for PSP.

It uses script files for almost everything, and the scripts between the PC US version and PSP JP version are in the same format.

However, I'm only able to decode PGD files. I can't re-encrypt them.

This would be slightly helpful, but the disc already includes all the unencrypted PGD files. :|

So what I need to do is modify the decrypted files and re-insert them, but it's not possible to just replace the PGD files with unencrypted copies or modify them in their encrypted state. There also isn't a data install feature.
Advertising
Last edited by doctorgoat on Tue Mar 03, 2015 11:57 pm, edited 1 time in total.

User avatar
noname120
Developer
Posts: 776
Joined: Thu Oct 07, 2010 4:29 pm

Re: PGD encrypt/decrypt

Post by noname120 » Sun Mar 01, 2015 11:53 am

Which tool did you use in order to decrypt it?

PPSSPP contains valuable information about this encryption: https://github.com/hrydgard/ppsspp/blob ... k/amctrl.c
You can use the function int sceDrmBBCipherInit(CIPHER_KEY *ckey, int type, int mode, u8 *header_key, u8 *version_key, u32 seed); with the parameter mode = 1 in order to encrypt it.


Another way is to patch the executable of the game so that it loads the unencrypted content.
Advertising
Funny stuff
<yifanlu> I enjoy being loud and obnoxious
<yifanlu> rooting an android is like getting a hooker pregnant
<xerpi> I sometimes think I should leave all this stressing **** and be a farmer instead

Hykem
Guru
Posts: 75
Joined: Sat Jan 15, 2011 8:11 pm

Re: PGD encrypt/decrypt

Post by Hykem » Sun Mar 01, 2015 12:47 pm

Take a look at this: https://github.com/Hykem/sign_np/blob/master/pgd.c
You can write a small application using those routines. It's being used in "sign_np" for PGD decryption and encryption.

doctorgoat
Posts: 264
Joined: Sat Jan 03, 2015 12:19 am

Re: PGD encrypt/decrypt

Post by doctorgoat » Sun Mar 01, 2015 2:03 pm

PPSSPP decrypts, but JPCSP decrypts and dumps the key and dumps both the pre and post encryption files.

The PGDs are also in both encrypted and decrypted forms on the disc for some weird reason. I wasn't sure the decrypted ones were identical until I checked that. I have no diea why they're leaving those on.

edit:
at least, I THINK it's the key.

an example of one: ms0:/tmp/PGDfile.raw 11fa997106f6de3a4eb291bf0d31b1c9

doctorgoat
Posts: 264
Joined: Sat Jan 03, 2015 12:19 am

Re: PGD encrypt/decrypt

Post by doctorgoat » Tue Mar 03, 2015 11:56 pm

Okay, I'm almost entirely sure this isn't even feasible.

So, what's a good way that I can get a game to load a decrypted PGD file? NPloader hasn't worked, and npdecrypter doesn't recognize the PGD files being loaded at all.

Hykem
Guru
Posts: 75
Joined: Sat Jan 15, 2011 8:11 pm

Re: PGD shenanigans

Post by Hykem » Wed Mar 04, 2015 6:01 pm

You can re-encrypt PGD files with the code I've linked to. You need to write your own program for that, since there's no standalone tool for PGD encryption/decryption. Just get the key with JPCSP and send it to "encrypt_pgd".

doctorgoat
Posts: 264
Joined: Sat Jan 03, 2015 12:19 am

Re: PGD shenanigans

Post by doctorgoat » Wed Mar 04, 2015 8:37 pm

It turns out I didn't need to! I have my hands on a way to get stuff to work now.

I just need to figure out how to properly import some files now. The file format I have to work with now is called mps2, and injecting things is a bit odd.

http://i.imgur.com/ndCjVy9.png

here's items.csv injected

Post Reply

Return to “Programming and Security”