mirror of
https://github.com/isledecomp/isle.git
synced 2026-05-05 14:33:56 +00:00
MxStreamChunk
This commit is contained in:
parent
f291380198
commit
8b31be1320
@ -1,5 +1,6 @@
|
|||||||
#include "mxdsbuffer.h"
|
#include "mxdsbuffer.h"
|
||||||
|
|
||||||
|
#include "mxdschunk.h"
|
||||||
#include "mxdsstreamingaction.h"
|
#include "mxdsstreamingaction.h"
|
||||||
#include "mxomni.h"
|
#include "mxomni.h"
|
||||||
#include "mxstreamchunk.h"
|
#include "mxstreamchunk.h"
|
||||||
@ -11,7 +12,7 @@ DECOMP_SIZE_ASSERT(MxDSBuffer, 0x34);
|
|||||||
// FUNCTION: LEGO1 0x100c6470
|
// FUNCTION: LEGO1 0x100c6470
|
||||||
MxDSBuffer::MxDSBuffer()
|
MxDSBuffer::MxDSBuffer()
|
||||||
{
|
{
|
||||||
m_unk0x20 = 0;
|
m_refcount = 0;
|
||||||
m_pBuffer = NULL;
|
m_pBuffer = NULL;
|
||||||
m_pIntoBuffer = NULL;
|
m_pIntoBuffer = NULL;
|
||||||
m_pIntoBuffer2 = NULL;
|
m_pIntoBuffer2 = NULL;
|
||||||
@ -143,7 +144,7 @@ MxResult MxDSBuffer::CreateObject(MxStreamController* p_controller, MxU32* p_dat
|
|||||||
|
|
||||||
switch (*p_data) {
|
switch (*p_data) {
|
||||||
case FOURCC('M', 'x', 'C', 'h'):
|
case FOURCC('M', 'x', 'C', 'h'):
|
||||||
if (!m_unk0x30->HasId(((MxStreamChunk*) header)->GetUnk0xc())) {
|
if (!m_unk0x30->HasId(((MxStreamChunk*) header)->GetObjectId())) {
|
||||||
delete header;
|
delete header;
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
@ -230,6 +231,23 @@ MxCore* MxDSBuffer::ReadChunk(MxU32* p_chunkData, MxU16 p_flags)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100c6ec0
|
||||||
|
MxU8 MxDSBuffer::ReleaseRef(MxDSChunk*)
|
||||||
|
{
|
||||||
|
if (m_refcount != 0) {
|
||||||
|
m_refcount--;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100c6ee0
|
||||||
|
void MxDSBuffer::AddRef(MxDSChunk* p_chunk)
|
||||||
|
{
|
||||||
|
if (p_chunk) {
|
||||||
|
m_refcount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100c6f80
|
// FUNCTION: LEGO1 0x100c6f80
|
||||||
void MxDSBuffer::FUN_100c6f80(MxU32 p_writeOffset)
|
void MxDSBuffer::FUN_100c6f80(MxU32 p_writeOffset)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,6 +8,7 @@ class MxStreamController;
|
|||||||
class MxDSAction;
|
class MxDSAction;
|
||||||
class MxDSStreamingAction;
|
class MxDSStreamingAction;
|
||||||
class MxStreamChunk;
|
class MxStreamChunk;
|
||||||
|
class MxDSChunk;
|
||||||
|
|
||||||
enum MxDSBufferType {
|
enum MxDSBufferType {
|
||||||
MxDSBufferType_Chunk = 0,
|
MxDSBufferType_Chunk = 0,
|
||||||
@ -37,23 +38,25 @@ class MxDSBuffer : public MxCore {
|
|||||||
MxResult StartPresenterFromAction(MxStreamController* p_controller, MxDSAction* p_action1, MxDSAction* p_action2);
|
MxResult StartPresenterFromAction(MxStreamController* p_controller, MxDSAction* p_action1, MxDSAction* p_action2);
|
||||||
MxResult ParseChunk(MxStreamController* p_controller, MxU32* p_data, MxDSAction* p_action, MxStreamChunk* p_header);
|
MxResult ParseChunk(MxStreamController* p_controller, MxU32* p_data, MxDSAction* p_action, MxStreamChunk* p_header);
|
||||||
MxCore* ReadChunk(MxU32* p_chunkData, MxU16 p_flags);
|
MxCore* ReadChunk(MxU32* p_chunkData, MxU16 p_flags);
|
||||||
|
MxU8 ReleaseRef(MxDSChunk*);
|
||||||
|
void AddRef(MxDSChunk* p_chunk);
|
||||||
void FUN_100c6f80(MxU32 p_writeOffset);
|
void FUN_100c6f80(MxU32 p_writeOffset);
|
||||||
|
|
||||||
inline MxU8* GetBuffer() { return m_pBuffer; }
|
inline MxU8* GetBuffer() { return m_pBuffer; }
|
||||||
inline MxU32 GetWriteOffset() { return m_writeOffset; }
|
inline MxU32 GetWriteOffset() { return m_writeOffset; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MxU8* m_pBuffer;
|
MxU8* m_pBuffer; // 0x08
|
||||||
MxU8* m_pIntoBuffer;
|
MxU8* m_pIntoBuffer; // 0x0c
|
||||||
MxU8* m_pIntoBuffer2;
|
MxU8* m_pIntoBuffer2; // 0x10
|
||||||
undefined4 m_unk0x14;
|
undefined4 m_unk0x14; // 0x14
|
||||||
undefined4 m_unk0x18;
|
undefined4 m_unk0x18; // 0x18
|
||||||
undefined4 m_unk0x1c;
|
undefined4 m_unk0x1c; // 0x1c
|
||||||
undefined2 m_unk0x20;
|
MxU16 m_refcount; // 0x20
|
||||||
MxDSBufferType m_mode;
|
MxDSBufferType m_mode; // 0x24
|
||||||
MxU32 m_writeOffset;
|
MxU32 m_writeOffset; // 0x28
|
||||||
MxU32 m_bytesRemaining;
|
MxU32 m_bytesRemaining; // 0x2c
|
||||||
MxDSStreamingAction* m_unk0x30;
|
MxDSStreamingAction* m_unk0x30; // 0x30
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MXDSBUFFER_H
|
#endif // MXDSBUFFER_H
|
||||||
|
|||||||
@ -7,7 +7,7 @@ MxDSChunk::MxDSChunk()
|
|||||||
{
|
{
|
||||||
m_flags = 0;
|
m_flags = 0;
|
||||||
m_data = NULL;
|
m_data = NULL;
|
||||||
m_unk0x0c = -1;
|
m_objectid = -1;
|
||||||
m_time = 0;
|
m_time = 0;
|
||||||
m_length = 0;
|
m_length = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,7 @@ class MxDSChunk : public MxCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void SetFlags(MxU16 p_flags) { m_flags = p_flags; }
|
inline void SetFlags(MxU16 p_flags) { m_flags = p_flags; }
|
||||||
|
inline void SetObjectId(undefined4 p_objectid) { m_objectid = p_objectid; }
|
||||||
inline void SetTime(MxLong p_time) { m_time = p_time; }
|
inline void SetTime(MxLong p_time) { m_time = p_time; }
|
||||||
inline void SetLength(MxU32 p_length) { m_length = p_length; }
|
inline void SetLength(MxU32 p_length) { m_length = p_length; }
|
||||||
inline void SetData(MxU8* p_data) { m_data = p_data; }
|
inline void SetData(MxU8* p_data) { m_data = p_data; }
|
||||||
@ -43,7 +44,7 @@ class MxDSChunk : public MxCore {
|
|||||||
inline MxU32 GetLength() { return m_length; }
|
inline MxU32 GetLength() { return m_length; }
|
||||||
inline MxU8* GetData() { return m_data; }
|
inline MxU8* GetData() { return m_data; }
|
||||||
|
|
||||||
inline undefined4 GetUnk0xc() { return m_unk0x0c; }
|
inline undefined4 GetObjectId() { return m_objectid; }
|
||||||
|
|
||||||
inline void Release()
|
inline void Release()
|
||||||
{
|
{
|
||||||
@ -53,7 +54,7 @@ class MxDSChunk : public MxCore {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MxU16 m_flags; // 0x8
|
MxU16 m_flags; // 0x8
|
||||||
undefined4 m_unk0x0c; // 0xc
|
undefined4 m_objectid; // 0xc
|
||||||
MxLong m_time; // 0x10
|
MxLong m_time; // 0x10
|
||||||
MxU32 m_length; // 0x14
|
MxU32 m_length; // 0x14
|
||||||
MxU8* m_data; // 0x18
|
MxU8* m_data; // 0x18
|
||||||
|
|||||||
@ -1,8 +1,51 @@
|
|||||||
#include "mxstreamchunk.h"
|
#include "mxstreamchunk.h"
|
||||||
|
|
||||||
// STUB: LEGO1 0x100c3050
|
#include "mxdsbuffer.h"
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100c2fe0
|
||||||
|
MxStreamChunk::~MxStreamChunk()
|
||||||
|
{
|
||||||
|
if (m_buffer) {
|
||||||
|
m_buffer->ReleaseRef(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100c3050
|
||||||
MxResult MxStreamChunk::ReadChunk(MxDSBuffer* p_buffer, MxU8* p_chunkData)
|
MxResult MxStreamChunk::ReadChunk(MxDSBuffer* p_buffer, MxU8* p_chunkData)
|
||||||
{
|
{
|
||||||
// TODO
|
MxResult result = FAILURE;
|
||||||
return FAILURE;
|
|
||||||
|
if (p_chunkData != NULL && *(MxU32*) p_chunkData == FOURCC('M', 'x', 'C', 'h')) {
|
||||||
|
if (ReadChunkHeader(p_chunkData + 8)) {
|
||||||
|
if (p_buffer) {
|
||||||
|
SetBuffer(p_buffer);
|
||||||
|
p_buffer->AddRef(this);
|
||||||
|
}
|
||||||
|
result = SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100c30a0
|
||||||
|
MxU32 MxStreamChunk::ReadChunkHeader(MxU8* p_chunkData)
|
||||||
|
{
|
||||||
|
MxU32 headersize = 0;
|
||||||
|
if(p_chunkData)
|
||||||
|
{
|
||||||
|
SetFlags(*(MxU16*)p_chunkData);
|
||||||
|
SetObjectId(*(MxU32*)(p_chunkData + 2));
|
||||||
|
SetTime(*(MxLong*)(p_chunkData + 6));
|
||||||
|
SetLength(*(MxU32*)(p_chunkData + 10));
|
||||||
|
SetData(p_chunkData + 14);
|
||||||
|
headersize = (MxU32)(p_chunkData + 14) - (MxU32)p_chunkData;
|
||||||
|
}
|
||||||
|
return headersize;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100c3170
|
||||||
|
void MxStreamChunk::SetBuffer(MxDSBuffer* p_buffer)
|
||||||
|
{
|
||||||
|
m_buffer = p_buffer;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,8 @@ class MxDSBuffer;
|
|||||||
// SIZE 0x20
|
// SIZE 0x20
|
||||||
class MxStreamChunk : public MxDSChunk {
|
class MxStreamChunk : public MxDSChunk {
|
||||||
public:
|
public:
|
||||||
inline MxStreamChunk() : m_unk0x1c(NULL) {}
|
inline MxStreamChunk() : m_buffer(NULL) {}
|
||||||
|
virtual ~MxStreamChunk() override;
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100b1fe0
|
// FUNCTION: LEGO1 0x100b1fe0
|
||||||
inline virtual const char* ClassName() const override // vtable+0xc
|
inline virtual const char* ClassName() const override // vtable+0xc
|
||||||
@ -24,10 +25,14 @@ class MxStreamChunk : public MxDSChunk {
|
|||||||
return !strcmp(p_name, MxStreamChunk::ClassName()) || MxDSChunk::IsA(p_name);
|
return !strcmp(p_name, MxStreamChunk::ClassName()) || MxDSChunk::IsA(p_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline MxDSBuffer* GetBuffer() { return m_buffer; }
|
||||||
|
|
||||||
MxResult ReadChunk(MxDSBuffer* p_buffer, MxU8* p_chunkData);
|
MxResult ReadChunk(MxDSBuffer* p_buffer, MxU8* p_chunkData);
|
||||||
|
MxU32 ReadChunkHeader(MxU8* p_chunkData);
|
||||||
|
void SetBuffer(MxDSBuffer* p_buffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void* m_unk0x1c; // 0x1c
|
MxDSBuffer* m_buffer; // 0x1c
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MXSTREAMCHUNK_H
|
#endif // MXSTREAMCHUNK_H
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user