mirror of https://github.com/sm64pc/sm64pc.git
edit extract_assets script to support freebsd (#520)
Co-authored-by: ezntek <ezntek@xflymusic.com>
This commit is contained in:
parent
54cd27ccee
commit
2256c014c4
|
@ -2,14 +2,13 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import platform
|
||||||
|
|
||||||
def read_asset_map():
|
def read_asset_map():
|
||||||
with open("assets.json") as f:
|
with open("assets.json") as f:
|
||||||
ret = json.load(f)
|
ret = json.load(f)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def read_local_asset_list(f):
|
def read_local_asset_list(f):
|
||||||
if f is None:
|
if f is None:
|
||||||
return []
|
return []
|
||||||
|
@ -18,7 +17,6 @@ def read_local_asset_list(f):
|
||||||
ret.append(line.strip())
|
ret.append(line.strip())
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def asset_needs_update(asset, version):
|
def asset_needs_update(asset, version):
|
||||||
if version <= 5 and asset == "textures/spooky/bbh_textures.00800.rgba16.png":
|
if version <= 5 and asset == "textures/spooky/bbh_textures.00800.rgba16.png":
|
||||||
return True
|
return True
|
||||||
|
@ -34,7 +32,6 @@ def asset_needs_update(asset, version):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def remove_file(fname):
|
def remove_file(fname):
|
||||||
os.remove(fname)
|
os.remove(fname)
|
||||||
print("deleting", fname)
|
print("deleting", fname)
|
||||||
|
@ -43,7 +40,6 @@ def remove_file(fname):
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def clean_assets(local_asset_file):
|
def clean_assets(local_asset_file):
|
||||||
assets = set(read_asset_map().keys())
|
assets = set(read_asset_map().keys())
|
||||||
assets.update(read_local_asset_list(local_asset_file))
|
assets.update(read_local_asset_list(local_asset_file))
|
||||||
|
@ -55,7 +51,6 @@ def clean_assets(local_asset_file):
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# In case we ever need to change formats of generated files, we keep a
|
# In case we ever need to change formats of generated files, we keep a
|
||||||
# revision ID in the local asset file.
|
# revision ID in the local asset file.
|
||||||
|
@ -153,6 +148,11 @@ def main():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Make sure tools exist
|
# Make sure tools exist
|
||||||
|
if platform.system() == "FreeBSD":
|
||||||
|
subprocess.check_call(
|
||||||
|
["gmake", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"]
|
||||||
|
)
|
||||||
|
else:
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
["make", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"]
|
["make", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"]
|
||||||
)
|
)
|
||||||
|
@ -282,5 +282,4 @@ def main():
|
||||||
with open(".assets-local.txt", "w") as f:
|
with open(".assets-local.txt", "w") as f:
|
||||||
f.write(output)
|
f.write(output)
|
||||||
|
|
||||||
|
main() if __name__ == "__main__" else None
|
||||||
main()
|
|
Loading…
Reference in New Issue