Skip to content

Commit

Permalink
Merge pull request #3 from kanzure/proposed-yenatch-master
Browse files Browse the repository at this point in the history
Proposed merge of kanzure/master into yenatch/master
  • Loading branch information
yenatch committed Aug 30, 2013
2 parents b86d0da + d2333a9 commit 0b36af8
Show file tree
Hide file tree
Showing 41 changed files with 85 additions and 19,561 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "extras"]
path = extras
url = git://github.com/kanzure/pokemon-reverse-engineering-tools.git
39 changes: 26 additions & 13 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ md5: 9f2922b235a5eeb78d65594e82ef5dde

Save it as **baserom.gbc** in the repository.


Feel free to ask us on
**[nucleus.kafuka.org #skeetendo](https://kiwiirc.com/client/irc.nolimitzone.com/?#skeetendo)**
if something goes wrong.



# Windows

If you're on Windows and can't install Linux, **Cygwin** is a great alternative.
Expand All @@ -39,7 +36,6 @@ During the install:
* **python-setuptools**
* **unzip**


## Using Cygwin

Launch the **Cygwin terminal**.
Expand All @@ -56,7 +52,6 @@ pwd
cd /away/we/go
```


## Getting up and running

We need three things to assemble the source into a rom.
Expand All @@ -65,8 +60,6 @@ We need three things to assemble the source into a rom.
2. a **pokecrystal** repository
3. a **base rom**

-

We use **rgbds** to spit out a Game Boy rom from source.
```bash
cd /usr/local/bin
Expand Down Expand Up @@ -96,10 +89,17 @@ md5: 9f2922b235a5eeb78d65594e82ef5dde

Name it **baserom.gbc**.

-
**pokecrystal** only compiles with the use of a git submodule. To activate the submodule type:

```
git submodule init
git submodule update
```

Now you should be able to build **pokecrystal.gbc** for the first time.
This assembles a new rom from the source code.

This compiles a new rom from the source code, with any patches filled in from the base rom.

```bash
make
```
Expand All @@ -112,8 +112,6 @@ Your first build processes every source file at once.
After that, **only modified source files have to be processed again**,
so compiling again should be a few seconds faster.



# Linux

```bash
Expand All @@ -131,7 +129,16 @@ cd ..
# download pokecrystal
git clone git://github.com/kanzure/pokecrystal.git
cd pokecrystal
pip install -r requirements.txt

# grab extras/ which is required for compiling
git submodule init
git submodule update

# install python requirements
pip install -r extras/requirements.txt

# use hexdump to diff binary files
git config diff.hex.textconv hexdump
```

Put your base rom in the pokecrystal repository. Name it **baserom.gbc**.
Expand All @@ -145,7 +152,6 @@ That will take between 3 and 15 seconds, depending on your computer.
If you see `cmp baserom.gbc pokecrystal.gbc` as the last line, the build was successful! Rejoice!



# Now what?

**[pokecrystal.asm](https://github.com/kanzure/pokecrystal/blob/master/pokecrystal.asm)** is a good starting point.
Expand All @@ -169,3 +175,10 @@ We'll be happy to answer any **questions** on
**[nucleus.kafuka.org #skeetendo](https://kiwiirc.com/client/irc.nolimitzone.com/?#skeetendo)**.


Other **make targets** that may come in handy:

`make clean` deletes any preprocessed source files (.tx), rgbds object files and pokecrystal.gbc, in case something goes wrong.

`make pngs` decompresses any **lz** files in gfx/ and then exports any graphics files to **png**.

`make lzs` does the reverse. This is already part of the build process, so **modified pngs will automatically be converted to 2bpp and lz-compressed** without any additional work.
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ PNG_GFX := $(shell find gfx/ -type f -name '*.png')
LZ_GFX := $(shell find gfx/ -type f -name '*.lz')
TWOBPP_GFX := $(shell find gfx/ -type f -name '*.2bpp')

all: pokecrystal.gbc
cmp baserom.gbc $<
all: baserom.gbc pokecrystal.gbc
cmp baserom.gbc pokecrystal.gbc
clean:
rm -f pokecrystal.o pokecrystal.gbc
@echo 'rm -f $(TEXTFILES:.asm=.tx)'
Expand All @@ -19,27 +19,30 @@ pokecrystal.o: $(TEXTFILES:.asm=.tx) wram.asm constants.asm $(shell find constan
.asm.tx:
$(eval TEXTQUEUE := $(TEXTQUEUE) $<)
@rm -f $@
baserom.gbc:
python -c "import os; assert 'baserom.gbc' in os.listdir('.'), 'Wait! Need baserom.gbc first. Check README and INSTALL for details.';"

pokecrystal.gbc: pokecrystal.o
rgblink -n pokecrystal.sym -m pokecrystal.map -o $@ $<
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@

pngs:
cd extras && python gfx.py mass-decompress && python gfx.py dump-pngs
python extras/pokemontools/gfx.py mass-decompress
python extras/pokemontools/gfx.py dump-pngs

lzs: $(LZ_GFX) $(TWOBPP_GFX)
@:

gfx/pics/%/front.lz: gfx/pics/%/tiles.2bpp gfx/pics/%/front.png
python extras/gfx.py png-to-lz --front $^
python extras/pokemontools/gfx.py png-to-lz --front $^
gfx/pics/%/tiles.2bpp: gfx/pics/%/tiles.png
python extras/gfx.py png-to-2bpp $<
python extras/pokemontools/gfx.py png-to-2bpp $<
gfx/pics/%/back.lz: gfx/pics/%/back.png
python extras/gfx.py png-to-lz --vert $<
python extras/pokemontools/gfx.py png-to-lz --vert $<
gfx/trainers/%.lz: gfx/trainers/%.png
python extras/gfx.py png-to-lz --vert $<
python extras/pokemontools/gfx.py png-to-lz --vert $<
.png.lz:
python extras/gfx.py png-to-lz $<
python extras/pokemontools/gfx.py png-to-lz $<
.png.2bpp:
python extras/gfx.py png-to-lz $<
python extras/pokemontools/gfx.py png-to-lz $<

1 change: 1 addition & 0 deletions extras
Submodule extras added at 016f02
Loading

0 comments on commit 0b36af8

Please sign in to comment.