mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-23 04:49:45 +00:00
Small Misc Tooling (#1668)
* Move .extracted_assets.json to extracted folder * .options.mk * Move extract assets to tools folder * .make_options.mk * gitignore as well * Remove duplicate import
This commit is contained in:
parent
629584b1bc
commit
d925976c82
1
.gitignore
vendored
1
.gitignore
vendored
@ -58,4 +58,5 @@ docs/doxygen/
|
||||
# Per-user configuration
|
||||
.python-version
|
||||
.make_options
|
||||
.make_options.mk
|
||||
.*env
|
||||
|
8
Makefile
8
Makefile
@ -1,7 +1,7 @@
|
||||
# Build options can be changed by modifying the makefile or by building with 'make SETTING=value'.
|
||||
# It is also possible to override the settings in Defaults in a file called .make_options as 'SETTING=value'.
|
||||
# It is also possible to override the settings in Defaults in a file called .make_options.mk as 'SETTING=value'.
|
||||
|
||||
-include .make_options
|
||||
-include .make_options.mk
|
||||
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
|
||||
@ -433,7 +433,7 @@ assetclean:
|
||||
$(RM) -r $(ASSET_BIN_DIRS)
|
||||
$(RM) -r $(BUILD_DIR)/assets
|
||||
$(RM) -r assets/text/*.h
|
||||
$(RM) -r .extracted-assets.json
|
||||
$(RM) -r $(EXTRACTED_DIR)/.extracted-assets.json
|
||||
|
||||
distclean: assetclean clean
|
||||
$(RM) -r asm data extracted
|
||||
@ -457,7 +457,7 @@ setup-audio:
|
||||
$(AUDIO_EXTRACT) -o $(EXTRACTED_DIR) -v $(VERSION) --read-xml
|
||||
|
||||
assets:
|
||||
$(PYTHON) extract_assets.py $(EXTRACTED_DIR)/baserom assets -j$(N_THREADS) -Z Wno-hardcoded-pointer
|
||||
$(PYTHON) tools/extract_assets.py $(EXTRACTED_DIR)/baserom assets -j$(N_THREADS) -Z Wno-hardcoded-pointer -v $(VERSION)
|
||||
$(AUDIO_EXTRACT) -o $(EXTRACTED_DIR) -v $(VERSION) --read-xml
|
||||
|
||||
## Assembly generation
|
||||
|
@ -5,8 +5,6 @@ from pathlib import Path
|
||||
|
||||
colorama.init()
|
||||
|
||||
EXTRACTED_ASSETS_NAMEFILE = ".extracted-assets.json"
|
||||
|
||||
dontGenerateCFilesList = [
|
||||
"map_grand_static",
|
||||
"map_i_static",
|
||||
@ -95,6 +93,7 @@ def main():
|
||||
type=Path,
|
||||
help="Output directory to place files in",
|
||||
)
|
||||
parser.add_argument("-v", "--version", help="Which version should be processed", default="n64-us")
|
||||
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("-j", "--jobs", help="Number of cpu cores to extract with.")
|
||||
@ -128,9 +127,10 @@ def main():
|
||||
manager = multiprocessing.Manager()
|
||||
signal.signal(signal.SIGINT, SignalHandler)
|
||||
|
||||
extractedAssetsFile = Path("extracted") / args.version / ".extracted-assets.json"
|
||||
extractedAssetsTracker = manager.dict()
|
||||
if not args.force and os.path.exists(EXTRACTED_ASSETS_NAMEFILE):
|
||||
with open(EXTRACTED_ASSETS_NAMEFILE, encoding='utf-8') as f:
|
||||
if not args.force and extractedAssetsFile.exists():
|
||||
with extractedAssetsFile.open(encoding='utf-8') as f:
|
||||
extractedAssetsTracker.update(json.load(f, object_hook=manager.dict))
|
||||
|
||||
extract_text_path = outputDir / "text/message_data.h"
|
||||
@ -139,11 +139,11 @@ def main():
|
||||
asset_path = args.single
|
||||
if asset_path is not None:
|
||||
if "text/" in asset_path:
|
||||
from tools.msg.nes import msgdisNES
|
||||
from msg.nes import msgdisNES
|
||||
print("Extracting message_data")
|
||||
msgdisNES.main(extract_text_path)
|
||||
|
||||
from tools.msg.staff import msgdisStaff
|
||||
from msg.staff import msgdisStaff
|
||||
print("Extracting staff_message_data")
|
||||
msgdisStaff.main(extract_staff_text_path)
|
||||
else:
|
||||
@ -160,12 +160,12 @@ def main():
|
||||
else:
|
||||
# Only extract text if the header does not already exist, or if --force was passed
|
||||
if args.force or not os.path.isfile(extract_text_path):
|
||||
from tools.msg.nes import msgdisNES
|
||||
from msg.nes import msgdisNES
|
||||
print("Extracting message_data")
|
||||
msgdisNES.main(baseromSegmentsDir, extract_text_path)
|
||||
|
||||
if args.force or not os.path.isfile(extract_staff_text_path):
|
||||
from tools.msg.staff import msgdisStaff
|
||||
from msg.staff import msgdisStaff
|
||||
print("Extracting staff_message_data")
|
||||
msgdisStaff.main(baseromSegmentsDir, extract_staff_text_path)
|
||||
|
||||
@ -191,7 +191,7 @@ def main():
|
||||
for singlePath in xmlFiles:
|
||||
ExtractFunc(singlePath)
|
||||
|
||||
with open(EXTRACTED_ASSETS_NAMEFILE, 'w', encoding='utf-8') as f:
|
||||
with extractedAssetsFile.open('w', encoding='utf-8') as f:
|
||||
serializableDict = dict()
|
||||
for xml, data in extractedAssetsTracker.items():
|
||||
serializableDict[xml] = dict(data)
|
Loading…
Reference in New Issue
Block a user