Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MathyFurret committed Sep 17, 2021
0 parents commit 51e4371
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bsp/bspcomp
*.bsp
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "bsp"]
path = bsp
url = https://github.com/aaaaaa123456789/bsp
ignore = dirty
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
conquestsavefiletools.bsp: bsp/bspcomp *.bsps
./bsp/bspcomp main.bsps conquestsavefiletools.bsp

bsp/bspcomp: bsp/bspcomp.c
gcc -o bsp/bspcomp bsp/bspcomp.c

clean:
rm *.bsp
rm bsp/bspcomp
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Conquest Save File Patcher

BSP scrips that work on Pokemon Conquest save data

## Download the patch script

(todo: add releases page)

## Building the project yourself

On Linux, Mac, or WSL:

git clone --recurse-submodules https://github.com/MathyFurret/conquestsavefiletools
cd conquestsavefiletools
make

This builds conquestsavefiletools.bsp. GCC is used to build the BSP compiler; to use a different C compiler, simply run a command that builds `bsp/bspcomp` yourself.

## Patching your save

Go to https://aaaaaa123456789.github.io/bsp/. Drop the .bsp under "Patch file" and your save file under "Input file", then click "Begin patching" and select the patch you want.
1 change: 1 addition & 0 deletions bsp
Submodule bsp added at 1553f2
21 changes: 21 additions & 0 deletions main.bsps
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
main:
print .message1
print .message2
print .message3
menu #0, .options
jumptable #0
dw Max_IVs

.message1
string "Mathy's Conquest Save File Tools v0.0"
.message2
string "Use only for a Pokemon Conquest (USA) save file."
.message3
string "What would you like to do?"
.options
dw .option1
dw -1
.option1
string "Max out all IVs (only option currently)"

include "maxivs.bsps"
58 changes: 58 additions & 0 deletions maxivs.bsps
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
define GALLERY_BLOCK_OFFSET, 0x78b6
define HEADER_LENGTH, 0x18
define WARRIOR_LIST_LENGTH, 0xe10
define TOTAL_LENGTH, 0x3c84

define FORRETRESS, 56
define NUM_POKEMON, 1000

define i, 0
define species, 1
define checksum, 2

Max_IVs:
add #0, GALLERY_BLOCK_OFFSET, HEADER_LENGTH
add #0, WARRIOR_LIST_LENGTH
seek #0
xor #i, #i
.loop
readword #species
and #species, 0xff

lockpos
readword #2
or #2, 0x3fff8000
unlockpos
writeword #2

lockpos
readword #2
unlockpos
ifne #species, FORRETRESS, .not_forretress

xor #3, 0x1f, 0xffffffff
and #2, #3
jump .endif
.not_forretress
or #2, 0x1f
.endif
writeword #2

increment #i
iflt #i, NUM_POKEMON, .loop

; calculate checksum
add #0, GALLERY_BLOCK_OFFSET, HEADER_LENGTH
seek #0
xor #i, #i
xor #checksum, #checksum
.checksum_loop
readbyte #3
add #checksum, #3
increment #i
iflt #i, TOTAL_LENGTH, .checksum_loop

seek GALLERY_BLOCK_OFFSET
writeword #checksum

return

0 comments on commit 51e4371

Please sign in to comment.