mirror of
https://github.com/isledecomp/SIEdit.git
synced 2024-11-27 01:25:45 -05:00
lib: if object is only one chunk, write end chunk immediately
Improves accuracy
This commit is contained in:
parent
c0bfa09e35
commit
dae4d105d5
1 changed files with 16 additions and 2 deletions
|
@ -536,12 +536,26 @@ void Interleaf::InterleaveObjects(FileBase *f, const std::vector<Object *> &obje
|
|||
}
|
||||
|
||||
// First, interleave headers
|
||||
for (size_t i=0; i<status.size(); i++) {
|
||||
ChunkStatus &s = status[i];
|
||||
for (std::vector<ChunkStatus>::iterator it = status.begin(); it != status.end(); ) {
|
||||
ChunkStatus &s = *it;
|
||||
Object *o = s.object;
|
||||
|
||||
bool proceed = true;
|
||||
|
||||
if (!o->data().empty()) {
|
||||
WriteSubChunk(f, 0, o->id(), 0xFFFFFFFF, o->data().front());
|
||||
s.index++;
|
||||
|
||||
// If we've already reached the end, write the end chunk now
|
||||
if (o->data().size() == s.index) {
|
||||
WriteSubChunk(f, MxCh::FLAG_END, o->id(), 0xFFFFFFFF);
|
||||
it = status.erase(it);
|
||||
proceed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (proceed) {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue