Move CreateStreamObject to proper location (#1249)

This commit is contained in:
Christian Semmler
2024-12-20 14:15:52 -07:00
committed by GitHub
parent c9acd9a49f
commit 5a61cf6566
8 changed files with 61 additions and 72 deletions

View File

@@ -158,39 +158,3 @@ void FUN_100b7220(MxDSAction* p_action, MxU32 p_newFlags, MxBool p_setFlags)
}
}
}
// Should probably be somewhere else
// FUNCTION: LEGO1 0x100c0280
MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)
{
MxU8* buf;
_MMCKINFO tmpChunk;
if (p_file->Seek(((MxLong*) p_file->GetBuffer())[p_ofs], SEEK_SET)) {
return NULL;
}
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'S', 't')) {
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'O', 'b')) {
buf = new MxU8[tmpChunk.cksize];
if (!buf) {
return NULL;
}
if (p_file->Read(buf, tmpChunk.cksize) != 0) {
return NULL;
}
// Save a copy so we can clean up properly, because
// this function will alter the pointer value.
MxU8* copy = buf;
MxDSObject* obj = DeserializeDSObjectDispatch(buf, -1);
delete[] copy;
return obj;
}
return NULL;
}
return NULL;
}