From d0081fb83e3d060c7b9ce81fe35446cc66e5971a Mon Sep 17 00:00:00 2001 From: farisawan-2000 Date: Sat, 16 Jan 2021 16:53:37 -0500 Subject: [PATCH] added make setup target --- Makefile | 32 +++++++++++++++++--------------- extract_assets.py | 6 +++++- tools/decompile_geos.py | 4 ++++ 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 57e634ed..92644da5 100644 --- a/Makefile +++ b/Makefile @@ -123,14 +123,14 @@ CC_TEST := gcc -Wall ######################## Targets ############################# NOEXTRACT ?= 0 -ifeq ($(VERBOSE),1) - DUMMY != ./extract_assets.py $(VERSION) >&2 || echo FAIL -else - DUMMY != ./extract_assets.py $(VERSION) CI >&2 || echo FAIL -endif -ifeq ($(DUMMY),FAIL) - $(error Failed to extract assets) -endif +# ifeq ($(VERBOSE),1) +# DUMMY != ./extract_assets.py $(VERSION) >&2 || echo FAIL +# else +# DUMMY != ./extract_assets.py $(VERSION) CI >&2 || echo FAIL +# endif +# ifeq ($(DUMMY),FAIL) +# $(error Failed to extract assets) +# endif ALL_DIRS = $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(ASSET_DIRS) $(SRC_DIRS) $(INCLUDE_DIRS) $(ASM_DIRS) $(TEXTURES_DIR)/raw $(TEXTURES_DIR)/standalone $(UCODE_DIRS)) @@ -148,10 +148,7 @@ ifeq ($(DUMMY),FAIL) endif # Making submodules -DUMMY != make -C libreultra -j4 -DUMMY != make -C libreultra naudio -j4 -DUMMY != make -C tools -j4 -DUMMY != make -C f3dex2 VERSION=2.04H ARMIPS=../tools/armips + default: all @@ -216,9 +213,6 @@ $(BUILD_DIR)/data/%.o: data/%.c # $(CC_TEST) -c $(INCLUDE_CFLAGS) -o $@ $< $(CC) -c $(CFLAGS) -o $@ $< -assets/geo/%.c: assets/geo/%.bin - python3 tools/scut/GeoFromBin.py $< $@ - $(BUILD_DIR)/assets/geo/%.o: assets/geo/%.c $(CC) -c $(CFLAGS) -o $@ $< @@ -256,6 +250,14 @@ test: $(BUILD_DIR)/$(TARGET).z64 load: $(BUILD_DIR)/$(TARGET).z64 $(LOADER) $(LOADER_FLAGS) $< +setup: $(ASSET_C_FILES) + make -C libreultra -j4 + make -C libreultra naudio -j4 + make -C tools -j4 + make -C f3dex2 VERSION=2.04H ARMIPS=../tools/armips + make -C tools + ./extract_assets.py $(VERSION) + .PHONY: all clean default diff test distclean # Remove built-in rules, to improve performance diff --git a/extract_assets.py b/extract_assets.py index 27fb8e78..c863bcd0 100755 --- a/extract_assets.py +++ b/extract_assets.py @@ -146,7 +146,6 @@ def main(): # Go through the assets in roughly alphabetical order (but assets in the same # compressed block still go together). keys = sorted(list(todo.keys()), key=lambda k: todo[k][0][0]) - # Import new assets for key in keys: assets = todo[key] @@ -250,6 +249,11 @@ def main(): else: with open(asset, "wb") as f: f.write(input) + if "geo" in asset: + if "bank_0" in asset or "bank_1" in asset or "bank_2" in asset: + asset_c = asset[:-3] + "c" + print("Converting %s to C..." % asset) + subprocess.run("python3 tools/scut/GeoFromBin.py %s %s" % (asset, asset_c), shell=True) # Remove old assets for asset in previous_assets: diff --git a/tools/decompile_geos.py b/tools/decompile_geos.py index ec3f5476..a0a57ca2 100644 --- a/tools/decompile_geos.py +++ b/tools/decompile_geos.py @@ -7,6 +7,10 @@ if "--clean" in ''.join(sys.argv): subprocess.run("rm assets/geo/bank_0/**/block.c", shell=True) subprocess.run("rm assets/geo/bank_1/**/block.c", shell=True) subprocess.run("rm assets/geo/bank_2/**/block.c", shell=True) + subprocess.run("rm assets/geo/bank_3/**/block.c", shell=True) + subprocess.run("rm assets/geo/bank_4/**/block.c", shell=True) + subprocess.run("rm assets/geo/bank_6/**/block.c", shell=True) + subprocess.run("rm assets/geo/bank_7/**/block.c", shell=True) exit(0) for i in sorted(glob.glob("assets/geo/bank_*/**/block.bin")):