Jump to content

-


luisfox37

Recommended Posts

it's actually really easy to do. starting at 0x2638 in the save, highlight 136(0x88 in hex) bytes and copy them out of your hex editor and into a new file in the hex editor and save it as a pkm file. you can open and view the files in pokegen and view their catch/met date.(that one will be a quilava) note the pattern at the beginning of the pkm: 4 bytes, 2 zero-ed bytes, and 2 bytes again. you can go down from there copying 0x88 bytes at a time and making pkm files out of it. just ignore the 0x1C bytes between pkms. see the picture:

box_pkm.png

the highlight is the first pkm. the red boxes are the second and so forth.

e: here:

http://hack.thundaga.com/box_pkms.7z

i wrote a dumper for the files instead because there are so many.

here's the source for anyone interested: http://pastebin.com/TYHMkHtR

Edited by Bond697
Link to comment
Share on other sites

  • 3 months later...

Oh wow, this is incredible. I have a very similar problem. I finally got to extracting all of my Ranch save data, and all I'm trying to do is retrieve my long lost pokemon onto my Diamond cart. I had multiple people deposit their pokemon on my Ranch, so the save file is a mess and I honestly have no idea where to find any information. Right now, I'm armed with homebrew, my savedata, a fresh copy of diamond, and an Action Replay. any help getting these pokemon would be GREATLY appreciated!

EDIT: HOLY SHIT, AFTER LIKE 4 YEARS, I'VE GOT MY POKEMON BACK.

I used the PokeGen you recommended, and went through the save data until I found a pokemon with my old save as the OT. Then simply changed my TID and SID to match the poke. Pretty simple, but it seems like the pokemon are placed randomly in the save file, so I had to do A LOT of trial and error as far as finding a pokemon from my Diamond, and not one from Hayley, FR/LG, or anyone else that uploaded their pokemon onto my Ranch. Now the only thing left is to retrieve about 150 from a Pearl cart from a while back ago, and to transfer everything up to Diamond.

Edited by TheTellingTruth
Link to comment
Share on other sites

  • 2 months later...
it's actually really easy to do. starting at 0x2638 in the save, highlight 136(0x88 in hex) bytes and copy them out of your hex editor and into a new file in the hex editor and save it as a pkm file. you can open and view the files in pokegen and view their catch/met date.(that one will be a quilava) note the pattern at the beginning of the pkm: 4 bytes, 2 zero-ed bytes, and 2 bytes again. you can go down from there copying 0x88 bytes at a time and making pkm files out of it. just ignore the 0x1C bytes between pkms. see the picture:

box_pkm.png

the highlight is the first pkm. the red boxes are the second and so forth.

e: here:

http://hack.thundaga.com/box_pkms.7z

i wrote a dumper for the files instead because there are so many.

here's the source for anyone interested: http://pastebin.com/TYHMkHtR

Does anyone have a link to the compiled executable? I tried compiling it myself, but I couldn't find a dtypes header file online, and changing u8 to uint8_t or unsigned char still didn't produce an executable that produced working .pkm files. It would just spit out 119 garbage .pkm files of the correct size, even though I have 300+ pokemon in my pokemon ranch.

Link to comment
Share on other sites

they're encrypted.

i didn't bother decrypting them because pokegen can read encrypted files.

e: and you wouldn't find that header anywhere because it's a common one that i use. it's nothing but

typedef unsigned char			u8;
typedef unsigned short int		u16;
typedef unsigned long int		u32;
typedef unsigned long long int     u64;

typedef signed char			s8;
typedef signed short int		s16;
typedef signed long	 int		s32;
typedef signed long long int	        s64;

typedef float				f32;
typedef double				f64;

and occasionally some architecture-specific stuff.

Link to comment
Share on other sites

  • 5 months later...

I didn't know whether to hijack this thread or create a new one. I'm trying to find the ID and Secret ID of Pokemon on my Pokemon Ranch save so I can rescue them. I've tried everything in this thread, and I've dumped all the .pkm files, but when I read them with PokeGen I can't find any from my game. About a third are Hayley's Pokemon (with an ID of 1000) about a third are corrupted messes, and about a third PokeGen won't even open. Please help!

Here is a .zip with my save and all the dumped .pkm files: http://www.filedropper.com/deboogpokemon

Link to comment
Share on other sites

  • 1 month later...
  • 7 months later...

I've looked at 3 different ranch savedata.bin files and in each file the stored pokemon start at different offsets. This seems to be because of the amount of Mii in the savefile doesn't have a constant allocated space.

The actual data starts at 0x22AC, and each Mii takes up 40 bytes. 0x22AF value indicates how many Mii are registered (probably it is a 4 byte variable, taking from 0x22AC to 0x22AF). After the mii data there are 8 bytes more of data, here's data from two different save files:

