Merge branch 'master' into deserialize-refactor

This commit is contained in:
Christian Semmler 2023-10-07 14:04:44 -04:00 committed by GitHub
commit 5d85039e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 504 additions and 239 deletions

View File

@ -140,8 +140,8 @@ add_library(lego1 SHARED
LEGO1/mxmatrix.cpp
LEGO1/mxmediamanager.cpp
LEGO1/mxmediapresenter.cpp
LEGO1/mxmidimanager.cpp
LEGO1/mxmidipresenter.cpp
LEGO1/mxmusicmanager.cpp
LEGO1/mxmusicpresenter.cpp
LEGO1/mxnotificationmanager.cpp
LEGO1/mxobjectfactory.cpp
@ -163,6 +163,7 @@ add_library(lego1 SHARED
LEGO1/mxstreamcontroller.cpp
LEGO1/mxstreamer.cpp
LEGO1/mxstring.cpp
LEGO1/mxstringlist.cpp
LEGO1/mxthread.cpp
LEGO1/mxticklemanager.cpp
LEGO1/mxtimer.cpp

View File

@ -3,14 +3,25 @@
#include <dsound.h>
#include "legoomni.h"
#include "legoanimationmanager.h"
#include "legobuildingmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legomodelpresenter.h"
#include "legoomni.h"
#include "legopartpresenter.h"
#include "legoroi.h"
#include "legovideomanager.h"
#include "legoworldpresenter.h"
#include "mxbackgroundaudiomanager.h"
#include "mxdirectdraw.h"
#include "mxdsaction.h"
#include "mxomnicreateflags.h"
#include "mxomnicreateparam.h"
#include "mxstreamer.h"
#include "mxticklemanager.h"
#include "mxtimer.h"
#include "mxtransitionmanager.h"
#include "res/resource.h"
@ -93,7 +104,7 @@ void IsleApp::Close()
Lego()->RemoveWorld(ds.GetAtomId(), ds.GetObjectId());
Lego()->DeleteObject(ds);
TransitionManager()->SetWaitIndicator(NULL);
Lego()->vtable0x3c();
Lego()->StopTimer();
MxLong lVar8;
do {
@ -232,7 +243,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
g_reqEnableRMDevice = 0;
VideoManager()->EnableRMDevice();
g_rmDisabled = 0;
Lego()->vtable0x3c();
Lego()->StopTimer();
}
if (g_closed) {

View File

@ -18,6 +18,9 @@
// Impossible to avoid this if using STL map or set.
// This removes most (but not all) occurrences of the warning.
#pragma warning( disable : 4786 )
// To really remove *all* of the warnings, we have to employ the following,
// obscure workaround from https://www.earthli.com/news/view_article.php?id=376
static class msVC6_4786WorkAround { public: msVC6_4786WorkAround() {} } msVC6_4786WorkAround;
#define MSVC420_VERSION 1020

View File

@ -23,12 +23,8 @@ MxLong LegoEntity::Notify(MxParam &p)
// OFFSET: LEGO1 0x100105f0
void LegoEntity::Reset()
{
float value = 0.0f;
m_vec1.EqualsScalar(&value);
value = 0.0f;
m_vec2.EqualsScalar(&value);
m_vec1.Fill(0);
m_vec2.Fill(0);
m_unk50 = 0;
m_unk54 = 0;
m_unk58 = 0;

View File

@ -1,6 +1,8 @@
#include "legofullscreenmovie.h"
#include "mxtypes.h"
#include "legoomni.h"
#include "legovideomanager.h"
#include "mxtypes.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(LegoFullScreenMovie, 0x24)

View File

@ -1,5 +1,7 @@
#include "legogamestate.h"
#include "legoomni.h"
#include "mxvariabletable.h"
#include "decomp.h"
// Based on the highest dword offset (0x42c) referenced in the constructor.

View File

@ -1,6 +1,7 @@
#include "legonavcontroller.h"
#include "legoomni.h"
#include "legovideomanager.h"
#include "legoutil.h"
// 0x100f4c28

View File

@ -1,6 +1,9 @@
#include "legoomni.h"
#include "mxdsobject.h"
#include "mxbackgroundaudiomanager.h"
#include "mxdsfile.h"
#include "legogamestate.h"
#include "legoutil.h"
// 0x100f4588
char *g_nocdSourceName = NULL;
@ -99,11 +102,10 @@ void SetOmniUserMessage(void (*p_userMsg)(const char *,int))
g_omniUserMessage = p_userMsg;
}
// OFFSET: LEGO1 0x100acf50 STUB
MxLong Start(MxDSAction *)
// OFFSET: LEGO1 0x100acf50
MxResult Start(MxDSAction* p_dsAction)
{
// TODO
return 0;
return MxOmni::GetInstance()->Start(p_dsAction);
}
// OFFSET: LEGO1 0x1005ad10
@ -257,6 +259,10 @@ void LegoOmni::Init()
MxResult LegoOmni::Create(COMPAT_CONST MxOmniCreateParam &p)
{
// FIXME: Stub
MxOmni::Create(p);
m_gameState = new LegoGameState();
m_bkgAudioManager = new MxBackgroundAudioManager();
return SUCCESS;
}
@ -265,9 +271,14 @@ void LegoOmni::Destroy()
// FIXME: Stub
}
void LegoOmni::vtable0x20()
// OFFSET: LEGO1 0x1005b580
MxResult LegoOmni::Start(MxDSAction* action)
{
// FIXME: Stub
MxResult result = MxOmni::Start(action);
this->m_action.SetAtomId(action->GetAtomId());
this->m_action.SetObjectId(action->GetObjectId());
this->m_action.SetUnknown24(action->GetUnknown24());
return result;
}
void LegoOmni::DeleteObject(MxDSAction &ds)
@ -297,14 +308,18 @@ void LegoOmni::NotifyCurrentEntity()
// FIXME: Stub
}
// OFFSET: LEGO1 0x1005b640
void LegoOmni::StartTimer()
{
// FIXME: Stub
MxOmni::StartTimer();
SetAppCursor(2);
}
void LegoOmni::vtable0x3c()
// OFFSET: LEGO1 0x1005b650
void LegoOmni::StopTimer()
{
// FIXME: Stub
MxOmni::StopTimer();
SetAppCursor(0);
}
MxBool LegoOmni::vtable40()

View File

@ -2,25 +2,24 @@
#define LEGOOMNI_H
#include "compat.h"
#include "legoentity.h"
#include "legoinputmanager.h"
#include "legogamestate.h"
#include "legonavcontroller.h"
#include "legopathboundary.h"
#include "legoroi.h"
#include "legovideomanager.h"
#include "mxatomid.h"
#include "mxbackgroundaudiomanager.h"
#include "mxdsaction.h"
#include "mxdsfile.h"
#include "mxdsobject.h"
#include "mxomni.h"
#include "mxtransitionmanager.h"
#include "isle.h"
#include "legobuildingmanager.h"
#include "legoplantmanager.h"
#include "mxdsaction.h"
class Isle;
class LegoBuildingManager;
class LegoEntity;
class LegoGameState;
class LegoInputManager;
class LegoNavController;
class LegoPathBoundary;
class LegoPlantManager;
class LegoROI;
class LegoSoundManager;
class LegoVideoManager;
class LegoWorld;
class MxAtomId;
class MxBackgroundAudioManager;
class MxDSFile;
class MxTransitionManager;
// VTABLE 0x100d8638
@ -55,14 +54,14 @@ class LegoOmni : public MxOmni
virtual void Init() override; // vtable+14
virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p) override; // vtable+18
virtual void Destroy() override; // vtable+1c
virtual void vtable0x20() override;
virtual MxResult Start(MxDSAction* action) override;
virtual void DeleteObject(MxDSAction &ds) override;
virtual MxBool DoesEntityExist(MxDSAction &ds) override;
virtual void vtable0x2c() override;
virtual int vtable0x30(char*, int, MxCore*) override;
virtual void NotifyCurrentEntity() override;
virtual void StartTimer() override;
virtual void vtable0x3c() override;
virtual void StopTimer() override;
virtual MxBool vtable40();
LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; }
@ -110,10 +109,9 @@ __declspec(dllexport) LegoEntity * PickEntity(MxLong,MxLong);
__declspec(dllexport) LegoROI * PickROI(MxLong,MxLong);
__declspec(dllexport) void SetOmniUserMessage(void (*)(const char *,int));
__declspec(dllexport) LegoSoundManager * SoundManager();
__declspec(dllexport) MxLong Start(MxDSAction *);
__declspec(dllexport) MxResult Start(MxDSAction*);
__declspec(dllexport) MxTransitionManager * TransitionManager();
__declspec(dllexport) LegoVideoManager * VideoManager();
__declspec(dllexport) MxLong Start(MxDSAction *a);
LegoBuildingManager* BuildingManager();
Isle* GetIsle();

