This is a working decrypter and encrypter for save games (including the EDIT file) generated by Pro Evolution Soccer 2016 and later.
Compiled binaries for Windows are available [here on GitHub](https://github.com/the4chancup/pesXdecrypter/releases).
The game version-specific libraries from previous releases were replaced by the universal pesXdecrypter library.
This project was initially developed as 'pes16decrypter' by a contributor who now wishes to remain anonymous. May he rest in peace among the fish.
Since then, support for newer game versions and CMake has been added, along with some additional features.
Thanks go to zlac for providing simplified decryption/encryption functions, as well as additional encryption keys.
All save files generated by the games mentioned above are encrypted using an interesting combination of Mersenne Twister and some kind of chained encryption key.
Each file consists of six different blocks that are encrypted differently. In the order they appear in the file, they are
- The encryption header. This contains part of the information required to decrypt the file. This is seeded differently every time PES16 saves a file.
- The file header. This specifies the type of file (EDIT, TEXPORT, SYSTEM etc.), the length of the remaining blocks in the file and some sort of hash/checksum (the game does not seem to care about this).
- A thumbnail/logo. You would think this would be displayed when selecting the save state to load, but the game seems to ignore this.
- The file description. This contains one or two strings about what is in the file, such as the name of the team. This is mainly for aesthetics, i.e. displaying the correct name when listing save states.
- The actual save game data. This contains the team data/system settings/other things. This is probably the main thing you want to edit.
- A serial number/version string. We do not know what this is for, but you probably should not change this.
This project comes with two command line tools per game version that do decryption and encryption, respectively, as well as a library.
To decrypt a file, run (replace XXX with the game version you are using, e.g. 16, 16myClub, or 17)
decrypterXXX input_file output_directory [master_key_file]
This will decrypt the file at `input_file`, split it up into different data blocks and save the resulting files into `output_directory`.
You can edit the decrypted files directly. After you're done, run the encrypter with
encrypterXXX input_directory output_file [master_key_file]
This will encrypt the different files from the specified output directory and merge them into a single output file that can be read by the corresponding game.
Optionally, a file at `master_key_file` that includes a custom master key may be provided.
This 64 byte key is then used for decryption/encryption, regardless of what game version the binary is meant for.
A library is provided for when you want to use the decrypter/encrypter in an external program. Please refer to `src/crypt.h` and `src/masterkey.h` for the exported symbols.
While there are still functions available that do not require a master key argument, these are considered deprecated and should not be used anymore.
Instead, the functions that also take a master key argument should be used.
The currently known keys are exported from `src/masterkey.h`.
Keep in mind that some languages like e.g. Python require libraries to be compiled in the same bit variety they are running in.
That means you cannot use 32-bit versions of the libraries from 64-bit Python.