ADM3: GRN1 chunk

This commit is contained in:
EdnessP 2024-06-27 17:31:49 +03:00
parent e5834f7da2
commit 95747bceef

View File

@ -101,7 +101,7 @@ fail:
static int parse_type(adm_header_t* adm, STREAMFILE* sf, uint32_t offset) {
/* ADM2 chunks */
if (is_id32be(offset, sf, "GRN1")) {
if (is_id32be(offset, sf, "GRN1") && adm->file_version == 2) {
/* 0x74: offset to floats? */
offset = read_u32le(offset + 0x78, sf); /* to SMP1 */
if (!parse_type(adm, sf, offset))
@ -127,10 +127,18 @@ static int parse_type(adm_header_t* adm, STREAMFILE* sf, uint32_t offset) {
/* ADM3 chunks */
else if (is_id32be(offset, sf, "RMP1")) {
offset = read_u32le(offset + 0x1c, sf);
if (!parse_type(adm, sf, offset))
off_t next_offset;
next_offset = read_u32le(offset + 0x1c, sf);
if (!parse_type(adm, sf, next_offset)) /* to SMP1 */
goto fail;
next_offset = read_u32le(offset + 0x24, sf);
if (!parse_type(adm, sf, next_offset)) /* to GRN1 */
goto fail;
}
else if (is_id32be(offset, sf, "GRN1") && adm->file_version == 3) {
offset = read_u32le(offset + 0x5c, sf);
if (!parse_type(adm, sf, offset)) /* to SMP2 */
goto fail;
/* 0x24: offset to GRN1 */
}
else if (is_id32be(offset, sf, "SMB1")) {
uint32_t table_count = read_u32le(offset + 0x10, sf);