View File

@ -3,3 +3,15 @@
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxAudioPresenter, 0x54);
// OFFSET: LEGO1 0x1000d260
undefined4 MxAudioPresenter::vtable5c()
{
return this->m_unk50;
}
// OFFSET: LEGO1 0x1000d270
void MxAudioPresenter::vtable60(undefined4 p_unk50)
{
this->m_unk50 = p_unk50;
}

View File

@ -1,6 +1,7 @@
#ifndef MXAUDIOPRESENTER_H
#define MXAUDIOPRESENTER_H
#include "decomp.h"
#include "mxmediapresenter.h"
// VTABLE 0x100d4c70
@ -24,7 +25,10 @@ class MxAudioPresenter : public MxMediaPresenter
return !strcmp(name, MxAudioPresenter::ClassName()) || MxMediaPresenter::IsA(name);
}
int m_unk50;
virtual undefined4 vtable5c();
virtual void vtable60(undefined4);
undefined4 m_unk50;
};
#endif // MXAUDIOPRESENTER_H

View File

@ -25,6 +25,8 @@ struct MxBITMAPINFO {
#define LOWCOLOR 0 // 256 color
#define HIGHCOLOR 1 // High Color (16-bit)
// SIZE 0x20
// VTABLE 0x100dc7b0
class MxBitmap : public MxCore
{
public:
@ -44,6 +46,8 @@ class MxBitmap : public MxCore
virtual MxResult SetBitDepth(MxBool); // vtable+3c
virtual MxResult StretchBits(HDC p_hdc, int p_xSrc, int p_ySrc, int p_xDest, int p_yDest, int p_destWidth, int p_destHeight); // vtable+40
inline BITMAPINFOHEADER *GetBmiHeader() const { return m_bmiHeader; }
private:
MxResult ImportColorsToPalette(RGBQUAD*, MxPalette*);

View File

@ -1,5 +1,7 @@
#include "mxdisplaysurface.h"
#include "mxomni.h"
#include "mxvideomanager.h"
DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac);
@ -174,7 +176,7 @@ void MxDisplaySurface::SetPalette(MxPalette *p_palette)
}
// OFFSET: LEGO1 0x100bc200 STUB
void MxDisplaySurface::vtable24(LPDDSURFACEDESC, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4)
void MxDisplaySurface::vtable24(LPDDSURFACEDESC, MxBitmap*, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4)
{
}
@ -186,7 +188,7 @@ MxBool MxDisplaySurface::vtable28(undefined4, undefined4, undefined4, undefined4
}
// OFFSET: LEGO1 0x100bc630 STUB
MxBool MxDisplaySurface::vtable2c(LPDDSURFACEDESC, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool)
MxBool MxDisplaySurface::vtable2c(LPDDSURFACEDESC, MxBitmap*, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool)
{
return 0;
}

View File

@ -3,6 +3,7 @@
#include <ddraw.h>
#include "mxbitmap.h"
#include "mxcore.h"
#include "mxpalette.h"
#include "mxvideoparam.h"
@ -25,9 +26,9 @@ class MxDisplaySurface : public MxCore
virtual MxResult Create(MxVideoParam &p_videoParam);
virtual void Clear();
virtual void SetPalette(MxPalette *p_palette);
virtual void vtable24(LPDDSURFACEDESC, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
virtual void vtable24(LPDDSURFACEDESC, MxBitmap*, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
virtual MxBool vtable28(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
virtual MxBool vtable2c(LPDDSURFACEDESC, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool);
virtual MxBool vtable2c(LPDDSURFACEDESC, MxBitmap*, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool);
virtual MxBool vtable30(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool);
virtual undefined4 vtable34(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
virtual void Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);

View File

@ -1,11 +1,12 @@
#include "mxdsaction.h"
#include "mxomni.h"
#include "mxtimer.h"
#include "legoutil.h"
#include <float.h>
#include <limits.h>
#include "mxomni.h"
#include "legoutil.h"
DECOMP_SIZE_ASSERT(MxDSAction, 0x94)
// GLOBAL OFFSET: LEGO1 0x10101410
@ -22,22 +23,9 @@ MxDSAction::MxDSAction()
this->m_loopCount = -1;
this->SetType(MxDSType_Action);
{
float value = FLT_MAX;
this->m_location.EqualsScalar(&value);
}
{
float value = FLT_MAX;
this->m_direction.EqualsScalar(&value);
}
{
float value = FLT_MAX;
this->m_up.EqualsScalar(&value);
}
this->m_location.Fill(FLT_MAX);
this->m_direction.Fill(FLT_MAX);
this->m_up.Fill(FLT_MAX);
this->m_unk84 = 0;
this->m_unk88 = 0;
this->m_omni = NULL;

View File

@ -41,8 +41,8 @@ class MxDSAction : public MxDSObject
return !strcmp(name, MxDSAction::ClassName()) || MxDSObject::IsA(name);
}
virtual MxU32 GetSizeOnDisk(); // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c;
virtual MxU32 GetSizeOnDisk() override; // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24) override; // vtable+1c;
virtual MxLong GetDuration(); // vtable+24;
virtual void SetDuration(MxLong p_duration); // vtable+28;
virtual MxDSAction *Clone(); // vtable+2c;

View File

@ -27,7 +27,7 @@ class MxDSAnim : public MxDSMediaAction
return !strcmp(name, MxDSAnim::ClassName()) || MxDSMediaAction::IsA(name);
}
virtual MxDSAction *Clone(); // vtable+2c;
virtual MxDSAction *Clone() override; // vtable+2c;
};
#endif // MXDSANIM_H

