PSX Decompilation
This commit is contained in:
parent
56f6099820
commit
bbd29b1f10
25 changed files with 1921 additions and 701 deletions
|
|
@ -771,7 +771,7 @@ def annotate_region_tim_counts(
|
|||
|
||||
|
||||
def parse_lset_wdl(data: bytes) -> dict[str, object] | None:
|
||||
if len(data) < 0x34:
|
||||
if len(data) < 0x38:
|
||||
return None
|
||||
|
||||
header_size = u32(data, 0)
|
||||
|
|
@ -781,6 +781,22 @@ def parse_lset_wdl(data: bytes) -> dict[str, object] | None:
|
|||
header_words = [u32(data, offset) for offset in range(0, header_size, 4)]
|
||||
audio_size = header_words[1]
|
||||
post_audio_start = header_size + audio_size
|
||||
section_sizes = [u32(data, offset) for offset in range(0x08, 0x38, 4)]
|
||||
sections: list[dict[str, int | str]] = []
|
||||
cursor = post_audio_start
|
||||
for index, size in enumerate(section_sizes):
|
||||
if size <= 0:
|
||||
continue
|
||||
if cursor + size > len(data):
|
||||
break
|
||||
sections.append(
|
||||
{
|
||||
"name": f"post_audio_section_{index:02d}",
|
||||
"offset": cursor,
|
||||
"size": size,
|
||||
}
|
||||
)
|
||||
cursor += size
|
||||
high_boundaries = sorted(
|
||||
{
|
||||
value
|
||||
|
|
@ -815,6 +831,7 @@ def parse_lset_wdl(data: bytes) -> dict[str, object] | None:
|
|||
|
||||
tim_hits = scan_tims(data)
|
||||
annotate_region_tim_counts(regions, tim_hits)
|
||||
annotate_region_tim_counts(sections, tim_hits)
|
||||
|
||||
return {
|
||||
"kind": "lset",
|
||||
|
|
@ -822,6 +839,8 @@ def parse_lset_wdl(data: bytes) -> dict[str, object] | None:
|
|||
"header_words": header_words,
|
||||
"audio_size": audio_size,
|
||||
"post_audio_start": post_audio_start,
|
||||
"section_sizes": section_sizes,
|
||||
"sections": sections,
|
||||
"high_offset_boundaries": high_boundaries,
|
||||
"regions": regions,
|
||||
"tim_hits": tim_hits,
|
||||
|
|
@ -880,6 +899,10 @@ def summarize(path: Path, summary: dict[str, object]) -> str:
|
|||
lines.append(f"header_size: 0x{summary['header_size']:X}")
|
||||
lines.append(f"audio_size: 0x{summary['audio_size']:X}")
|
||||
lines.append(f"post_audio_start: 0x{summary['post_audio_start']:X}")
|
||||
lines.append(
|
||||
"section_sizes: "
|
||||
+ ", ".join(f"0x{value:X}" for value in summary["section_sizes"])
|
||||
)
|
||||
lines.append(
|
||||
"high_offset_boundaries: "
|
||||
+ ", ".join(f"0x{value:X}" for value in summary["high_offset_boundaries"])
|
||||
|
|
@ -896,6 +919,15 @@ def summarize(path: Path, summary: dict[str, object]) -> str:
|
|||
+ f"{region['name']}: offset=0x{region['offset']:X} size=0x{region['size']:X} tims={tim_count}"
|
||||
)
|
||||
|
||||
if summary["kind"] == "lset":
|
||||
lines.append("sections:")
|
||||
for section in summary["sections"]:
|
||||
tim_count = section.get("tim_count", 0)
|
||||
lines.append(
|
||||
" "
|
||||
+ f"{section['name']}: offset=0x{section['offset']:X} size=0x{section['size']:X} tims={tim_count}"
|
||||
)
|
||||
|
||||
lines.append("tim_hits:")
|
||||
for hit in summary["tim_hits"]:
|
||||
lines.append(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue