1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 23:36:22 +00:00

Fix extract_assets.py --force for text extraction (#1350)

This commit is contained in:
Dragorn421 2022-08-24 02:30:21 +02:00 committed by GitHub
parent fec5cd84af
commit c0f7f4ad26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,7 +89,7 @@ def processZAPDArgs(argsZ):
def main(): def main():
parser = argparse.ArgumentParser(description="baserom asset extractor") parser = argparse.ArgumentParser(description="baserom asset extractor")
parser.add_argument("-s", "--single", help="asset path relative to assets/, e.g. objects/gameplay_keep") parser.add_argument("-s", "--single", help="asset path relative to assets/, e.g. objects/gameplay_keep")
parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones.", action="store_true") parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones, and text (overwriting current files).", action="store_true")
parser.add_argument("-j", "--jobs", help="Number of cpu cores to extract with.") parser.add_argument("-j", "--jobs", help="Number of cpu cores to extract with.")
parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true") parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true")
parser.add_argument("-Z", help="Pass the argument on to ZAPD, e.g. `-ZWunaccounted` to warn about unaccounted blocks in XMLs. Each argument should be passed separately, *without* the leading dash.", metavar="ZAPD_ARG", action="append") parser.add_argument("-Z", help="Pass the argument on to ZAPD, e.g. `-ZWunaccounted` to warn about unaccounted blocks in XMLs. Each argument should be passed separately, *without* the leading dash.", metavar="ZAPD_ARG", action="append")
@ -122,13 +122,16 @@ def main():
ExtractFunc(fullPath) ExtractFunc(fullPath)
else: else:
extract_text_path = "assets/text/message_data.h" extract_text_path = "assets/text/message_data.h"
if os.path.isfile(extract_text_path):
extract_text_path = None
extract_staff_text_path = "assets/text/message_data_staff.h" extract_staff_text_path = "assets/text/message_data_staff.h"
if os.path.isfile(extract_staff_text_path):
extract_staff_text_path = None
# Only extract text if the header does not already exist, or if --force was passed # Only extract text if the header does not already exist, or if --force was passed
if args.force or extract_text_path is not None or extract_staff_text_path is not None: if not args.force:
if os.path.isfile(extract_text_path):
extract_text_path = None
if os.path.isfile(extract_staff_text_path):
extract_staff_text_path = None
if extract_text_path is not None or extract_staff_text_path is not None:
print("Extracting text") print("Extracting text")
from tools import msgdis from tools import msgdis
msgdis.extract_all_text(extract_text_path, extract_staff_text_path) msgdis.extract_all_text(extract_text_path, extract_staff_text_path)