mirror of
https://github.com/isledecomp/SIEdit.git
synced 2024-11-27 09:35:45 -05:00
lib: handle "act" lists
This commit is contained in:
parent
c7bfceaaa2
commit
501fa2f0cf
2 changed files with 49 additions and 23 deletions
|
@ -133,6 +133,25 @@ Interleaf::Error Interleaf::ReadChunk(Core *parent, FileBase *f, Info *info)
|
||||||
uint32_t list_count = 0;
|
uint32_t list_count = 0;
|
||||||
if (list_type == RIFF::MxCh) {
|
if (list_type == RIFF::MxCh) {
|
||||||
list_count = f->ReadU32();
|
list_count = f->ReadU32();
|
||||||
|
if (list_count == LIST::Act_ || list_count == LIST::RAND) {
|
||||||
|
desc << "Extension: ";
|
||||||
|
if (list_count == LIST::RAND) {
|
||||||
|
uint32_t rand_lower = f->ReadU32();
|
||||||
|
uint64_t rand_val = uint64_t(list_count) << 32 | rand_lower;
|
||||||
|
desc << ((const char *) &rand_val);
|
||||||
|
} else if (list_count == LIST::Act_) {
|
||||||
|
desc << ((const char *) &list_count);
|
||||||
|
}
|
||||||
|
desc << std::endl;
|
||||||
|
|
||||||
|
// Re-read list count
|
||||||
|
list_count = f->ReadU32();
|
||||||
|
for (uint32_t i=0; i<list_count; i++) {
|
||||||
|
// Read every short
|
||||||
|
uint16_t val = f->ReadU16();
|
||||||
|
desc << " " << ((const char *) &val) << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
desc << "Count: " << list_count << std::endl;
|
desc << "Count: " << list_count << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -190,29 +209,32 @@ Interleaf::Error Interleaf::ReadChunk(Core *parent, FileBase *f, Info *info)
|
||||||
info->SetData(data);
|
info->SetData(data);
|
||||||
|
|
||||||
if (!(flags & MxCh::FLAG_END)) {
|
if (!(flags & MxCh::FLAG_END)) {
|
||||||
Object *o = m_ObjectIDTable.at(object);
|
std::map<uint32_t, Object*>::iterator it = m_ObjectIDTable.find(object);
|
||||||
if (!o) {
|
if (it == m_ObjectIDTable.end()) {
|
||||||
return ERROR_INVALID_INPUT;
|
LogError() << "Failed to find object " << object << " for chunk at " << std::hex << offset << std::endl;
|
||||||
}
|
//return ERROR_INVALID_INPUT;
|
||||||
|
|
||||||
if (flags & MxCh::FLAG_SPLIT && m_JoiningSize > 0) {
|
|
||||||
o->data_.back().append(data);
|
|
||||||
|
|
||||||
m_JoiningProgress += data.size();
|
|
||||||
if (m_JoiningProgress == m_JoiningSize) {
|
|
||||||
m_JoiningProgress = 0;
|
|
||||||
m_JoiningSize = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
o->data_.push_back(data);
|
Object *o = it->second;
|
||||||
|
|
||||||
if (o->data_.size() == 2) {
|
if (flags & MxCh::FLAG_SPLIT && m_JoiningSize > 0) {
|
||||||
o->time_offset_ = time;
|
o->data_.back().append(data);
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & MxCh::FLAG_SPLIT) {
|
m_JoiningProgress += data.size();
|
||||||
m_JoiningProgress = data.size();
|
if (m_JoiningProgress == m_JoiningSize) {
|
||||||
m_JoiningSize = data_sz;
|
m_JoiningProgress = 0;
|
||||||
|
m_JoiningSize = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
o->data_.push_back(data);
|
||||||
|
|
||||||
|
if (o->data_.size() == 2) {
|
||||||
|
o->time_offset_ = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & MxCh::FLAG_SPLIT) {
|
||||||
|
m_JoiningProgress = data.size();
|
||||||
|
m_JoiningSize = data_sz;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -265,7 +287,7 @@ Object *Interleaf::ReadObject(FileBase *f, Object *o, std::stringstream &desc)
|
||||||
o->id_ = f->ReadU32();
|
o->id_ = f->ReadU32();
|
||||||
desc << "ID: " << o->id_ << std::endl;
|
desc << "ID: " << o->id_ << std::endl;
|
||||||
o->flags_ = f->ReadU32();
|
o->flags_ = f->ReadU32();
|
||||||
desc << "Flags: " << o->flags_ << std::endl;
|
desc << "Flags: 0x" << std::hex << o->flags_ << std::endl;
|
||||||
o->unknown4_ = f->ReadU32();
|
o->unknown4_ = f->ReadU32();
|
||||||
desc << "Unknown4: " << o->unknown4_ << std::endl;
|
desc << "Unknown4: " << o->unknown4_ << std::endl;
|
||||||
o->duration_ = f->ReadU32();
|
o->duration_ = f->ReadU32();
|
||||||
|
@ -283,7 +305,7 @@ Object *Interleaf::ReadObject(FileBase *f, Object *o, std::stringstream &desc)
|
||||||
desc << "Extra Size: " << extra_sz << std::endl;
|
desc << "Extra Size: " << extra_sz << std::endl;
|
||||||
o->extra_ = f->ReadBytes(extra_sz);
|
o->extra_ = f->ReadBytes(extra_sz);
|
||||||
|
|
||||||
if (o->type_ != MxOb::Presenter && o->type_ != MxOb::World) {
|
if (o->type_ != MxOb::Presenter && o->type_ != MxOb::World && o->type_ != MxOb::Animation) {
|
||||||
o->filename_ = f->ReadString();
|
o->filename_ = f->ReadString();
|
||||||
desc << "Filename: " << o->filename_ << std::endl;
|
desc << "Filename: " << o->filename_ << std::endl;
|
||||||
o->unknown26_ = f->ReadU32();
|
o->unknown26_ = f->ReadU32();
|
||||||
|
@ -444,7 +466,7 @@ void Interleaf::WriteObject(FileBase *f, const Object *o) const
|
||||||
f->WriteU16(o->extra_.size());
|
f->WriteU16(o->extra_.size());
|
||||||
f->WriteBytes(o->extra_);
|
f->WriteBytes(o->extra_);
|
||||||
|
|
||||||
if (o->type_ != MxOb::Presenter && o->type_ != MxOb::World) {
|
if (o->type_ != MxOb::Presenter && o->type_ != MxOb::World && o->type_ != MxOb::Animation) {
|
||||||
f->WriteString(o->filename_);
|
f->WriteString(o->filename_);
|
||||||
f->WriteU32(o->unknown26_);
|
f->WriteU32(o->unknown26_);
|
||||||
f->WriteU32(o->unknown27_);
|
f->WriteU32(o->unknown27_);
|
||||||
|
|
|
@ -63,6 +63,10 @@ public:
|
||||||
class LIST : public RIFF
|
class LIST : public RIFF
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum Variation {
|
||||||
|
Act_ = 0x00746341,
|
||||||
|
RAND = 0x4f444e41
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue