Added LEGACY_RES Flag

This commit is contained in:
NoHomoBoi 2020-08-18 06:39:40 -05:00
parent c82ca9e75f
commit aecc45867e
2 changed files with 7 additions and 19 deletions

View File

@ -63,6 +63,7 @@ AUDIO_API ?= SDL2
# Controller backends (can have multiple, space separated): SDL2
CONTROLLER_API ?= SDL2
LEGACY_RES ?= 0
BASEDIR ?= res
# Automatic settings for PC port(s)
@ -690,7 +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)
@$(PYTHON) $(TOOLS_DIR)/mkzip.py $(BASEPACK_LST) $(BASEPACK_PATH) $(LEGACY_RES)
clean:
$(RM) -r $(BUILD_DIR_BASE)

View File

@ -37,22 +37,9 @@ with open(sys.argv[1], 'r') as f:
else:
print("Skipping: " + path + " - MD5: "+md5(fname))
else:
regenZip = False
zipPath = os.path.join(sys.argv[2],"legacy.zip")
zipPath = os.path.join(sys.argv[2], "awesome-legacy.zip")
print("Using Legacy System")
if os.path.exists(zipPath):
with zipfile.ZipFile(zipPath, 'w', allowZip64=False) as zipf:
for(zinfo) in zipf.infolist():
with zipf.open(zinfo) as tmp:
print("Pre Loaded: "+md5(tmp.read()))
if md5(fname) != md5(tmp.read()):
print("Found a change on the zip, regenerating")
regenZip = True
break
else:
regenZip = True
if regenZip:
with zipfile.ZipFile(zipPath, 'w', allowZip64=False) as zipf:
for (fname, aname) in lst:
zipf.write(fname, arcname=aname)
print("Copying: " + aname)
with zipfile.ZipFile(zipPath, 'w', allowZip64=False) as zipf:
for (fname, aname) in lst:
zipf.write(fname, arcname=aname)
print("Legacy - Copying: " + aname)