Skip to content

Commit

Permalink
physmat - print names on extract
Browse files Browse the repository at this point in the history
  • Loading branch information
HENDRIX-ZT2 committed Nov 13, 2023
1 parent b752162 commit 751e2ab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion experimentals/physmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

files = (
("C:/Users/arnfi/Desktop/pz.physmat", pz_classification_name, pz_surface_name),
("C:/Users/arnfi/Desktop/jwe2.physmat", jwe2_classification_name, jwe2_surface_name))
("C:/Users/arnfi/Desktop/jwe2.physmat", jwe2_classification_name, jwe2_surface_name),
("C:/Users/arnfi/Desktop/wh.physmat", (), ()))
for fp, classification, surface in files:
with open(fp, "rb") as f:
mat = PhysmatRoot.from_stream(f, OvlContext())
Expand Down
19 changes: 19 additions & 0 deletions modules/formats/PHYSMAT.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,22 @@
class PhysmatLoader(MemStructLoader):
target_class = PhysmatRoot
extension = ".physmat"

def extract(self, out_dir):
print(self.header)
for s in ("all_surfaces", "surface_res", "classnames"):
print("\n\n")
print(s)
names = []
arr = getattr(self.header, f"{s}_names")
for ind, offset in enumerate(arr):
lut = None
if s in ("surface_res", "classnames"):
lut = getattr(self.header, f"{s}_indices")[ind]
else:
lut = f'{bin(getattr(self.header, f"all_surfaces_flags")[ind])[2:]:>64s}'
name = self.header.names.get_str_at(offset)
print(f'{ind:>3d}', lut, name)
names.append(name)
print(sorted(names))
return super().extract(out_dir)
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e5cbba344 - Mon Nov 13 16:54:31 2023 +0100
b75216277 - Mon Nov 13 19:00:14 2023 +0100

0 comments on commit 751e2ab

Please sign in to comment.