shithub: pokecrystal

Download patch

ref: 7580f1119b2409aeeea1e3ce2f26c0a2c1663756
parent: e239aa4aba89156ac52b2af26d1bbf084ee88e75
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Mon Jul 13 12:10:52 EDT 2020

Port pokegold's method of defining rgblink arguments per ROM

--- a/FAQ.md
+++ b/FAQ.md
@@ -4,7 +4,7 @@
 ## Questions
 
 - [What is pokecrystal11.gbc?](#what-is-pokecrystal11gbc)
-- [What is pokecrystal-au.gbc?](#what-is-pokecrystal-augbc)
+- [What is pokecrystal_au.gbc?](#what-is-pokecrystal_augbc)
 - [I can't build the ROM, `make` just prints an error!](#i-cant-build-the-rom-make-just-prints-an-error)
   - [`gcc`: command not found](#gcc-command-not-found)
   - ["ERROR: `UNION` already defined"](#error-union-already-defined)
@@ -25,9 +25,10 @@
 
 Version 1.1 of Pokémon Crystal, which fixed some issues with the initial international release. `make crystal11` defines `_CRYSTAL11` so the assembly builds the changed version.
 
-## What is pokecrystal-au.gbc?
 
-The Australian release of Pokémon Crystal, which is based on the international 1.1 release but censors gambling references from the Game Corners. `make crystal-au` defines `_CRYSTAL11` and `_CRYSTAL_AU` so the assembly builds the changed version.
+## What is pokecrystal_au.gbc?
+
+The Australian release of Pokémon Crystal, which is based on the international 1.1 release but censors gambling references from the Game Corners. `make crystal_au` defines `_CRYSTAL11` and `_CRYSTAL_AU` so the assembly builds the changed version.
 
 
 ## I can't build the ROM, `make` just prints an error!
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
-roms := pokecrystal.gbc pokecrystal11.gbc pokecrystal-au.gbc pokecrystal-debug.gbc pokecrystal11-debug.gbc
+roms := pokecrystal.gbc pokecrystal11.gbc pokecrystal_au.gbc pokecrystal_debug.gbc pokecrystal11_debug.gbc
 
-crystal_obj := \
+rom_obj := \
 audio.o \
 home.o \
 main.o \
@@ -17,10 +17,11 @@
 gfx/tilesets.o \
 lib/mobile/main.o
 
-crystal11_obj       := $(crystal_obj:.o=11.o)
-crystal_au_obj      := $(crystal_obj:.o=_au.o)
-crystal_debug_obj   := $(crystal_obj:.o=_debug.o)
-crystal11_debug_obj := $(crystal_obj:.o=11_debug.o)
+pokecrystal_obj         := $(rom_obj:.o=.o)
+pokecrystal11_obj       := $(rom_obj:.o=11.o)
+pokecrystal_au_obj      := $(rom_obj:.o=_au.o)
+pokecrystal_debug_obj   := $(rom_obj:.o=_debug.o)
+pokecrystal11_debug_obj := $(rom_obj:.o=11_debug.o)
 
 
 ### Build tools
@@ -41,7 +42,7 @@
 ### Build targets
 
 .SUFFIXES:
-.PHONY: all crystal crystal11 crystal-au crystal-debug crystal11-debug clean tidy compare tools
+.PHONY: all crystal crystal11 crystal_au crystal_debug crystal11_debug clean tidy compare tools
 .SECONDEXPANSION:
 .PRECIOUS:
 .SECONDARY:
@@ -49,18 +50,18 @@
 all: crystal
 crystal:         pokecrystal.gbc
 crystal11:       pokecrystal11.gbc
-crystal-au:      pokecrystal-au.gbc
-crystal-debug:   pokecrystal-debug.gbc
-crystal11-debug: pokecrystal11-debug.gbc
+crystal_au:      pokecrystal_au.gbc
+crystal_debug:   pokecrystal_debug.gbc
+crystal11_debug: pokecrystal11_debug.gbc
 
 clean:
-	rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(crystal_debug_obj) $(crystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
+	rm -f $(roms) $(pokecrystal_obj) $(pokecrystal11_obj) $(pokecrystal_au_obj) $(pokecrystal_debug_obj) $(pokecrystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
 	find gfx \( -name "*.[12]bpp" -o -name "*.lz" -o -name "*.gbcpal" -o -name "*.sgb.tilemap" \) -delete
 	find gfx/pokemon -mindepth 1 ! -path "gfx/pokemon/unown/*" \( -name "bitmask.asm" -o -name "frames.asm" -o -name "front.animated.tilemap" -o -name "front.dimensions" \) -delete
 	$(MAKE) clean -C tools/
 
 tidy:
-	rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(crystal_debug_obj) $(crystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
+	rm -f $(roms) $(pokecrystal_obj) $(pokecrystal11_obj) $(pokecrystal_au_obj) $(pokecrystal_debug_obj) $(pokecrystal11_debug_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
 	$(MAKE) clean -C tools/
 
 compare: $(roms)
@@ -76,11 +77,11 @@
 RGBASMFLAGS += -E
 endif
 
-$(crystal_obj):         RGBASMFLAGS +=
-$(crystal11_obj):       RGBASMFLAGS += -D _CRYSTAL11
-$(crystal_au_obj):      RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL_AU
-$(crystal_debug_obj):   RGBASMFLAGS += -D _DEBUG
-$(crystal11_debug_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _DEBUG
+$(pokecrystal_obj):         RGBASMFLAGS +=
+$(pokecrystal11_obj):       RGBASMFLAGS += -D _CRYSTAL11
+$(pokecrystal_au_obj):      RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL_AU
+$(pokecrystal_debug_obj):   RGBASMFLAGS += -D _DEBUG
+$(pokecrystal11_debug_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _DEBUG
 
 rgbdscheck.o: rgbdscheck.asm
 	$(RGBASM) -o $@ $<
@@ -99,34 +100,25 @@
 
 $(info $(shell $(MAKE) -C tools))
 
-$(foreach obj, $(crystal_obj), $(eval $(call DEP,$(obj),$(obj:.o=.asm))))
-$(foreach obj, $(crystal11_obj), $(eval $(call DEP,$(obj),$(obj:11.o=.asm))))
-$(foreach obj, $(crystal_au_obj), $(eval $(call DEP,$(obj),$(obj:_au.o=.asm))))
-$(foreach obj, $(crystal_debug_obj), $(eval $(call DEP,$(obj),$(obj:_debug.o=.asm))))
-$(foreach obj, $(crystal11_debug_obj), $(eval $(call DEP,$(obj),$(obj:11_debug.o=.asm))))
+# Dependencies for shared objects objects
+$(foreach obj, $(pokecrystal_obj), $(eval $(call DEP,$(obj),$(obj:.o=.asm))))
+$(foreach obj, $(pokecrystal11_obj), $(eval $(call DEP,$(obj),$(obj:11.o=.asm))))
+$(foreach obj, $(pokecrystal_au_obj), $(eval $(call DEP,$(obj),$(obj:_au.o=.asm))))
+$(foreach obj, $(pokecrystal_debug_obj), $(eval $(call DEP,$(obj),$(obj:_debug.o=.asm))))
+$(foreach obj, $(pokecrystal11_debug_obj), $(eval $(call DEP,$(obj),$(obj:11_debug.o=.asm))))
 
 endif
 
 
-pokecrystal.gbc: $(crystal_obj) layout.link
-	$(RGBLINK) -n pokecrystal.sym -m pokecrystal.map -l layout.link -p 0 -o $@ $(crystal_obj)
-	$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
+pokecrystal_opt         = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
+pokecrystal11_opt       = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
+pokecrystal_au_opt      = -Cjv -t PM_CRYSTAL -i BYTU -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
+pokecrystal_debug_opt   = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
+pokecrystal11_debug_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
 
-pokecrystal11.gbc: $(crystal11_obj) layout.link
-	$(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l layout.link -p 0 -o $@ $(crystal11_obj)
-	$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
-
-pokecrystal-au.gbc: $(crystal_au_obj) layout.link
-	$(RGBLINK) -n pokecrystal-au.sym -m pokecrystal-au.map -l layout.link -p 0 -o $@ $(crystal_au_obj)
-	$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTU -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
-
-pokecrystal-debug.gbc: $(crystal_debug_obj) layout.link
-	$(RGBLINK) -n pokecrystal-debug.sym -m pokecrystal-debug.map -l layout.link -p 0 -o $@ $(crystal_debug_obj)
-	$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
-
-pokecrystal11-debug.gbc: $(crystal11_debug_obj) layout.link
-	$(RGBLINK) -n pokecrystal11-debug.sym -m pokecrystal11-debug.map -l layout.link -p 0 -o $@ $(crystal11_debug_obj)
-	$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
+%.gbc: $$(%_obj) layout.link
+	$(RGBLINK) -n $*.sym -m $*.map -l layout.link -o $@ $(filter %.o,$^)
+	$(RGBFIX) $($*_opt) $@
 
 
 ### LZ compression rules
--- a/roms.sha1
+++ b/roms.sha1
@@ -1,5 +1,5 @@
 f4cd194bdee0d04ca4eac29e09b8e4e9d818c133 *pokecrystal.gbc
 f2f52230b536214ef7c9924f483392993e226cfb *pokecrystal11.gbc
-a0fc810f1d4e124434f7be2c989ab5b5892ddf36 *pokecrystal-au.gbc
-c60d57a24bbe8ecf7cba54ab3f90669f97bd330d *pokecrystal-debug.gbc
-391ae86b1d5a26db712ffe6c28bbf2a1f804c3c4 *pokecrystal11-debug.gbc
+a0fc810f1d4e124434f7be2c989ab5b5892ddf36 *pokecrystal_au.gbc
+c60d57a24bbe8ecf7cba54ab3f90669f97bd330d *pokecrystal_debug.gbc
+391ae86b1d5a26db712ffe6c28bbf2a1f804c3c4 *pokecrystal11_debug.gbc