Julian52575 Posted June 19, 2023 Posted June 19, 2023 (edited) Hi all, I am a IT student and I am currently trying to reverse engineer the inner working of the Gen IV Distribution ROM. I already figured out the basics but... Right now, I am facing an issue with the way data is encrypted. I already know of tools such as WC4PCD or PokeGen, PokeHex... but I am trying to understand and create my own program to decrypt and reencrypt all by myself. So I am asking if any one here as any leads or straight up know what encryption algorithm is used. I obviously did some research but no luck yet. (Chat GPT told me to XOR the file but idk what key to use). Thanks in advance, and my apologies if I made any english mistake Edited June 22, 2023 by Julian52575
theSLAYER Posted June 19, 2023 Posted June 19, 2023 Please don’t link to ROMs on our site. I can’t remember for sure, but I think there’s a PKM file in the PGT, and what you need to decrypt is the PKM file. And https://bulbapedia.bulbagarden.net/wiki/Pokémon_data_structure_(Generation_IV)
Julian52575 Posted June 20, 2023 Author Posted June 20, 2023 (edited) Thanks for the reply, I'm sorry about the link, I should have put more thought into it. These are really valuable information so thank you again for replying. But I don't think it works this way for 2 reasons : The PGT file is not 136 bytes long but 260. I don't have any personality values to use for block shuffling, as I believe it is only generated after the gift is received (hence the random IVs and Natures). I tried nonetheless to program an decryption tool (without the block shuffling bit) but the result is nowhere near the decrypted file I got with the online tool (probably due to a bug on my end though). My best chance is probably to understand the PCDWC4 source code but it feels wrong and too easy... Edit : about the data structure, according to this reddit thread and my personal research, the .Pokemon Card T? file contain the Wondercard text alongside the .Pokemon Gift T? file which contain the gift data (What item or pokémon). Edited June 20, 2023 by Julian52575 Explaning the PCT / Wondercard data structure
theSLAYER Posted June 20, 2023 Posted June 20, 2023 Sorry yeah, WC4 is from PCD, not PGT. You can probably check how PKHeD handles both PCD and PGT https://github.com/kwsch/PKHeX/tree/master/PKHeX.Core/MysteryGifts 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now