From e03af7cea089665e967d0a3a234317eab8ae80ab Mon Sep 17 00:00:00 2001 From: vulcandth Date: Wed, 25 Dec 2024 21:27:12 -0600 Subject: [PATCH] Use exported constants for VC patch --- Makefile | 6 +---- constants/gfx_constants.asm | 1 + constants/input_constants.asm | 7 ++++++ constants/map_constants.asm | 4 ++++ constants/move_constants.asm | 10 +++++++++ macros/scripts/battle_anims.asm | 1 + tools/make_patch.c | 13 +++++------ vc/pokecrystal11.constants.asm | 39 --------------------------------- 8 files changed, 30 insertions(+), 51 deletions(-) delete mode 100644 vc/pokecrystal11.constants.asm diff --git a/Makefile b/Makefile index cd3852adaa8..ed76db4b204 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,7 @@ $(pokecrystal_debug_obj): RGBASMFLAGS += -D _DEBUG $(pokecrystal11_debug_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _DEBUG $(pokecrystal11_vc_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL11_VC -%.patch: vc/%.constants.sym %_vc.gbc %.gbc vc/%.patch.template +%.patch: %_vc.gbc %.gbc vc/%.patch.template tools/make_patch $*_vc.sym $^ $@ rgbdscheck.o: rgbdscheck.asm @@ -146,10 +146,6 @@ $(foreach obj, $(pokecrystal_debug_obj), $(eval $(call DEP,$(obj),$(obj:_debug.o $(foreach obj, $(pokecrystal11_debug_obj), $(eval $(call DEP,$(obj),$(obj:11_debug.o=.asm)))) $(foreach obj, $(pokecrystal11_vc_obj), $(eval $(call DEP,$(obj),$(obj:11_vc.o=.asm)))) -# Dependencies for VC files that need to run scan_includes -%.constants.sym: %.constants.asm $(shell tools/scan_includes %.constants.asm) $(preinclude_deps) | rgbdscheck.o - $(RGBASM) $(RGBASMFLAGS) $< > $@ - endif diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index e41fe82c7f9..6330be26c56 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -12,6 +12,7 @@ DEF SCREEN_WIDTH EQU 20 ; tiles DEF SCREEN_HEIGHT EQU 18 ; tiles DEF SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels DEF SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * TILE_WIDTH ; pixels +EXPORT SCREEN_HEIGHT_PX ; needed for VC patch DEF BG_MAP_WIDTH EQU 32 ; tiles DEF BG_MAP_HEIGHT EQU 32 ; tiles diff --git a/constants/input_constants.asm b/constants/input_constants.asm index 8febf47d9ef..557883f8a4f 100644 --- a/constants/input_constants.asm +++ b/constants/input_constants.asm @@ -13,3 +13,10 @@ DEF NO_INPUT EQU %00000000 DEF BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START DEF D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN + +; needed for VC patch +EXPORT NO_INPUT +EXPORT A_BUTTON +EXPORT B_BUTTON +EXPORT D_UP +EXPORT D_DOWN diff --git a/constants/map_constants.asm b/constants/map_constants.asm index 55befd2f7ea..2815c7dd21c 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -502,3 +502,7 @@ ENDM endgroup DEF NUM_MAP_GROUPS EQU const_value ; 26 + +; needed for VC patch +EXPORT MAPGROUP_CIANWOOD +EXPORT MAP_CIANWOOD_PHOTO_STUDIO diff --git a/constants/move_constants.asm b/constants/move_constants.asm index 6112966cb63..b703c92cac6 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -259,6 +259,16 @@ const BEAT_UP ; fb DEF NUM_ATTACKS EQU const_value - 1 +; needed for VC patch +EXPORT FISSURE +EXPORT SELFDESTRUCT +EXPORT THUNDER +EXPORT FLASH +EXPORT EXPLOSION +EXPORT HORN_DRILL +EXPORT HYPER_BEAM +EXPORT PRESENT + ; Battle animations use the same constants as the moves up to this point const_next $ff const ANIM_SWEET_SCENT_2 ; ff diff --git a/macros/scripts/battle_anims.asm b/macros/scripts/battle_anims.asm index 9410f015e50..865fe3b8791 100644 --- a/macros/scripts/battle_anims.asm +++ b/macros/scripts/battle_anims.asm @@ -25,6 +25,7 @@ MACRO anim_obj ENDM const anim_1gfx_command ; $d1 +EXPORT anim_1gfx_command ; needed for VC patch MACRO anim_1gfx db anim_1gfx_command db \1 ; gfx1 diff --git a/tools/make_patch.c b/tools/make_patch.c index 3a36accdd87..706a42ccb84 100644 --- a/tools/make_patch.c +++ b/tools/make_patch.c @@ -1,5 +1,5 @@ #define PROGRAM_NAME "make_patch" -#define USAGE_OPTS "labels.sym constants.sym patched.gbc original.gbc vc.patch.template vc.patch" +#define USAGE_OPTS "labels.sym patched.gbc original.gbc vc.patch.template vc.patch" #include "common.h" @@ -449,20 +449,19 @@ bool verify_completeness(FILE *restrict orig_rom, FILE *restrict new_rom, struct } int main(int argc, char *argv[]) { - if (argc != 7) { + if (argc != 6) { usage_exit(1); } struct Symbol *symbols = NULL; parse_symbols(argv[1], &symbols); - parse_symbols(argv[2], &symbols); - FILE *new_rom = xfopen(argv[3], 'r'); - FILE *orig_rom = xfopen(argv[4], 'r'); - struct Buffer *patches = process_template(argv[5], argv[6], new_rom, orig_rom, symbols); + FILE *new_rom = xfopen(argv[2], 'r'); + FILE *orig_rom = xfopen(argv[3], 'r'); + struct Buffer *patches = process_template(argv[4], argv[5], new_rom, orig_rom, symbols); if (!verify_completeness(orig_rom, new_rom, patches)) { - fprintf(stderr, PROGRAM_NAME ": Warning: Not all ROM differences are defined by \"%s\"\n", argv[6]); + fprintf(stderr, PROGRAM_NAME ": Warning: Not all ROM differences are defined by \"%s\"\n", argv[5]); } symbol_free(symbols); diff --git a/vc/pokecrystal11.constants.asm b/vc/pokecrystal11.constants.asm deleted file mode 100644 index 8410f5f074c..00000000000 --- a/vc/pokecrystal11.constants.asm +++ /dev/null @@ -1,39 +0,0 @@ -; These are all the asm constants needed to make the crystal11_vc patch. - -MACRO vc_const - DEF x = \1 - println "{02x:x} \1" ; same format as rgblink's .sym file -ENDM - -; [fight begin] - vc_const SCREEN_HEIGHT_PX - -; [print forbid 2] - vc_const A_BUTTON -; [print forbid 3] - vc_const MAPGROUP_CIANWOOD - vc_const MAP_CIANWOOD_PHOTO_STUDIO -; [print forbid 5] - vc_const NO_INPUT - vc_const B_BUTTON - vc_const D_UP - vc_const D_DOWN - -; [FPA 001 Begin] - vc_const FISSURE -; [FPA 002 Begin] - vc_const SELFDESTRUCT -; [FPA 003 Begin] - vc_const THUNDER -; [FPA 004 Begin] - vc_const FLASH -; [FPA 005 Begin] - vc_const EXPLOSION -; [FPA 006 Begin] - vc_const HORN_DRILL -; [FPA 007 Begin] - vc_const HYPER_BEAM - -; [FPA 042801 Begin] - vc_const PRESENT - vc_const anim_1gfx_command