Jump to content

Recommended Posts

Posted (edited)

UPDATE 4: About Japanesse My Pokemon Ranch:

- Region code seems to be 0x00 for normal japanesse my pokemon ranch. Seems totally compatible with the other versions (NTSC and PAL using regionchanger).

About the Platinum update savegame:

- savedata.bin is bigger, seems that space was added for 500 player pokemon and 500 hayley's pokemon (a total of 3000 pokemon in the ranch). Some more Ranch data is added as well (for the new features I guess, like song changing, that setting may be saved as well).

- The start offset of mii data has changed, since some more data for the ranch save was added, the start offset of mii data has changed. Since I wrote these tools with a hardcoded offset instead of reading the offset from the header (because I discovered that later) the only tools that will work with the platinum update savegame are hashupdater and regionchanger. I may rewrite my tools to clean the code and add compatibility with the platinum update savegame.

- For platinum update the region code seems to be 0x40. I think that these region codes are actually only bitmasks, since my pal savegame was updated to 0x60 (bit 6 was enabled) and not 0x40.

- A platinum update savegame will NOT work on any non platinum update game. The game will say the save is corrupted (but it is not, it must make some kind of filesize check).

UPDATE 3: I tested a little with dolphin and found the header value that defines de region/language of the savegame. I've updated the post with the new information, and I've also attached a new file with the updated information and a new app: PR-regionchanger.exe, which has a region selector (jap, NTSC-U, PAL: english, dutch, french, german, spanish, italian) and also updates the file's hash.

UPDATE 2: I made a quick test with a pal savedata I found. The PAL ranch save seems to be language locked and the "connect to wii" option will only appear in the DS games of the same language (english, deutch, french, italian and spanish). I couldn't find any obvious value in the savefile storing the language setting. The lack of a language setting in the NTSC-U savefile might be what prevents the save from loading on the PAL game. I could create several new savefiles in different languages and compare them, but as I said I'm not working on this anymore.

UPDATE: Released extractor, id changer and hash updater!

Only tested with PAL and NTSC-U savefiles.

FAQ:

- What are these for?

With these tools you can extract the .pkm files from My Pokemon Ranch savedata and take ownership of all the pokemon in the ranch, so you can withdraw them with any NDS cart.

- How do I get the savefile from my wii?

You will need a homebrew enabled wii (aka Homebrew Channel) and you'll need to use Savegame Manager Gx.

- Can I use the savegame copied from the system menu?

No, you can't. Either way, if you can copy it it means your wii is homebrew enabled, since you aren't supposed to be able to copy that savegame.

- Can I know my secret trainer ID with these tools?

Yes you can. Each .pkm file extracted with PR-extractor contains in its filename the TID and SID of the trainer that deposited the pokemon in decimal (normal numbers, not hex like the .tnr files).

Alternative method for pokemon extracting:

If you use PR-extractor, you can check data of the trainer that deposited the pokemon (TID and SID). You can check the name at My pokemon Ranch screen or using pokegen and opening the .pkm file (only if the pokemon belonged to this same trainer).

If you edit your NDS savegame so it matches the TID, SID and name of the trainer that deposited the pokemon, you can withdraw them.

Quick Instructions:

  Quote

I'll briefly explain the process of changing all pokemon from a savefile to a specified trainer.

0.- Connect to My Pokemon Ranch with your DS trainer and deposit a pokemon. If the ranch is full see side notes*

1.- Use Savegame Manager Gx to extract your savegame (extract, not copy).

2.- Put savedata.bin in the same folder as the PR tools.

3.- Run PR-extractor.exe. Sort by number.

4.- Get the .tnr file of the LAST pokemon extracted. This file contains the hex data from your trainer (TID, SID and Name).

5.- Drag and drop your .tnr file to "Insert_tnr_and_update_hash.bat". The file "savedata_hashed.bin" will be created. The program will ask you if the trainer had connected to the ranch, select YES if the new trainer information matches any of the ranch trainers.

6.- Delete savedata.bin inside the folder you extracted with Savegame Manager Gx (0001000157424d50 for PAL savefile, 0001000157424d45 for NTSC-U savefile).

7.- Copy savedata_hashed.bin to that folder and rename it as savedata.bin.

8.- Restore your savegame to your wii with Savegame Manager Gx.

9.- You should now be able to extract all the pokemon with the specified trainer

-----------

Side notes:

