Refresh 10

This commit is contained in:
n64
2020-06-02 12:44:34 -04:00
parent e58669b4b3
commit d43d9b7f20
444 changed files with 30163 additions and 7628 deletions

View File

@@ -136,8 +136,8 @@ def main():
try:
with open(fname, "rb") as f:
roms[lang] = f.read()
except:
print("Failed to open " + fname + ". Please ensure it exists!")
except Exception as e:
print("Failed to open " + fname + "! " + str(e))
sys.exit(1)
sha1 = hashlib.sha1(roms[lang]).hexdigest()
with open("sm64." + lang + ".sha1", "r") as f:
@@ -215,9 +215,11 @@ def main():
input = image[pos : pos + size]
os.makedirs(os.path.dirname(asset), exist_ok=True)
if asset.endswith(".png"):
with tempfile.NamedTemporaryFile(prefix="asset") as png_file:
png_file = tempfile.NamedTemporaryFile(prefix="asset", delete=False)
try:
png_file.write(input)
png_file.flush()
png_file.close()
if asset.startswith("textures/skyboxes/") or asset.startswith("levels/ending/cake"):
if asset.startswith("textures/skyboxes/"):
imagetype = "sky"
@@ -253,6 +255,9 @@ def main():
],
check=True,
)
finally:
png_file.close()
remove_file(png_file.name)
else:
with open(asset, "wb") as f:
f.write(input)