implement MxDSBuffer object creation (#340)

* push changes

* Update mxstreamcontroller.cpp

* fix build

* MxStreamChunk

* fix format

* Match functions

* Add a comment

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha
2023-12-17 12:24:39 -05:00
committed by GitHub
parent d72c767685
commit 20daddde32
27 changed files with 297 additions and 51 deletions

View File

@@ -731,7 +731,7 @@ void SetOmniUserMessage(void (*p_userMsg)(const char*, int))
// FUNCTION: LEGO1 0x100c0280
MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)
{
char* buf;
MxU8* buf;
_MMCKINFO tmpChunk;
if (p_file->Seek(((MxLong*) p_file->GetBuffer())[p_ofs], 0)) {
@@ -741,18 +741,18 @@ MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)
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 char[tmpChunk.cksize];
buf = new MxU8[tmpChunk.cksize];
if (!buf) {
return NULL;
}
if (p_file->Read((MxU8*) buf, tmpChunk.cksize) != 0) {
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.
char* copy = buf;
MxU8* copy = buf;
MxDSObject* obj = DeserializeDSObjectDispatch(&buf, -1);
delete[] copy;
return obj;