Last active
October 19, 2021 03:03
-
-
Save brecert/44e96e42ae0141d46802c822cb19ef03 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
meta: | |
id: ffli | |
file-extension: dat | |
endian: be | |
seq: | |
- id: resource | |
type: resource | |
enums: | |
resource_type: | |
1: texture | |
2: mesh | |
types: | |
resource: | |
seq: | |
- id: header | |
type: header | |
- id: texture_header | |
type: texture_header | |
- id: mesh_header | |
type: mesh_header | |
header: | |
seq: | |
- id: magic | |
contents: "FFRA" | |
- id: version | |
type: u4 | |
- id: unk1 | |
type: u4 | |
- id: uncompressed_size | |
type: u4 | |
- id: unk2 | |
contents: [0, 0, 0, 0] | |
texture: | |
seq: | |
- id: data | |
size: _io.size - 12 | |
- id: mipmap_offset | |
type: u4 | |
- id: width | |
type: u2 | |
- id: height | |
type: u2 | |
- id: mipmap_count | |
type: u1 | |
- id: texture_format | |
type: u1 | |
- id: unk1 | |
type: u2 | |
instances: | |
area: | |
value: 'width * height * (texture_format == 0 ? 1 : texture_format * 2)' | |
pixels: | |
pos: 0 | |
size: area | |
texture_header: | |
seq: | |
- id: max_sizes | |
type: u4 | |
repeat: expr | |
repeat-expr: 11 | |
- id: textures | |
type: resource_part(ffli::resource_type::texture) | |
repeat: expr | |
repeat-expr: 365 | |
mesh_header: | |
seq: | |
- id: max_size | |
type: u4 | |
repeat: expr | |
repeat-expr: 12 | |
- id: meshes | |
type: resource_part(ffli::resource_type::mesh) | |
repeat: expr | |
repeat-expr: 859 | |
resource_part: | |
seq: | |
- id: offset | |
type: u4 | |
- id: uncompressed_size | |
type: u4 | |
- id: compressed_size | |
type: u4 | |
- id: unk1 | |
type: u1 | |
- id: unk2 | |
type: u1 | |
- id: unk3 | |
type: u1 | |
- id: compression_type | |
type: u1 | |
params: | |
- id: resource_type | |
type: u2 | |
enum: 'ffli::resource_type' | |
types: | |
compressed: | |
params: | |
- id: resource_type | |
type: u2 | |
enum: 'ffli::resource_type' | |
seq: | |
- id: data | |
process: zlib | |
type: | |
switch-on: resource_type | |
cases: | |
'ffli::resource_type::texture': texture | |
'ffli::resource_type::mesh': mesh | |
size-eos: true | |
uncompressed: | |
params: | |
- id: resource_type | |
type: u2 | |
enum: 'ffli::resource_type' | |
seq: | |
- id: data | |
type: | |
switch-on: resource_type | |
cases: | |
'ffli::resource_type::texture': texture | |
'ffli::resource_type::mesh': mesh | |
size-eos: true | |
instances: | |
is_compressed: | |
value: (not compression_type == 5 or not compression_type > 100) and compressed_size != 0 | |
body: | |
pos: offset | |
size: compressed_size | |
type: | |
switch-on: is_compressed | |
cases: | |
true: compressed(resource_type) | |
false: uncompressed(resource_type) | |
mesh: | |
seq: [] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment