shithub: pokecrystal

Download patch

ref: 0b36af8da526ef1389d2c08bb61d6ea5fdb41f2e
parent: b86d0da040448f286aa65ff5b2bacb05fff200a8
parent: d2333a90c9eed0be38d722bfcd0d8b5dee0e56a7
author: yenatch <[email protected]>
date: Fri Aug 30 09:33:09 EDT 2013

Merge pull request #3 from kanzure/proposed-yenatch-master

Proposed merge of kanzure/master into yenatch/master

git/query: bad hash 016f0206b5029fc83a6200be29b0f980c76dfd90
--- /dev/null
+++ b/.gitmodules
@@ -1,0 +1,3 @@
+[submodule "extras"]
+	path = extras
+	url = git://github.com/kanzure/pokemon-reverse-engineering-tools.git
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -9,13 +9,10 @@
 
 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.
@@ -39,7 +36,6 @@
  * **python-setuptools**
  * **unzip**
 
-
 ## Using Cygwin
 
 Launch the **Cygwin terminal**.
@@ -56,7 +52,6 @@
 cd /away/we/go
 ```
 
-
 ## Getting up and running
 
 We need three things to assemble the source into a rom.
@@ -65,8 +60,6 @@
 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
@@ -96,10 +89,17 @@
 
 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
 ```
@@ -112,8 +112,6 @@
 After that, **only modified source files have to be processed again**,
 so compiling again should be a few seconds faster.
 
-
-
 # Linux
 
 ```bash
@@ -131,7 +129,16 @@
 # 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**.
@@ -145,7 +152,6 @@
 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.
@@ -169,3 +175,10 @@
 **[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.
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,8 @@
 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)'
@@ -19,6 +19,8 @@
 .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 $@ $<
@@ -25,21 +27,22 @@
 	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 $<