MY POKEMON RANCH HAND
-----------------------------------
~Artemis251

Version 0.1.2 G...Gamma? Is that a thing? - 17 Feb 2015

Version History:

  Version 0.1.2 Gamma - 17 Feb 2015
      - Actually fixed the name thing. Whoops!
  Version 0.1.1 Gamma - 13 Feb 2015
      - Fixed some weird things with the trainer name letter parser.
  Version 0.1 BETA - 2 Dec 2010
      - Initial release!

=====================================================

Remember how useful Pokemon Box was? Storing your pokemon, swapping
game packs, storing items... It was a superb help for every kind of
Pokemon player. So where's the D/P version of this tool? Unfortunately,
it was given to us as My Pokemon Ranch, a dumbed down version of Box for
the Wii with limited capabilities. However, with a little work and
Wii hacking, some of the functionality can be restored to the Ranch,
and even extended to encompass the latest tools like Pokesav, if you
should be seeking personal game save hacking.

-----------------------------------------------------
  WHAT THE RANCH HAND CAN (CURRENTLY) DO
-----------------------------------------------------

This project is a little bit dead at the moment, but it might (hopefully)
be picked up down the line. So far, the following can be done:

  - Ranch Depositor can be changed (allowing any cartridge to withdraw
	stored pokemon). This can be done singularly, by box, and 
	entirely (the whole ranch).
  - Pokemon can be backed up as .pkm files. This way, you can rest assured
	that if your game glitches, you can still have your pokemon handy.
	Granted, just having the Ranch save file does this, but hey, it
	helps. This can only be done singularly, despite the option being
	present to Save all Pokemon to File.
  - Pokemon can be Loaded from .pkm files. These can be created via saving
	your own pokemon (see above) or they may come from Pokesav.
  - Pokemon can be released. So far, this can only be done singularly.
	This is much faster than releasing in-game!

What I was hoping to one day complete, are the following:

  - Add new pokemon. So far, if this is attempted, the game save file is
	corrupt for some reason that I never fully investigated (likely a
	value not being upped somewhere).
  - Move items/pokemon around. This allows for much more hands-on ordering
	of the boxes.
  - Reanme pokemon. This way, you can get rid of crappy names the GTS stuck
	you with.
  - Steal Hayley's pokemon. Every pokemon Hayley brings in has normal stats
	and moves, just like pokemon you capture. Being able to take what she
	brings is a cool addition and could help some people get pokemon
	they're missing.
  - Perhaps somehow get rid of Club Look See members? I don't know, I always
	found them so irritating...
  - Allow for Ranch size manipulation. This way, players can store as many
	pokemon as they like without waiting many days or messing with the
	Wii calendar.


--------------------------------------------
	HOW TO USE
--------------------------------------------

You'll need to have Java installed to open the .jar file. Think of
it as an .exe - you just double-click and it should open for itself.
If you don't have java, it's simple enough to get Java Run-Time
installed -- just visit the following link:

	http://java.com/download 

The files should be extracted from the ZIP as-is. Their structure
should be the following:

  icons (folder)
	0.PNG
	...
	493.PNG
	egg.PNG
  images (folder)
	back1.png
	...
	back6.png
  PkmnRanchHand.jar

Additionally, you'll notice that once you use My Pokemon Ranch Hand, a file
named 'config.prh' will appear. This is a simple file that will keep track
of your last opened directory and all the trainers you've saved.

Next, you'll need the following to properly load your Ranch save data:

  - An SD card
  - My Pokemon Ranch
  - Homebrew installed on your Wii
  - A program to get My Pokemon Ranch save files
  - A program to dump data.bin files

There are/may be many potential programs to do the last two things.
My own setup is using Gekko OS and FE100.


	1) USING GEKKO TO GET YOUR SAVE FILE
	------------------------------------
To get a save file, go into the Homebrew Channel and start up Gekko OS.
Go to 'Rebooter Options' and turn 'Remove Copy Flags' to 'YES'. Press B
to go back to the main menu and choose 'Launch Rebooter'. Now go to your
save files as you normally do and choose to save your My Pokemon Ranch
save file to your SD card.

(As of this writing, my version was 1.9, so the options may have changed.
However, the process should be similar for you.)
(Note that you do not need to reboot with the copy flag hooks when you just
want to move a save file from the SD card to your Wii.)

Now connect the SD card to your computer. You must navigate to the save
file on the SD card. You'll want to look for WMBE, the game code for My
Pokemon Ranch. For me, the path is "\private\wii\title\WBME\". The folder
for the save contains one file: data.bin. Copy this file to your computer--
it is your Ranch save file.


	2) USING FE100 TO GET SAVEDATA.BIN
	----------------------------------
Now the hard part (at least it was for me). You'll need something that can
both dump and rebuild save .bin files. FE100 is a little old, but it works
just fine. The main problem that makes this hard is getting it to work with
your specific Wii. Every Wii has unique values used to validate its own
save files and such. These are cryptographic keys, IVs, MACs, Signatures,
etc. The good news is that getting your Wii's data is a one-time setup
using FE100KeyGrabber. The bad news is...I forgot how I did it. However,
fret not! There's documentation here and there on the interwebs, so search
around and you ought to be able to set your own Wii data up.

