Removed Globs

Figured out how to pass src files from meson to python.
Removed all file names from scripts so that can all be handled in meson
This commit is contained in:
h2o-DS 2024-11-30 17:03:33 -05:00
parent 38bca5acb9
commit f671b0ee0e
6 changed files with 58 additions and 57 deletions

View File

@ -250,6 +250,7 @@ pokedex_enc_platinum_narc = custom_target('zukan_enc_platinum.narc',
'--honey-file', '@INPUT1@',
'--trophy-file', '@INPUT2@',
'--marsh-file', '@INPUT3@',
zukan_enc_platinum_srcs
]
)

View File

@ -799,7 +799,8 @@ pokedex_data_narc = custom_target('zukan_data.narc',
'--source-dir', '@CURRENT_SOURCE_DIR@',
'--private-dir', '@PRIVATE_DIR@',
'--output-dir', '@OUTDIR@',
'giratina_origin'
'giratina_origin',
pokedex_data_srcs
]
)
@ -814,7 +815,8 @@ pokedex_data_giratina_altered_narc = custom_target('zukan_data_gira.narc',
'--source-dir', '@CURRENT_SOURCE_DIR@',
'--private-dir', '@PRIVATE_DIR@',
'--output-dir', '@OUTDIR@',
'giratina_altered'
'giratina_altered',
pokedex_data_srcs
]
)

View File

@ -756,16 +756,14 @@ pokedex_message_banks = custom_target('pokedex_message_banks',
'message_bank_species_name_number_3.gmm',
'message_bank_species_category.gmm'
],
input: [
message_banks_narc_order,
pokedex_data_srcs
],
input: pokedex_data_srcs,
env: json2bin_env,
depends: [ py_consts_generators ],
command: [
make_pokedex_message_banks_py,
'--source-dir', '@CURRENT_SOURCE_DIR@',
'--output-dir', '@OUTDIR@'
'--output-dir', '@OUTDIR@',
pokedex_data_srcs
]
)

View File

@ -27,6 +27,9 @@ argparser.add_argument('-o', '--output-dir',
help='Path to the output directory (where the NARC will be made)')
argparser.add_argument('giratina_form',
help='String of either giratina_origin or giratina_altered')
argparser.add_argument('src_files',
nargs='+',
help='List of files to process in-order')
args = argparser.parse_args()
source_dir = pathlib.Path(args.source_dir)
@ -64,19 +67,17 @@ heightData = [0 for i in range(NUM_POKEMON)]
weightData = [0 for i in range(NUM_POKEMON)]
nameData = ['' for i in range(NUM_POKEMON)]
for i, species in enumerate(PokemonSpecies):
subdir = species.name
subdir = subdir[8:].lower()
if subdir == 'none':
subdir = '000'
# Do not attempt to process eggs
if subdir in ['egg', 'bad_egg']:
continue
with open(source_dir / subdir / 'data.json', 'r', encoding='utf-8') as data_file:
for i, file in enumerate(args.src_files):
with open(file, 'r', encoding='utf-8') as data_file:
pkdata = json.load(data_file)
pk_name = pkdata['name'].lower()
# Do not attempt to process eggs
if pk_name in ['egg', 'bad egg']:
continue
pkdexdata = pkdata['pokedex_data']
if subdir == 'giratina':
if pk_name == 'giratina':
if args.giratina_form == 'giratina_origin':
pkdexdata = pkdexdata[0]
if args.giratina_form == 'giratina_altered':
@ -109,7 +110,7 @@ for i, species in enumerate(PokemonSpecies):
# store for later
heightData[i-1] = pkdexdata['height']
weightData[i-1] = pkdexdata['weight']
nameData[i-1] = subdir.replace('porygon2','porygon_z2')
nameData[i-1] = pk_name.replace('porygon2','porygon-z2')
# sinnoh dex order
with open(source_dir / 'sinnoh_pokedex.json') as data_file:

View File