*: if the ranch is full, backup the savefile, then erase it and start a new game in my pokemon ranch, deposit a pokemon and extract this new savefile (in another location, don't overwrite the save with the pokemon you want to obtan!). The use this savefile to obtain your .tnr file. If you do that, select NO in step 5.

If you want to change the savegame's region/language, drag and drop savedata_hashed.bin on PR-regionchange.exe after step 5 and use the new created file instead in further steps.

Savedata structure information:

  Reveal hidden contents

This is the thread that originated it all: http://projectpokemon.org/forums/showthread.php?28382-Reading-My-Pokemon-Ranch-save)

Original post:

  Reveal hidden contents

PR-tools_v2.zip

PR-tools_v2.zipFetching info...

583dd01c3cca9_Savedataheaderinformation.

Edited by suloku
Updated file and information
  • Like 3
Posted (edited)

Thank you, I've looked at it, but I don't know visual basic (in fact, I know very little programming).

I've taken advantage of MPKR making a backup of the savefile to compare what happens when I withdraw a pokemon and deposit a different one. The result was that the only changes to the file are the ones shown in the following image (and obviously the 136 bytes correponding to the pokemon I deposited, which now take the place of the one I withdrawed):

ranchheader.png

EDIT: I also tried to just enter the ranch and save 2 times in a row, then extract the savedata. The only difference between the two savedata were the bytes marked in red in the image (0x00-0x19 and 0x63).

I also tried withdrawing the first pokemon deposited at the ranch, then depositing a different one, which shifts the whole pokemon data 164 bytes. But same result. Removing a pokemon has the same changes to the header (well, the pokemon start offset is updated, as stated below).

The checksum is definitely one of those, maybe 0x60-0x63 is the header checksum and 0x00-0x19 is the savedata header.

Also, I noticed some values in the header are offsets in the file:

- Underlined in the image, they seem to be just some index values

- In a black square I've marked the values of the offsets of different sections in the savegame:

0x00-0x19: SHA-1 hash of all the following data in the file

0x24-0x27: start offset of mii data entries in the ranch

0x2C-0x2F: start offset of "mii-trainer" data entries in the ranch

0x34-0x37: start offset of pokemon data

0x3C-0x3F: ending offset of pokemon data (after this the savegame is all 0x00)

[ATTACH=CONFIG]11917[/ATTACH]

UPDATE: found it! 0x00-0x19 is a SHA-1 checksum of the rest of the savedata. 0x60-0x63 might be a time value, since in subsecuent savefiles it only increases.

Thankully this is a very common checksum, so I will be able to update the id changer app myself!

UPDATE_2: I successfully edited my pokemon ranch savefile and could download all pokemon to a different diamond/pearl savegame, without modifying the nds savegame.

It required some extra tweaking, like adding TID, SID, Name to one of the mii-trainer entries (this one was expected). I need more testing, because in my successful attemp i just changed all the trainer data existing in the savefile (which only had had one trainer ever) to the new one and I don't know if changing them all is required, as my save had 3 consecutive TID, SID, Name for no apparent reason. Maybe it is a log of the last trainers that connected to the ranch for the ranch and wiiconnect features?

I'll do more testing tomorrow, but the big part is done.

UPDATE_3: The process is now automatic. I updated the id-changer and coded a program that updates the hash. I coded it as a separate application because that way one can manually modify the savefile, for example, to change a pokemon for other, and add event pokemon to the ranch for example.

With the information in this thread one could write a full save editor, that changes the trainers in the ranch and the pokemon they have stored. It would be nice for people who don't have access to AR or nds flashcarts to mingle with pearl/diamond savegames, but I'm not going to code it, and since my pokemon ranch is only for diamond/pearl I doubt anyone will take that much interest as to code it.

I'll update first post with new binaries and the info I've gathered later.

UPDATE_4: First post updated. I doubt I will work on this anymore, source and all the information I gathered is available in the rar attached to the first post.

UPDATE_5: updated first post with new information and a tool to change the savegame region/language setting

ranchheader.png.250fecb04bc39fb26ebdbfda

Edited by suloku
  • Like 1
  • Thanks 1
  • 4 weeks later...
Posted

I would like to thank you for this software it saved my two shinies from radar chaining in Diamond from being lost forever. When I randomly found a nand+keys backup of my long dead Wii on a sd card I was successful decrypting it and getting the Ranch save out. I found them and injected them back into Diamond and did all the transfers to bring them up to Omega Ruby. I'm really happy since I had permantly lost hope of finding them again.

  • 4 months later...
Posted

Hey

So despite being a habitual lurker I thought I should post this. I've written a Python 2.7 script that allows you to decompile and recompile My Pokémon Ranch saves, built upon the research of suloku.

If you want to add new pokémon to the ranch just decompile the save and add the encrypted 138 .pkm file to the "Pokemon" subfolder of the extraction folder and recompile. Make sure it isn't named similarly to the other files in there or the script may make a terrible mistake. It'll use the trainer link information from the last ranch pokemon in the list.

It isn't fully featured, it only really handles pokémon dynamically.

Script is here: http://pastebin.com/NnjYjqYR

Hope someone finds it useful.

PSA: Python scripts can be dangerous, don't run unknown scripts from somebody you don't trust. Get someone who knows what they're doing to read through them first to check they don't do anything bad.

  • 2 years later...
  • 3 years later...
  • 3 weeks later...
Posted

As I wrote in my last update, you can convert a save to work on a jap my pokemon ranch, then update to the platinum update, but once the pokemon ranch save has been updated to platinum there's no going back.

 

  • 2 years later...
Posted

Hi, apologies for the question on an ancient thread, but I'm currently trying to extract Pokemon from MPR to my current pearl version, deposited from diamond save files that no longer exist, and haven't had any luck using the tool or the alternate method. I could use some help, if that's ok!

Dragging a .tnr file onto Insert_tnr_and_update_hash.bat like instructed doesn't seem to do anything- no command box appears and no changes to the files. Trying to run it manually instead and inputting the HEX TID SID and name as copied from the .tnr filenames (I've also tried copying from the id changer's list of current trainers registered to the ranch, same result), all seems to go well, but the results don't work. The game crashes on the save screen as if the trained info inputted was not already present on the ranch, which it is. I've checked multiple times, and the trainer info I enter matches the info given for the trainer that is registered to the ranch. If I instead select "no" while inputting this info, the save file boots just fine, with all the pokemon except those deposited from my current trainer registered to a new trainer with the same name as my current trainer, whose pokemon I cannot extract.

Trying the alternate method hasn't worked either. I've changed my save's TID, SID, name, and gender to match with those of the extracted pokemon from my old saves, but when connecting to ranch, it doesn't show that any pokemon can be withdrawn. Is this because they were deposited with Diamond?

Any help would be appreciated if you have the time. Thank you.

Posted

May you upload your ranch savefile somewhere? It's been a while but I'll try to see what's going on.

Also, you want to be able to withdraw the mon to your pearl right? Do you have any pokemon from pearl in your ranch? May you post your pearl trainer name and TID?

  • 2 weeks later...
Posted

Was going to throw in the towel but seeing a recent reply got my hopes up haha. I'm trying to use the japanese version of ranch with my english copy of platinum. I used the region changer to change it to ntsc-u, but when i try to install the savegame in savegame manager gx i get an error, "error: unable to copy datas". i'm assuming this is because the region code in the platinum update is different than in the original version (0x40 rather than 0x00). What would the region code be to make the savegame compatible with an english copy of platinum? Or how would i go about finding this out? And if I were to get the proper region code, would the hash updater work properly after changing the region code in HxD myself?

Posted

Many years ago I already tried to use the platinum update with non-japanese games. The thing is there's code running in both wii and nds ends, a modified version of pokémon ranch platinum would be needed.

It's "probably" something not really hard to do for someone familiar with wii RE, as this most likely would "only" require removing the region checks, but the nds software probably needs patching...

A patched and translated platinum update that works on every region games would be amazing to have.

By the way, Pkhex does support my pokémon ranch savedata, haven't checked what edits cane be done though.

Posted

Ah, that makes sense. Oh well.

Yeah a patch+translation would be awesome, would definitely make things much smoother lol.

I didn't know pkhex had that, i'll have to give it a look, thanks!

  • 2 months later...
Posted

Hello,

I'm trying to use the tool to change all of the pokemon to the same ID.

When I run the tool, it looks like everything works. However, when I try to overwrite the save data on my Wii. I get the error "Unable to copy datas"

I also looked at the newly created savedata-hashed.bin in PKHex. I noticed that the trainer IDs were not adjusted. 

Is there any way someone can help me with this?

Thanks

  • 6 months later...
Posted (edited)

I know this post is quite old already, but do you happen to still have the source code that you'd be willing to share?

Because I'd like to look into Pokémon Rumble's save data and figure out the differences between it and save data from my Pokémon Ranch and then use that information to mod this Ranch Save Editor into a Rumble Save Editor, since that's something we still don't have.

I'm probably not the first to ask for the source code, so my apologies in advance if a question like this ticks you off

Edited by eman_not_ava
fixing typos

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...