From dc457dfdf255af2059a976b49efc679c5666ef44 Mon Sep 17 00:00:00 2001 From: FexCollects Date: Tue, 15 Jul 2025 20:21:19 -0600 Subject: [PATCH] [build] Fix incorrect region on some cards (#24) --- giftpokemon/Makefile | 2 +- ribbons/Makefile | 2 +- scripts/ereadertext.py | 13 +++++++++++++ scripts/regionalize.py | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/giftpokemon/Makefile b/giftpokemon/Makefile index 63b2c4e..41070b6 100644 --- a/giftpokemon/Makefile +++ b/giftpokemon/Makefile @@ -40,7 +40,7 @@ build/00-G000-%.z80: build/00-G000-%.gbc python3 ../scripts/stripgbc.py $< $@ build/00-G000-%.vpk: build/00-G000-%.z80 ../bin/nedc/v1.4/nevpk -c -i $< -o $@ -build/00-G000-%.raw: build/00-G000-%.vpk +build/00-G000-%-01.raw: build/00-G000-%.vpk ../bin/nedc/v1.4/nedcmake -i $< -o $(subst -01.raw,,$@) -type 1 -region 1 .PRECIOUS: build/00-G000-%.tx build/00-G000-%.o build/00-G000-%.gbc build/00-G000-%.z80 build/00-G000-%.vpk build/00-G000-%-01.raw diff --git a/ribbons/Makefile b/ribbons/Makefile index 28e4925..1c133d8 100644 --- a/ribbons/Makefile +++ b/ribbons/Makefile @@ -38,7 +38,7 @@ build/00-R000-%.z80: build/00-R000-%.gbc python3 ../scripts/stripgbc.py $< $@ build/00-R000-%.vpk: build/00-R000-%.z80 ../bin/nedc/v1.4/nevpk -c -i $< -o $@ -build/00-R000-%.raw: build/00-R000-%.vpk +build/00-R000-%-01.raw: build/00-R000-%.vpk ../bin/nedc/v1.4/nedcmake -i $< -o $(subst -01.raw,,$@) -type 1 -region 1 .PRECIOUS: build/00-R000-%.tx build/00-R000-%.o build/00-R000-%.gbc build/00-R000-%.z80 build/00-R000-%.vpk build/00-R000-%-01.raw diff --git a/scripts/ereadertext.py b/scripts/ereadertext.py index 70cd664..783e747 100644 --- a/scripts/ereadertext.py +++ b/scripts/ereadertext.py @@ -4,6 +4,19 @@ from asmquote import asmQuote region = sys.argv[3] +valid_regions = [ + 'JP', + 'EN', + 'FR', + 'IT', + 'DE', + 'ES', +] + +if region not in valid_regions: + print("Invalid region") + sys.exit(1) + out = open(sys.argv[2], 'w') with open(sys.argv[1], 'r') as f: diff --git a/scripts/regionalize.py b/scripts/regionalize.py index 19b8848..fb99507 100644 --- a/scripts/regionalize.py +++ b/scripts/regionalize.py @@ -6,6 +6,23 @@ from asmquote import asmQuoteBytes data_region = sys.argv[3] # determines region code text_region = sys.argv[4] # determines string translation +valid_regions = [ + 'JP', + 'EN', + 'FR', + 'IT', + 'DE', + 'ES', +] + +if data_region not in valid_regions: + print("Invalid data region") + sys.exit(1) + +if text_region not in valid_regions: + print("Invalid text region") + sys.exit(1) + out = open(sys.argv[2], 'w') with open(sys.argv[1], 'r') as f: