Added LEGACY_RES Flag

This commit is contained in:
DorfDork 2020-08-18 06:55:51 -05:00
parent 0ca30fbd7e
commit ae1eaab79c
2 changed files with 31 additions and 77 deletions

View file

@ -43,9 +43,7 @@ TEXTURE_FIX ?= 0
# Enable extended options menu by default
EXT_OPTIONS_MENU ?= 1
# Disable text-based save-files by default
TEXTSAVES ?= 0
# Load resources from external files
EXTERNAL_DATA ?= 0
TEXTSAVES ?= 1
# Enable Discord Rich Presence
DISCORDRPC ?= 0
@ -65,8 +63,7 @@ AUDIO_API ?= SDL2
# Controller backends (can have multiple, space separated): SDL2
CONTROLLER_API ?= SDL2
# Misc settings for EXTERNAL_DATA
LEGACY_RES ?= 0
BASEDIR ?= res
# Automatic settings for PC port(s)
@ -595,14 +592,14 @@ ifeq ($(LEGACY_GL),1)
CFLAGS += -DLEGACY_GL
endif
# TODO: Remove -DEXTERNAL_DATA
# Load external textures
ifeq ($(EXTERNAL_DATA),1)
CC_CHECK += -DEXTERNAL_DATA -DFS_BASEDIR="\"$(BASEDIR)\""
CFLAGS += -DEXTERNAL_DATA -DFS_BASEDIR="\"$(BASEDIR)\""
# tell skyconv to write names instead of actual texture data and save the split tiles so we can use them later
SKYTILE_DIR := $(BUILD_DIR)/textures/skybox_tiles
SKYCONV_ARGS := --store-names --write-tiles "$(SKYTILE_DIR)"
endif
CC_CHECK += -DEXTERNAL_DATA -DFS_BASEDIR="\"$(BASEDIR)\""
CFLAGS += -DEXTERNAL_DATA -DFS_BASEDIR="\"$(BASEDIR)\""
# tell skyconv to write names instead of actual texture data and save the split tiles so we can use them later
SKYTILE_DIR := $(BUILD_DIR)/textures/skybox_tiles
SKYCONV_ARGS := --store-names --write-tiles "$(SKYTILE_DIR)"
ASFLAGS := -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS)
@ -670,8 +667,6 @@ else
CP := cp
endif
ifeq ($(EXTERNAL_DATA),1)
BASEPACK_PATH := $(BUILD_DIR)/$(BASEDIR)/
BASEPACK_LST := $(BUILD_DIR)/basepack.lst
@ -696,9 +691,7 @@ $(BASEPACK_LST): $(EXE)
# prepares the resource ZIP with base data
$(BASEPACK_PATH): $(BASEPACK_LST)
@$(PYTHON) $(TOOLS_DIR)/mkzip.py $(BASEPACK_LST) $(BASEPACK_PATH)
endif
@$(PYTHON) $(TOOLS_DIR)/mkzip.py $(BASEPACK_LST) $(BASEPACK_PATH) $(LEGACY_RES)
clean:
$(RM) -r $(BUILD_DIR_BASE)
@ -797,42 +790,6 @@ ifeq ($(DISCORDRPC),1)
endif
endif
################################################################
# TEXTURE GENERATION #
################################################################
# RGBA32, RGBA16, IA16, IA8, IA4, IA1, I8, I4
ifeq ($(EXTERNAL_DATA),1)
$(BUILD_DIR)/%: %.png
$(ZEROTERM) "$(patsubst %.png,%,$^)" > $@
else
$(BUILD_DIR)/%: %.png
$(N64GRAPHICS) -i $@ -g $< -f $(lastword $(subst ., ,$@))
endif
$(BUILD_DIR)/%.inc.c: $(BUILD_DIR)/% %.png
hexdump -v -e '1/1 "0x%X,"' $< > $@
echo >> $@
ifeq ($(EXTERNAL_DATA),0)
# Color Index CI8
$(BUILD_DIR)/%.ci8: %.ci8.png
$(N64GRAPHICS_CI) -i $@ -g $< -f ci8
# Color Index CI4
$(BUILD_DIR)/%.ci4: %.ci4.png
$(N64GRAPHICS_CI) -i $@ -g $< -f ci4
endif
################################################################
# compressed segment generation
# PC Area
@ -875,19 +832,9 @@ $(SOUND_BIN_DIR)/%.m64: $(SOUND_BIN_DIR)/%.o
$(SOUND_BIN_DIR)/%.o: $(SOUND_BIN_DIR)/%.s
$(AS) $(ASFLAGS) -o $@ $<
ifeq ($(EXTERNAL_DATA),1)
$(SOUND_BIN_DIR)/%.inc.c: $(SOUND_BIN_DIR)/%
$(ZEROTERM) "$(patsubst $(BUILD_DIR)/%,%,$^)" | hexdump -v -e '1/1 "0x%X,"' > $@
else
$(SOUND_BIN_DIR)/%.inc.c: $(SOUND_BIN_DIR)/%
hexdump -v -e '1/1 "0x%X,"' $< > $@
echo >> $@
endif
$(SOUND_BIN_DIR)/sound_data.o: $(SOUND_BIN_DIR)/sound_data.ctl.inc.c $(SOUND_BIN_DIR)/sound_data.tbl.inc.c $(SOUND_BIN_DIR)/sequences.bin.inc.c $(SOUND_BIN_DIR)/bank_sets.inc.c
$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h

View file

@ -14,8 +14,8 @@ def md5(fname):
hash_md5.update(chunk)
return hash_md5.hexdigest()
if len(sys.argv) < 3:
print('usage: mkzip <lstfile> <dstpath>')
if len(sys.argv) < 4:
print('usage: mkzip <lstfile> <dstpath> <legacy>')
sys.exit(1)
lst = []
@ -26,13 +26,20 @@ with open(sys.argv[1], 'r') as f:
continue
tok = line.split()
lst.append((tok[0], tok[1]))
if not sys.argv[3] or not sys.argv[3] == "1":
for (fname, aname) in lst:
path = os.path.join(sys.argv[2], aname)
old_md5 = md5(fname);
old_md5 = md5(fname)
if not os.path.exists(path) or os.path.exists(path) and old_md5 != md5(path):
os.makedirs(os.path.dirname(path), exist_ok=True)
copyfile(fname, path)
print("Copying: " + path)
else:
print("Skipping: " + path + " - MD5: "+md5(fname))
else:
zipPath = os.path.join(sys.argv[2], "awesome-legacy.zip")
print("Using Legacy System")
with zipfile.ZipFile(zipPath, 'w', allowZip64=False) as zipf:
for (fname, aname) in lst:
zipf.write(fname, arcname=aname)
print("Legacy - Copying: " + aname)