mirror of
https://github.com/zeldaret/oot.git
synced 2025-05-11 03:23:46 +00:00
misc cleanup/fixes, pygfxd 1.0.3
This commit is contained in:
parent
15692565fe
commit
8e5e543731
7 changed files with 36 additions and 22 deletions
|
@ -6,3 +6,9 @@ For details on the xml files contents, see [the assets xml specification file](.
|
||||||
|
|
||||||
The extraction tool can use [rich](https://github.com/Textualize/rich) if installed to make output prettier.
|
The extraction tool can use [rich](https://github.com/Textualize/rich) if installed to make output prettier.
|
||||||
If you are looking at output or errors from during extraction, consider installing rich for a better experience: `.venv/bin/python3 -m pip install rich`
|
If you are looking at output or errors from during extraction, consider installing rich for a better experience: `.venv/bin/python3 -m pip install rich`
|
||||||
|
|
||||||
|
To run the extraction outside of `make setup`, use `./tools/extract_assets.sh VERSION`.
|
||||||
|
- Pass `-f` to force extraction: otherwise only assets for which xmls were modified will be extracted.
|
||||||
|
- Pass `-j` to use multiprocessing, making extraction quicker. Note that this makes for less readable errors if any error happens.
|
||||||
|
- Pass `-s name` to extract assets using baserom file `name`.
|
||||||
|
- Pass `-r -s 'name.*'` to extract assets using baserom files whose name match regular expression `name.*`.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
crunch64>=0.5.1,<1.0.0
|
crunch64>=0.5.1,<1.0.0
|
||||||
ipl3checksum>=1.2.0,<2.0.0
|
ipl3checksum>=1.2.0,<2.0.0
|
||||||
pyyaml>=6.0.1,<7.0.0
|
pyyaml>=6.0.1,<7.0.0
|
||||||
|
pygfxd>=1.0.3,<2.0.0
|
||||||
|
|
||||||
# asm-differ
|
# asm-differ
|
||||||
argcomplete
|
argcomplete
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
from pprint import pprint as vanilla_pprint
|
||||||
|
|
||||||
|
try:
|
||||||
|
from rich.pretty import pprint
|
||||||
|
except ImportError:
|
||||||
|
pprint = vanilla_pprint
|
||||||
|
|
||||||
from tools import version_config
|
from tools import version_config
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
|
@ -8,16 +15,15 @@ def main():
|
||||||
|
|
||||||
pools = base.get_resources_desc(vc)
|
pools = base.get_resources_desc(vc)
|
||||||
|
|
||||||
from pprint import pprint
|
try:
|
||||||
|
for pool in pools:
|
||||||
if 0:
|
if any(coll.out_path.name == "gameplay_keep" for coll in pool.collections):
|
||||||
with open(
|
vanilla_pprint(pool)
|
||||||
"/home/dragorn421/Documents/oot/tools/assets/descriptor/resources.txt",
|
else:
|
||||||
"w",
|
pprint(pool)
|
||||||
) as f:
|
input("Press enter for next pool")
|
||||||
for i, pool in enumerate(pools):
|
except KeyboardInterrupt:
|
||||||
print(round(i / len(pools) * 100, 2), "%", end="\r")
|
print()
|
||||||
pprint(pool, f)
|
|
||||||
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -191,14 +191,6 @@ def get_resources_desc(vc: version_config.VersionConfig):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(f"Error with pool {pool}") from e
|
raise Exception(f"Error with pool {pool}") from e
|
||||||
|
|
||||||
if 0:
|
|
||||||
from rich.pretty import pretty_repr
|
|
||||||
|
|
||||||
with Path(
|
|
||||||
"/home/dragorn421/Documents/oot/tools/assets/descriptor/pools.txt"
|
|
||||||
).open("w") as f:
|
|
||||||
f.write(pretty_repr(pools))
|
|
||||||
|
|
||||||
return pools
|
return pools
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,6 @@ if __name__ == "__main__":
|
||||||
if profile:
|
if profile:
|
||||||
import cProfile
|
import cProfile
|
||||||
|
|
||||||
cProfile.run("extract_xml_z64.main()", "cprof_assets421.txt")
|
cProfile.run("extract_xml_z64.main()", "cprofile_extract_assets.txt")
|
||||||
else:
|
else:
|
||||||
extract_xml_z64.main()
|
extract_xml_z64.main()
|
||||||
|
|
|
@ -760,7 +760,9 @@ class Resource(abc.ABC):
|
||||||
range_end: Optional[int],
|
range_end: Optional[int],
|
||||||
name: str,
|
name: str,
|
||||||
):
|
):
|
||||||
assert 0 <= range_start < file.size
|
assert (
|
||||||
|
0 <= range_start < file.size
|
||||||
|
), f"{range_start=:#08X} out of range [0,{file.size=:#08X})"
|
||||||
if range_end is None:
|
if range_end is None:
|
||||||
assert self.can_size_be_unknown
|
assert self.can_size_be_unknown
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -65,6 +65,10 @@ def create_file_resources(rescoll: ResourcesDescCollection, file: File):
|
||||||
) as e:
|
) as e:
|
||||||
resource = e.resource
|
resource = e.resource
|
||||||
list_ResourceNeedsPostProcessWithPoolResourcesException.append(e)
|
list_ResourceNeedsPostProcessWithPoolResourcesException.append(e)
|
||||||
|
except Exception as e:
|
||||||
|
raise Exception(
|
||||||
|
"Error while creating resource from description:", resource_desc
|
||||||
|
) from e
|
||||||
|
|
||||||
# TODO nice hack right here.
|
# TODO nice hack right here.
|
||||||
# probably instead rework the "c declaration" system into a more opaque object
|
# probably instead rework the "c declaration" system into a more opaque object
|
||||||
|
@ -454,13 +458,14 @@ def main():
|
||||||
import traceback
|
import traceback
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
traceback.print_exc(file=sys.stdout)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import rich.pretty
|
import rich.pretty
|
||||||
|
import rich.console
|
||||||
except:
|
except:
|
||||||
|
traceback.print_exc(file=sys.stdout)
|
||||||
print("Install rich for prettier output (`pip install rich`)")
|
print("Install rich for prettier output (`pip install rich`)")
|
||||||
else:
|
else:
|
||||||
|
rich.console.Console().print_exception()
|
||||||
# TODO implement more __rich_repr__
|
# TODO implement more __rich_repr__
|
||||||
if e.__class__ in (Exception, AssertionError, NotImplementedError):
|
if e.__class__ in (Exception, AssertionError, NotImplementedError):
|
||||||
print("rich.pretty.pprint(e.args):")
|
print("rich.pretty.pprint(e.args):")
|
||||||
|
@ -468,6 +473,8 @@ def main():
|
||||||
else:
|
else:
|
||||||
print("rich.pretty.pprint(e):")
|
print("rich.pretty.pprint(e):")
|
||||||
rich.pretty.pprint(e, indent_guides=False)
|
rich.pretty.pprint(e, indent_guides=False)
|
||||||
|
|
||||||
|
sys.exit(1)
|
||||||
finally:
|
finally:
|
||||||
with last_extracts_json_p.open("w") as f:
|
with last_extracts_json_p.open("w") as f:
|
||||||
json.dump(last_extracts, f)
|
json.dump(last_extracts, f)
|
||||||
|
|
Loading…
Add table
Reference in a new issue