Implement MxDSBuffer constructor, match MxDSSource::FUN_100bffd0 (#235)

* Implement MxDSBuffer constructor, match FUN_100bffd0

* Match to 100%, minor style fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2023-10-22 15:58:05 -04:00 committed by GitHub
parent 5ab993bfda
commit 724c953947
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 9 deletions

View file

@ -1,9 +1,21 @@
#include "mxdsbuffer.h"
DECOMP_SIZE_ASSERT(MxDSBuffer, 0x34);
// OFFSET: LEGO1 0x100c6470
MxDSBuffer::MxDSBuffer()
{
// TODO
m_unk20 = 0;
m_pBuffer = NULL;
m_pIntoBuffer = NULL;
m_pIntoBuffer2 = NULL;
m_unk14 = 0;
m_unk18 = 0;
m_unk1c = 0;
m_writeOffset = 0;
m_bytesRemaining = 0;
m_mode = 2;
m_unk30 = 0;
}
// OFFSET: LEGO1 0x100c6530
@ -11,3 +23,15 @@ MxDSBuffer::~MxDSBuffer()
{
// TODO
}
// OFFSET: LEGO1 0x100c6780
MxResult MxDSBuffer::FUN_100c6780(void* p_buffer, MxU32 p_size)
{
m_pBuffer = p_buffer;
m_pIntoBuffer = p_buffer;
m_pIntoBuffer2 = p_buffer;
m_bytesRemaining = p_size;
m_writeOffset = p_size;
m_mode = 2;
return SUCCESS;
}

View file

@ -12,9 +12,30 @@ class MxDSBuffer : public MxCore
MxDSBuffer();
virtual ~MxDSBuffer() override;
private:
undefined m_unk08[0x2C];
// OFFSET: LEGO1 0x100c6500
inline virtual const char *ClassName() const override // vtable+0x0c
{
// 0x100f0568
return "MxDSBuffer";
}
MxResult FUN_100c6780(void* p_buffer, MxU32 p_size);
inline void* GetBuffer() { return m_pBuffer;}
inline MxU32 GetWriteOffset() { return m_writeOffset;}
private:
void* m_pBuffer;
void* m_pIntoBuffer;
void* m_pIntoBuffer2;
undefined4 m_unk14;
undefined4 m_unk18;
undefined4 m_unk1c;
undefined2 m_unk20;
undefined4 m_mode;
MxU32 m_writeOffset;
MxU32 m_bytesRemaining;
undefined4 m_unk30;
};
#endif // MXDSBUFFER_H

View file

@ -1,10 +1,10 @@
#include "mxdssource.h"
#include "mxdsbuffer.h"
// OFFSET: LEGO1 0x100bffd0
void MxDSSource::FUN_100bffd0(void* p_unk)
void MxDSSource::ReadToBuffer(MxDSBuffer* p_buffer)
{
// TODO: Calls read, reading into a buffer somewhere in p_unk.
Read(NULL, 0);
Read((unsigned char*)p_buffer->GetBuffer(), p_buffer->GetWriteOffset());
}
// OFFSET: LEGO1 0x100bfff0
@ -17,4 +17,4 @@ MxLong MxDSSource::GetLengthInDWords()
MxU32 *MxDSSource::GetBuffer()
{
return m_pBuffer;
}
}

View file

@ -3,13 +3,15 @@
#include "mxcore.h"
class MxDSBuffer;
// VTABLE 0x100dc8c8
class MxDSSource : public MxCore
{
public:
MxDSSource()
: m_lengthInDWords(0)
, m_pBuffer(0)
, m_pBuffer(NULL)
, m_position(-1)
{}
@ -28,7 +30,7 @@ class MxDSSource : public MxCore
virtual MxLong Open(MxULong) = 0;
virtual MxLong Close() = 0;
virtual void FUN_100bffd0(void* p_unk);
virtual void ReadToBuffer(MxDSBuffer* p_buffer);
virtual MxResult Read(unsigned char *, MxULong) = 0;
virtual MxLong Seek(MxLong, int) = 0;
virtual MxULong GetBufferSize() = 0;