View File

@ -1,7 +1,6 @@
#ifndef MXDSCHUNK_H
#define MXDSCHUNK_H
#include "mxcore.h"
#include "mxtypes.h"

View File

@ -25,7 +25,7 @@ class MxDSEvent : public MxDSMediaAction
return !strcmp(name, MxDSEvent::ClassName()) || MxDSMediaAction::IsA(name);
}
virtual MxDSAction *Clone(); // vtable+2c;
virtual MxDSAction *Clone() override; // vtable+2c;
};
#endif // MXDSEVENT_H

View File

@ -28,8 +28,8 @@ class MxDSMediaAction : public MxDSAction
return !strcmp(name, MxDSMediaAction::ClassName()) || MxDSAction::IsA(name);
}
virtual MxU32 GetSizeOnDisk(); // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c;
virtual MxU32 GetSizeOnDisk() override; // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24) override; // vtable+1c;
void CopyMediaSrcPath(const char *p_mediaSrcPath);

View File

@ -28,14 +28,14 @@ class MxDSMultiAction : public MxDSAction
return !strcmp(name, MxDSMultiAction::ClassName()) || MxDSAction::IsA(name);
}
virtual undefined4 unk14(); // vtable+14;
virtual MxU32 GetSizeOnDisk(); // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c;
virtual void SetAtomId(MxAtomId p_atomId); // vtable+20;
virtual MxDSAction *Clone(); // vtable+2c;
virtual void MergeFrom(MxDSAction &p_dsAction); // vtable+30;
virtual MxBool HasId(MxU32 p_objectId); // vtable+34;
virtual void SetSomeTimingField(MxLong p_someTimingField); // vtable+38;
virtual undefined4 unk14() override; // vtable+14;
virtual MxU32 GetSizeOnDisk() override; // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24) override; // vtable+1c;
virtual void SetAtomId(MxAtomId p_atomId) override; // vtable+20;
virtual MxDSAction *Clone() override; // vtable+2c;
virtual void MergeFrom(MxDSAction &p_dsAction) override; // vtable+30;
virtual MxBool HasId(MxU32 p_objectId) override; // vtable+34;
virtual void SetSomeTimingField(MxLong p_someTimingField) override; // vtable+38;
private:
MxU32 m_sizeOnDisk;

View File

@ -36,6 +36,7 @@ class MxDSObject : public MxCore
inline const MxAtomId& GetAtomId() { return this->m_atomId; }
inline MxU32 GetObjectId() { return this->m_objectId; }
inline MxS16 GetUnknown24() { return this->m_unk24; }
inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; }
inline void SetUnknown24(MxS16 p_unk24) { this->m_unk24 = p_unk24; }

View File

@ -26,7 +26,7 @@ class MxDSObjectAction : public MxDSMediaAction
return !strcmp(name, MxDSObjectAction::ClassName()) || MxDSMediaAction::IsA(name);
}
virtual MxDSAction *Clone(); // vtable+2c;
virtual MxDSAction *Clone() override; // vtable+2c;
virtual void CopyFrom(MxDSObjectAction &p_dsObjectAction); // vtable+44;
};

View File

@ -27,8 +27,8 @@ class MxDSParallelAction : public MxDSMultiAction
return !strcmp(name, MxDSParallelAction::ClassName()) || MxDSMultiAction::IsA(name);
}
virtual MxLong GetDuration(); // vtable+24;
virtual MxDSAction *Clone(); // vtable+2c;
virtual MxLong GetDuration() override; // vtable+24;
virtual MxDSAction *Clone() override; // vtable+2c;
};
#endif // MXDSPARALLELACTION_H

View File

@ -15,3 +15,37 @@ MxDSSelectAction::~MxDSSelectAction()
if (this->m_unk0xac)
delete this->m_unk0xac;
}
// OFFSET: LEGO1 0x100cb950
void MxDSSelectAction::CopyFrom(MxDSSelectAction &p_dsSelectAction)
{
this->m_unk0x9c = p_dsSelectAction.m_unk0x9c;
this->m_unk0xac->DeleteAll();
MxStringListCursor cursor(p_dsSelectAction.m_unk0xac);
MxString string;
while (cursor.Next(string))
this->m_unk0xac->OtherAppend(string);
}
// OFFSET: LEGO1 0x100cbd50
MxDSSelectAction &MxDSSelectAction::operator=(MxDSSelectAction &p_dsSelectAction)
{
if (this != &p_dsSelectAction) {
MxDSParallelAction::operator=(p_dsSelectAction);
this->CopyFrom(p_dsSelectAction);
}
return *this;
}
// OFFSET: LEGO1 0x100cbd80
MxDSAction *MxDSSelectAction::Clone()
{
MxDSSelectAction *clone = new MxDSSelectAction();
if (clone)
*clone = *this;
return clone;
}

View File

@ -13,6 +13,9 @@ class MxDSSelectAction : public MxDSParallelAction
MxDSSelectAction();
virtual ~MxDSSelectAction() override;
void CopyFrom(MxDSSelectAction &p_dsSelectAction);
MxDSSelectAction &operator=(MxDSSelectAction &p_dsSelectAction);
// OFFSET: LEGO1 0x100cb6f0
inline virtual const char *ClassName() const override // vtable+0x0c
{
@ -26,6 +29,11 @@ class MxDSSelectAction : public MxDSParallelAction
return !strcmp(name, MxDSSelectAction::ClassName()) || MxDSParallelAction::IsA(name);
}
//virtual MxU32 GetSizeOnDisk() override; // vtable+18;
//virtual void Deserialize(char **p_source, MxS16 p_unk24) override; // vtable+1c;
//virtual MxLong GetDuration() override; // vtable+24;
virtual MxDSAction *Clone() override; // vtable+2c;
private:
MxString m_unk0x9c;
MxStringList *m_unk0xac;

View File

@ -28,9 +28,9 @@ class MxDSSerialAction : public MxDSMultiAction
return !strcmp(name, MxDSSerialAction::ClassName()) || MxDSMultiAction::IsA(name);
}
virtual MxLong GetDuration(); // vtable+24;
virtual void SetDuration(MxLong p_duration); // vtable+28;
virtual MxDSAction *Clone(); // vtable+2c;
virtual MxLong GetDuration() override; // vtable+24;
virtual void SetDuration(MxLong p_duration) override; // vtable+28;
virtual MxDSAction *Clone() override; // vtable+2c;
private:
MxDSActionListCursor *m_cursor;

View File

@ -27,9 +27,9 @@ class MxDSSound : public MxDSMediaAction
return !strcmp(name, MxDSSound::ClassName()) || MxDSMediaAction::IsA(name);
}
virtual MxU32 GetSizeOnDisk(); // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c;
virtual MxDSAction *Clone(); // vtable+2c;
virtual MxU32 GetSizeOnDisk() override; // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24) override; // vtable+1c;
virtual MxDSAction *Clone() override; // vtable+2c;
private:
MxU32 m_sizeOnDisk;

View File

@ -27,7 +27,7 @@ class MxDSStill : public MxDSMediaAction
return !strcmp(name, MxDSStill::ClassName()) || MxDSMediaAction::IsA(name);
}
virtual MxDSAction *Clone(); // vtable+2c;
virtual MxDSAction *Clone() override; // vtable+2c;
};
#endif // MXDSSTILL_H

View File

@ -24,7 +24,7 @@ class MxDSStreamingAction : public MxDSAction
return *this;
}
virtual MxBool HasId(MxU32 p_objectId); // vtable+34;
virtual MxBool HasId(MxU32 p_objectId) override; // vtable+34;
MxResult Init();
void SetInternalAction(MxDSAction *p_dsAction);

View File

@ -4,7 +4,6 @@
#include "mxtypes.h"
#include "mxcore.h"
// SIZE 0xc
template <class T>
class MxListEntry
{
@ -15,6 +14,11 @@ class MxListEntry
m_prev = p_prev;
m_next = NULL;
}
MxListEntry(T p_obj, MxListEntry *p_prev, MxListEntry *p_next) {
m_obj = p_obj;
m_prev = p_prev;
m_next = p_next;
}
T GetValue() { return this->m_obj; }
@ -26,7 +30,6 @@ class MxListEntry
MxListEntry *m_next;
};
// VTABLE 0x100d6350
// SIZE 0x10
template <class T>
class MxListParent : public MxCore
@ -46,7 +49,6 @@ class MxListParent : public MxCore
void (*m_customDestructor)(T); // +0xc
};
// VTABLE 0x100d6368
// SIZE 0x18
template <class T>
class MxList : protected MxListParent<T>
@ -60,6 +62,7 @@ class MxList : protected MxListParent<T>
virtual ~MxList();
void Append(T);
void OtherAppend(T p_obj) { _InsertEntry(p_obj, this->m_last, NULL); };
void DeleteAll();
MxU32 GetCount() { return m_count; }
void SetDestroy(void (*p_customDestructor)(T)) { this->m_customDestructor = p_customDestructor; }
@ -71,9 +74,9 @@ class MxList : protected MxListParent<T>
private:
void _DeleteEntry(MxListEntry<T> *match);
void _InsertEntry(T, MxListEntry<T> *, MxListEntry<T> *);
};
// VTABLE 0x100d6488
template <class T>
class MxListCursor : public MxCore
{
@ -96,7 +99,6 @@ class MxListCursor : public MxCore
};
// Unclear purpose
// VTABLE 0x100d6530
template <class T>
class MxListCursorChild : public MxListCursor<T>
{
@ -105,7 +107,6 @@ class MxListCursorChild : public MxListCursor<T>
};
// Unclear purpose
// VTABLE 0x100d6470
template <class T>
class MxListCursorChildChild : public MxListCursorChild<T>
{
@ -152,6 +153,24 @@ inline void MxList<T>::Append(T p_newobj)
this->m_count++;
}
template <class T>
inline void MxList<T>::_InsertEntry(T p_newobj, MxListEntry<T> *p_prev, MxListEntry<T> *p_next)
{
MxListEntry<T> *newEntry = new MxListEntry<T>(p_newobj, p_prev, p_next);
if (p_prev)
p_prev->m_next = newEntry;
else
this->m_first = newEntry;
if (p_next)
p_next->m_prev = newEntry;
else
this->m_last = newEntry;
this->m_count++;
}
template <class T>
inline void MxList<T>::_DeleteEntry(MxListEntry<T> *match)
{
@ -198,7 +217,7 @@ inline MxBool MxListCursor<T>::Next(T& p_obj)
m_match = m_match->m_next;
if (m_match)
p_obj = m_match->m_obj;
p_obj = m_match->GetValue();
return m_match != NULL;
}

View File

@ -10,7 +10,7 @@ MxLoopingFlcPresenter::MxLoopingFlcPresenter()
Init();
}
// OFFSET: LEGO1 0x100b43b0 STUB
// OFFSET: LEGO1 0x100b43b0
MxLoopingFlcPresenter::~MxLoopingFlcPresenter()
{
Destroy(TRUE);

View File

@ -1,42 +0,0 @@
#ifndef MXMIDIMANAGER_H
#define MXMIDIMANAGER_H
#include "decomp.h"
#include "mxaudiomanager.h"
// VTABLE 0x100dc930
// SIZE 0x58
class MxMIDIManager : public MxAudioManager
{
public:
MxMIDIManager();
virtual ~MxMIDIManager() override;
virtual void Destroy() override; // vtable+18
virtual void SetVolume(MxS32 p_volume) override; // vtable+2c
virtual MxResult StartMIDIThread(MxU32 p_frequencyMS, MxU8 p_noRegister); // vtable+30
private:
void LockedReinitialize(MxBool p_skipDestroy);
void DeinitializeMIDI();
MxS32 CalculateVolume(MxS32 p_volume);
void SetMIDIVolume();
HMIDISTRM m_MIDIStreamH; // 0x30
MxBool m_MIDIInitialized; // 0x34
undefined4 m_unk38; // 0x38
undefined4 m_unk3c; // 0x3c
undefined4 m_unk40; // 0x40
undefined4 m_unk44; // 0x44
undefined4 m_unk48; // 0x48
MIDIHDR *m_MIDIHdrP; // 0x4c
MxS32 m_multiplier; // 0x50
DWORD m_MIDIVolume; // 0x54
protected:
void Init();
void InitData();
};
#endif // MXMIDIMANAGER_H

View File

@ -1,23 +1,25 @@
#include "mxmidimanager.h"
#include "mxmusicmanager.h"
#include "mxticklemanager.h"
#include "mxomni.h"
#include <windows.h>
DECOMP_SIZE_ASSERT(MxMIDIManager, 0x58);
DECOMP_SIZE_ASSERT(MxMusicManager, 0x58);
// OFFSET: LEGO1 0x100c05a0
MxMIDIManager::MxMIDIManager()
MxMusicManager::MxMusicManager()
{
Init();
}
// OFFSET: LEGO1 0x100c0630
MxMIDIManager::~MxMIDIManager()
MxMusicManager::~MxMusicManager()
{
LockedReinitialize(TRUE);
}
// OFFSET: LEGO1 0x100c0b20
void MxMIDIManager::DeinitializeMIDI()
void MxMusicManager::DeinitializeMIDI()
{
m_criticalSection.Enter();
@ -36,14 +38,14 @@ void MxMIDIManager::DeinitializeMIDI()
}
// OFFSET: LEGO1 0x100c0690
void MxMIDIManager::Init()
void MxMusicManager::Init()
{
this->m_multiplier = 100;
InitData();
}
// OFFSET: LEGO1 0x100c06a0
void MxMIDIManager::InitData()
void MxMusicManager::InitData()
{
this->m_MIDIStreamH = 0;
this->m_MIDIInitialized = FALSE;
@ -56,7 +58,7 @@ void MxMIDIManager::InitData()
}
// OFFSET: LEGO1 0x100c06c0
void MxMIDIManager::LockedReinitialize(MxBool p_skipDestroy)
void MxMusicManager::LockedReinitialize(MxBool p_skipDestroy)
{
if (this->m_thread)
{
@ -83,20 +85,20 @@ void MxMIDIManager::LockedReinitialize(MxBool p_skipDestroy)
}
// OFFSET: LEGO1 0x100c0930
void MxMIDIManager::Destroy()
void MxMusicManager::Destroy()
{
LockedReinitialize(FALSE);
}
// OFFSET: LEGO1 0x100c09a0
MxS32 MxMIDIManager::CalculateVolume(MxS32 p_volume)
MxS32 MxMusicManager::CalculateVolume(MxS32 p_volume)
{
MxS32 result = (p_volume * 0xffff) / 100;
return (result << 0x10) | result;
}
// OFFSET: LEGO1 0x100c07f0
void MxMIDIManager::SetMIDIVolume()
void MxMusicManager::SetMIDIVolume()
{
MxS32 result = (this->m_volume * this->m_multiplier) / 0x64;
HMIDISTRM streamHandle = this->m_MIDIStreamH;
@ -109,7 +111,7 @@ void MxMIDIManager::SetMIDIVolume()
}
// OFFSET: LEGO1 0x100c0940
void MxMIDIManager::SetVolume(MxS32 p_volume)
void MxMusicManager::SetVolume(MxS32 p_volume)
{
MxAudioManager::SetVolume(p_volume);
this->m_criticalSection.Enter();
@ -118,7 +120,7 @@ void MxMIDIManager::SetVolume(MxS32 p_volume)
}
// OFFSET: LEGO1 0x100c0840
MxResult MxMIDIManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_noRegister)
MxResult MxMusicManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_noRegister)
{
MxResult status = FAILURE;
MxBool locked = FALSE;

View File

@ -1,11 +1,42 @@
#ifndef MXMUSICMANAGER_H
#define MXMUSICMANAGER_H
#include "mxcore.h"
#include "decomp.h"
#include "mxaudiomanager.h"
// VTABLE 0x100dc930
class MxMusicManager : public MxCore
// SIZE 0x58
class MxMusicManager : public MxAudioManager
{
public:
MxMusicManager();
virtual ~MxMusicManager() override;
virtual void Destroy() override; // vtable+18
virtual void SetVolume(MxS32 p_volume) override; // vtable+2c
virtual MxResult StartMIDIThread(MxU32 p_frequencyMS, MxU8 p_noRegister); // vtable+30
private:
void LockedReinitialize(MxBool p_skipDestroy);
void DeinitializeMIDI();
MxS32 CalculateVolume(MxS32 p_volume);
void SetMIDIVolume();
HMIDISTRM m_MIDIStreamH; // 0x30
MxBool m_MIDIInitialized; // 0x34
undefined4 m_unk38; // 0x38
undefined4 m_unk3c; // 0x3c
undefined4 m_unk40; // 0x40
undefined4 m_unk44; // 0x44
undefined4 m_unk48; // 0x48
MIDIHDR *m_MIDIHdrP; // 0x4c
MxS32 m_multiplier; // 0x50
DWORD m_MIDIVolume; // 0x54
protected:
void Init();
void InitData();
};
#endif // MXMUSICMANAGER_H
#endif // MXMUSICMANAGER_H

View File

@ -6,7 +6,19 @@ MxMusicPresenter::MxMusicPresenter()
Init();
}
// OFFSET: LEGO1 0x100c24e0
MxMusicPresenter::~MxMusicPresenter()
{
Destroy(TRUE);
}
// OFFSET: LEGO1 0x100c2540
void MxMusicPresenter::Init()
{
}
// OFFSET: LEGO1 0x100c2550 STUB
void MxMusicPresenter::Destroy(MxBool)
{
// TODO
}

View File

@ -21,9 +21,11 @@ class MxMusicPresenter : public MxAudioPresenter
}
MxMusicPresenter();
virtual ~MxMusicPresenter() override;
private:
void Init();
void Destroy(MxBool);
};
#endif // MXMUSICPRESENTER_H

View File

@ -1,7 +1,8 @@
#include "mxnotificationmanager.h"
#include "legoomni.h"
#include "mxautolocker.h"
#include "mxcore.h"
#include "mxnotificationmanager.h"
#include "mxticklemanager.h"
#include "mxparam.h"
#include "mxtypes.h"

View File

@ -1,5 +1,17 @@
#include "mxomni.h"
#include "mxatomidcounter.h"
#include "mxeventmanager.h"
#include "mxmusicmanager.h"
#include "mxnotificationmanager.h"
#include "mxobjectfactory.h"
#include "mxomnicreateparam.h"
#include "mxsoundmanager.h"
#include "mxstreamer.h"
#include "mxticklemanager.h"
#include "mxtimer.h"
#include "mxvideomanager.h"
// 0x101015b8
char g_hdPath[1024];
@ -39,13 +51,19 @@ void MxOmni::Init()
m_timer = NULL;
m_streamer = NULL;
m_atomIdCounterSet = NULL;
m_unk64 = NULL;
m_timerRunning = NULL;
}
// OFFSET: LEGO1 0x100b0090 STUB
void MxOmni::vtable0x20()
// OFFSET: LEGO1 0x100b0090
MxResult MxOmni::Start(MxDSAction* p_dsAction)
{
// TODO
MxResult result = FAILURE;
if(p_dsAction->GetAtomId().GetInternal() != NULL && p_dsAction->GetObjectId() != -1 && m_streamer != NULL)
{
result = m_streamer->Unknown100b99b0(p_dsAction);
}
return result;
}
// OFFSET: LEGO1 0x100b00c0 STUB
@ -80,16 +98,26 @@ void MxOmni::NotifyCurrentEntity()
// TODO
}
// OFFSET: LEGO1 0x100b09d0 STUB
// OFFSET: LEGO1 0x100b09d0
void MxOmni::StartTimer()
{
// TODO
if (m_timerRunning == FALSE && m_timer != NULL && m_soundManager != NULL)
{
m_timer->Start();
m_soundManager->vtable0x34();
m_timerRunning = TRUE;
}
}
// OFFSET: LEGO1 0x100b0a00 STUB
void MxOmni::vtable0x3c()
// OFFSET: LEGO1 0x100b0a00
void MxOmni::StopTimer()
{
// TODO
if (m_timerRunning != FALSE && m_timer != NULL && m_soundManager != NULL)
{
m_timer->Stop();
m_soundManager->vtable0x38();
m_timerRunning = FALSE;
}
}
// OFFSET: LEGO1 0x100b0690
@ -258,7 +286,7 @@ MxAtomIdCounterSet *AtomIdCounterSet()
MxStreamer* Streamer()
{
return MxOmni::GetInstance()->GetStreamer();
}
}
// OFFSET: LEGO1 0x100acf00
MxSoundManager* MSoundManager()
@ -288,4 +316,4 @@ MxMusicManager* MusicManager()
MxEventManager* EventManager()
{
return MxOmni::GetInstance()->GetEventManager();
}
}

View File

@ -1,21 +1,23 @@
#ifndef MXOMNI_H
#define MXOMNI_H
#include "mxcore.h"
#include "mxstring.h"
#include "mxcriticalsection.h"
#include "mxdsaction.h"
#include "mxeventmanager.h"
#include "mxmusicmanager.h"
#include "mxnotificationmanager.h"
#include "mxobjectfactory.h"
#include "mxomnicreateflags.h"
#include "mxomnicreateparam.h"
#include "mxsoundmanager.h"
#include "mxstreamer.h"
#include "mxticklemanager.h"
#include "mxtimer.h"
#include "mxvariabletable.h"
#include "mxvideomanager.h"
#include "mxatomidcounter.h"
class MxAtomIdCounterSet;
class MxDSAction;
class MxEventManager;
class MxMusicManager;
class MxNotificationManager;
class MxObjectFactory;
class MxOmniCreateParam;
class MxSoundManager;
class MxStreamer;
class MxTickleManager;
class MxTimer;
class MxVariableTable;
class MxVideoManager;
// VTABLE 0x100dc168
// SIZE 0x68
@ -38,14 +40,14 @@ class MxOmni : public MxCore
virtual void Init(); // vtable+14
virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p); // vtable+18
virtual void Destroy(); // vtable+1c
virtual void vtable0x20(); // vtable+20
virtual MxResult Start(MxDSAction* p_dsAction); // vtable+20
virtual void DeleteObject(MxDSAction &ds); // vtable+24
virtual MxBool DoesEntityExist(MxDSAction &ds); // vtable+28
virtual void vtable0x2c(); // vtable+2c
virtual int vtable0x30(char*, int, MxCore*); // vtable+30
virtual void NotifyCurrentEntity(); // vtable+34
virtual void StartTimer(); // vtable+38
virtual void vtable0x3c(); // vtable+3c
virtual void StopTimer(); // vtable+3c
static void SetInstance(MxOmni* instance);
HWND GetWindowHandle() const { return this->m_windowHandle; }
MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; }
@ -79,7 +81,7 @@ class MxOmni : public MxCore
MxCriticalSection m_criticalsection; // 0x48
unsigned char m_unk64; // 0x64
MxBool m_timerRunning; // 0x64
};
__declspec(dllexport) MxTickleManager * TickleManager();
__declspec(dllexport) MxTimer * Timer();

View File

@ -1,5 +1,7 @@
#include "mxpalette.h"
#include "mxomni.h"
#include "mxvideomanager.h"
// GLOBAL: LEGO1 0x10102188 0x400
PALETTEENTRY g_defaultPaletteEntries[256] =

View File

@ -1,14 +1,17 @@
#include "mxpresenter.h"
#include "legoomni.h"
#include "mxautolocker.h"
#include "mxparam.h"
#include "legoomni.h"
#include "mxdsanim.h"
#include "mxdssound.h"
#include <string.h>
#include "mxnotificationmanager.h"
#include "decomp.h"
#include "define.h"
#include <string.h>
DECOMP_SIZE_ASSERT(MxPresenter, 0x40);
// OFFSET: LEGO1 0x100b4d50

View File

@ -68,17 +68,19 @@ class MxPresenter : public MxCore
MxBool IsEnabled();
inline MxS32 GetCurrentTickleState() { return this->m_currentTickleState; }
inline MxPoint32 GetLocation() { return this->m_location; }
inline MxS32 GetDisplayZ() { return this->m_displayZ; }
inline MxDSAction *GetAction() { return this->m_action; }
inline MxS32 GetCurrentTickleState() const { return this->m_currentTickleState; }
inline MxPoint32 GetLocation() const { return this->m_location; }
inline MxS32 GetLocationX() const { return this->m_location.m_x; }
inline MxS32 GetLocationY() const { return this->m_location.m_y; }
inline MxS32 GetDisplayZ() const { return this->m_displayZ; }
inline MxDSAction *GetAction() const { return this->m_action; }
protected:
__declspec(dllexport) void Init();
void SendTo_unkPresenter(MxOmni *);
private:
MxS32 m_currentTickleState; // 0x8
TickleState m_currentTickleState; // 0x8
MxU32 m_previousTickleStates;
MxPoint32 m_location;
MxS32 m_displayZ;

View File

@ -15,3 +15,14 @@ void MxSmkPresenter::Init()
{
// TODO
}
// OFFSET: LEGO1 0x100b3960
void MxSmkPresenter::VTable0x60()
{
if (m_bitmap) {
delete m_bitmap;
}
m_bitmap = new MxBitmap();
m_bitmap->SetSize(m_smkWidth, m_smkHeight, NULL, NULL);
}

View File

@ -12,7 +12,12 @@ class MxSmkPresenter : public MxVideoPresenter
public:
MxSmkPresenter();
undefined4 m_unk64[430];
virtual void VTable0x60() override;
undefined4 m_unk64;
MxS32 m_smkWidth; // 0x68
MxS32 m_smkHeight; // 0x6c
undefined4 m_unk70[427];
undefined4 m_unk71c;
private:
void Init();

View File

@ -1,5 +1,5 @@
#include "mxsoundmanager.h"
#include "mxticklemanager.h"
#include "mxomni.h"
DECOMP_SIZE_ASSERT(MxSoundManager, 0x3c);
@ -46,4 +46,23 @@ void MxSoundManager::Destroy(MxBool p_param)
if (!p_param) {
MxAudioManager::Destroy();
}
}
}
// OFFSET: LEGO1 0x100ae8b0 STUB
MxResult MxSoundManager::StartDirectSound(undefined4 p_unknown1, MxBool p_unknown2)
{
// TODO STUB
return FAILURE;
}
// OFFSET: LEGO1 0x100aed10 STUB
void MxSoundManager::vtable0x34()
{
// TODO STUB
}
// OFFSET: LEGO1 0x100aee10 STUB
void MxSoundManager::vtable0x38()
{
// TODO STUB
}

View File

@ -14,6 +14,10 @@ class MxSoundManager : public MxAudioManager
MxSoundManager();
virtual ~MxSoundManager() override; // vtable+0x0
virtual MxResult StartDirectSound(undefined4 p_unknown1, MxBool p_unknown2); //vtable+0x30
virtual void vtable0x34(); // vtable+0x34
virtual void vtable0x38(); // vtable+0x38
private:
void Init();
void Destroy(MxBool);

View File

@ -30,3 +30,22 @@ MxResult MxStreamController::Open(const char *p_filename)
return SUCCESS;
}
// OFFSET: LEGO1 0x100b9400
MxResult MxStreamController::vtable0x18(undefined4 p_unknown, undefined4 p_unknown2)
{
return FAILURE;
}
// OFFSET: LEGO1 0x100b9410
MxResult MxStreamController::vtable0x1C(undefined4 p_unknown, undefined4 p_unknown2)
{
return FAILURE;
}
// OFFSET: LEGO1 0x100c1690 STUB
MxResult MxStreamController::vtable0x20(MxDSAction* action)
{
// TODO STUB
return FAILURE;
}

View File

@ -6,6 +6,7 @@
#include "mxcriticalsection.h"
#include "mxcore.h"
#include "mxdsobject.h"
#include "mxdsaction.h"
// VTABLE 0x100dc968
// SIZE 0x64
@ -30,6 +31,9 @@ class MxStreamController : public MxCore
}
virtual MxResult Open(const char *p_filename); // vtable+0x14
virtual MxResult vtable0x18(undefined4 p_unknown, undefined4 p_unknown2); //vtable+0x18
virtual MxResult vtable0x1C(undefined4 p_unknown, undefined4 p_unknown2); //vtable+0x1c
virtual MxResult vtable0x20(MxDSAction* action); //vtable+0x20
MxBool FUN_100c20d0(MxDSObject &p_obj);

View File

@ -1,10 +1,11 @@
#include "mxstreamer.h"
#include <algorithm>
#include "legoomni.h"
#include "mxdiskstreamcontroller.h"
#include "mxramstreamcontroller.h"
#include "mxnotificationmanager.h"
#include <algorithm>
DECOMP_SIZE_ASSERT(MxStreamer, 0x2c);
@ -133,6 +134,22 @@ MxResult MxStreamer::AddStreamControllerToOpenList(MxStreamController *stream)
return FAILURE;
}
// OFFSET: LEGO1 0x100b99b0
MxResult MxStreamer::Unknown100b99b0(MxDSAction* p_action)
{
MxStreamController* controller;
if (p_action != NULL && p_action->GetAtomId().GetInternal() != NULL && p_action->GetObjectId() != -1)
{
controller = GetOpenStream(p_action->GetAtomId().GetInternal());
if (controller == NULL)
{
return FAILURE;
}
return controller->vtable0x20(p_action);
}
return FAILURE;
}
// OFFSET: LEGO1 0x100b9b60
MxLong MxStreamer::Notify(MxParam &p)
{

View File

@ -96,6 +96,8 @@ class MxStreamer : public MxCore
MxResult AddStreamControllerToOpenList(MxStreamController *p_stream);
MxResult MxStreamer::Unknown100b99b0(MxDSAction* p_action);
private:
list<MxStreamController *> m_openStreams; // 0x8
MxStreamerSubClass2 m_subclass1; // 0x14

View File

@ -56,14 +56,14 @@ void MxString::ToLowerCase()
}
// OFFSET: LEGO1 0x100ae4b0
MxString &MxString::operator=(MxString *param)
MxString &MxString::operator=(MxString &param)
{
if (this->m_data != param->m_data)
if (this->m_data != param.m_data)
{
delete[] this->m_data;
this->m_length = param->m_length;
this->m_length = param.m_length;
this->m_data = new char[this->m_length + 1];
strcpy(this->m_data, param->m_data);
strcpy(this->m_data, param.m_data);
}
return *this;

View File

@ -15,7 +15,7 @@ class MxString : public MxCore
MxString(const char *);
void ToUpperCase();
void ToLowerCase();
MxString& operator=(MxString *);
MxString& operator=(MxString &);
MxString operator+(const char *);
MxString& operator+=(const char *);

5
LEGO1/mxstringlist.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "mxstringlist.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxListEntry<MxString>, 0x18)

View File

@ -8,6 +8,9 @@
// SIZE 0x18
class MxStringList : public MxList<MxString> {};
// VTABLE 0x100dd058
typedef MxListCursorChild<MxString> MxStringListCursor;
// OFFSET: LEGO1 0x100cb3c0 TEMPLATE
// MxListParent<MxString>::Compare
@ -17,6 +20,15 @@ class MxStringList : public MxList<MxString> {};
// OFFSET: LEGO1 0x100cb4c0 TEMPLATE
// MxList<MxString>::~MxList<MxString>
// OFFSET: LEGO1 0x100cbb40 TEMPLATE
// MxList<MxString>::OtherAppend
// OFFSET: LEGO1 0x100cc2d0 TEMPLATE
// MxList<MxString>::_InsertEntry
// OFFSET: LEGO1 0x100cc3c0 TEMPLATE
// MxListEntry<MxString>::MxListEntry<MxString>
// OFFSET: LEGO1 0x100cc450 TEMPLATE
// MxListEntry<MxString>::GetValue

View File

@ -1,9 +1,10 @@
#include "mxthread.h"
#include <process.h>
#include "mxomni.h"
#include "mxtimer.h"
#include <process.h>
// OFFSET: LEGO1 0x100bf690
MxResult MxThread::Run()

View File

@ -1,6 +1,12 @@
#include "mxtransitionmanager.h"
#include "legoutil.h"
#include "legovideomanager.h"
#include "legoinputmanager.h"
#include "legoutil.h"
#include "legoworld.h"
#include "mxbackgroundaudiomanager.h"
#include "mxparam.h"
#include "mxticklemanager.h"
DECOMP_SIZE_ASSERT(MxTransitionManager, 0x900);
@ -23,7 +29,7 @@ MxTransitionManager::MxTransitionManager()
// OFFSET: LEGO1 0x1004ba00
MxTransitionManager::~MxTransitionManager()
{
free(m_copyBuffer);
delete[] m_copyBuffer;
if (m_waitIndicator != NULL) {
delete m_waitIndicator->GetAction();
@ -318,17 +324,17 @@ void MxTransitionManager::SubmitCopyRect(LPDDSURFACEDESC ddsc)
}
// Copy the copy rect onto the surface
char *dst;
MxU8 *dst;
DWORD bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
MxU32 bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
const char *src = (const char *)m_copyBuffer;
const MxU8 *src = (const MxU8 *)m_copyBuffer;
LONG copyPitch;
MxS32 copyPitch;
copyPitch = ((m_copyRect.right - m_copyRect.left) + 1) * bytesPerPixel;
LONG y;
dst = (char *)ddsc->lpSurface + (ddsc->lPitch * m_copyRect.top) + (bytesPerPixel * m_copyRect.left);
MxS32 y;
dst = (MxU8 *)ddsc->lpSurface + (ddsc->lPitch * m_copyRect.top) + (bytesPerPixel * m_copyRect.left);
for (y = 0; y < m_copyRect.bottom - m_copyRect.top + 1; ++y) {
memcpy(dst, src, copyPitch);
@ -337,7 +343,7 @@ void MxTransitionManager::SubmitCopyRect(LPDDSURFACEDESC ddsc)
}
// Free the copy buffer
free(m_copyBuffer);
delete[] m_copyBuffer;
m_copyBuffer = NULL;
}
@ -355,11 +361,11 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
// Check if wait indicator has started
if (m_waitIndicator->GetCurrentTickleState() >= MxPresenter::TickleState_Streaming) {
// Setup the copy rect
DWORD copyPitch = (ddsc->ddpfPixelFormat.dwRGBBitCount / 8) * (m_copyRect.right - m_copyRect.left + 1); // This uses m_copyRect, seemingly erroneously
DWORD bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
MxU32 copyPitch = (ddsc->ddpfPixelFormat.dwRGBBitCount / 8) * (m_copyRect.right - m_copyRect.left + 1); // This uses m_copyRect, seemingly erroneously
MxU32 bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
m_copyRect.left = m_waitIndicator->GetLocation().m_x;
m_copyRect.top = m_waitIndicator->GetLocation().m_y;
m_copyRect.left = m_waitIndicator->GetLocationX();
m_copyRect.top = m_waitIndicator->GetLocationY();
MxS32 height = m_waitIndicator->GetHeight();
MxS32 width = m_waitIndicator->GetWidth();
@ -368,14 +374,14 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
m_copyRect.bottom = m_copyRect.top + height - 1;
// Allocate the copy buffer
const char *src = (const char*)ddsc->lpSurface + m_copyRect.top * ddsc->lPitch + bytesPerPixel * m_copyRect.left;
const MxU8 *src = (const MxU8*)ddsc->lpSurface + m_copyRect.top * ddsc->lPitch + bytesPerPixel * m_copyRect.left;
m_copyBuffer = malloc(bytesPerPixel * width * height);
m_copyBuffer = new MxU8[bytesPerPixel * width * height];
if (!m_copyBuffer)
return;
// Copy into the copy buffer
char *dst = (char*)m_copyBuffer;
MxU8 *dst = m_copyBuffer;
for (MxS32 i = 0; i < (m_copyRect.bottom - m_copyRect.top + 1); i++)
{
@ -390,11 +396,11 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
{
MxDisplaySurface *displaySurface = VideoManager()->GetDisplaySurface();
MxBool unkbool = FALSE;
displaySurface->vtable2c(ddsc, m_waitIndicator->m_unk50, 0, 0, m_waitIndicator->GetLocation().m_x, m_waitIndicator->GetLocation().m_y, m_waitIndicator->GetWidth(), m_waitIndicator->GetHeight(), unkbool);
displaySurface->vtable2c(ddsc, m_waitIndicator->m_bitmap, 0, 0, m_waitIndicator->GetLocationX(), m_waitIndicator->GetLocationY(), m_waitIndicator->GetWidth(), m_waitIndicator->GetHeight(), unkbool);
}
else
{
MxDisplaySurface *displaySurface = VideoManager()->GetDisplaySurface();
displaySurface->vtable24(ddsc, m_waitIndicator->m_unk50, 0, 0, m_waitIndicator->GetLocation().m_x, m_waitIndicator->GetLocation().m_y, m_waitIndicator->GetWidth(), m_waitIndicator->GetHeight());
displaySurface->vtable24(ddsc, m_waitIndicator->m_bitmap, 0, 0, m_waitIndicator->GetLocationX(), m_waitIndicator->GetLocationY(), m_waitIndicator->GetWidth(), m_waitIndicator->GetHeight());
}
}

View File

@ -5,6 +5,8 @@
#include "mxvideopresenter.h"
#include "legoomni.h"
#include <ddraw.h>
// VTABLE 0x100d7ea0
class MxTransitionManager : public MxCore
{
@ -57,7 +59,7 @@ class MxTransitionManager : public MxCore
MxVideoPresenter *m_waitIndicator;
RECT m_copyRect;
void *m_copyBuffer;
MxU8 *m_copyBuffer;
flag_bitfield m_copyFlags;
undefined4 m_unk24;

View File

@ -95,6 +95,8 @@ class MxVector3 : public MxVector2
virtual void EqualsCross(MxVector3 *p_a, float *p_b);
virtual void EqualsCross(MxVector3 *p_a, MxVector3 *p_b);
virtual void EqualsScalar(float *p_value);
inline void Fill(float p_value) { EqualsScalar(&p_value); }
};
// VTABLE 0x100d45a0

View File

@ -8,10 +8,10 @@ void MxVideoPresenter::VTable0x5c()
// TODO
}
// OFFSET: LEGO1 0x1000c710 STUB
// OFFSET: LEGO1 0x1000c710
void MxVideoPresenter::VTable0x60()
{
// TODO
// Empty
}
// OFFSET: LEGO1 0x1000c720 STUB
@ -44,24 +44,24 @@ void MxVideoPresenter::VTable0x78()
// TODO
}
// OFFSET: LEGO1 0x1000c7c0 STUB
void MxVideoPresenter::VTable0x7c()
// OFFSET: LEGO1 0x1000c7c0
MxBool MxVideoPresenter::VTable0x7c()
{
// TODO
return (m_bitmap != NULL) || (m_unk54 != NULL);
}
// OFFSET: LEGO1 0x1000c7e0 STUB
// OFFSET: LEGO1 0x1000c7e0
MxS32 MxVideoPresenter::GetWidth()
{
// TODO
return 0;
return m_unk54 ? m_unk54->width
: m_bitmap->GetBmiHeader()->biWidth;
}
// OFFSET: LEGO1 0x1000c800 STUB
// OFFSET: LEGO1 0x1000c800
MxS32 MxVideoPresenter::GetHeight()
{
// TODO
return 0;
return m_unk54 ? m_unk54->height
: m_bitmap->GetBmiHeader()->biHeight;
}
// OFFSET: LEGO1 0x100b2760 STUB

