-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98e5b4f
commit 6ddda5c
Showing
15 changed files
with
432 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from generated.array import Array | ||
from generated.base_struct import BaseStruct | ||
from generated.formats.manis.imports import name_type_map | ||
|
||
|
||
class ChunkSizesZT(BaseStruct): | ||
|
||
""" | ||
32 bytes | ||
""" | ||
|
||
__name__ = 'ChunkSizesZT' | ||
|
||
|
||
def __init__(self, context, arg=0, template=None, set_default=True): | ||
super().__init__(context, arg, template, set_default=False) | ||
self.index_a = name_type_map['Ushort'](self.context, 0, None) | ||
self.index_b = name_type_map['Ushort'](self.context, 0, None) | ||
self.zero_0 = name_type_map['Ushort'](self.context, 0, None) | ||
self.count_a = name_type_map['Ushort'](self.context, 0, None) | ||
self.count_b = name_type_map['Ushort'](self.context, 0, None) | ||
self.zero_1 = name_type_map['Ushort'](self.context, 0, None) | ||
self.zeros = Array(self.context, 0, None, (0,), name_type_map['Uint']) | ||
if set_default: | ||
self.set_defaults() | ||
|
||
@classmethod | ||
def _get_attribute_list(cls): | ||
yield from super()._get_attribute_list() | ||
yield 'index_a', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
yield 'index_b', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
yield 'zero_0', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
yield 'count_a', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
yield 'count_b', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
yield 'zero_1', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
yield 'zeros', Array, (0, None, (5,), name_type_map['Uint']), (False, None), (None, None) | ||
|
||
@classmethod | ||
def _get_filtered_attribute_list(cls, instance, include_abstract=True): | ||
yield from super()._get_filtered_attribute_list(instance, include_abstract) | ||
yield 'index_a', name_type_map['Ushort'], (0, None), (False, None) | ||
yield 'index_b', name_type_map['Ushort'], (0, None), (False, None) | ||
yield 'zero_0', name_type_map['Ushort'], (0, None), (False, None) | ||
yield 'count_a', name_type_map['Ushort'], (0, None), (False, None) | ||
yield 'count_b', name_type_map['Ushort'], (0, None), (False, None) | ||
yield 'zero_1', name_type_map['Ushort'], (0, None), (False, None) | ||
yield 'zeros', Array, (0, None, (5,), name_type_map['Uint']), (False, None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from generated.array import Array | ||
from generated.base_struct import BaseStruct | ||
from generated.formats.manis.imports import name_type_map | ||
|
||
|
||
class ElemZt(BaseStruct): | ||
|
||
__name__ = 'ElemZt' | ||
|
||
|
||
def __init__(self, context, arg=0, template=None, set_default=True): | ||
super().__init__(context, arg, template, set_default=False) | ||
self.floats = Array(self.context, 0, None, (0,), name_type_map['Float']) | ||
self.a = name_type_map['Ushort'](self.context, 0, None) | ||
self.b = name_type_map['Ushort'](self.context, 0, None) | ||
self.c = name_type_map['Ushort'](self.context, 0, None) | ||
self.d = name_type_map['Ushort'](self.context, 0, None) | ||
if set_default: | ||
self.set_defaults() | ||
|
||
@classmethod | ||
def _get_attribute_list(cls): | ||
yield from super()._get_attribute_list() | ||
yield 'floats', Array, (0, None, (4,), name_type_map['Float']), (False, None), (None, None) | ||
yield 'a', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
yield 'b', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
yield 'c', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
yield 'd', name_type_map['Ushort'], (0, None), (False, None), (None, None) | ||
|
||
@classmethod | ||
def _get_filtered_attribute_list(cls, instance, include_abstract=True): | ||
yield from super()._get_filtered_attribute_list(instance, include_abstract) | ||
yield 'floats', Array, (0, None, (4,), name_type_map['Float']), (False, None) | ||
yield 'a', name_type_map['Ushort'], (0, None), (False, None) | ||
yield 'b', name_type_map['Ushort'], (0, None), (False, None) | ||
yield 'c', name_type_map['Ushort'], (0, None), (False, None) | ||
yield 'd', name_type_map['Ushort'], (0, None), (False, None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from generated.base_struct import BaseStruct | ||
from generated.formats.base.compounds.PadAlign import get_padding_size, get_padding | ||
|
||
|
||
from generated.formats.manis.compounds.SubChunkZt import SubChunkZt | ||
from generated.base_struct import BaseStruct | ||
|
||
|
||
class SubChunkReaderZt(BaseStruct): | ||
|
||
__name__ = 'SubChunkReaderZt' | ||
|
||
|
||
def __init__(self, context, arg=0, template=None, set_default=True): | ||
super().__init__(context, arg, template, set_default=False) | ||
if set_default: | ||
self.set_defaults() | ||
|
||
@classmethod | ||
def _get_attribute_list(cls): | ||
yield from super()._get_attribute_list() | ||
|
||
@classmethod | ||
def _get_filtered_attribute_list(cls, instance, include_abstract=True): | ||
yield from super()._get_filtered_attribute_list(instance, include_abstract) | ||
|
||
@classmethod | ||
def read_fields(cls, stream, instance): | ||
instance.io_start = stream.tell() | ||
# for chunk_sizes in instance.arg: | ||
# chunk_sizes.keys = () | ||
for chunk_sizes in instance.arg: | ||
chunk_sizes.keys = SubChunkZt.from_stream(stream, instance.context, chunk_sizes, None) | ||
# print(f"SubChunkZt io_size {chunk_sizes.keys.io_size}") | ||
pad_size = get_padding_size(chunk_sizes.keys.io_size, alignment=16) | ||
chunk_sizes.padding = stream.read(pad_size) | ||
assert chunk_sizes.padding == b"\x00" * pad_size | ||
# print(f"{chunk_sizes.padding} padding ends at {stream.tell()}") | ||
instance.io_size = stream.tell() - instance.io_start | ||
|
||
@classmethod | ||
def write_fields(cls, stream, instance): | ||
instance.io_start = stream.tell() | ||
for chunk_sizes in instance.arg: | ||
SubChunkZt.to_stream(chunk_sizes.keys, stream, instance.context) | ||
stream.write(get_padding(chunk_sizes.keys.io_size, alignment=8)) | ||
instance.io_size = stream.tell() - instance.io_start | ||
|
||
@classmethod | ||
def get_fields_str(cls, instance, indent=0): | ||
s = '' | ||
for chunk_sizes in instance.arg: | ||
s += str(chunk_sizes.keys) | ||
return s | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from generated.array import Array | ||
from generated.base_struct import BaseStruct | ||
from generated.formats.manis.imports import name_type_map | ||
|
||
|
||
class SubChunkZt(BaseStruct): | ||
|
||
""" | ||
arg is chunksizes | ||
""" | ||
|
||
__name__ = 'SubChunkZt' | ||
|
||
|
||
def __init__(self, context, arg=0, template=None, set_default=True): | ||
super().__init__(context, arg, template, set_default=False) | ||
self.list_one = Array(self.context, 0, None, (0,), name_type_map['Float']) | ||
self.list_two = Array(self.context, 0, None, (0,), name_type_map['ElemZt']) | ||
if set_default: | ||
self.set_defaults() | ||
|
||
@classmethod | ||
def _get_attribute_list(cls): | ||
yield from super()._get_attribute_list() | ||
yield 'list_one', Array, (0, None, (None, 6,), name_type_map['Float']), (False, None), (None, None) | ||
yield 'list_two', Array, (0, None, (None,), name_type_map['ElemZt']), (False, None), (None, None) | ||
|
||
@classmethod | ||
def _get_filtered_attribute_list(cls, instance, include_abstract=True): | ||
yield from super()._get_filtered_attribute_list(instance, include_abstract) | ||
yield 'list_one', Array, (0, None, (instance.arg.count_b, 6,), name_type_map['Float']), (False, None) | ||
yield 'list_two', Array, (0, None, (instance.arg.count_b,), name_type_map['ElemZt']), (False, None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from generated.array import Array | ||
from generated.base_struct import BaseStruct | ||
from generated.formats.manis.imports import name_type_map | ||
|
||
|
||
class UnkChunkListZT(BaseStruct): | ||
|
||
__name__ = 'UnkChunkListZT' | ||
|
||
|
||
def __init__(self, context, arg=0, template=None, set_default=True): | ||
super().__init__(context, arg, template, set_default=False) | ||
self.ref = name_type_map['Empty'](self.context, 0, None) | ||
self.subchunk_count = name_type_map['Uint64'](self.context, 0, None) | ||
self.pad_1 = name_type_map['Uint64'](self.context, 0, None) | ||
self.chunksize_list = Array(self.context, 0, None, (0,), name_type_map['ChunkSizesZT']) | ||
self.pad_2 = name_type_map['Uint64'](self.context, 0, None) | ||
self.subchunk_list = name_type_map['SubChunkReaderZt'](self.context, self.chunksize_list, None) | ||
|
||
# ? | ||
self.pad = name_type_map['PadAlign'](self.context, 16, self.ref) | ||
if set_default: | ||
self.set_defaults() | ||
|
||
@classmethod | ||
def _get_attribute_list(cls): | ||
yield from super()._get_attribute_list() | ||
yield 'ref', name_type_map['Empty'], (0, None), (False, None), (None, None) | ||
yield 'subchunk_count', name_type_map['Uint64'], (0, None), (False, None), (None, None) | ||
yield 'pad_1', name_type_map['Uint64'], (0, None), (False, None), (None, None) | ||
yield 'chunksize_list', Array, (0, None, (None,), name_type_map['ChunkSizesZT']), (False, None), (None, None) | ||
yield 'pad_2', name_type_map['Uint64'], (0, None), (False, None), (None, None) | ||
yield 'subchunk_list', name_type_map['SubChunkReaderZt'], (None, None), (False, None), (None, None) | ||
yield 'pad', name_type_map['PadAlign'], (16, None), (False, None), (None, None) | ||
|
||
@classmethod | ||
def _get_filtered_attribute_list(cls, instance, include_abstract=True): | ||
yield from super()._get_filtered_attribute_list(instance, include_abstract) | ||
yield 'ref', name_type_map['Empty'], (0, None), (False, None) | ||
yield 'subchunk_count', name_type_map['Uint64'], (0, None), (False, None) | ||
yield 'pad_1', name_type_map['Uint64'], (0, None), (False, None) | ||
yield 'chunksize_list', Array, (0, None, (instance.subchunk_count,), name_type_map['ChunkSizesZT']), (False, None) | ||
yield 'pad_2', name_type_map['Uint64'], (0, None), (False, None) | ||
yield 'subchunk_list', name_type_map['SubChunkReaderZt'], (instance.chunksize_list, None), (False, None) | ||
yield 'pad', name_type_map['PadAlign'], (16, instance.ref), (False, None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.