From aa57a08cc5bac87b9973466b7c7a417dae52a3ae Mon Sep 17 00:00:00 2001 From: MattKC <34096995+itsmattkc@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:52:19 -0700 Subject: [PATCH] added support for SI 2.1 (pre-alpha) --- lib/interleaf.cpp | 16 ++++++++-------- lib/interleaf.h | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/interleaf.cpp b/lib/interleaf.cpp index a255b6c..5ec74fb 100644 --- a/lib/interleaf.cpp +++ b/lib/interleaf.cpp @@ -99,10 +99,8 @@ Interleaf::Error Interleaf::ReadChunk(Core *parent, FileBase *f, Info *info) m_BufferSize = f->ReadU32(); desc << "Buffer Size: 0x" << std::hex << m_BufferSize; - if (m_Version == 0x00020002) { - m_BufferCount = f->ReadU32(); - desc << std::endl << "Buffer Count: " << std::dec << m_BufferCount << std::endl; - } + m_BufferCount = f->ReadU32(); + desc << std::endl << "Buffer Count: " << std::dec << m_BufferCount << std::endl; break; } case RIFF::pad_: @@ -132,6 +130,11 @@ Interleaf::Error Interleaf::ReadChunk(Core *parent, FileBase *f, Info *info) desc << "Type: " << RIFF::PrintU32AsString(list_type) << std::endl; uint32_t list_count = 0; if (list_type == RIFF::MxCh) { + if (m_Version == Version2_1) { + uint32_t unknown_list_entry = f->ReadU32(); + desc << "Unknown v2.1 list entry: " << unknown_list_entry << std::endl; + } + list_count = f->ReadU32(); if (list_count == LIST::Act_ || list_count == LIST::RAND) { desc << "Extension: "; @@ -369,10 +372,7 @@ Interleaf::Error Interleaf::Write(FileBase *f) const f->WriteU32(m_Version); f->WriteU32(m_BufferSize); - - if (m_Version == 0x00020002) { - f->WriteU32(m_BufferCount); - } + f->WriteU32(m_BufferCount); RIFF::EndChunk(f, mxhd); } diff --git a/lib/interleaf.h b/lib/interleaf.h index 582eca9..b67a900 100644 --- a/lib/interleaf.h +++ b/lib/interleaf.h @@ -21,6 +21,12 @@ public: ERROR_INVALID_BUFFER_SIZE }; + enum Version + { + Version2_1 = 0x00010002, + Version2_2 = 0x00020002 + }; + LIBWEAVER_EXPORT Interleaf(); LIBWEAVER_EXPORT void Clear();