View File

@ -2,9 +2,11 @@
#define MXVIDEOPRESENTER_H
#include "mxmediapresenter.h"
#include "mxbitmap.h"
#include "decomp.h"
// VTABLE 0x100d4be8
class MxVideoPresenter : public MxMediaPresenter
{
public:
@ -41,12 +43,20 @@ class MxVideoPresenter : public MxMediaPresenter
virtual void VTable0x70(); // vtable+0x70
virtual void VTable0x74(); // vtable+0x74
virtual void VTable0x78(); // vtable+0x78
virtual void VTable0x7c(); // vtable+0x7c
virtual MxBool VTable0x7c(); // vtable+0x7c
virtual MxS32 GetWidth(); // vtable+0x80
virtual MxS32 GetHeight(); // vtable+0x84
undefined4 m_unk50;
undefined4 m_unk54;
// TODO: Not sure what this is. Seems to have size of 12 bytes
// based on 0x100b9e9a. Values are copied from the bitmap header.
typedef struct {
undefined unk0[8];
MxU16 width;
MxU16 height;
} unknown_meta_struct;
MxBitmap *m_bitmap;
unknown_meta_struct *m_unk54;
undefined4 m_unk58;
undefined2 m_unk5c;
unsigned char m_flags; // 0x5e

View File

@ -1,5 +1,7 @@
#include "skateboard.h"
#include "mxomni.h"
#include "mxnotificationmanager.h"
#include "decomp.h"