mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 08:41:16 +00:00
Merge remote-tracking branch 'upstream/master' into impl/legoobjectfactory
This commit is contained in:
commit
5b730cc6ca
@ -2,6 +2,7 @@
|
||||
#define LEGO3DVIEW_H
|
||||
|
||||
#include "mxtypes.h"
|
||||
#include "tgl/d3drm/impl.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
class LegoROI;
|
||||
@ -9,11 +10,18 @@ class LegoROI;
|
||||
class Lego3DView {
|
||||
public:
|
||||
inline ViewManager* GetViewManager() { return this->m_viewManager; }
|
||||
inline TglImpl::ViewImpl* GetViewPort() { return this->m_viewPort; }
|
||||
LegoROI* PickROI(MxLong p_a, MxLong p_b);
|
||||
|
||||
private:
|
||||
char m_pad[0x88];
|
||||
ViewManager* m_viewManager;
|
||||
// TODO: all of these fields are in various base classes
|
||||
undefined4 m_vtable; // 0x0 (TODO: remove once virtual function added)
|
||||
undefined4 m_unk0x4; // 0x4
|
||||
TglImpl::RendererImpl* m_renderImpl; // 0x8
|
||||
TglImpl::DeviceImpl* m_deviceImpl; // 0xc
|
||||
TglImpl::ViewImpl* m_viewPort; // 0x10
|
||||
char m_pad[0x78]; // 0x14
|
||||
ViewManager* m_viewManager; // 0x88
|
||||
};
|
||||
|
||||
#endif // LEGO3DVIEW_H
|
||||
|
||||
@ -37,6 +37,13 @@ LegoVideoManager::~LegoVideoManager()
|
||||
delete m_palette;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007ac40
|
||||
MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
|
||||
{
|
||||
// TODO
|
||||
return MxVideoManager::Create(p_videoParam, p_frequencyMS, p_createThread);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007b5e0
|
||||
void LegoVideoManager::Destroy()
|
||||
{
|
||||
@ -69,6 +76,31 @@ void LegoVideoManager::MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY)
|
||||
m_cursorY = 463;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007b770
|
||||
MxResult LegoVideoManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007c080
|
||||
void LegoVideoManager::VTable0x38(undefined4, undefined4)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c290
|
||||
MxResult LegoVideoManager::RealizePalette(MxPalette* p_pallete)
|
||||
{
|
||||
if (p_pallete && m_videoParam.GetPalette()) {
|
||||
p_pallete->GetEntries(m_paletteEntries);
|
||||
m_videoParam.GetPalette()->SetEntries(m_paletteEntries);
|
||||
m_displaySurface->SetPalette(m_videoParam.GetPalette());
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c300
|
||||
void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable)
|
||||
{
|
||||
@ -135,9 +167,7 @@ void LegoVideoManager::SetSkyColor(float p_red, float p_green, float p_blue)
|
||||
colorStrucure.peFlags = -124;
|
||||
m_videoParam.GetPalette()->SetSkyColor(&colorStrucure);
|
||||
m_videoParam.GetPalette()->SetOverrideSkyColor(TRUE);
|
||||
|
||||
// TODO 3d manager
|
||||
// m_3dManager->m_pViewport->VTable0x1c(red, green, blue)
|
||||
m_3dManager->GetLego3DView()->GetViewPort()->SetBackgroundColor(p_red, p_green, p_blue);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c4c0
|
||||
@ -146,6 +176,21 @@ void LegoVideoManager::OverrideSkyColor(MxBool p_shouldOverride)
|
||||
this->m_videoParam.GetPalette()->SetOverrideSkyColor(p_shouldOverride);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007c4d0
|
||||
void LegoVideoManager::VTable0x34(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height)
|
||||
{
|
||||
if (p_width == 0) {
|
||||
p_width = m_videoParam.GetRect().GetWidth();
|
||||
}
|
||||
if (p_height == 0) {
|
||||
p_height = m_videoParam.GetRect().GetHeight();
|
||||
}
|
||||
|
||||
if (!m_initialized) {
|
||||
m_3dManager->GetLego3DView()->GetViewPort()->ForceUpdate(p_x, p_y, p_width, p_height);
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1007c560
|
||||
int LegoVideoManager::EnableRMDevice()
|
||||
{
|
||||
|
||||
@ -21,7 +21,15 @@ class LegoVideoManager : public MxVideoManager {
|
||||
__declspec(dllexport) void EnableFullScreenMovie(MxBool p_enable, MxBool p_scale);
|
||||
__declspec(dllexport) void MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY);
|
||||
|
||||
virtual void Destroy() override; // vtable+0x18
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
virtual void Destroy() override; // vtable+0x18
|
||||
virtual MxResult Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
|
||||
override; // vtable+0x2c
|
||||
virtual MxResult RealizePalette(MxPalette*) override; // vtable+0x30
|
||||
virtual void VTable0x34(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) override; // vtable+0x34
|
||||
virtual void VTable0x38(undefined4, undefined4); // vtable+0x38
|
||||
// FUNCTION: LGEO1 0x1007ab10
|
||||
virtual undefined4 VTable0x3c() { return m_unk0x4e8; } // vtable+0x3c
|
||||
|
||||
void SetSkyColor(float p_red, float p_green, float p_blue);
|
||||
void OverrideSkyColor(MxBool p_shouldOverride);
|
||||
|
||||
@ -77,10 +77,47 @@ MxResult MxDiskStreamProvider::SetResourceToGet(MxStreamController* p_resource)
|
||||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100d15e0
|
||||
// FUNCTION: LEGO1 0x100d15e0
|
||||
void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action)
|
||||
{
|
||||
// TODO
|
||||
MxDSStreamingAction* action;
|
||||
|
||||
if (p_action->GetObjectId() == -1) {
|
||||
m_unk0x35 = FALSE;
|
||||
|
||||
do {
|
||||
action = NULL;
|
||||
|
||||
{
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
m_list.PopFrontStreamingAction(action);
|
||||
}
|
||||
|
||||
if (!action)
|
||||
return;
|
||||
|
||||
if (action->GetUnknowna0()->GetWriteOffset() < 0x20000)
|
||||
g_unk0x10102878--;
|
||||
|
||||
((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action);
|
||||
} while (action);
|
||||
}
|
||||
else {
|
||||
do {
|
||||
{
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
action = (MxDSStreamingAction*) m_list.Find(p_action, TRUE);
|
||||
}
|
||||
|
||||
if (!action)
|
||||
return;
|
||||
|
||||
if (action->GetUnknowna0()->GetWriteOffset() < 0x20000)
|
||||
g_unk0x10102878--;
|
||||
|
||||
((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action);
|
||||
} while (action);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100d1750
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac);
|
||||
|
||||
MxU32 g_unk0x1010215c = 0;
|
||||
|
||||
// FUNCTION: LEGO1 0x100ba500
|
||||
MxDisplaySurface::MxDisplaySurface()
|
||||
{
|
||||
@ -248,9 +250,60 @@ undefined4 MxDisplaySurface::VTable0x34(undefined4, undefined4, undefined4, unde
|
||||
return 0;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100bba50
|
||||
void MxDisplaySurface::Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4)
|
||||
// FUNCTION: LEGO1 0x100bba50
|
||||
void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p_top2, MxS32 p_width, MxS32 p_height)
|
||||
{
|
||||
if (m_videoParam.Flags().GetF2bit1()) {
|
||||
if (m_videoParam.Flags().GetFlipSurfaces()) {
|
||||
if (g_unk0x1010215c < 2) {
|
||||
g_unk0x1010215c++;
|
||||
|
||||
DDSURFACEDESC ddsd;
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
if (m_ddSurface2->Lock(NULL, &ddsd, 1, NULL) == S_OK) {
|
||||
MxU8* surface = (MxU8*) ddsd.lpSurface;
|
||||
MxS32 height = m_videoParam.GetRect().GetHeight();
|
||||
|
||||
for (MxU32 i = 0; i < ddsd.dwHeight; i++) {
|
||||
memset(surface, 0, ddsd.dwWidth * ddsd.ddpfPixelFormat.dwRGBBitCount / 8);
|
||||
surface += ddsd.lPitch;
|
||||
}
|
||||
|
||||
m_ddSurface2->Unlock(ddsd.lpSurface);
|
||||
}
|
||||
else {
|
||||
OutputDebugString("MxDisplaySurface::Display error\n");
|
||||
}
|
||||
}
|
||||
m_ddSurface1->Flip(NULL, 1);
|
||||
}
|
||||
else {
|
||||
POINT point = {0, 0};
|
||||
ClientToScreen(MxOmni::GetInstance()->GetWindowHandle(), &point);
|
||||
|
||||
// TODO: Match
|
||||
RECT rect1, rect2;
|
||||
rect1.left = p_left2 + m_videoParam.GetRect().GetLeft() + point.x;
|
||||
rect2.left = p_left;
|
||||
rect1.top = p_top2 + m_videoParam.GetRect().GetTop() + point.y;
|
||||
rect2.right = p_left + p_width;
|
||||
rect2.top = p_top;
|
||||
rect2.bottom = p_top + p_height;
|
||||
rect1.right = rect1.left + p_width;
|
||||
rect1.bottom = rect1.top + p_height;
|
||||
|
||||
DDBLTFX data;
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.dwSize = sizeof(data);
|
||||
data.dwDDFX = 8;
|
||||
|
||||
if (m_ddSurface1->Blt(&rect1, m_ddSurface2, &rect2, 0, &data) == DDERR_SURFACELOST) {
|
||||
m_ddSurface1->Restore();
|
||||
m_ddSurface1->Blt(&rect1, m_ddSurface2, &rect2, 0, &data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100bbc10
|
||||
|
||||
@ -62,7 +62,7 @@ class MxDisplaySurface : public MxCore {
|
||||
MxBool
|
||||
);
|
||||
virtual undefined4 VTable0x34(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
|
||||
virtual void Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
|
||||
virtual void Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p_top2, MxS32 p_width, MxS32 p_height);
|
||||
virtual void GetDC(HDC* p_hdc);
|
||||
virtual void ReleaseDC(HDC p_hdc);
|
||||
virtual LPDIRECTDRAWSURFACE VTable0x44(MxBitmap*, undefined4*, undefined4, undefined4);
|
||||
|
||||
@ -30,11 +30,45 @@ MxDSBuffer::MxDSBuffer()
|
||||
MxDSBuffer::~MxDSBuffer()
|
||||
{
|
||||
if (m_pBuffer != NULL) {
|
||||
if (m_mode == MxDSBufferType_Chunk) {
|
||||
// TODO
|
||||
}
|
||||
else if (m_mode == MxDSBufferType_Allocate || m_mode == MxDSBufferType_Unknown) {
|
||||
switch (m_mode) {
|
||||
case MxDSBufferType_Allocate:
|
||||
case MxDSBufferType_Unknown:
|
||||
delete[] m_pBuffer;
|
||||
break;
|
||||
|
||||
case MxDSBufferType_Chunk: {
|
||||
MxU32 offset = m_writeOffset / 1024;
|
||||
MxStreamer* streamer = Streamer();
|
||||
|
||||
switch (offset) {
|
||||
case 0x40: {
|
||||
MxU32 a =
|
||||
(m_pBuffer - streamer->GetSubclass1().GetBuffer()) / (streamer->GetSubclass1().GetSize() << 10);
|
||||
|
||||
MxU32 bit = 1 << ((MxU8) a & 0x1f);
|
||||
MxU32 index = (a & ~0x18u) >> 3;
|
||||
|
||||
if ((*(MxU32*) (&streamer->GetSubclass1().GetUnk08Ref()[index])) & bit) {
|
||||
MxU32* ptr = (MxU32*) (&streamer->GetSubclass1().GetUnk08Ref()[index]);
|
||||
*ptr = *ptr ^ bit;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x80: {
|
||||
MxU32 a =
|
||||
(m_pBuffer - streamer->GetSubclass1().GetBuffer()) / (streamer->GetSubclass1().GetSize() << 10);
|
||||
|
||||
MxU32 bit = 1 << ((MxU8) a & 0x1f);
|
||||
MxU32 index = (a & ~0x18u) >> 3;
|
||||
|
||||
if ((*(MxU32*) (&streamer->GetSubclass2().GetUnk08Ref()[index])) & bit) {
|
||||
MxU32* ptr = (MxU32*) (&streamer->GetSubclass2().GetUnk08Ref()[index]);
|
||||
*ptr = *ptr ^ bit;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,7 +280,7 @@ MxResult MxDSBuffer::StartPresenterFromAction(
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100c6a50
|
||||
// FUNCTION: LEGO1 0x100c6a50
|
||||
MxResult MxDSBuffer::ParseChunk(
|
||||
MxStreamController* p_controller,
|
||||
MxU32* p_data,
|
||||
@ -255,8 +289,83 @@ MxResult MxDSBuffer::ParseChunk(
|
||||
MxStreamChunk* p_header
|
||||
)
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
MxResult result = SUCCESS;
|
||||
|
||||
if (m_unk0x30->GetFlags() & MxDSAction::Flag_Bit3 && m_unk0x30->GetUnknowna8() && p_header->GetTime() < 0) {
|
||||
delete p_header;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
p_header->SetTime(p_header->GetTime() + m_unk0x30->GetUnknowna8());
|
||||
|
||||
if (p_header->GetFlags() & MxDSChunk::Flag_Bit5) {
|
||||
MxU32 length = p_header->GetLength() + MxDSChunk::ReturnE() + 8;
|
||||
MxDSBuffer* buffer = new MxDSBuffer();
|
||||
|
||||
if (buffer && buffer->AllocateBuffer(length, MxDSBufferType_Allocate) == SUCCESS &&
|
||||
buffer->CalcBytesRemaining((MxU8*) p_data) == SUCCESS) {
|
||||
*p_streamingAction = new MxDSStreamingAction((MxDSStreamingAction&) *p_action);
|
||||
;
|
||||
|
||||
if (*p_streamingAction) {
|
||||
MxU16* flags = MxStreamChunk::IntoFlags(buffer->GetBuffer());
|
||||
*flags = p_header->GetFlags() & ~MxDSChunk::Flag_Bit5;
|
||||
|
||||
delete p_header;
|
||||
(*p_streamingAction)->SetUnknowna0(buffer);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer)
|
||||
delete buffer;
|
||||
|
||||
delete p_header;
|
||||
return FAILURE;
|
||||
}
|
||||
else {
|
||||
if (p_header->GetFlags() & MxDSChunk::Flag_Bit2) {
|
||||
if (m_unk0x30->HasId(p_header->GetObjectId())) {
|
||||
if (m_unk0x30->GetFlags() & MxDSAction::Flag_Bit3 &&
|
||||
(m_unk0x30->GetLoopCount() > 1 || m_unk0x30->GetDuration() == -1)) {
|
||||
|
||||
if (p_action->GetObjectId() == p_header->GetObjectId()) {
|
||||
MxU32 val = p_controller->GetProvider()->GetBufferForDWords()[m_unk0x30->GetObjectId()];
|
||||
|
||||
m_unk0x30->SetUnknown94(val);
|
||||
m_unk0x30->SetBufferOffset(m_writeOffset * (val / m_writeOffset));
|
||||
|
||||
MxNextActionDataStart* data =
|
||||
p_controller->FindNextActionDataStartFromStreamingAction(m_unk0x30);
|
||||
|
||||
if (data)
|
||||
data->SetData(m_unk0x30->GetBufferOffset());
|
||||
|
||||
m_unk0x30->FUN_100cd2d0();
|
||||
}
|
||||
|
||||
delete p_header;
|
||||
p_header = NULL;
|
||||
}
|
||||
else {
|
||||
if (p_action->GetObjectId() == p_header->GetObjectId() &&
|
||||
p_controller->VTable0x30(p_action) == SUCCESS) {
|
||||
p_controller->GetProvider()->VTable0x20(p_action);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_header) {
|
||||
if (p_header->SendChunk(p_controller->GetSubscriberList(), TRUE, p_action->GetUnknown24()) != SUCCESS) {
|
||||
delete p_header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c6d00
|
||||
@ -343,11 +452,36 @@ void MxDSBuffer::AddRef(MxDSChunk* p_chunk)
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100c6ef0
|
||||
// FUNCTION: LEGO1 0x100c6ef0
|
||||
MxResult MxDSBuffer::CalcBytesRemaining(MxU8* p_data)
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
MxResult result = FAILURE;
|
||||
|
||||
if (m_mode == MxDSBufferType_Allocate && m_bytesRemaining != 0) {
|
||||
MxU32 bytesRead;
|
||||
MxU8* ptr;
|
||||
|
||||
if (m_writeOffset == m_bytesRemaining) {
|
||||
bytesRead = *(MxU32*) (p_data + 4) + 8;
|
||||
ptr = p_data;
|
||||
}
|
||||
else {
|
||||
ptr = &p_data[MxStreamChunk::ReturnE() + 8];
|
||||
bytesRead = (*(MxU32*) (p_data + 4)) - MxStreamChunk::ReturnE();
|
||||
}
|
||||
|
||||
if (bytesRead <= m_bytesRemaining) {
|
||||
memcpy(m_pBuffer + m_writeOffset - m_bytesRemaining, ptr, bytesRead);
|
||||
|
||||
if (m_writeOffset == m_bytesRemaining)
|
||||
*(MxU32*) (m_pBuffer + 4) = *MxStreamChunk::IntoPlus0x12(m_pBuffer) + MxStreamChunk::ReturnE();
|
||||
|
||||
m_bytesRemaining -= bytesRead;
|
||||
result = SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c6f80
|
||||
|
||||
@ -19,3 +19,9 @@ MxDSChunk::~MxDSChunk()
|
||||
delete[] m_data;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100be1e0
|
||||
MxU32 MxDSChunk::ReturnE()
|
||||
{
|
||||
return 0xe;
|
||||
}
|
||||
|
||||
@ -13,6 +13,8 @@ class MxDSChunk : public MxCore {
|
||||
Flag_Bit1 = 0x01,
|
||||
Flag_Bit2 = 0x02,
|
||||
Flag_Bit3 = 0x04,
|
||||
Flag_Bit4 = 0x08,
|
||||
Flag_Bit5 = 0x10,
|
||||
Flag_Bit8 = 0x80,
|
||||
Flag_Bit16 = 0x8000
|
||||
};
|
||||
@ -33,6 +35,8 @@ class MxDSChunk : public MxCore {
|
||||
return !strcmp(p_name, MxDSChunk::ClassName()) || MxCore::IsA(p_name);
|
||||
}
|
||||
|
||||
static MxU32 ReturnE();
|
||||
|
||||
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; }
|
||||
|
||||
@ -35,6 +35,7 @@ class MxDSStreamingAction : public MxDSAction {
|
||||
inline MxS32 GetUnknown9c() { return m_unk0x9c; }
|
||||
inline MxDSBuffer* GetUnknowna0() { return m_unk0xa0; }
|
||||
inline MxDSBuffer* GetUnknowna4() { return m_unk0xa4; }
|
||||
inline MxLong GetUnknowna8() { return m_unk0xa8; }
|
||||
inline MxDSAction* GetInternalAction() { return m_internalAction; }
|
||||
inline MxU32 GetBufferOffset() { return m_bufferOffset; }
|
||||
inline void SetUnknown94(MxU32 p_unk0x94) { m_unk0x94 = p_unk0x94; }
|
||||
|
||||
@ -17,7 +17,7 @@ MxDSSubscriber::MxDSSubscriber()
|
||||
MxDSSubscriber::~MxDSSubscriber()
|
||||
{
|
||||
if (m_controller)
|
||||
m_controller->FUN_100c1620(this);
|
||||
m_controller->RemoveSubscriber(this);
|
||||
|
||||
DeleteChunks();
|
||||
|
||||
@ -48,7 +48,7 @@ MxResult MxDSSubscriber::Create(MxStreamController* p_controller, MxU32 p_object
|
||||
if (!m_unk0x3c)
|
||||
return FAILURE;
|
||||
|
||||
m_controller->FUN_100c15d0(this);
|
||||
m_controller->AddSubscriber(this);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include "legoutil.h"
|
||||
#include "mxdsbuffer.h"
|
||||
#include "mxstreamlist.h"
|
||||
|
||||
// FUNCTION: LEGO1 0x100c2fe0
|
||||
MxStreamChunk::~MxStreamChunk()
|
||||
@ -48,8 +49,51 @@ MxU32 MxStreamChunk::ReadChunkHeader(MxU8* p_chunkData)
|
||||
return headersize;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c30e0
|
||||
MxResult MxStreamChunk::SendChunk(MxStreamListMxDSSubscriber& p_subscriberList, MxBool p_append, MxS16 p_obj24val)
|
||||
{
|
||||
for (MxStreamListMxDSSubscriber::iterator it = p_subscriberList.begin(); it != p_subscriberList.end(); it++) {
|
||||
if ((*it)->GetObjectId() == m_objectId && (*it)->GetUnknown48() == p_obj24val) {
|
||||
if (m_flags & MxDSChunk::Flag_Bit2 && m_buffer) {
|
||||
m_buffer->ReleaseRef(this);
|
||||
m_buffer = NULL;
|
||||
}
|
||||
|
||||
(*it)->AddChunk(this, p_append);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c3170
|
||||
void MxStreamChunk::SetBuffer(MxDSBuffer* p_buffer)
|
||||
{
|
||||
m_buffer = p_buffer;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c3180
|
||||
MxU16* MxStreamChunk::IntoFlags(MxU8* p_buffer)
|
||||
{
|
||||
return (MxU16*) (p_buffer + 8);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c3190
|
||||
MxU32* MxStreamChunk::IntoPlus0xa(MxU8* p_buffer)
|
||||
{
|
||||
return (MxU32*) (p_buffer + 0xa);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c31a0
|
||||
MxU32* MxStreamChunk::IntoPlus0xe(MxU8* p_buffer)
|
||||
{
|
||||
return (MxU32*) (p_buffer + 0xe);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c31b0
|
||||
MxU32* MxStreamChunk::IntoPlus0x12(MxU8* p_buffer)
|
||||
{
|
||||
return (MxU32*) (p_buffer + 0x12);
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@
|
||||
#define MXSTREAMCHUNK_H
|
||||
|
||||
#include "mxdschunk.h"
|
||||
#include "mxdsobject.h"
|
||||
|
||||
class MxDSBuffer;
|
||||
class MxStreamListMxDSSubscriber;
|
||||
|
||||
// VTABLE: LEGO1 0x100dc2a8
|
||||
// SIZE 0x20
|
||||
@ -29,8 +31,14 @@ class MxStreamChunk : public MxDSChunk {
|
||||
|
||||
MxResult ReadChunk(MxDSBuffer* p_buffer, MxU8* p_chunkData);
|
||||
MxU32 ReadChunkHeader(MxU8* p_chunkData);
|
||||
MxResult SendChunk(MxStreamListMxDSSubscriber& p_subscriberList, MxBool p_append, MxS16 p_obj24val);
|
||||
void SetBuffer(MxDSBuffer* p_buffer);
|
||||
|
||||
static MxU16* IntoFlags(MxU8* p_buffer);
|
||||
static MxU32* IntoPlus0x12(MxU8* p_buffer);
|
||||
static MxU32* IntoPlus0xa(MxU8* p_buffer);
|
||||
static MxU32* IntoPlus0xe(MxU8* p_buffer);
|
||||
|
||||
private:
|
||||
MxDSBuffer* m_buffer; // 0x1c
|
||||
};
|
||||
|
||||
@ -78,16 +78,16 @@ MxResult MxStreamController::Open(const char* p_filename)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100c15d0
|
||||
void MxStreamController::FUN_100c15d0(MxDSSubscriber* p_subscriber)
|
||||
// FUNCTION: LEGO1 0x100c15d0
|
||||
void MxStreamController::AddSubscriber(MxDSSubscriber* p_subscriber)
|
||||
{
|
||||
// TODO
|
||||
m_subscriberList.push_back(p_subscriber);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100c1620
|
||||
void MxStreamController::FUN_100c1620(MxDSSubscriber* p_subscriber)
|
||||
// FUNCTION: LEGO1 0x100c1620
|
||||
void MxStreamController::RemoveSubscriber(MxDSSubscriber* p_subscriber)
|
||||
{
|
||||
// TODO
|
||||
m_subscriberList.remove(p_subscriber);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c1690
|
||||
@ -259,6 +259,12 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100c20b0
|
||||
MxNextActionDataStart* MxStreamController::FindNextActionDataStartFromStreamingAction(MxDSStreamingAction* p_action)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100c20d0
|
||||
MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj)
|
||||
{
|
||||
|
||||
@ -43,18 +43,21 @@ class MxStreamController : public MxCore {
|
||||
virtual MxResult VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval); // vtable+0x2c
|
||||
virtual MxResult VTable0x30(MxDSAction* p_action); // vtable+0x30
|
||||
|
||||
void FUN_100c15d0(MxDSSubscriber* p_subscriber);
|
||||
void FUN_100c1620(MxDSSubscriber* p_subscriber);
|
||||
void AddSubscriber(MxDSSubscriber* p_subscriber);
|
||||
void RemoveSubscriber(MxDSSubscriber* p_subscriber);
|
||||
MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val);
|
||||
MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset);
|
||||
MxPresenter* FUN_100c1e70(MxDSAction& p_action);
|
||||
MxResult FUN_100c1f00(MxDSAction* p_action);
|
||||
MxBool FUN_100c20d0(MxDSObject& p_obj);
|
||||
MxResult InsertActionToList54(MxDSAction* p_action);
|
||||
MxNextActionDataStart* FindNextActionDataStartFromStreamingAction(MxDSStreamingAction* p_action);
|
||||
|
||||
inline MxAtomId& GetAtom() { return m_atom; };
|
||||
inline MxStreamProvider* GetProvider() { return m_provider; };
|
||||
inline MxStreamListMxDSAction& GetUnk0x3c() { return m_unk0x3c; };
|
||||
inline MxStreamListMxDSAction& GetUnk0x54() { return m_unk0x54; };
|
||||
inline MxStreamListMxDSSubscriber& GetSubscriberList() { return m_subscriberList; };
|
||||
|
||||
protected:
|
||||
MxCriticalSection m_criticalSection; // 0x8
|
||||
|
||||
Loading…
Reference in New Issue
Block a user