News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: PGD file manipulation (PSP)  (Read 3974 times)

DoctorGoat

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
PGD file manipulation (PSP)
« on: March 01, 2015, 01:45:30 pm »
Elminage Original's JP/US versions use the same script files with strings manually replaced. The scripts seem to be extremely loose and allow a lot of modification.

Elminage Gothic on PSP didn't receive a US translation, but the PC version did, and it uses the same scripts. The PC version's only differences with the JP PSP version are that the PC version's strings are different, and the Shift-JIS is absolutely mangled.

http://cloud-4.steamusercontent.com/ugc/45372069331764385/E1AEC4ED382A100A54DF4A6F4523A627DD24B73A/

Here's the PC version with the PSP items injected in. It doesn't care that the encoding is different or anything, it just works. I have no idea how or why, or what goblins possess it.

Elminage Gothic PSP's files are in PGD files, and Elminage PC's are in a .bra file. The .bra file is easily decrypted and I don't need to re-encrypt it. The PSP version, though, is both in an encrypted PGD file and then an unencrypted filesystem container with obfuscated headings. The unencrypted filesystem PGD files are already on the disc without needing any decryption, but getting them into the encrypted PGD file is past me. It's reallllly easy to modify the unencrypted files, though.

Can anyone help?

Edit: If I can replace install data, this will work on a unmodded PSP if it works out.
« Last Edit: March 01, 2015, 04:38:50 pm by DoctorGoat »

PhOeNiX

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: PGD file manipulation (PSP)
« Reply #1 on: March 03, 2015, 09:56:15 am »
If I recall well, there is no tool available that is able to re-encrypt pgd files.
But as far as I understand, it uses AES encryption, so, there should definitely be a way to adapt current DEcrypting tools
to also encrypt back your files..
The most documented and well written code I am aware of, for decrypting PGD files can be found at
https://github.com/Hykem/psxtract

Function decrypt_pgd in file https://github.com/Hykem/psxtract/blob/master/Windows/src/crypto.cpp is what you need to check.

Actual decrypting should take place in file https://github.com/Hykem/psxtract/blob/master/Windows/src/libkirk/amctrl.c

DoctorGoat

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: PGD file manipulation (PSP)
« Reply #2 on: March 03, 2015, 12:11:03 pm »
I'm not sure if it's possible to get the game to load a unencrypted PGD instead of the encrypted one, but I've seen it mentioned as a thing that can be done. If the PGD functions were simpler to use, I'd try just disabling them in the PPSSPP debugger, but they're obfuscated somehow.

If you have the PC Elminage Gothic and a copy of Elminage Gothic - Ulm Zakir to Yami no Gishiki, you can try this out by extracting the files from the PC version and manually overwriting strings using a hex editor. If you find the beginning of the data file in notepad++ or something, you can paste an entire csv file in. There's a bms script at http://aluigi.org/papers/bms/others/elminage.bms that can pull things from the unencrypted data files for PSP, but I'm not sure how well it works.

some info:
event_text.csv is all the text for plot summaries. It won't need reprocessing.
dgn_name and dgn_set are both for dungeon names. Probably won't need retouching.
race.csv contains the character race strings.
treasure.csv handles trap names.
spell.csv is the list of spells used and descriptions.
item.csv is all the item names and descriptions. You can see the PSP items.csv put into the PC version in the link I posted.
the el_ csv files are event images.
help_text.csv is a lot of game strings are located.


edit:
repacking a PGD and having the game accept it isn't feasible, i think.

March 05, 2015, 04:08:22 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Could I have help with a file format?

http://aluigi.org/papers/bms/others/elminage.bms

This is a bms script that.. sort of works, but the file offsets are obfuscated.

http://www.filedropper.com/anime

Here's a sample file.

This is stopping me from doing a _whole_ lot of work.
« Last Edit: March 05, 2015, 04:08:22 pm by DoctorGoat »

Pokeytax

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Cavespeak
Re: PGD file manipulation (PSP)
« Reply #3 on: April 04, 2015, 11:22:24 am »
I like RHDN, but this is a question you're better off asking on GBAtemp where there's a broader PSP knowledge base.

In some cases, renaming an unencrypted .cpk (it is a cpk, right?) as INSTALL.DAT has worked.

You can also try directly working with the EBOOT and redirecting the system call: example

I'm still working out the best way to do it myself.