FlagBrew / PKSM

Gen I to GenVIII save manager.
GNU General Public License v3.0
1.67k stars 173 forks source link

Edit Pal Park Pokémon #1234

Open ccfman2004 opened 3 years ago

ccfman2004 commented 3 years ago

It would be nice to be able to edit Pal Park Pokémon in Gen 4 saves

Describe the solution you'd like To be able to add/import Pokemon in the Pal Park area.

Describe alternatives you've considered There doesn't seem to be a way to edit Pal Park Pokémon in any save editor.

piepie62 commented 3 years ago

I personally do not have the equipment to perform the research necessary for this. If somebody else wishes to perform that research and tell me the results, I'd likely add that capability to at least the backend, though I'm not certain where in the UI it would fit for the frontend.

piepie62 commented 3 years ago

For anyone considering this, I'd need to know at least three things: the offset at which the transferred Pokémon are stored, whether they are in PK3 or PK4 format (and, as part of that, whether they have party data attached or not), and the location of possibly-present flags that indicate whether Pokémon have been transferred and/or whether they have been caught.

SNBeast commented 3 years ago

Here's conclusions from some research I just did (could only thoroughly research DP, as the tools I used [pokesav] only supported Catching Show editing in DP):

  1. The offset for the location of the six Catching Show pokemon for DP is 0xBA28, where they're all stored next to each other with no space between, and no metadata afaik. I suspect the Pt offset to be 0xC7F0 and the HGSS offset to be 0xB3C0, given the similar proximity to Wonder Card data as in DP and the presence of six blank (encrypted, so non-zero) pokemon data.
  2. They are EK4s and are each 236 bytes long, makes them party pokemon. Again, they are stored directly next to each other with no spacing.
  3. The slots for the six Catching Show pokemon are all blanked at the end and when the save is initialized (six blank EK4s), and besides the usual checksums there is otherwise no difference between a save that has six pokemon ready to go for the Catching Show and a save with no pokemon ready, so there is likely no such transfer/caught flag in at least DP.
ccfman2004 commented 3 years ago

For some reason the separate tool for Platinum has the Pal Park Editor grayed out for some reason.

Focas2003 commented 3 years ago

Anyone have idea how i can edit the pal park pls

FM1337 commented 2 months ago

@SNBeast thanks for those offsets, it pointed me in the right direction for finding and verifying them

Still wanna do more testing but got a basic script done for viewing: https://github.com/FlagBrew/PKSM-Scripts/commit/4d2222521653ee522153845f4f978c5b87464ddc

FM1337 commented 2 months ago

So injecting via a script may be possible, but as of right now due to either an incorrect approach I've been taking with the scripting or a bug in PKSM-Core ( or a bug with the scripting API), I cannot get injected Pokemon to be encountered.

Did a lot of research and testing, originally I thought that there might've been extra flags out side of Pokemon data needing to be set (despite what SNBeast had indicated), but creating an ek4 from PKHeX, injecting it in via HxD (hex editor) to the offset for PalPark mons and then using PKHeX to correct the save checksum allowed the Pokemon to be encountered.

FM1337 commented 2 months ago

Gamefreak stored them as decrypted Nope they're encrypted which means the scripting apis for encryption and decryption are jank/borked