PSE is a go library for interacting and modifying
pokemon generation 3(Ruby/Sapphire/Emerald/Fire Red/Leaf Green) game saves.
PSE supports reading and changing trainer info, inventory and pokemon storage
block regions of the save game.
General control flow is to call NewSafe with a reader of the save file,
modify the struct it retuns and then calling Save.Write() with the output
file writer.
PSE also includes a command line tool pse(1). This tool can be used
to read and write textual representations of data to the save file.
Usage: pse cmd sourcefile <destfile>
Where cmd is one of 'dump' or 'inject' with the later requiring a destfile to be defined.
There also are two flags that are used '-fmt' and '-section' which define the output format
and section to operate on respectivly. The format flag defaults to tab and the section
flag defaults to trainer.
Examples:
# Dump all box information in json
$ pse -section box -fmt json dump ./fire.sav
# Dump trainer information as tab seperated values
$ pse -section trainer -fmt tab dump ./fire.sav
# Give all Bulbasaur the nickname Chuck
$ pse -section box -fmt tab dump ./fire.sav | sed 's/BULBASAUR/Chuck/g' | ./pse -section box inject ./fire.sav ./newfire.sav
# Make every pokemon in your boxes shiny
$ pse -section box dump fire.sav | awk -F '\t' '{
sid = rshift($3, 16);
tid = and($3, 0xFFFF);
p1 = rshift($2, 16);
p2 = and($2, 0xFFFF);
p1 = xor(sid, tid, 7, p2);
$3 = lshift(sid, 16)+tid;
$2 = lshift(p1, 16)+p2;
print $0 }' | pse -section box inject fire.sav newfire.sav