Savefile 1: 00 00 00 2C 00 00 00 01
Savefile 2: 00 00 00 2C 00 00 00 01

After this come the entries linking the Mii's and the trainers, I think the 00 00 00 01 is a 4-byte value indicating how many trainer id's follow. The two savefiles I have only have one trainer, I may check later to confirm this. Each entry is 44 bytes long, then, 4 unknown bytes and then 4 bytes which value is the number of pokemon stored. Then the pokemon start.

I think it is worth mentioning that the 0x1C (28 in decimal) bytes that follow the 136 byte pokemon are 4 bytes, then TID (2 bytes), SID (two bytes), trainer name (16 bytes) and 4 more unknown bytes. All this data is unencrypted.

First come Hayley's pokemon, including the ones that may have been traded with her. You can identify them because the 0x1C bytes that follow them are blank, they don't have any trainer ID assigned (so you can't take them out of the ranch). Any pokemon traded with hayley are here too, even eggs.

I don't know how many pokemon can Hayley take to the ranch. Because of the amount of blank savedata after my last pokemon (and I have 990+ in this savefile) I pressume that this number is as high as 1000 more pokemon brought in by hayley. I guess nobody got that far to confirm.

Then come the pokemon stored at the ranch by DS cartriges.

I have found the end of the pokemon in the ranch marked by "00 00 00 28" in two different save files.

Summary:

- My goal is to code an app that can extract all pokemon into .pkm files

- Extracting Hayley's pokemon will be optional

- Another use of the app will be to change the TID, SID and Name of all stored pokemon, so instead of editing the diamond/pearl savegame the pokemon ranch savegame is edited.

Information so far:

0x22AC-0x22AF: number of mii stored
Variable: mii data, each mii takes 40 bytes.
4 bytes:  00 00 00 2C
4 bytes: number of trainer-Mii links
Variable: trainer-mii entries, 44 bytes long each entry
4 bytes: unknown data; 00 00 00 A4 in two different savegames
4 bytes: number of pokemon in the ranch

POKEMON ENTRIES (164 bytes each), structured as following:
-136 bytes: encrypted .pkm file (readable by pokegen)
-28 bytes: 4 bytes (*read below), then TID (2 bytes), SID (two bytes), trainer name (16 bytes) and 4 more unknown bytes. This data is unencrypted.

End of file mark? (4 bytes): 00 00 00 28

* These value seems to be 01 00 00 00 for trainers, 05 00 00 00 for pokemon traded to Hayley, 04 00 00 00 for Hayley's pokemon, and 04 00 00 02 for pokemon that are tradeable with the player (check here for those pokemon: http://bulbapedia.bulbagarden.net/wiki/Hayley%27s_trades).

EDIT:

I have already coded a program that extracts all pokemon and should work with all pokemon ranch savefiles (well, maybe it doesn't with the japanesse platinum update).

I also coded a program that changes the trainer of every pokemon in the ranch (except Hayley's) to the inputed TID, SID and trainer name. This needs testing and I can't do it right now, so we'll have to wait some hours to see if it works (if there's no checksums it should work).

EDIT2: As expected, the ranch savefile seems to have a header with a checksum for the savefile, so changing the data without recalculating the checksum won't work. I don't know how checksums work, anyone would lend a hand?

Edited by suloku
Link to comment
Share on other sites

It seems you missed this thread: http://projectpokemon.org/forums/showthread.php?44253-My-Pokemon-Ranch-Savedata-Exctractor-0-1

Use the extractor, the .pkm filenames contain the trainer id and secret id of the trainer that deposited the pokemon in the ranch. If you need the name, open the .pkm file with pokegen.

For extracting the ranch savefile use savegame manager gx on your wii. You will need hombrew channel on your wii to use savegame manager gx, there are plenty of tutorials out there.

As another option dolphin emulator can "install" savefiles copied to the sd from the system menu, the you can get savedata.bin in you computer, but since the savefile is protected you still need a homebrew enabled wii to do so and run an app like "banana saves".

Link to comment
Share on other sites

It seems you missed this thread: http://projectpokemon.org/forums/showthread.php?44253-My-Pokemon-Ranch-Savedata-Exctractor-0-1

Use the extractor, the .pkm filenames contain the trainer id and secret id of the trainer that deposited the pokemon in the ranch. If you need the name, open the .pkm file with pokegen.

For extracting the ranch savefile use savegame manager gx on your wii. You will need hombrew channel on your wii to use savegame manager gx, there are plenty of tutorials out there.

As another option dolphin emulator can "install" savefiles copied to the sd from the system menu, the you can get savedata.bin in you computer, but since the savefile is protected you still need a homebrew enabled wii to do so and run an app like "banana saves".

Too bad I don't have Windows.

That and it wasn't there months ago when I first asked.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...