@ -35,6 +35,9 @@ argparser.add_argument('-g', '--trophy-file',
argparser.add_argument('-m', '--marsh-file',
required=True,
help='encounter file for the Great Marsh Lookout')
argparser.add_argument('src_files',
nargs='+',
help='List of files to process in-order')
args = argparser.parse_args()
source_dir = pathlib.Path(args.source_dir)
@ -281,12 +284,10 @@ field_night = [set() for species in range(NUM_POKEMON)]
field_special = [set() for species in range(NUM_POKEMON)]
field_special_natdex = [set() for species in range(NUM_POKEMON)]
for file in source_dir.glob('encounters_*.json'):
for file in args.src_files:
with open(file, encoding='utf-8') as encounter_file:
enc_data = json.load(encounter_file)
file = str(file)
if (file == args.honey_file):
for species in enc_data['common']:
for map_num in honey_tree_dungeons:

View File

@ -16,6 +16,9 @@ argparser.add_argument('-s', '--source-dir',
argparser.add_argument('-o', '--output-dir',
required=True,
help='Path to the output directory (where the gmm files will be made)')
argparser.add_argument('src_files',
nargs='+',
help='List of files to process in-order')
args = argparser.parse_args()
source_dir = pathlib.Path(args.source_dir)
@ -57,58 +60,52 @@ def Convert_Height(decimeters):
# variables
NUM_POKEMON = len(PokemonSpecies)
nameData = ['' for i in range(NUM_POKEMON)]
nameArticles = ['' for i in range(NUM_POKEMON)]
dexEntries = ['' for i in range(NUM_POKEMON-2)]
name_data = ['' for i in range(NUM_POKEMON)]
name_articles = ['' for i in range(NUM_POKEMON)]
dex_entries = ['' for i in range(NUM_POKEMON-2)]
heights = ['' for i in range(NUM_POKEMON-2)]
heights_gira = ['' for i in range(NUM_POKEMON-2)]
weights = ['' for i in range(NUM_POKEMON-2)]
weights_gira = ['' for i in range(NUM_POKEMON-2)]
nameNumber = ['' for i in range(NUM_POKEMON-2)]
dexCategories = ['' for i in range(NUM_POKEMON-2)]
name_number = ['' for i in range(NUM_POKEMON-2)]
dex_categories = ['' for i in range(NUM_POKEMON-2)]
# collect data
for i, species in enumerate(PokemonSpecies):
subdir = species.name
subdir = subdir[8:].lower()
if subdir == 'none':
subdir = '000'
with open(source_dir / '../pokemon' / subdir / 'data.json', 'r', encoding='utf-8') as data_file:
for i, file in enumerate(args.src_files):
with open(file, 'r', encoding='utf-8') as data_file:
pkdata = json.load(data_file)
pokemon_name = pkdata['name']
if subdir not in ['egg', 'bad_egg']:
pokemonName = pkdata['name'].upper()
else:
pokemonName = pkdata['name']
if pokemon_name not in ['Egg', 'Bad Egg']:
pokemon_name = pokemon_name.upper()
nameData[i] = pokemonName
name_data[i] = pokemon_name
if pokemonName[0] in ['A','E','I','O','U']:
nameArticles[i] = 'an {COLOR 255}' + pokemonName + '{COLOR 0}'
if pokemon_name[0] in ['A','E','I','O','U']:
name_articles[i] = 'an {COLOR 255}' + pokemon_name + '{COLOR 0}'
else:
nameArticles[i] = 'a {COLOR 255}' + pokemonName + '{COLOR 0}'
name_articles[i] = 'a {COLOR 255}' + pokemon_name + '{COLOR 0}'
# eggs do not have dex entries
if subdir in ['egg', 'bad_egg']:
if pokemon_name in ['Egg', 'Bad Egg']:
continue
nameNumber[i] = f'{i:03} ' + pokemonName
name_number[i] = f'{i:03} ' + pokemon_name
pkdexdata = pkdata['pokedex_data']
if subdir == 'giratina':
if pokemon_name == 'GIRATINA':
heights_gira[i] = Convert_Height(pkdexdata[1]['height'])
weights_gira[i] = Convert_weight(pkdexdata[1]['weight'])
pkdexdata = pkdexdata[0]
else:
heights_gira[i] = Convert_Height(pkdexdata['height'])
weights_gira[i] = Convert_weight(pkdexdata['weight'])
dexEntries[i] = str(pkdexdata['entry_text']).replace('\n','\\n')
dexCategories[i] = pkdexdata['category']
dex_entries[i] = str(pkdexdata['entry_text']).replace('\n','\\n')
dex_categories[i] = pkdexdata['category']
heights[i] = Convert_Height(pkdexdata['height'])
weights[i] = Convert_weight(pkdexdata['weight'])
if subdir == '000':
nameNumber[i] = '----------'
if pokemon_name == '-----':
name_number[i] = '----------'
heights[i] = '?????”'
heights_gira[i] = '?????”'
weights[i] = '????.? lbs.'
@ -132,7 +129,8 @@ fileKeys = [
'59681',
'63572',
'25297',
'64639', '5013',
'64639',
'5013',
'28660',
'32249',
'32250',
@ -153,17 +151,17 @@ fileNumber = [
718
]
fileArrays = [
nameData,
nameArticles,
dexEntries,
name_data,
name_articles,
dex_entries,
weights,
weights_gira,
heights,
heights_gira,
nameNumber,
nameNumber,
nameNumber,
dexCategories
name_number,
name_number,
name_number,
dex_categories
]
fileData = [bytes() for i in range(len(fileNames))]
emptyString = 'empty_string'