Once you have FE100 running, point it to your save file in the upper text
field and click the 'Unpack savefile' button. It will dump the contents of
your data.bin to several files, named as a hex folder in your directory
containing FE100.exe. Navigate to that folder (perhaps note which it is if
you have many game files dumped) and grab the 'savedata.bin' file you see
inside. This is the file you'll want to open in My Pokemon Ranch Hand.


	3) OPENING IN MY POKEMON RANCH HAND
	-----------------------------------
Now is a good time to BACK UP YOUR SAVE FILE. Seriously, since I've only
tested this on my own files, there could be something grossly wrong that will
mess up your save file completely. Be safe and save your files for backup,
and do so frequently! It's always easy to restore previous saves.

Doubleclick PkmnRanchHand.jar to open the main window. To open your file,
Click 'File > Open File' or press Ctrl+O. Navigate to your savedata.bin
file and open it. If all goes well, your pokemon should appear in the right
window. Congrats! Now let's get on to how to use the program itself.


	4) PUTTING EVERYTHING BACK
	--------------------------
To put your modified save back, simply open FE100, point the 'Unpacked
Savefile folder' to the folder that was created in step 2) and click the
'Pack savefile' button. Your new 'data.bin' will be created in the
directory you keep FE100.exe in. Copy that to your SD card, boot up your
Wii, delete your old savefile on the Wii memory, and copy the new file over.
Start up My Pokemon Ranch and you should be good to go!


--------------------------------------------
	USING MY POKEMON RANCH HAND 
--------------------------------------------

Let's start with the two basic interfaces: the Box window and the Trainer
List.


	THE BOX WINDOW
	--------------
The Bow Window is immediately visible when the program opens. It should look
enough like the boxes in-game. Pokemon should appear as their in-game icons.
You can navigate your boxes by selecting them from the dropdown box or by
clicking the buttons to the left and right of it (<< goes to the first box,
>> goes to the last, and < and > move left and right a box, respectively).
Clicking a pokemon will highlight it and fill the 'Selected Pokemon' and
'Deposited By...' data containers on the left.

The Selected Pokemon area shows the pokemon, its species, nickname, ability,
nature, gender, and item. Additionally, it has buttons to save the selected
pokemon to file or replace it by loading another over it.

The Deposited By area shows who deposited the pokemon, including their in-game
name, Trainer ID, and Secret ID. There are also buttons to change the selected
pokemon's depositor, save changes to the data, and add the depositor to the
Trainer List, which we will look at next.


	THE TRAINER LIST
	----------------
The Trainer List keeps a list of all trainers that you've decided to save for
future use. This way, you don't have to keep typing the same name/numbers in
to change pokemon depositors (who are the only trainers able to withdraw pokemon
from the ranch, if you didn't know). You can see this list by going to
'Ranch > Manage Trainers' or pressing Ctrl+T.

The Trainer Manager has 4 rows for each trainer saved: Their Saved Name, Trainer
Name, TID, and SID. The Saved Name is what the trainer is seen as when you use the
dropdown box in the Box Window's 'Deposited By...' area. These names are crucial
if you have 2 cartridges with the same Trainer name. Trainer Name is the in-game
name for the trainer. TID is the trainer's Trainer ID, and SID is their Secret ID.

The buttons at the bottom of the Trainer Manager allow you to Add, Edit, or Delete
trainers. 'Add' gives you the 4 blank fields to fill out a new trainer. 'Edit' and
'Delete' only work if you select a trainer from your list first. 'Edit' allows you
to modify saved trainer data, like their Display Name. 'Delete' will remove the
trainer from the list.

 !!! NOTE! !!!
   I don't quite understand the trainers registered in the save file just yet.
   Thus, adding new trainers from scratch will likely crash your save file.
   If you want to transfer pokemon, deposit a pokemon from the new trainer's cart
   first to 'register' them in-game. Then, load up the Ranch Hand utility and
   change trainers as normal. Make sure the IDs and name match! Currently the
   program will only work well with trainers who had already deposited a pokemon
   into the Ranch.


Well...that's about it, I suppose. There are a few other options in the Menu Bar:

File:
	Open
	Save
	Save As
	Close File
	Exit
Box
	Change Box's Depositor to...
	* Release all from this box
	* Save all Pokemon to File
Ranch
	Manage Trainers
	Change All Pkmn's Depositor To...

  * - this has not yet been implemented

These are all fairly straightforward, though.


--------------------------------------------
	USELESS THINGS 
--------------------------------------------

Since this is unfinished, there are a few things that should be noted
as incomplete. They are the following:

 - Box > Release all from this box
 - Box > Save all Pokemon to File
 - The < and > buttons on the bottom of the main Box Window (meant to
	shift pokemon one place left/right)
 - The Add Pokemon button (it adds pokemon, all right, but the save file
	becomes corrupt if it is done)
 - Selected Pokemon Level
 - Selected Pokemon Markings
 - Handling most characters outside A-Z and a-z (as of now, the unknown
	characters should be turned into hex)
 - Some Menu options are able to be clicked prior to loading a file. Try
	not to click these before loading, as they might screw some things
	up.


--------------------------------------------
	FINAL WORDS
--------------------------------------------

Welp, that's all I have at the moment. If something doesn't work or you've
found a bug, I'd love to know! Drop me a line at the following E-mail address,
though I can't promise any quick fixes.

Artemis251@yahoo.com

I hope you find the program useful and it helps you trainers sort everything
out! Thanks for downloading my program!

--Artemis251

--EOF



