mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-24 16:01:26 +00:00
all versions OK
This commit is contained in:
parent
dae083d039
commit
ad6ff6df27
7 changed files with 28 additions and 11 deletions
|
@ -116,6 +116,7 @@ class File:
|
|||
*,
|
||||
data: Optional[memoryview] = None,
|
||||
size: Optional[int] = None,
|
||||
alignment: int = 8,
|
||||
):
|
||||
self.name = name
|
||||
if data is None != size is None:
|
||||
|
@ -129,6 +130,7 @@ class File:
|
|||
assert size is not None
|
||||
self.data = None
|
||||
self.size = size
|
||||
self.alignment = alignment
|
||||
self._resources: list[Resource] = []
|
||||
self._is_resources_sorted = True
|
||||
self.referenced_files: set[File] = set()
|
||||
|
|
|
@ -220,9 +220,9 @@ class TextureResource(Resource):
|
|||
self.resources_ci_list: list[TextureResource] = []
|
||||
"""For TLUT "textures", the CI textures using it"""
|
||||
|
||||
if size_bytes % 8 == 0 and range_start % 8 == 0:
|
||||
if size_bytes % 8 == 0 and (file.alignment + range_start) % 8 == 0:
|
||||
self.alignment = 8
|
||||
elif size_bytes % 4 == 0 and range_start % 4 == 0:
|
||||
elif size_bytes % 4 == 0 and (file.alignment + range_start) % 4 == 0:
|
||||
self.alignment = 4
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
|
|
|
@ -120,8 +120,21 @@ def process_pool(
|
|||
range_start, range_end = rescoll.backing_memory.range
|
||||
data = data[range_start:range_end]
|
||||
|
||||
if isinstance(rescoll.start_address, VRAMStartAddress):
|
||||
if rescoll.start_address.vram % 8 == 0:
|
||||
alignment = 8
|
||||
elif rescoll.start_address.vram % 4 == 0:
|
||||
alignment = 4
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
f"alignment for {rescoll.start_address.vram=:#08X}"
|
||||
)
|
||||
elif isinstance(rescoll.start_address, SegmentStartAddress):
|
||||
alignment = 8
|
||||
else:
|
||||
raise NotImplementedError(rescoll.start_address)
|
||||
# TODO File.name
|
||||
file = File(rescoll.backing_memory.name, data=data)
|
||||
file = File(rescoll.backing_memory.name, data=data, alignment=alignment)
|
||||
file_by_rescoll[rescoll] = file
|
||||
|
||||
(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue