~moody/pse

pse/README -rw-r--r-- 1.5 KiB
e4de17d5 — Jacob Moody Introduce pse(1) 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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