mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 00:31:16 +00:00
Merge branch 'isledecomp:master' into master
This commit is contained in:
commit
5f5b359bcb
@ -21,6 +21,7 @@ add_library(lego1 SHARED
|
||||
LEGO1/buildingentity.cpp
|
||||
LEGO1/bumpbouy.cpp
|
||||
LEGO1/carrace.cpp
|
||||
LEGO1/define.cpp
|
||||
LEGO1/dllmain.cpp
|
||||
LEGO1/dunebuggy.cpp
|
||||
LEGO1/elevatorbottom.cpp
|
||||
@ -46,9 +47,9 @@ add_library(lego1 SHARED
|
||||
LEGO1/jukeboxentity.cpp
|
||||
LEGO1/jukeboxstate.cpp
|
||||
LEGO1/legoact2state.cpp
|
||||
LEGO1/legoactor.cpp
|
||||
LEGO1/legoactioncontrolpresenter.cpp
|
||||
LEGO1/legoactor.cpp
|
||||
LEGO1/legoactor.cpp
|
||||
LEGO1/legoanimactor.cpp
|
||||
LEGO1/legoanimationmanager.cpp
|
||||
LEGO1/legoanimmmpresenter.cpp
|
||||
@ -64,6 +65,7 @@ add_library(lego1 SHARED
|
||||
LEGO1/legoentity.cpp
|
||||
LEGO1/legoentitypresenter.cpp
|
||||
LEGO1/legoflctexturepresenter.cpp
|
||||
LEGO1/legofullscreenmovie.cpp
|
||||
LEGO1/legogamestate.cpp
|
||||
LEGO1/legohideanimpresenter.cpp
|
||||
LEGO1/legoinputmanager.cpp
|
||||
@ -91,8 +93,10 @@ add_library(lego1 SHARED
|
||||
LEGO1/legoworld.cpp
|
||||
LEGO1/legoworldpresenter.cpp
|
||||
LEGO1/motorcycle.cpp
|
||||
LEGO1/mxactionnotificationparam.cpp
|
||||
LEGO1/mxatomid.cpp
|
||||
LEGO1/mxatomidcounter.cpp
|
||||
LEGO1/mxaudiomanager.cpp
|
||||
LEGO1/mxaudiopresenter.cpp
|
||||
LEGO1/mxautolocker.cpp
|
||||
LEGO1/mxbackgroundaudiomanager.cpp
|
||||
@ -102,12 +106,15 @@ add_library(lego1 SHARED
|
||||
LEGO1/mxcontrolpresenter.cpp
|
||||
LEGO1/mxcore.cpp
|
||||
LEGO1/mxcriticalsection.cpp
|
||||
LEGO1/mxdirect3d.cpp
|
||||
LEGO1/mxdirectdraw.cpp
|
||||
LEGO1/mxdiskstreamcontroller.cpp
|
||||
LEGO1/mxdiskstreamprovider.cpp
|
||||
LEGO1/mxdisplaysurface.cpp
|
||||
LEGO1/mxdsaction.cpp
|
||||
LEGO1/mxdsactionlist.cpp
|
||||
LEGO1/mxdsanim.cpp
|
||||
LEGO1/mxdsbuffer.cpp
|
||||
LEGO1/mxdschunk.cpp
|
||||
LEGO1/mxdsevent.cpp
|
||||
LEGO1/mxdsfile.cpp
|
||||
@ -118,10 +125,10 @@ add_library(lego1 SHARED
|
||||
LEGO1/mxdsparallelaction.cpp
|
||||
LEGO1/mxdsselectaction.cpp
|
||||
LEGO1/mxdsserialaction.cpp
|
||||
LEGO1/mxdsstreamingaction.cpp
|
||||
LEGO1/mxdssound.cpp
|
||||
LEGO1/mxdssource.cpp
|
||||
LEGO1/mxdsstill.cpp
|
||||
LEGO1/mxdsstreamingaction.cpp
|
||||
LEGO1/mxdssubscriber.cpp
|
||||
LEGO1/mxentity.cpp
|
||||
LEGO1/mxeventmanager.cpp
|
||||
@ -135,29 +142,35 @@ add_library(lego1 SHARED
|
||||
LEGO1/mxmediamanager.cpp
|
||||
LEGO1/mxmediapresenter.cpp
|
||||
LEGO1/mxmidipresenter.cpp
|
||||
LEGO1/mxmusicmanager.cpp
|
||||
LEGO1/mxmusicpresenter.cpp
|
||||
LEGO1/mxnotificationmanager.cpp
|
||||
LEGO1/mxnotificationparam.cpp
|
||||
LEGO1/mxobjectfactory.cpp
|
||||
LEGO1/mxomni.cpp
|
||||
LEGO1/mxomnicreateflags.cpp
|
||||
LEGO1/mxomnicreateparam.cpp
|
||||
LEGO1/mxomnicreateparambase.cpp
|
||||
LEGO1/mxpalette.cpp
|
||||
LEGO1/mxparam.cpp
|
||||
LEGO1/mxpresenter.cpp
|
||||
LEGO1/mxpresenterlist.cpp
|
||||
LEGO1/mxramstreamcontroller.cpp
|
||||
LEGO1/mxramstreamprovider.cpp
|
||||
LEGO1/mxscheduler.cpp
|
||||
LEGO1/mxsemaphore.cpp
|
||||
LEGO1/mxsmkpresenter.cpp
|
||||
LEGO1/mxsoundmanager.cpp
|
||||
LEGO1/mxsoundpresenter.cpp
|
||||
LEGO1/mxstillpresenter.cpp
|
||||
LEGO1/mxstreamcontroller.cpp
|
||||
LEGO1/mxstreamer.cpp
|
||||
LEGO1/mxstreamprovider.cpp
|
||||
LEGO1/mxstring.cpp
|
||||
LEGO1/mxstringlist.cpp
|
||||
LEGO1/mxthread.cpp
|
||||
LEGO1/mxticklemanager.cpp
|
||||
LEGO1/mxtimer.cpp
|
||||
LEGO1/mxtransitionmanager.cpp
|
||||
LEGO1/mxunknown100dc6e0.cpp
|
||||
LEGO1/mxvariable.cpp
|
||||
LEGO1/mxvariabletable.cpp
|
||||
LEGO1/mxvector.cpp
|
||||
@ -205,7 +218,7 @@ if (ISLE_USE_DX5)
|
||||
endif()
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(lego1 PRIVATE ddraw dsound winmm)
|
||||
target_link_libraries(lego1 PRIVATE ddraw dsound dxguid dinput winmm)
|
||||
|
||||
# Make sure filenames are ALL CAPS
|
||||
set_property(TARGET lego1 PROPERTY OUTPUT_NAME LEGO1)
|
||||
|
||||
@ -26,7 +26,7 @@ This repository currently has only one goal: accuracy to the original executable
|
||||
In general, we're not exhaustively strict about coding style, but there are some preferable guidelines to follow that have been adopted from what we know about the original codebase:
|
||||
|
||||
- Indent: 2 spaces
|
||||
- `PascalCase` for classes and function names.
|
||||
- `PascalCase` for classes, function names, and enumerations.
|
||||
- `m_camelCase` for member variables.
|
||||
- `g_camelCase` for global variables.
|
||||
- `p_camelCase` for function parameters.
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -91,9 +102,9 @@ void IsleApp::Close()
|
||||
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL);
|
||||
|
||||
Lego()->RemoveWorld(ds.GetAtomId(), ds.GetObjectId());
|
||||
Lego()->vtable24(ds);
|
||||
Lego()->DeleteObject(ds);
|
||||
TransitionManager()->SetWaitIndicator(NULL);
|
||||
Lego()->vtable3c();
|
||||
Lego()->StopTimer();
|
||||
|
||||
MxLong lVar8;
|
||||
do {
|
||||
@ -101,7 +112,7 @@ void IsleApp::Close()
|
||||
} while (lVar8 == 0);
|
||||
|
||||
while (Lego()) {
|
||||
if (Lego()->vtable28(ds) != FALSE) {
|
||||
if (Lego()->DoesEntityExist(ds)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -232,23 +243,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
g_reqEnableRMDevice = 0;
|
||||
VideoManager()->EnableRMDevice();
|
||||
g_rmDisabled = 0;
|
||||
Lego()->vtable3c();
|
||||
Lego()->StopTimer();
|
||||
}
|
||||
|
||||
if (g_closed) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_mousedown == 0) {
|
||||
LAB_00401bc7:
|
||||
if (g_mousemoved) {
|
||||
g_mousemoved = FALSE;
|
||||
}
|
||||
} else if (g_mousemoved) {
|
||||
if (g_isle) {
|
||||
g_isle->Tick(0);
|
||||
}
|
||||
goto LAB_00401bc7;
|
||||
if (g_mousedown && g_mousemoved && g_isle) {
|
||||
g_isle->Tick(0);
|
||||
}
|
||||
|
||||
if (g_mousemoved) {
|
||||
g_mousemoved = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -379,7 +386,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
else if (!valid) {
|
||||
g_rmDisabled = 1;
|
||||
Lego()->vtable38();
|
||||
Lego()->StartTimer();
|
||||
VideoManager()->DisableRMDevice();
|
||||
}
|
||||
}
|
||||
@ -701,7 +708,7 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
|
||||
}
|
||||
|
||||
if (this->m_frameDelta + g_lastFrameTime < currentTime) {
|
||||
if (!Lego()->vtable40()) {
|
||||
if (!Lego()->IsTimerRunning()) {
|
||||
TickleManager()->Tickle();
|
||||
}
|
||||
g_lastFrameTime = currentTime;
|
||||
@ -727,7 +734,7 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
|
||||
return;
|
||||
}
|
||||
|
||||
ds.SetAtomId(stream->atom);
|
||||
ds.SetAtomId(stream->GetAtom());
|
||||
ds.SetUnknown24(-1);
|
||||
ds.SetObjectId(0);
|
||||
VideoManager()->EnableFullScreenMovie(TRUE, TRUE);
|
||||
@ -736,7 +743,7 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ds.SetAtomId(stream->atom);
|
||||
ds.SetAtomId(stream->GetAtom());
|
||||
ds.SetUnknown24(-1);
|
||||
ds.SetObjectId(0);
|
||||
if (Start(&ds) != SUCCESS) {
|
||||
|
||||
@ -21,7 +21,7 @@ MxLong Act2Brick::Notify(MxParam &p)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1007a7f0 STUB
|
||||
MxLong Act2Brick::Tickle()
|
||||
MxResult Act2Brick::Tickle()
|
||||
{
|
||||
// TODO
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ class Act2Brick : public LegoPathActor
|
||||
virtual ~Act2Brick() override; // vtable+0x0
|
||||
|
||||
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
|
||||
virtual MxLong Tickle() override; // vtable+0x08
|
||||
virtual MxResult Tickle() override; // vtable+0x08
|
||||
|
||||
// OFFSET: LEGO1 0x1007a360
|
||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||
|
||||
@ -1,7 +1,21 @@
|
||||
#include "ambulance.h"
|
||||
|
||||
// OFFSET: LEGO1 0x10035ee0 STUB
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(Ambulance, 0x184);
|
||||
|
||||
// OFFSET: LEGO1 0x10035ee0
|
||||
Ambulance::Ambulance()
|
||||
{
|
||||
// TODO
|
||||
this->m_unk168 = 0;
|
||||
this->m_unk16a = -1;
|
||||
this->m_unk164 = 0;
|
||||
this->m_unk16c = 0;
|
||||
this->m_unk174 = -1;
|
||||
this->m_unk16e = 0;
|
||||
this->m_unk178 = -1;
|
||||
this->m_unk170 = 0;
|
||||
this->m_unk172 = 0;
|
||||
this->m_unk13c = 40.0;
|
||||
this->m_unk17c = 1.0;
|
||||
}
|
||||
@ -22,7 +22,20 @@ class Ambulance : public IslePathActor
|
||||
{
|
||||
return !strcmp(name, Ambulance::ClassName()) || IslePathActor::IsA(name);
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO: Ambulance fields
|
||||
undefined m_unk160[4];
|
||||
MxS32 m_unk164;
|
||||
MxS16 m_unk168;
|
||||
MxS16 m_unk16a;
|
||||
MxS16 m_unk16c;
|
||||
MxS16 m_unk16e;
|
||||
MxS16 m_unk170;
|
||||
MxS16 m_unk172;
|
||||
MxS32 m_unk174;
|
||||
MxS32 m_unk178;
|
||||
MxFloat m_unk17c;
|
||||
undefined m_unk180[4];
|
||||
};
|
||||
|
||||
#endif // AMBULANCE_H
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
#include "bike.h"
|
||||
|
||||
// OFFSET: LEGO1 0x10076670 STUB
|
||||
DECOMP_SIZE_ASSERT(Bike, 0x164);
|
||||
|
||||
// OFFSET: LEGO1 0x10076670
|
||||
Bike::Bike()
|
||||
{
|
||||
// TODO
|
||||
this->m_unk13c = 20.0;
|
||||
this->m_unk150 = 3.0;
|
||||
this->m_unk148 = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef BIKE_H
|
||||
#define BIKE_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "islepathactor.h"
|
||||
|
||||
// VTABLE 0x100d9808
|
||||
@ -22,7 +23,9 @@ class Bike : public IslePathActor
|
||||
{
|
||||
return !strcmp(name, Bike::ClassName()) || IslePathActor::IsA(name);
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO: Bike fields
|
||||
undefined m_unk160[4];
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
10
LEGO1/define.cpp
Normal file
10
LEGO1/define.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "define.h"
|
||||
|
||||
// 0x10101eac
|
||||
const char *g_parseExtraTokens = ":;";
|
||||
|
||||
// 0x10101edc
|
||||
const char *g_strWORLD = "WORLD";
|
||||
|
||||
// 0x10102040
|
||||
const char *g_strACTION = "ACTION";
|
||||
8
LEGO1/define.h
Normal file
8
LEGO1/define.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef DEFINE_H
|
||||
#define DEFINE_H
|
||||
|
||||
extern const char *g_parseExtraTokens;
|
||||
extern const char *g_strWORLD;
|
||||
extern const char *g_strACTION;
|
||||
|
||||
#endif // DEFINE_H
|
||||
@ -1,7 +1,12 @@
|
||||
#include "dunebuggy.h"
|
||||
|
||||
// OFFSET: LEGO1 0x10067bb0 STUB
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(DuneBuggy, 0x16c);
|
||||
|
||||
// OFFSET: LEGO1 0x10067bb0
|
||||
DuneBuggy::DuneBuggy()
|
||||
{
|
||||
// TODO
|
||||
this->m_unk13c = 25.0;
|
||||
this->m_unk164 = 1.0;
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef DUNEBUGGY_H
|
||||
#define DUNEBUGGY_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "islepathactor.h"
|
||||
|
||||
// VTABLE 0x100d8f98
|
||||
@ -22,7 +23,11 @@ class DuneBuggy : public IslePathActor
|
||||
{
|
||||
return !strcmp(name, DuneBuggy::ClassName()) || IslePathActor::IsA(name);
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO: Double check DuneBuggy field types
|
||||
undefined4 m_unk160;
|
||||
MxFloat m_unk164;
|
||||
undefined4 m_unk168;
|
||||
};
|
||||
|
||||
#endif // DUNEBUGGY_H
|
||||
|
||||
21
LEGO1/extra.h
Normal file
21
LEGO1/extra.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef EXTRA_H
|
||||
#define EXTRA_H
|
||||
|
||||
// Items related to the Extra string of key-value pairs found in MxOb
|
||||
|
||||
enum ExtraActionType
|
||||
{
|
||||
ExtraActionType_opendisk = 1,
|
||||
ExtraActionType_openram = 2,
|
||||
ExtraActionType_close = 3,
|
||||
ExtraActionType_start = 4,
|
||||
ExtraActionType_stop = 5,
|
||||
ExtraActionType_run = 6,
|
||||
ExtraActionType_exit = 7,
|
||||
ExtraActionType_enable = 8,
|
||||
ExtraActionType_disable = 9,
|
||||
ExtraActionType_notify = 10,
|
||||
ExtraActionType_unknown = 11,
|
||||
};
|
||||
|
||||
#endif // EXTRA_H
|
||||
@ -21,7 +21,7 @@ MxLong GasStation::Notify(MxParam &p)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10005c90 STUB
|
||||
MxLong GasStation::Tickle()
|
||||
MxResult GasStation::Tickle()
|
||||
{
|
||||
// TODO
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ class GasStation : public LegoWorld
|
||||
virtual ~GasStation() override; // vtable+0x0
|
||||
|
||||
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
|
||||
virtual MxLong Tickle() override; // vtable+0x8
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
|
||||
// OFFSET: LEGO1 0x10004780
|
||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||
|
||||
@ -21,7 +21,7 @@ MxLong Infocenter::Notify(MxParam &p)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10070af0 STUB
|
||||
MxLong Infocenter::Tickle()
|
||||
MxResult Infocenter::Tickle()
|
||||
{
|
||||
// TODO
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ class Infocenter : public LegoWorld
|
||||
virtual ~Infocenter() override;
|
||||
|
||||
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
|
||||
virtual MxLong Tickle() override; // vtable+0x8
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
|
||||
// OFFSET: LEGO1 0x1006eb40
|
||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
#include "jetski.h"
|
||||
|
||||
// OFFSET: LEGO1 0x1007e3b0 STUB
|
||||
DECOMP_SIZE_ASSERT(Jetski, 0x164);
|
||||
|
||||
// OFFSET: LEGO1 0x1007e3b0
|
||||
Jetski::Jetski()
|
||||
{
|
||||
// TODO
|
||||
this->m_unk13c = 25.0;
|
||||
this->m_unk150 = 2.0;
|
||||
this->m_unk148 = 1;
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef JETSKI_H
|
||||
#define JETSKI_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "islepathactor.h"
|
||||
|
||||
// VTABLE 0x100d9ec8
|
||||
@ -22,7 +23,9 @@ class Jetski : public IslePathActor
|
||||
{
|
||||
return !strcmp(name, Jetski::ClassName()) || IslePathActor::IsA(name);
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO: Jetski fields
|
||||
undefined m_unk160[4];
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
#include "legoactor.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoActor, 0x78)
|
||||
|
||||
// OFFSET: LEGO1 0x1002d110 STUB
|
||||
LegoActor::LegoActor()
|
||||
{
|
||||
}
|
||||
@ -9,6 +9,8 @@
|
||||
class LegoActor : public LegoEntity
|
||||
{
|
||||
public:
|
||||
LegoActor();
|
||||
|
||||
// OFFSET: LEGO1 0x1002d210
|
||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||
{
|
||||
|
||||
@ -23,7 +23,7 @@ MxLong LegoAnimationManager::Notify(MxParam &p)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10061cc0 STUB
|
||||
MxLong LegoAnimationManager::Tickle()
|
||||
MxResult LegoAnimationManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ class LegoAnimationManager : public MxCore
|
||||
virtual ~LegoAnimationManager() override; // vtable+0x0
|
||||
|
||||
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
|
||||
virtual MxLong Tickle() override; // vtable+0x8
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
|
||||
// OFFSET: LEGO1 0x1005ec80
|
||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
#include "legoomni.h"
|
||||
#include "legoutil.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoBackgroundColor, 0x30)
|
||||
|
||||
const char *g_delimiter = "\t";
|
||||
const char *g_set = "set";
|
||||
|
||||
@ -3,11 +3,13 @@
|
||||
|
||||
#include "mxvariable.h"
|
||||
|
||||
// VTABLE 0x100d74a8
|
||||
// SIZE 0x30
|
||||
class LegoBackgroundColor : public MxVariable
|
||||
{
|
||||
public:
|
||||
__declspec(dllexport) LegoBackgroundColor(const char *p_key, const char *p_value);
|
||||
void SetValue(const char *p_colorString);
|
||||
virtual void SetValue(const char *p_colorString) override;
|
||||
|
||||
private:
|
||||
float h;
|
||||
|
||||
@ -21,7 +21,7 @@ MxLong LegoCarBuild::Notify(MxParam &p)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100238b0 STUB
|
||||
MxLong LegoCarBuild::Tickle()
|
||||
MxResult LegoCarBuild::Tickle()
|
||||
{
|
||||
// TODO
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ class LegoCarBuild : public LegoWorld
|
||||
virtual ~LegoCarBuild() override;
|
||||
|
||||
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
|
||||
virtual MxLong Tickle() override; // vtable+0x8
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
|
||||
// OFFSET: LEGO1 0x10022940
|
||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||
|
||||
@ -13,7 +13,7 @@ LegoControlManager::~LegoControlManager()
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10029600 STUB
|
||||
MxLong LegoControlManager::Tickle()
|
||||
MxResult LegoControlManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ class LegoControlManager : public MxCore
|
||||
LegoControlManager();
|
||||
virtual ~LegoControlManager() override; // vtable+0x0
|
||||
|
||||
virtual MxLong Tickle() override; // vtable+0x8
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
|
||||
// OFFSET: LEGO1 0x10028cb0
|
||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
#include "legoentity.h"
|
||||
|
||||
#include "legoomni.h"
|
||||
#include "legoutil.h"
|
||||
#include "define.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoEntity, 0x68)
|
||||
|
||||
// OFFSET: LEGO1 0x1000c290
|
||||
LegoEntity::~LegoEntity()
|
||||
{
|
||||
Destroy();
|
||||
Destroy(TRUE);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100114f0 STUB
|
||||
@ -16,8 +20,58 @@ MxLong LegoEntity::Notify(MxParam &p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10010810 STUB
|
||||
void LegoEntity::Destroy()
|
||||
// OFFSET: LEGO1 0x100105f0
|
||||
void LegoEntity::Reset()
|
||||
{
|
||||
// TODO
|
||||
m_vec1.Fill(0);
|
||||
m_vec2.Fill(0);
|
||||
m_unk50 = 0;
|
||||
m_unk54 = 0;
|
||||
m_unk58 = 0;
|
||||
m_actionArgString = NULL;
|
||||
m_unk10 = 0;
|
||||
m_unk11 = 0;
|
||||
m_actionType = ExtraActionType_unknown;
|
||||
m_actionArgNumber = -1;
|
||||
m_unk59 = 4;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100107e0 STUB
|
||||
void LegoEntity::vtable18()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10010810 STUB
|
||||
void LegoEntity::Destroy(MxBool)
|
||||
{
|
||||
if (m_unk54) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
delete[] m_actionArgString;
|
||||
Reset();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10010e10
|
||||
void LegoEntity::ParseAction(char *p_extra)
|
||||
{
|
||||
char copy[1024];
|
||||
char actionValue[1024];
|
||||
strcpy(copy, p_extra);
|
||||
|
||||
if (KeyValueStringParse(actionValue, g_strACTION, copy)) {
|
||||
m_actionType = MatchActionString(strtok(actionValue, g_parseExtraTokens));
|
||||
|
||||
if (m_actionType != ExtraActionType_exit) {
|
||||
char *token = strtok(NULL, g_parseExtraTokens);
|
||||
|
||||
m_actionArgString = new char[strlen(token) + 1];
|
||||
strcpy(m_actionArgString, token);
|
||||
|
||||
if (m_actionType != ExtraActionType_run) {
|
||||
m_actionArgNumber = atoi(strtok(NULL, g_parseExtraTokens));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
#define LEGOENTITY_H
|
||||
|
||||
#include "mxentity.h"
|
||||
#include "mxvector.h"
|
||||
#include "extra.h"
|
||||
#include "decomp.h"
|
||||
|
||||
// VTABLE 0x100d4858
|
||||
// SIZE 0x68 (probably)
|
||||
@ -31,7 +34,27 @@ class LegoEntity : public MxEntity
|
||||
return !strcmp(name, LegoEntity::ClassName()) || MxEntity::IsA(name);
|
||||
}
|
||||
|
||||
virtual void Destroy() override; // vtable+0x1c
|
||||
virtual void vtable18(); // vtable+0x18
|
||||
virtual void Destroy(MxBool); // vtable+0x1c
|
||||
virtual void ParseAction(char *); // vtable+0x20
|
||||
|
||||
protected:
|
||||
void Reset();
|
||||
|
||||
undefined m_unk10;
|
||||
undefined m_unk11;
|
||||
MxVector3Data m_vec1; // 0x14
|
||||
MxVector3Data m_vec2; // 0x28
|
||||
MxVector3Data m_vec3; // 0x3c
|
||||
undefined4 m_unk50;
|
||||
undefined4 m_unk54;
|
||||
undefined m_unk58;
|
||||
undefined m_unk59;
|
||||
// For tokens from the extra string that look like this:
|
||||
// "Action:openram;\lego\scripts\Race\CarRaceR;0"
|
||||
ExtraActionType m_actionType; // 0x5c
|
||||
char *m_actionArgString; // 0x60
|
||||
MxS32 m_actionArgNumber; // 0x64
|
||||
|
||||
};
|
||||
|
||||
|
||||
43
LEGO1/legofullscreenmovie.cpp
Normal file
43
LEGO1/legofullscreenmovie.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include "legofullscreenmovie.h"
|
||||
|
||||
#include "legoomni.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "mxtypes.h"
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoFullScreenMovie, 0x24)
|
||||
|
||||
// 0x100f3be8
|
||||
const char *g_str_enable = "enable";
|
||||
|
||||
// 0x100f3bf4
|
||||
const char *g_str_disable = "disable";
|
||||
|
||||
// OFFSET: LEGO1 0x1003c500
|
||||
LegoFullScreenMovie::LegoFullScreenMovie(const char *p_key, const char *p_value)
|
||||
{
|
||||
m_key = p_key;
|
||||
m_key.ToUpperCase();
|
||||
SetValue(p_value);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1003c5c0
|
||||
void LegoFullScreenMovie::SetValue(const char *p_option)
|
||||
{
|
||||
m_value = p_option;
|
||||
m_value.ToLowerCase();
|
||||
|
||||
LegoVideoManager *videomanager = VideoManager();
|
||||
if (videomanager) {
|
||||
|
||||
if (!strcmp(m_value.GetData(), g_str_enable)) {
|
||||
videomanager->EnableFullScreenMovie(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(m_value.GetData(), g_str_disable)) {
|
||||
videomanager->EnableFullScreenMovie(FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
LEGO1/legofullscreenmovie.h
Normal file
15
LEGO1/legofullscreenmovie.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef LEGOFULLSCREENMOVIE_H
|
||||
#define LEGOFULLSCREENMOVIE_H
|
||||
|
||||
#include "mxvariable.h"
|
||||
|
||||
// VTABLE 0x100d74b8
|
||||
// SIZE 0x24
|
||||
class LegoFullScreenMovie : public MxVariable
|
||||
{
|
||||
public:
|
||||
LegoFullScreenMovie(const char *p_key, const char *p_value);
|
||||
virtual void SetValue(const char *p_option) override;
|
||||
};
|
||||
|
||||
#endif // LEGOFULLSCREENMOVIE_H
|
||||
@ -1,10 +1,28 @@
|
||||
#include "legogamestate.h"
|
||||
|
||||
#include "legoomni.h"
|
||||
#include "mxvariabletable.h"
|
||||
#include "decomp.h"
|
||||
|
||||
// Based on the highest dword offset (0x42c) referenced in the constructor.
|
||||
// There may be other members that come after.
|
||||
DECOMP_SIZE_ASSERT(LegoGameState, 0x430)
|
||||
|
||||
// OFFSET: LEGO1 0x10039550
|
||||
LegoGameState::LegoGameState()
|
||||
{
|
||||
// TODO
|
||||
m_backgroundColor = new LegoBackgroundColor("backgroundcolor", "set 56 54 68");
|
||||
VariableTable()->SetVariable(m_backgroundColor);
|
||||
|
||||
m_tempBackgroundColor = new LegoBackgroundColor("tempBackgroundcolor", "set 56 54 68");
|
||||
VariableTable()->SetVariable(m_tempBackgroundColor);
|
||||
|
||||
m_fullScreenMovie = new LegoFullScreenMovie("fsmovie", "disable");
|
||||
VariableTable()->SetVariable(m_fullScreenMovie);
|
||||
|
||||
VariableTable()->SetVariable("lightposition", "2");
|
||||
SerializeScoreHistory(1);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10039720
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
#ifndef LEGOGAMESTATE_H
|
||||
#define LEGOGAMESTATE_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxtypes.h"
|
||||
#include "legobackgroundcolor.h"
|
||||
#include "legofullscreenmovie.h"
|
||||
|
||||
// SIZE 0x430 (at least)
|
||||
class LegoGameState
|
||||
{
|
||||
public:
|
||||
@ -15,7 +19,12 @@ class LegoGameState
|
||||
__declspec(dllexport) void SetSavePath(char *p);
|
||||
|
||||
private:
|
||||
char *m_savePath;
|
||||
char *m_savePath; // 0x0
|
||||
undefined m_unk04[20];
|
||||
LegoBackgroundColor *m_backgroundColor; // 0x18
|
||||
LegoBackgroundColor *m_tempBackgroundColor; // 0x1c
|
||||
LegoFullScreenMovie *m_fullScreenMovie; // 0x20
|
||||
undefined m_unk24[1036];
|
||||
};
|
||||
|
||||
#endif // LEGOGAMESTATE_H
|
||||
|
||||
@ -1,25 +1,175 @@
|
||||
#include "legoinputmanager.h"
|
||||
#include "legocontrolmanager.h"
|
||||
#include "legoomni.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxautolocker.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338); // 0x10059085
|
||||
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338);
|
||||
|
||||
// OFFSET: LEGO1 0x1005b790 STUB
|
||||
// OFFSET: LEGO1 0x1005b790
|
||||
LegoInputManager::LegoInputManager()
|
||||
{
|
||||
// TODO
|
||||
m_unk0x5c = NULL;
|
||||
m_unk0x64 = 0;
|
||||
m_unk0x60 = 0;
|
||||
m_unk0x68 = NULL;
|
||||
m_unk0x80 = 0;
|
||||
m_timer = 0;
|
||||
m_unk0x6c = 0;
|
||||
m_unk0x70 = 0;
|
||||
m_controlManager = NULL;
|
||||
m_unk0x81 = 0;
|
||||
m_unk0x88 = FALSE;
|
||||
m_directInput = NULL;
|
||||
m_directInputDevice = NULL;
|
||||
m_unk0x94 = 0;
|
||||
m_unk0x195 = 0;
|
||||
m_joyid = -1;
|
||||
m_joystickIndex = -1;
|
||||
m_useJoystick = FALSE;
|
||||
m_unk0x335 = FALSE;
|
||||
m_unk0x336 = FALSE;
|
||||
m_unk0x74 = 0x19;
|
||||
m_timeout = 1000;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005b8f0 STUB
|
||||
// OFFSET: LEGO1 0x1005b8b0 STUB
|
||||
MxResult LegoInputManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005b8f0
|
||||
LegoInputManager::~LegoInputManager()
|
||||
{
|
||||
// TODO
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c740 STUB
|
||||
void LegoInputManager::QueueEvent(NotificationId id, unsigned char p2, MxLong p3, MxLong p4, unsigned char p5)
|
||||
// OFFSET: LEGO1 0x1005bfe0
|
||||
void LegoInputManager::Destroy()
|
||||
{
|
||||
// TODO
|
||||
ReleaseDX();
|
||||
|
||||
if (m_unk0x5c)
|
||||
delete m_unk0x5c;
|
||||
m_unk0x5c = NULL;
|
||||
|
||||
if (m_unk0x68)
|
||||
delete m_unk0x68;
|
||||
m_unk0x68 = NULL;
|
||||
|
||||
if (m_controlManager)
|
||||
delete m_controlManager;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c030
|
||||
void LegoInputManager::CreateAndAcquireKeyboard(HWND hwnd)
|
||||
{
|
||||
HINSTANCE hinstance = (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE);
|
||||
HRESULT hresult = DirectInputCreate(hinstance, 0x500, &m_directInput, NULL); // 0x500 for DX5
|
||||
|
||||
if (hresult == DI_OK) {
|
||||
HRESULT createdeviceresult = m_directInput->CreateDevice(GUID_SysKeyboard, &m_directInputDevice, NULL);
|
||||
if (createdeviceresult == DI_OK) {
|
||||
m_directInputDevice->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
|
||||
m_directInputDevice->SetDataFormat(&c_dfDIKeyboard);
|
||||
m_directInputDevice->Acquire();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c0a0
|
||||
void LegoInputManager::ReleaseDX()
|
||||
{
|
||||
if (m_directInputDevice != NULL) {
|
||||
m_directInputDevice->Unacquire();
|
||||
m_directInputDevice->Release();
|
||||
m_directInputDevice = NULL;
|
||||
}
|
||||
|
||||
if (m_directInput != NULL) {
|
||||
m_directInput->Release();
|
||||
m_directInput = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c240
|
||||
MxResult LegoInputManager::GetJoystickId()
|
||||
{
|
||||
JOYINFOEX joyinfoex;
|
||||
|
||||
if (m_useJoystick != FALSE) {
|
||||
MxS32 joyid = m_joystickIndex;
|
||||
if (joyid >= 0) {
|
||||
joyinfoex.dwSize = 0x34;
|
||||
joyinfoex.dwFlags = 0xFF;
|
||||
|
||||
if (joyGetPosEx(joyid, &joyinfoex) == JOYERR_NOERROR && joyGetDevCaps(joyid, &m_joyCaps, 0x194) == JOYERR_NOERROR) {
|
||||
m_joyid = joyid;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
for (joyid = JOYSTICKID1; joyid < 16; joyid++) {
|
||||
joyinfoex.dwSize = 0x34;
|
||||
joyinfoex.dwFlags = 0xFF;
|
||||
if (joyGetPosEx(joyid, &joyinfoex) == JOYERR_NOERROR && joyGetDevCaps(joyid, &m_joyCaps, 0x194) == JOYERR_NOERROR) {
|
||||
m_joyid = joyid;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c320
|
||||
MxResult LegoInputManager::GetJoystickState(MxU32 *joystick_x, MxU32 *joystick_y, DWORD *buttons_state, MxU32 *pov_position)
|
||||
{
|
||||
if (m_useJoystick != FALSE) {
|
||||
if (m_joyid < 0 && GetJoystickId() == -1) {
|
||||
m_useJoystick = FALSE;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
JOYINFOEX joyinfoex;
|
||||
joyinfoex.dwSize = 0x34;
|
||||
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNBUTTONS;
|
||||
MxU32 capabilities = m_joyCaps.wCaps;
|
||||
|
||||
if ((capabilities & JOYCAPS_HASPOV) != 0) {
|
||||
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS;
|
||||
|
||||
if ((capabilities & JOYCAPS_POVCTS) != 0)
|
||||
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS | JOY_RETURNPOVCTS;
|
||||
}
|
||||
|
||||
MMRESULT mmresult = joyGetPosEx(m_joyid, &joyinfoex);
|
||||
|
||||
if (mmresult == MMSYSERR_NOERROR) {
|
||||
*buttons_state = joyinfoex.dwButtons;
|
||||
MxU32 xmin = m_joyCaps.wXmin;
|
||||
MxU32 ymax = m_joyCaps.wYmax;
|
||||
MxU32 ymin = m_joyCaps.wYmin;
|
||||
MxS32 ydiff = ymax - ymin;
|
||||
*joystick_x = ((joyinfoex.dwXpos - xmin) * 100) / (m_joyCaps.wXmax - xmin);
|
||||
*joystick_y = ((joyinfoex.dwYpos - m_joyCaps.wYmin) * 100) / ydiff;
|
||||
if ((m_joyCaps.wCaps & (JOYCAPS_POV4DIR | JOYCAPS_POVCTS)) != 0) {
|
||||
if (joyinfoex.dwPOV == JOY_POVCENTERED) {
|
||||
*pov_position = (MxU32) -1;
|
||||
return SUCCESS;
|
||||
}
|
||||
*pov_position = joyinfoex.dwPOV / 100;
|
||||
return SUCCESS;
|
||||
}
|
||||
else {
|
||||
*pov_position = (MxU32) -1;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005c470 STUB
|
||||
@ -34,11 +184,25 @@ void LegoInputManager::UnRegister(MxCore *)
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005b8b0 STUB
|
||||
MxLong LegoInputManager::Tickle()
|
||||
// OFFSET: LEGO1 0x1005c740 STUB
|
||||
void LegoInputManager::QueueEvent(NotificationId id, unsigned char p2, MxLong p3, MxLong p4, unsigned char p5)
|
||||
{
|
||||
// TODO
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005cfb0
|
||||
void LegoInputManager::SetTimer()
|
||||
{
|
||||
LegoOmni* omni = LegoOmni::GetInstance();
|
||||
UINT timer = ::SetTimer(omni->GetWindowHandle(), 1, m_timeout, NULL);
|
||||
m_timer = timer;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005cfd0
|
||||
void LegoInputManager::KillTimer()
|
||||
{
|
||||
if (m_timer != 0) {
|
||||
LegoOmni* omni = LegoOmni::GetInstance();
|
||||
::KillTimer(omni->GetWindowHandle(), m_timer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxpresenter.h"
|
||||
#include "mxlist.h"
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
enum NotificationId
|
||||
{
|
||||
@ -14,6 +17,8 @@ enum NotificationId
|
||||
TIMER = 15
|
||||
};
|
||||
|
||||
class LegoControlManager;
|
||||
|
||||
// VTABLE 0x100d8760
|
||||
// SIZE 0x338
|
||||
class LegoInputManager : public MxPresenter
|
||||
@ -26,12 +31,44 @@ class LegoInputManager : public MxPresenter
|
||||
__declspec(dllexport) void Register(MxCore *);
|
||||
__declspec(dllexport) void UnRegister(MxCore *);
|
||||
|
||||
virtual MxLong Tickle() override; // vtable+0x8
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
|
||||
undefined m_pad40[0x15c];
|
||||
int m_joystickIndex;
|
||||
undefined m_pad200[0x194];
|
||||
void Destroy();
|
||||
void CreateAndAcquireKeyboard(HWND hwnd);
|
||||
void ReleaseDX();
|
||||
MxResult GetJoystickId();
|
||||
MxResult GetJoystickState(MxU32 *joystick_x, MxU32 *joystick_y, DWORD *buttons_state, MxU32 *pov_position);
|
||||
void SetTimer();
|
||||
void KillTimer();
|
||||
|
||||
//private:
|
||||
MxCriticalSection m_criticalSection;
|
||||
MxList<undefined4> *m_unk0x5c; // list or hash table
|
||||
undefined4 m_unk0x60;
|
||||
undefined4 m_unk0x64;
|
||||
MxList<undefined4> *m_unk0x68; // list or hash table
|
||||
undefined4 m_unk0x6c;
|
||||
undefined4 m_unk0x70;
|
||||
undefined4 m_unk0x74;
|
||||
UINT m_timer;
|
||||
UINT m_timeout;
|
||||
undefined m_unk0x80;
|
||||
undefined m_unk0x81;
|
||||
LegoControlManager* m_controlManager;
|
||||
MxBool m_unk0x88;
|
||||
IDirectInput *m_directInput;
|
||||
IDirectInputDevice *m_directInputDevice;
|
||||
undefined m_unk0x94;
|
||||
undefined4 m_unk0x98;
|
||||
undefined m_unk0x9c[0xF8];
|
||||
undefined m_unk0x194;
|
||||
MxBool m_unk0x195;
|
||||
MxS32 m_joyid;
|
||||
MxS32 m_joystickIndex;
|
||||
JOYCAPS m_joyCaps;
|
||||
MxBool m_useJoystick;
|
||||
MxBool m_unk0x335;
|
||||
MxBool m_unk0x336;
|
||||
};
|
||||
|
||||
#endif // LEGOINPUTMANAGER_H
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include "legonavcontroller.h"
|
||||
|
||||
#include "legoomni.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "legoutil.h"
|
||||
|
||||
// 0x100f4c28
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
#include "legoomni.h"
|
||||
|
||||
#include "mxbackgroundaudiomanager.h"
|
||||
#include "mxdsfile.h"
|
||||
#include "legogamestate.h"
|
||||
#include "legoutil.h"
|
||||
|
||||
// 0x100f4588
|
||||
char *g_nocdSourceName = NULL;
|
||||
MxAtomId *g_nocdSourceName = NULL;
|
||||
|
||||
// 0x101020e8
|
||||
void (*g_omniUserMessage)(const char *,int);
|
||||
@ -37,10 +42,58 @@ int LegoOmni::GetCurrPathInfo(LegoPathBoundary **,int &)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b6ff0 STUB
|
||||
void MakeSourceName(char *, const char *)
|
||||
// OFFSET: LEGO1 0x100b6ff0
|
||||
void MakeSourceName(char *p_output, const char *p_input)
|
||||
{
|
||||
// TODO
|
||||
const char *cln = strchr(p_input, ':');
|
||||
if (cln) {
|
||||
p_input = cln + 1;
|
||||
}
|
||||
|
||||
strcpy(p_output, p_input);
|
||||
|
||||
strlwr(p_output);
|
||||
|
||||
char *extLoc = strstr(p_output, ".si");
|
||||
if (extLoc) {
|
||||
*extLoc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b7050
|
||||
MxBool KeyValueStringParse(char *p_outputValue, const char *p_key, const char *p_source)
|
||||
{
|
||||
MxBool didMatch = FALSE;
|
||||
|
||||
MxS16 len = strlen(p_source);
|
||||
char *temp = new char[len + 1];
|
||||
strcpy(temp, p_source);
|
||||
|
||||
char *token = strtok(temp, ", \t\r\n:");
|
||||
while (token) {
|
||||
len -= (strlen(token) + 1);
|
||||
|
||||
if (strcmpi(token, p_key) == 0) {
|
||||
if (p_outputValue && len > 0) {
|
||||
char *cur = &token[strlen(p_key)];
|
||||
cur++;
|
||||
while (*cur != ',') {
|
||||
if (*cur == ' ' || *cur == '\0' || *cur == '\t' || *cur == '\n' || *cur == '\r')
|
||||
break;
|
||||
*p_outputValue++ = *cur++;
|
||||
}
|
||||
*p_outputValue = '\0';
|
||||
}
|
||||
|
||||
didMatch = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
token = strtok(NULL, ", \t\r\n:");
|
||||
}
|
||||
|
||||
delete[] temp;
|
||||
return didMatch;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b7210
|
||||
@ -49,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
|
||||
@ -111,10 +163,38 @@ MxBackgroundAudioManager *BackgroundAudioManager()
|
||||
return LegoOmni::GetInstance()->GetBackgroundAudioManager();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0280 STUB
|
||||
MxDSObject *CreateStreamObject(MxDSFile *,MxS16)
|
||||
// OFFSET: LEGO1 0x100c0280
|
||||
MxDSObject *CreateStreamObject(MxDSFile *p_file, MxS16 p_ofs)
|
||||
{
|
||||
// TODO
|
||||
char *buf;
|
||||
_MMCKINFO tmp_chunk;
|
||||
|
||||
if (p_file->Seek(((MxLong*)p_file->GetBuffer())[p_ofs], 0)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (p_file->Read((MxU8*)&tmp_chunk.ckid, 8) == 0 && tmp_chunk.ckid == FOURCC('M', 'x', 'S', 't')) {
|
||||
if (p_file->Read((MxU8*)&tmp_chunk.ckid, 8) == 0 && tmp_chunk.ckid == FOURCC('M', 'x', 'O', 'b')) {
|
||||
|
||||
buf = new char[tmp_chunk.cksize];
|
||||
if (!buf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (p_file->Read((MxU8*)buf, tmp_chunk.cksize) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Save a copy so we can clean up properly, because
|
||||
// this function will alter the pointer value.
|
||||
char *copy = buf;
|
||||
MxDSObject *obj = DeserializeDSObjectDispatch(&buf, -1);
|
||||
delete[] copy;
|
||||
return obj;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -145,7 +225,7 @@ MxTransitionManager *TransitionManager()
|
||||
// OFFSET: LEGO1 0x10053430
|
||||
const char *GetNoCD_SourceName()
|
||||
{
|
||||
return g_nocdSourceName;
|
||||
return g_nocdSourceName->GetInternal();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005b5f0
|
||||
@ -172,64 +252,95 @@ LegoEntity *PickEntity(MxLong,MxLong)
|
||||
// OFFSET: LEGO1 0x10058bd0
|
||||
void LegoOmni::Init()
|
||||
{
|
||||
// FIXME: Stub
|
||||
MxOmni::Init();
|
||||
m_unk68 = 0;
|
||||
m_inputMgr = NULL;
|
||||
m_unk6c = 0;
|
||||
m_unk74 = 0;
|
||||
m_unk78 = 0;
|
||||
m_currentWorld = NULL;
|
||||
m_unk80 = FALSE;
|
||||
m_isle = NULL;
|
||||
m_unk8c = 0;
|
||||
m_plantManager = NULL;
|
||||
m_gameState = NULL;
|
||||
m_animationManager = NULL;
|
||||
m_buildingManager = NULL;
|
||||
m_bkgAudioManager = NULL;
|
||||
m_unk13c = TRUE;
|
||||
m_transitionManager = NULL;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10058e70
|
||||
MxResult LegoOmni::Create(COMPAT_CONST MxOmniCreateParam &p)
|
||||
{
|
||||
// FIXME: Stub
|
||||
MxOmni::Create(p);
|
||||
m_gameState = new LegoGameState();
|
||||
m_bkgAudioManager = new MxBackgroundAudioManager();
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10058c30 STUB
|
||||
void LegoOmni::Destroy()
|
||||
{
|
||||
// FIXME: Stub
|
||||
}
|
||||
|
||||
void LegoOmni::vtable20()
|
||||
// OFFSET: LEGO1 0x1005b580
|
||||
MxResult LegoOmni::Start(MxDSAction* action)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// FIXME: Stub
|
||||
}
|
||||
|
||||
void LegoOmni::vtable24(MxDSAction &ds)
|
||||
{
|
||||
// FIXME: Stub
|
||||
}
|
||||
|
||||
MxBool LegoOmni::vtable28(MxDSAction &ds)
|
||||
MxBool LegoOmni::DoesEntityExist(MxDSAction &ds)
|
||||
{
|
||||
// FIXME: Stub
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LegoOmni::vtable2c()
|
||||
void LegoOmni::vtable0x2c()
|
||||
{
|
||||
// FIXME: Stub
|
||||
}
|
||||
|
||||
void LegoOmni::vtable30()
|
||||
{
|
||||
// FIXME: Stub
|
||||
}
|
||||
|
||||
void LegoOmni::vtable34()
|
||||
{
|
||||
// FIXME: Stub
|
||||
}
|
||||
|
||||
void LegoOmni::vtable38()
|
||||
{
|
||||
// FIXME: Stub
|
||||
}
|
||||
|
||||
void LegoOmni::vtable3c()
|
||||
{
|
||||
// FIXME: Stub
|
||||
}
|
||||
|
||||
unsigned char LegoOmni::vtable40()
|
||||
int LegoOmni::vtable0x30(char*, int, MxCore*)
|
||||
{
|
||||
// FIXME: Stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LegoOmni::NotifyCurrentEntity()
|
||||
{
|
||||
// FIXME: Stub
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005b640
|
||||
void LegoOmni::StartTimer()
|
||||
{
|
||||
MxOmni::StartTimer();
|
||||
SetAppCursor(2);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1005b650
|
||||
void LegoOmni::StopTimer()
|
||||
{
|
||||
MxOmni::StopTimer();
|
||||
SetAppCursor(0);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100157a0
|
||||
LegoWorld *GetCurrentWorld()
|
||||
{
|
||||
return LegoOmni::GetInstance()->GetCurrentWorld();
|
||||
}
|
||||
|
||||
@ -2,25 +2,26 @@
|
||||
#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 LegoAnimationManager;
|
||||
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
|
||||
// SIZE: 0x140
|
||||
@ -36,33 +37,32 @@ class LegoOmni : public MxOmni
|
||||
LegoOmni();
|
||||
virtual ~LegoOmni(); // vtable+00
|
||||
|
||||
virtual MxLong Notify(MxParam &p); // vtable+04
|
||||
virtual MxLong Notify(MxParam &p) override; // vtable+04
|
||||
|
||||
// OFFSET: LEGO1 0x10058aa0
|
||||
inline virtual const char *ClassName() const // vtable+0c
|
||||
inline virtual const char *ClassName() const override // vtable+0c
|
||||
{
|
||||
// 0x100f671c
|
||||
return "LegoOmni";
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10058ab0
|
||||
inline virtual MxBool IsA(const char *name) const // vtable+10
|
||||
inline virtual MxBool IsA(const char *name) const override // vtable+10
|
||||
{
|
||||
return !strcmp(name, LegoOmni::ClassName()) || MxOmni::IsA(name);
|
||||
}
|
||||
|
||||
virtual void Init(); // vtable+14
|
||||
virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p); // vtable+18
|
||||
virtual void Destroy(); // vtable+1c
|
||||
virtual void vtable20();
|
||||
virtual void vtable24(MxDSAction &ds);
|
||||
virtual MxBool vtable28(MxDSAction &ds);
|
||||
virtual void vtable2c();
|
||||
virtual void vtable30();
|
||||
virtual void vtable34();
|
||||
virtual void vtable38();
|
||||
virtual void vtable3c();
|
||||
virtual unsigned char vtable40();
|
||||
virtual void Init() override; // vtable+14
|
||||
virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p) override; // vtable+18
|
||||
virtual void Destroy() override; // vtable+1c
|
||||
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 StopTimer() override;
|
||||
|
||||
LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; }
|
||||
LegoSoundManager *GetSoundManager() { return (LegoSoundManager *)m_soundManager;}
|
||||
@ -74,24 +74,27 @@ class LegoOmni : public MxOmni
|
||||
LegoGameState *GetGameState() { return m_gameState; }
|
||||
LegoNavController *GetNavController() { return m_navController; }
|
||||
MxTransitionManager *GetTransitionManager() { return m_transitionManager; }
|
||||
LegoWorld *GetCurrentWorld() { return m_currentWorld; }
|
||||
|
||||
private:
|
||||
int m_unk68;
|
||||
int m_unk6c;
|
||||
LegoInputManager *m_inputMgr; // 0x70
|
||||
char m_unk74[0x10];
|
||||
undefined4 m_unk74;
|
||||
undefined4 m_unk78;
|
||||
LegoWorld *m_currentWorld;
|
||||
MxBool m_unk80;
|
||||
LegoNavController *m_navController; // 0x84
|
||||
Isle* m_isle; // 0x88
|
||||
char m_unk8c[0x4];
|
||||
undefined4 m_unk8c;
|
||||
LegoPlantManager* m_plantManager; // 0x90
|
||||
char m_unk94[0x4];
|
||||
LegoAnimationManager* m_animationManager;
|
||||
LegoBuildingManager* m_buildingManager; // 0x98
|
||||
LegoGameState *m_gameState; // 0x9c
|
||||
MxDSAction m_action;
|
||||
MxBackgroundAudioManager *m_bkgAudioManager; // 0x134
|
||||
MxTransitionManager *m_transitionManager; // 0x138
|
||||
int m_unk13c;
|
||||
|
||||
MxBool m_unk13c;
|
||||
};
|
||||
|
||||
__declspec(dllexport) MxBackgroundAudioManager * BackgroundAudioManager();
|
||||
@ -105,13 +108,14 @@ __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();
|
||||
LegoPlantManager* PlantManager();
|
||||
MxBool KeyValueStringParse(char *, const char *, const char *);
|
||||
LegoWorld *GetCurrentWorld();
|
||||
|
||||
#endif // LEGOOMNI_H
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#include "legopalettepresenter.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoPalettePresenter, 0x68)
|
||||
|
||||
// OFFSET: LEGO1 0x10079e50
|
||||
LegoPalettePresenter::LegoPalettePresenter()
|
||||
{
|
||||
@ -12,8 +14,8 @@ LegoPalettePresenter::~LegoPalettePresenter()
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1007a0d0 STUB
|
||||
// OFFSET: LEGO1 0x1007a0d0
|
||||
void LegoPalettePresenter::Init()
|
||||
{
|
||||
// TODO
|
||||
this->m_unk64 = 0;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef LEGOPALETTEPRESENTER_H
|
||||
#define LEGOPALETTEPRESENTER_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxvideopresenter.h"
|
||||
|
||||
// VTABLE 0x100d9aa0
|
||||
@ -27,6 +28,7 @@ class LegoPalettePresenter : public MxVideoPresenter
|
||||
private:
|
||||
void Init();
|
||||
|
||||
undefined4 m_unk64;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -25,11 +25,15 @@ class LegoPathActor : public LegoActor
|
||||
{
|
||||
return !strcmp(name, LegoPathActor::ClassName()) || LegoActor::IsA(name);
|
||||
}
|
||||
|
||||
// TODO: the types. Pizza needs this as public:
|
||||
protected:
|
||||
// TODO: the types
|
||||
undefined unk78[0xc4];
|
||||
MxS32 m_unk13c;
|
||||
undefined unk140[0x14];
|
||||
MxFloat m_unk13c;
|
||||
MxS32 m_unk140;
|
||||
MxS32 m_unk144;
|
||||
undefined m_unk148;
|
||||
MxS32 m_unk14c;
|
||||
MxFloat m_unk150;
|
||||
};
|
||||
|
||||
#endif // LEGOPATHACTOR_H
|
||||
|
||||
@ -13,7 +13,7 @@ LegoPathController::~LegoPathController()
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10045c10 STUB
|
||||
MxLong LegoPathController::Tickle()
|
||||
MxResult LegoPathController::Tickle()
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@ -11,7 +11,7 @@ class LegoPathController : public MxCore
|
||||
LegoPathController();
|
||||
virtual ~LegoPathController() override;
|
||||
|
||||
virtual MxLong Tickle() override; // vtable+08
|
||||
virtual MxResult Tickle() override; // vtable+08
|
||||
|
||||
// OFFSET: LEGO1 0x10045110
|
||||
inline const char *ClassName() const override // vtable+0xc
|
||||
|
||||
@ -13,7 +13,7 @@ LegoPlantManager::~LegoPlantManager()
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10026e00 STUB
|
||||
MxLong LegoPlantManager::Tickle()
|
||||
MxResult LegoPlantManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ class LegoPlantManager : public MxCore
|
||||
LegoPlantManager();
|
||||
virtual ~LegoPlantManager() override; // vtable+0x0
|
||||
|
||||
virtual MxLong Tickle() override; // vtable+0x8
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
|
||||
// OFFSET: LEGO1 0x10026290
|
||||
inline const char *ClassName() const override // vtable+0xc
|
||||
|
||||
@ -13,7 +13,7 @@ LegoSoundManager::~LegoSoundManager()
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1002a3a0 STUB
|
||||
MxLong LegoSoundManager::Tickle()
|
||||
MxResult LegoSoundManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@ -10,7 +10,7 @@ class LegoSoundManager : public MxSoundManager
|
||||
public:
|
||||
LegoSoundManager();
|
||||
virtual ~LegoSoundManager() override;
|
||||
virtual MxLong Tickle() override; // vtable+08
|
||||
virtual MxResult Tickle() override; // vtable+08
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
@ -1,7 +1,38 @@
|
||||
#include "legoutil.h"
|
||||
|
||||
#include "mxomni.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// OFFSET: LEGO1 0x1003e300
|
||||
ExtraActionType MatchActionString(const char *p_str) {
|
||||
ExtraActionType result = ExtraActionType_unknown;
|
||||
|
||||
if (!strcmpi("openram", p_str))
|
||||
result = ExtraActionType_openram;
|
||||
else if (!strcmpi("opendisk", p_str))
|
||||
result = ExtraActionType_opendisk;
|
||||
else if (!strcmpi("close", p_str))
|
||||
result = ExtraActionType_close;
|
||||
else if (!strcmpi("start", p_str))
|
||||
result = ExtraActionType_start;
|
||||
else if (!strcmpi("stop", p_str))
|
||||
result = ExtraActionType_stop;
|
||||
else if (!strcmpi("run", p_str))
|
||||
result = ExtraActionType_run;
|
||||
else if (!strcmpi("exit", p_str))
|
||||
result = ExtraActionType_exit;
|
||||
else if (!strcmpi("enable", p_str))
|
||||
result = ExtraActionType_enable;
|
||||
else if (!strcmpi("disable", p_str))
|
||||
result = ExtraActionType_disable;
|
||||
else if (!strcmpi("notify", p_str))
|
||||
result = ExtraActionType_notify;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1003eae0
|
||||
void ConvertHSVToRGB(float h, float s, float v, float *r_out, float *b_out, float *g_out)
|
||||
{
|
||||
@ -71,3 +102,9 @@ void ConvertHSVToRGB(float h, float s, float v, float *r_out, float *b_out, floa
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1003ef40
|
||||
void SetAppCursor(WPARAM p_wparam)
|
||||
{
|
||||
PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), 0x5400, p_wparam, 0);
|
||||
}
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
#ifndef LEGOUTIL_H
|
||||
#define LEGOUTIL_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "extra.h"
|
||||
|
||||
template <class T>
|
||||
inline T Abs(T p_t)
|
||||
{
|
||||
@ -19,6 +23,37 @@ inline T Max(T p_t1, T p_t2)
|
||||
return p_t1 > p_t2 ? p_t1 : p_t2;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void GetScalar(char **p_source, T& p_dest)
|
||||
{
|
||||
p_dest = *(T*) *p_source;
|
||||
*p_source += sizeof(T);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T GetScalar(T **p_source)
|
||||
{
|
||||
T val = **p_source;
|
||||
*p_source += 1;
|
||||
return val;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void GetDouble(char **p_source, T& p_dest)
|
||||
{
|
||||
p_dest = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void GetString(char **p_source, const char *&p_dest, T *p_obj, void (T::*p_setter)(const char*))
|
||||
{
|
||||
(p_obj->*p_setter)(*p_source);
|
||||
*p_source += strlen(p_dest) + 1;
|
||||
}
|
||||
|
||||
ExtraActionType MatchActionString(const char *);
|
||||
void ConvertHSVToRGB(float r, float g, float b, float* out_r, float* out_g, float* out_b);
|
||||
void SetAppCursor(WPARAM p_wparam);
|
||||
|
||||
#endif // LEGOUTIL_H
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include "legovideomanager.h"
|
||||
#include <ddraw.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoVideoManager, 0x590);
|
||||
|
||||
// OFFSET: LEGO1 0x1007aa20 STUB
|
||||
LegoVideoManager::LegoVideoManager()
|
||||
@ -27,26 +28,44 @@ int LegoVideoManager::DisableRMDevice()
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1007c300
|
||||
void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable)
|
||||
{
|
||||
EnableFullScreenMovie(p_enable, TRUE);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1007c310 STUB
|
||||
void LegoVideoManager::EnableFullScreenMovie(unsigned char a, unsigned char b)
|
||||
void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable, MxBool p_scale)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1007b6a0 STUB
|
||||
void LegoVideoManager::MoveCursor(int x, int y)
|
||||
// OFFSET: LEGO1 0x1007b6a0
|
||||
void LegoVideoManager::MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY)
|
||||
{
|
||||
// TODO
|
||||
m_cursorX = p_cursorX;
|
||||
m_cursorY = p_cursorY;
|
||||
m_cursorMoved = TRUE;
|
||||
|
||||
if (623 < p_cursorX)
|
||||
m_cursorX = 623;
|
||||
|
||||
if (463 < p_cursorY)
|
||||
m_cursorY = 463;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1007c440
|
||||
void LegoVideoManager::SetSkyColor(float red, float green, float blue)
|
||||
void LegoVideoManager::SetSkyColor(float p_red, float p_green, float p_blue)
|
||||
{
|
||||
PALETTEENTRY colorStrucure; // [esp+0h] [ebp-4h] BYREF
|
||||
PALETTEENTRY colorStrucure;
|
||||
|
||||
colorStrucure.peRed = (red* 255.0);
|
||||
colorStrucure.peGreen = (green * 255.0);
|
||||
colorStrucure.peBlue = (blue * 255.0);
|
||||
colorStrucure.peRed = (p_red * 255.0f);
|
||||
colorStrucure.peGreen = (p_green * 255.0f);
|
||||
colorStrucure.peBlue = (p_blue * 255.0f);
|
||||
colorStrucure.peFlags = -124;
|
||||
// TODO
|
||||
m_videoParam.GetPalette()->SetSkyColor(&colorStrucure);
|
||||
m_videoParam.GetPalette()->SetOverrideSkyColor(TRUE);
|
||||
|
||||
// TODO 3d manager
|
||||
//m_3dManager->m_pViewport->vtable1c(red, green, blue)
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
#include "lego3dmanager.h"
|
||||
#include "decomp.h"
|
||||
|
||||
#include <ddraw.h>
|
||||
|
||||
// VTABLE 0x100d9c88
|
||||
// SIZE 0x590
|
||||
class LegoVideoManager : public MxVideoManager
|
||||
@ -16,13 +18,18 @@ class LegoVideoManager : public MxVideoManager
|
||||
|
||||
__declspec(dllexport) int EnableRMDevice();
|
||||
__declspec(dllexport) int DisableRMDevice();
|
||||
__declspec(dllexport) void EnableFullScreenMovie(unsigned char a, unsigned char b);
|
||||
void EnableFullScreenMovie(MxBool p_enable);
|
||||
__declspec(dllexport) void EnableFullScreenMovie(MxBool p_enable, MxBool p_scale);
|
||||
__declspec(dllexport) void MoveCursor(int x, int y);
|
||||
|
||||
inline Lego3DManager *Get3DManager() { return this->m_3dManager; }
|
||||
inline MxDirect3D *GetDirect3D() { return this->m_direct3d; }
|
||||
|
||||
void SetSkyColor(float r, float g, float b);
|
||||
inline void SetUnkE4(MxBool p_unk0xe4) { this->m_unk0xe4 = p_unk0xe4; }
|
||||
|
||||
// OFFSET: LEGO1 0x1007c4c0
|
||||
void OverrideSkyColor(MxBool p_shouldOverride) { this->m_videoParam.GetPalette()->SetOverrideSkyColor(p_shouldOverride);}
|
||||
|
||||
private:
|
||||
undefined4 m_unk64;
|
||||
@ -30,6 +37,14 @@ class LegoVideoManager : public MxVideoManager
|
||||
undefined4 m_unk6c;
|
||||
undefined4 m_unk70;
|
||||
MxDirect3D *m_direct3d;
|
||||
undefined m_pad0x78[0x6c];
|
||||
MxBool m_unk0xe4;
|
||||
undefined m_pad0xe8[0x41c];
|
||||
MxBool m_cursorMoved; // 0x501
|
||||
undefined m_pad0x502[0x8];
|
||||
MxS32 m_cursorX; // 0x50c
|
||||
MxS32 m_cursorY; // 0x510
|
||||
undefined m_pad0x514[0x7c];
|
||||
};
|
||||
|
||||
#endif // LEGOVIDEOMANAGER_H
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
#include "motorcycle.h"
|
||||
|
||||
// OFFSET: LEGO1 0x100357b0 STUB
|
||||
DECOMP_SIZE_ASSERT(Motorcycle, 0x16c);
|
||||
|
||||
// OFFSET: LEGO1 0x100357b0
|
||||
Motorcycle::Motorcycle()
|
||||
{
|
||||
// TODO
|
||||
this->m_unk13c = 40.0;
|
||||
this->m_unk150 = 1.75;
|
||||
this->m_unk148 = 1;
|
||||
this->m_unk164 = 1.0;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef MOTORCYCLE_H
|
||||
#define MOTORCYCLE_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "islepathactor.h"
|
||||
|
||||
// VTABLE 0x100d7090
|
||||
@ -22,7 +23,10 @@ class Motorcycle : public IslePathActor
|
||||
{
|
||||
return !strcmp(name, Motorcycle::ClassName()) || IslePathActor::IsA(name);
|
||||
}
|
||||
|
||||
private:
|
||||
undefined m_unk160[4];
|
||||
MxFloat m_unk164;
|
||||
undefined m_unk168[4];
|
||||
};
|
||||
|
||||
#endif // MOTORCYCLE_H
|
||||
|
||||
16
LEGO1/mxactionnotificationparam.cpp
Normal file
16
LEGO1/mxactionnotificationparam.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "mxactionnotificationparam.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxActionNotificationParam, 0x14)
|
||||
DECOMP_SIZE_ASSERT(MxEndActionNotificationParam, 0x14)
|
||||
|
||||
// OFFSET: LEGO1 0x100510c0
|
||||
MxNotificationParam *MxActionNotificationParam::Clone()
|
||||
{
|
||||
return new MxActionNotificationParam(this->m_type, this->m_sender, this->m_action, this->m_realloc);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10051270
|
||||
MxNotificationParam *MxEndActionNotificationParam::Clone()
|
||||
{
|
||||
return new MxEndActionNotificationParam(MXSTREAMER_UNKNOWN, this->m_sender, this->m_action, this->m_realloc);
|
||||
}
|
||||
59
LEGO1/mxactionnotificationparam.h
Normal file
59
LEGO1/mxactionnotificationparam.h
Normal file
@ -0,0 +1,59 @@
|
||||
#ifndef MXACTIONNOTIFICATIONPARAM_H
|
||||
#define MXACTIONNOTIFICATIONPARAM_H
|
||||
|
||||
#include "mxnotificationparam.h"
|
||||
#include "mxdsaction.h"
|
||||
|
||||
// VTABLE 0x100d8350
|
||||
// SIZE 0x14
|
||||
class MxActionNotificationParam : public MxNotificationParam
|
||||
{
|
||||
public:
|
||||
inline MxActionNotificationParam(MxParamType p_type, MxCore *p_sender, MxDSAction *p_action, MxBool p_reallocAction) : MxNotificationParam(p_type, p_sender)
|
||||
{
|
||||
MxDSAction *oldAction = p_action;
|
||||
this->m_realloc = p_reallocAction;
|
||||
|
||||
if (p_reallocAction)
|
||||
this->m_action = new MxDSAction();
|
||||
else {
|
||||
this->m_action = oldAction;
|
||||
return;
|
||||
}
|
||||
|
||||
this->m_action->SetAtomId(oldAction->GetAtomId());
|
||||
this->m_action->SetObjectId(oldAction->GetObjectId());
|
||||
this->m_action->SetUnknown24(oldAction->GetUnknown24());
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10051050
|
||||
inline virtual MxActionNotificationParam::~MxActionNotificationParam() override
|
||||
{
|
||||
if (!this->m_realloc)
|
||||
return;
|
||||
|
||||
if (this->m_action)
|
||||
delete this->m_action;
|
||||
}
|
||||
|
||||
virtual MxNotificationParam *Clone() override; // vtable+0x4
|
||||
|
||||
protected:
|
||||
MxDSAction *m_action; // 0xc
|
||||
MxBool m_realloc; // 0x10
|
||||
};
|
||||
|
||||
// VTABLE 0x100d8358
|
||||
// SIZE 0x14
|
||||
class MxEndActionNotificationParam : public MxActionNotificationParam
|
||||
{
|
||||
public:
|
||||
inline MxEndActionNotificationParam(MxParamType p_type, MxCore *p_sender, MxDSAction *p_action, MxBool p_reallocAction)
|
||||
: MxActionNotificationParam(p_type, p_sender, p_action, p_reallocAction) {}
|
||||
|
||||
inline virtual ~MxEndActionNotificationParam() override {}; // 0x100513a0
|
||||
|
||||
virtual MxNotificationParam *Clone() override; // vtable+0x4
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -28,8 +28,11 @@ class MxAtomId
|
||||
{
|
||||
return this->m_internal == other.m_internal;
|
||||
}
|
||||
|
||||
void Clear();
|
||||
|
||||
const char *GetInternal() const { return m_internal; }
|
||||
|
||||
private:
|
||||
MxAtomIdCounter* GetCounter(const char *, LookupMode);
|
||||
void Destroy();
|
||||
|
||||
78
LEGO1/mxaudiomanager.cpp
Normal file
78
LEGO1/mxaudiomanager.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
#include "mxaudiomanager.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxAudioManager, 0x30);
|
||||
|
||||
// GLOBAL: LEGO1 0x10102108
|
||||
MxS32 MxAudioManager::g_unkCount = 0;
|
||||
|
||||
// OFFSET: LEGO1 0x100b8d00
|
||||
MxAudioManager::MxAudioManager()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b8d90
|
||||
MxAudioManager::~MxAudioManager()
|
||||
{
|
||||
LockedReinitialize(TRUE);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b8df0
|
||||
void MxAudioManager::Init()
|
||||
{
|
||||
this->m_volume = 100;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10029910
|
||||
MxS32 MxAudioManager::GetVolume()
|
||||
{
|
||||
return this->m_volume;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b8ea0
|
||||
void MxAudioManager::SetVolume(MxS32 p_volume)
|
||||
{
|
||||
this->m_criticalSection.Enter();
|
||||
this->m_volume = p_volume;
|
||||
this->m_criticalSection.Leave();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b8e00
|
||||
void MxAudioManager::LockedReinitialize(MxBool p_skipDestroy)
|
||||
{
|
||||
this->m_criticalSection.Enter();
|
||||
g_unkCount--;
|
||||
Init();
|
||||
this->m_criticalSection.Leave();
|
||||
|
||||
if (!p_skipDestroy)
|
||||
MxMediaManager::Destroy();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b8e40
|
||||
MxResult MxAudioManager::InitPresenters()
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
MxBool success = FALSE;
|
||||
|
||||
if (MxMediaManager::InitPresenters() == SUCCESS) {
|
||||
this->m_criticalSection.Enter();
|
||||
success = TRUE;
|
||||
result = SUCCESS;
|
||||
g_unkCount++;
|
||||
}
|
||||
|
||||
if (result)
|
||||
Destroy();
|
||||
|
||||
if (success)
|
||||
this->m_criticalSection.Leave();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b8e90
|
||||
void MxAudioManager::Destroy()
|
||||
{
|
||||
LockedReinitialize(FALSE);
|
||||
}
|
||||
30
LEGO1/mxaudiomanager.h
Normal file
30
LEGO1/mxaudiomanager.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef MXAUDIOMANAGER_H
|
||||
#define MXAUDIOMANAGER_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxmediamanager.h"
|
||||
|
||||
// VTABLE 0x100dc6e0
|
||||
class MxAudioManager : public MxMediaManager
|
||||
{
|
||||
public:
|
||||
MxAudioManager();
|
||||
virtual ~MxAudioManager() override;
|
||||
|
||||
virtual MxResult InitPresenters() override; // vtable+14
|
||||
virtual void Destroy() override; // vtable+18
|
||||
virtual MxS32 GetVolume(); // vtable+28
|
||||
virtual void SetVolume(MxS32 p_volume); // vtable+2c
|
||||
|
||||
private:
|
||||
void LockedReinitialize(MxBool p_skipDestroy);
|
||||
|
||||
static MxS32 g_unkCount;
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
MxS32 m_volume; // 0x2c
|
||||
};
|
||||
|
||||
#endif // MXAUDIOMANAGER_H
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#include "mxbackgroundaudiomanager.h"
|
||||
|
||||
#include "mxomni.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxBackgroundAudioManager, 0x150)
|
||||
|
||||
// OFFSET: LEGO1 0x1007ea90
|
||||
|
||||
@ -28,8 +28,9 @@ class MxBackgroundAudioManager : public MxCore
|
||||
}
|
||||
|
||||
__declspec(dllexport) void Enable(unsigned char p);
|
||||
private:
|
||||
|
||||
void Stop();
|
||||
private:
|
||||
void Init();
|
||||
|
||||
MxBool m_musicEnabled; // 0x8
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
#include "mxbitmap.h"
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxBITMAPINFO, 1064);
|
||||
DECOMP_SIZE_ASSERT(MxBitmap, 0x20);
|
||||
DECOMP_SIZE_ASSERT(MxBITMAPINFO, 0x428);
|
||||
|
||||
// The way that the BITMAPFILEHEADER structure ensures the file type is by ensuring it is "BM", which is literally just 0x424d.
|
||||
// Bitmap header magic string "BM" (42 4d)
|
||||
// Sources: https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapfileheader, DirectX Complete (1998)
|
||||
// GLOBAL: LEGO1 0x10102184
|
||||
undefined2 g_bitmapSignature = 0x424d;
|
||||
MxU16 g_bitmapSignature = TWOCC('B', 'M');
|
||||
|
||||
// OFFSET: LEGO1 0x100bc980
|
||||
MxBitmap::MxBitmap()
|
||||
@ -15,7 +16,7 @@ MxBitmap::MxBitmap()
|
||||
this->m_bmiHeader = NULL;
|
||||
this->m_paletteData = NULL;
|
||||
this->m_data = NULL;
|
||||
this->m_bitDepth = LOWCOLOR;
|
||||
this->m_isHighColor = FALSE;
|
||||
this->m_palette = NULL;
|
||||
}
|
||||
|
||||
@ -30,43 +31,54 @@ MxBitmap::~MxBitmap()
|
||||
delete m_palette;
|
||||
}
|
||||
|
||||
// Bit mask trick to round up to the nearest multiple of four.
|
||||
// Pixel data may be stored with padding.
|
||||
// https://learn.microsoft.com/en-us/windows/win32/medfound/image-stride
|
||||
inline MxLong AlignToFourByte(MxLong p_value)
|
||||
{
|
||||
return (p_value + 3) & -4;
|
||||
}
|
||||
|
||||
// Same as the one from legoutil.h, but flipped the other way
|
||||
// TODO: While it's not outside the realm of possibility that they
|
||||
// reimplemented Abs for only this file, that seems odd, right?
|
||||
inline MxLong _Abs(MxLong p_value)
|
||||
{
|
||||
return p_value > 0 ? p_value : -p_value;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bcc40
|
||||
MxResult MxBitmap::ImportBitmap(MxBitmap *p_bitmap)
|
||||
{
|
||||
MxLong height;
|
||||
MxResult result = FAILURE;
|
||||
|
||||
this->m_info = new MxBITMAPINFO;
|
||||
if(this->m_info) {
|
||||
height = p_bitmap->m_bmiHeader->biHeight;
|
||||
if (height <= 0L) {
|
||||
height = -height;
|
||||
}
|
||||
this->m_data = (LPVOID*) new MxU8[(p_bitmap->m_bmiHeader->biWidth + 3U & -4) * height];
|
||||
MxLong height = _Abs(p_bitmap->m_bmiHeader->biHeight);
|
||||
this->m_data = new MxU8[AlignToFourByte(p_bitmap->m_bmiHeader->biWidth) * height];
|
||||
if(this->m_data) {
|
||||
memcpy(this->m_info, p_bitmap->m_info, sizeof(MxBITMAPINFO));
|
||||
|
||||
height = p_bitmap->m_bmiHeader->biHeight;
|
||||
if (height <= 0L) {
|
||||
height = -height;
|
||||
}
|
||||
memcpy(this->m_data, p_bitmap->m_data, (p_bitmap->m_bmiHeader->biWidth + 3U & -4) * height);
|
||||
memcpy(this->m_info, p_bitmap->m_info, sizeof(*this->m_info));
|
||||
height = _Abs(p_bitmap->m_bmiHeader->biHeight);
|
||||
memcpy(this->m_data, p_bitmap->m_data, AlignToFourByte(p_bitmap->m_bmiHeader->biWidth) * height);
|
||||
|
||||
result = SUCCESS;
|
||||
this->m_bmiHeader = &this->m_info->bmiHeader;
|
||||
this->m_paletteData = this->m_info->bmiColors;
|
||||
}
|
||||
}
|
||||
|
||||
if (result != SUCCESS) {
|
||||
if (this->m_info) {
|
||||
delete this->m_info;
|
||||
this->m_info = NULL;
|
||||
}
|
||||
|
||||
if (this->m_data) {
|
||||
delete this->m_data;
|
||||
this->m_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -76,29 +88,31 @@ MxResult MxBitmap::ImportBitmapInfo(MxBITMAPINFO *p_info)
|
||||
MxResult result = FAILURE;
|
||||
MxLong width = p_info->bmiHeader.biWidth;
|
||||
MxLong height = p_info->bmiHeader.biHeight;
|
||||
// ((width + 3) & -4) clamps width to nearest 4-byte boundary
|
||||
MxLong size = ((width + 3) & -4) * height;
|
||||
MxLong size = AlignToFourByte(width) * height;
|
||||
|
||||
this->m_info = new MxBITMAPINFO;
|
||||
if (this->m_info) {
|
||||
this->m_data = (LPVOID*) new MxU8[size];
|
||||
this->m_data = new MxU8[size];
|
||||
if(this->m_data) {
|
||||
memcpy(this->m_info, p_info, sizeof(MxBITMAPINFO));
|
||||
memcpy(this->m_info, p_info, sizeof(*this->m_info));
|
||||
this->m_bmiHeader = &this->m_info->bmiHeader;
|
||||
this->m_paletteData = this->m_info->bmiColors;
|
||||
result = SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (result != SUCCESS) {
|
||||
if (this->m_info) {
|
||||
delete this->m_info;
|
||||
this->m_info = NULL;
|
||||
}
|
||||
|
||||
if (this->m_data) {
|
||||
delete this->m_data;
|
||||
this->m_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -118,7 +132,7 @@ MxResult MxBitmap::ImportColorsToPalette(RGBQUAD* p_rgbquad, MxPalette* p_palett
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
for (MxS32 i = 0; i < 256; i++) {
|
||||
p_rgbquad[i].rgbRed = entries[i].peRed;
|
||||
p_rgbquad[i].rgbGreen = entries[i].peGreen;
|
||||
p_rgbquad[i].rgbBlue = entries[i].peBlue;
|
||||
@ -130,14 +144,14 @@ MxResult MxBitmap::ImportColorsToPalette(RGBQUAD* p_rgbquad, MxPalette* p_palett
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bcaa0
|
||||
MxResult MxBitmap::SetSize(int p_width, int p_height, MxPalette *p_palette, int p_bitDepth)
|
||||
MxResult MxBitmap::SetSize(MxS32 p_width, MxS32 p_height, MxPalette *p_palette, MxBool p_isHighColor)
|
||||
{
|
||||
MxResult ret = FAILURE;
|
||||
MxLong size = ((p_width + 3) & -4) * p_height;
|
||||
MxLong size = AlignToFourByte(p_width) * p_height;
|
||||
|
||||
m_info = new MxBITMAPINFO;
|
||||
if (m_info) {
|
||||
m_data = (LPVOID*) new MxU8[size];
|
||||
m_data = new MxU8[size];
|
||||
if (m_data) {
|
||||
m_bmiHeader = &m_info->bmiHeader;
|
||||
m_paletteData = m_info->bmiColors;
|
||||
@ -152,7 +166,7 @@ MxResult MxBitmap::SetSize(int p_width, int p_height, MxPalette *p_palette, int
|
||||
m_bmiHeader->biSizeImage = size;
|
||||
|
||||
if (!ImportColorsToPalette(m_paletteData, p_palette)) {
|
||||
if (!SetBitDepth(p_bitDepth)) {
|
||||
if (!SetBitDepth(p_isHighColor)) {
|
||||
ret = SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -177,34 +191,26 @@ MxResult MxBitmap::SetSize(int p_width, int p_height, MxPalette *p_palette, int
|
||||
// OFFSET: LEGO1 0x100bcd60
|
||||
MxResult MxBitmap::LoadFile(HANDLE p_handle)
|
||||
{
|
||||
BOOL ret;
|
||||
LPVOID* lpBuffer;
|
||||
MxLong height;
|
||||
MxResult result = FAILURE;
|
||||
DWORD bytesRead;
|
||||
BITMAPFILEHEADER hdr;
|
||||
MxLong size;
|
||||
|
||||
ret = ReadFile(p_handle, &hdr, sizeof(hdr), &bytesRead, NULL);
|
||||
BOOL ret = ReadFile(p_handle, &hdr, sizeof(hdr), &bytesRead, NULL);
|
||||
if (ret && (hdr.bfType == g_bitmapSignature)) {
|
||||
this->m_info = new MxBITMAPINFO;
|
||||
if(this->m_info) {
|
||||
ret = ReadFile(p_handle, this->m_info, sizeof(MxBITMAPINFO), &bytesRead, NULL);
|
||||
if (ret && ((this->m_info->bmiHeader).biBitCount == 8)) {
|
||||
size = hdr.bfSize - (sizeof(MxBITMAPINFO) + sizeof(BITMAPFILEHEADER));
|
||||
lpBuffer = (LPVOID*) new MxU8[size];
|
||||
this->m_data = lpBuffer;
|
||||
if (lpBuffer) {
|
||||
ret = ReadFile(p_handle, lpBuffer, size, &bytesRead, NULL);
|
||||
if(ret) {
|
||||
if (this->m_info) {
|
||||
ret = ReadFile(p_handle, this->m_info, sizeof(*this->m_info), &bytesRead, NULL);
|
||||
if (ret && (this->m_info->bmiHeader.biBitCount == 8)) {
|
||||
MxLong size = hdr.bfSize - (sizeof(MxBITMAPINFO) + sizeof(BITMAPFILEHEADER));
|
||||
this->m_data = new MxU8[size];
|
||||
if (this->m_data) {
|
||||
ret = ReadFile(p_handle, this->m_data, size, &bytesRead, NULL);
|
||||
if (ret) {
|
||||
this->m_bmiHeader = &this->m_info->bmiHeader;
|
||||
this->m_paletteData = this->m_info->bmiColors;
|
||||
if((this->m_info->bmiHeader).biSizeImage == 0) {
|
||||
height = (this->m_info->bmiHeader).biHeight;
|
||||
if (height <= 0L) {
|
||||
height = -height;
|
||||
}
|
||||
(this->m_info->bmiHeader).biSizeImage = ((this->m_info->bmiHeader).biWidth + 3U & -4) * height;
|
||||
if (this->m_info->bmiHeader.biSizeImage == 0) {
|
||||
MxLong height = _Abs(this->m_info->bmiHeader.biHeight);
|
||||
this->m_info->bmiHeader.biSizeImage = AlignToFourByte(this->m_info->bmiHeader.biWidth) * height;
|
||||
}
|
||||
result = SUCCESS;
|
||||
}
|
||||
@ -212,16 +218,19 @@ MxResult MxBitmap::LoadFile(HANDLE p_handle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result != SUCCESS) {
|
||||
if (this->m_info) {
|
||||
delete this->m_info;
|
||||
this->m_info = NULL;
|
||||
}
|
||||
|
||||
if (this->m_data) {
|
||||
delete this->m_data;
|
||||
this->m_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -270,14 +279,14 @@ MxPalette *MxBitmap::CreatePalette()
|
||||
MxBool success = FALSE;
|
||||
MxPalette *palette = NULL;
|
||||
|
||||
switch (this->m_bitDepth) {
|
||||
case LOWCOLOR:
|
||||
switch (this->m_isHighColor) {
|
||||
case FALSE:
|
||||
palette = new MxPalette(this->m_paletteData);
|
||||
if (palette)
|
||||
success = TRUE;
|
||||
break;
|
||||
|
||||
case HIGHCOLOR:
|
||||
case TRUE:
|
||||
palette = this->m_palette->Clone();
|
||||
if (palette)
|
||||
success = TRUE;
|
||||
@ -295,14 +304,13 @@ MxPalette *MxBitmap::CreatePalette()
|
||||
// OFFSET: LEGO1 0x100bd280
|
||||
void MxBitmap::ImportPalette(MxPalette* p_palette)
|
||||
{
|
||||
// This is weird but it matches. Maybe m_bmiColorsProvided had more
|
||||
// potential values than just true/false at some point?
|
||||
switch (this->m_bitDepth) {
|
||||
case LOWCOLOR:
|
||||
// Odd to use a switch on a boolean, but it matches.
|
||||
switch (this->m_isHighColor) {
|
||||
case FALSE:
|
||||
ImportColorsToPalette(this->m_paletteData, p_palette);
|
||||
break;
|
||||
|
||||
case HIGHCOLOR:
|
||||
case TRUE:
|
||||
if (this->m_palette) {
|
||||
delete this->m_palette;
|
||||
}
|
||||
@ -312,18 +320,17 @@ void MxBitmap::ImportPalette(MxPalette* p_palette)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bd2d0
|
||||
MxResult MxBitmap::SetBitDepth(MxBool p_bitDepth)
|
||||
MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor)
|
||||
{
|
||||
MxResult ret = FAILURE;
|
||||
MxPalette *pal = NULL;
|
||||
|
||||
if (m_bitDepth == p_bitDepth) {
|
||||
if (m_isHighColor == p_isHighColor) {
|
||||
// no change: do nothing.
|
||||
ret = SUCCESS;
|
||||
} else {
|
||||
// TODO: Another switch used for this boolean value? Is it not a bool?
|
||||
switch (p_bitDepth) {
|
||||
case 0:
|
||||
switch (p_isHighColor) {
|
||||
case FALSE:
|
||||
ImportColorsToPalette(m_paletteData, m_palette);
|
||||
if (m_palette)
|
||||
delete m_palette;
|
||||
@ -331,7 +338,7 @@ MxResult MxBitmap::SetBitDepth(MxBool p_bitDepth)
|
||||
m_palette = NULL;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case TRUE:
|
||||
pal = NULL;
|
||||
pal = new MxPalette(m_paletteData);
|
||||
if (pal) {
|
||||
@ -343,7 +350,7 @@ MxResult MxBitmap::SetBitDepth(MxBool p_bitDepth)
|
||||
buf[i] = i;
|
||||
}
|
||||
|
||||
m_bitDepth = p_bitDepth;
|
||||
m_isHighColor = p_isHighColor;
|
||||
ret = SUCCESS;
|
||||
}
|
||||
break;
|
||||
@ -359,12 +366,12 @@ MxResult MxBitmap::SetBitDepth(MxBool p_bitDepth)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bd3e0
|
||||
MxResult MxBitmap::StretchBits(HDC p_hdc, int p_xSrc, int p_ySrc, int p_xDest, int p_yDest, int p_destWidth, int p_destHeight)
|
||||
MxResult MxBitmap::StretchBits(HDC p_hdc, MxS32 p_xSrc, MxS32 p_ySrc, MxS32 p_xDest, MxS32 p_yDest, MxS32 p_destWidth, MxS32 p_destHeight)
|
||||
{
|
||||
// Compression fix?
|
||||
if ((this->m_bmiHeader->biCompression != 16) && (0 < this->m_bmiHeader->biHeight)) {
|
||||
p_ySrc = (this->m_bmiHeader->biHeight - p_destHeight) - p_ySrc;
|
||||
}
|
||||
|
||||
return StretchDIBits(p_hdc, p_xDest, p_yDest, p_destWidth, p_destHeight, p_xSrc, p_ySrc, p_destWidth, p_destHeight, this->m_data, (BITMAPINFO*)this->m_info, this->m_bitDepth, SRCCOPY);
|
||||
}
|
||||
return StretchDIBits(p_hdc, p_xDest, p_yDest, p_destWidth, p_destHeight, p_xSrc, p_ySrc, p_destWidth, p_destHeight, this->m_data, (BITMAPINFO*)this->m_info, this->m_isHighColor, SRCCOPY);
|
||||
}
|
||||
|
||||
@ -21,10 +21,8 @@ struct MxBITMAPINFO {
|
||||
RGBQUAD bmiColors[256];
|
||||
};
|
||||
|
||||
// These values are the bit depth, set in the registry
|
||||
#define LOWCOLOR 0 // 256 color
|
||||
#define HIGHCOLOR 1 // High Color (16-bit)
|
||||
|
||||
// SIZE 0x20
|
||||
// VTABLE 0x100dc7b0
|
||||
class MxBitmap : public MxCore
|
||||
{
|
||||
public:
|
||||
@ -33,7 +31,7 @@ class MxBitmap : public MxCore
|
||||
|
||||
virtual MxResult ImportBitmap(MxBitmap *p_bitmap); // vtable+14
|
||||
virtual MxResult ImportBitmapInfo(MxBITMAPINFO *p_info); // vtable+18
|
||||
virtual MxResult SetSize(int p_width, int p_height, MxPalette *p_palette, int); // vtable+1c
|
||||
virtual MxResult SetSize(MxS32 p_width, MxS32 p_height, MxPalette *p_palette, MxBool); // vtable+1c
|
||||
virtual MxResult LoadFile(HANDLE p_handle); // vtable+20
|
||||
__declspec(dllexport) virtual MxLong Read(const char *p_filename); // vtable+24
|
||||
virtual int vtable28(int);
|
||||
@ -42,7 +40,9 @@ class MxBitmap : public MxCore
|
||||
__declspec(dllexport) virtual MxPalette *CreatePalette(); // vtable+34
|
||||
virtual void ImportPalette(MxPalette* p_palette); // vtable+38
|
||||
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
|
||||
virtual MxResult StretchBits(HDC p_hdc, MxS32 p_xSrc, MxS32 p_ySrc, MxS32 p_xDest, MxS32 p_yDest, MxS32 p_destWidth, MxS32 p_destHeight); // vtable+40
|
||||
|
||||
inline BITMAPINFOHEADER *GetBmiHeader() const { return m_bmiHeader; }
|
||||
|
||||
private:
|
||||
MxResult ImportColorsToPalette(RGBQUAD*, MxPalette*);
|
||||
@ -50,8 +50,8 @@ class MxBitmap : public MxCore
|
||||
MxBITMAPINFO *m_info; // 0x8
|
||||
BITMAPINFOHEADER *m_bmiHeader; // 0xc
|
||||
RGBQUAD *m_paletteData; // 0x10
|
||||
LPVOID *m_data; // 0x14
|
||||
MxBool m_bitDepth; // 0x18
|
||||
MxU8 *m_data; // 0x14
|
||||
MxBool m_isHighColor; // 0x18
|
||||
MxPalette *m_palette; // 0x1c
|
||||
};
|
||||
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
#include "mxcompositepresenter.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxnotificationmanager.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxCompositePresenter, 0x4c);
|
||||
|
||||
// OFFSET: LEGO1 0x100b60b0 STUB
|
||||
// OFFSET: LEGO1 0x100b60b0
|
||||
MxCompositePresenter::MxCompositePresenter()
|
||||
{
|
||||
// TODO
|
||||
NotificationManager()->Register(this);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b6390 STUB
|
||||
// OFFSET: LEGO1 0x100b6390
|
||||
MxCompositePresenter::~MxCompositePresenter()
|
||||
{
|
||||
// TODO
|
||||
NotificationManager()->Unregister(this);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#define MXCOMPOSITEPRESENTER_H
|
||||
|
||||
#include "mxpresenter.h"
|
||||
#include "mxunklist.h"
|
||||
|
||||
// VTABLE 0x100dc618
|
||||
// SIZE 0x4c
|
||||
@ -24,9 +25,7 @@ class MxCompositePresenter : public MxPresenter
|
||||
return !strcmp(name, MxCompositePresenter::ClassName()) || MxPresenter::IsA(name);
|
||||
}
|
||||
|
||||
undefined m_unk40;
|
||||
undefined4 *m_unk44;
|
||||
undefined4 m_unk48;
|
||||
MxUnkList m_list;
|
||||
};
|
||||
|
||||
#endif // MXCOMPOSITEPRESENTER_H
|
||||
|
||||
@ -1,7 +1,14 @@
|
||||
#include "mxcontrolpresenter.h"
|
||||
|
||||
// OFFSET: LEGO1 0x10043f50 STUB
|
||||
DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
|
||||
|
||||
// OFFSET: LEGO1 0x10043f50
|
||||
MxControlPresenter::MxControlPresenter()
|
||||
{
|
||||
// TODO
|
||||
this->m_unk4c = 0;
|
||||
this->m_unk4e = -1;
|
||||
this->m_unk50 = 0;
|
||||
this->m_unk52 = 0;
|
||||
this->m_unk58 = 0;
|
||||
this->m_unk54 = 0;
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
#ifndef MXCONTROLPRESENTER_H
|
||||
#define MXCONTROLPRESENTER_H
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
#include "mxcompositepresenter.h"
|
||||
|
||||
// VTABLE 0x100d7b88
|
||||
@ -22,7 +24,13 @@ class MxControlPresenter : public MxCompositePresenter
|
||||
{
|
||||
return !strcmp(name, MxControlPresenter::ClassName()) || MxCompositePresenter::IsA(name);
|
||||
}
|
||||
|
||||
private:
|
||||
undefined2 m_unk4c;
|
||||
MxS16 m_unk4e;
|
||||
undefined m_unk50;
|
||||
undefined2 m_unk52;
|
||||
undefined2 m_unk54;
|
||||
undefined4 m_unk58;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ MxLong MxCore::Notify(MxParam &p)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10001f70
|
||||
MxLong MxCore::Tickle()
|
||||
MxResult MxCore::Tickle()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,191 @@
|
||||
#include "mxdirect3d.h"
|
||||
#include <stdio.h> // for vsprintf
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDirect3D, 0x894);
|
||||
DECOMP_SIZE_ASSERT(MxDeviceModeFinder, 0xe4);
|
||||
DECOMP_SIZE_ASSERT(MxDeviceEnumerate, 0x198);
|
||||
|
||||
// OFFSET: LEGO1 0x1009b0a0
|
||||
MxDirect3D::MxDirect3D()
|
||||
{
|
||||
this->m_pDirect3d = NULL;
|
||||
this->m_pDirect3dDevice = NULL;
|
||||
this->m_unk88c = NULL;
|
||||
this->m_pDeviceModeFinder = NULL;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009b140
|
||||
MxDirect3D::~MxDirect3D()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009b1a0
|
||||
BOOL MxDirect3D::Create(
|
||||
HWND hWnd,
|
||||
BOOL fullscreen_1,
|
||||
BOOL surface_fullscreen,
|
||||
BOOL onlySystemMemory,
|
||||
int width,
|
||||
int height,
|
||||
int bpp,
|
||||
const PALETTEENTRY* pPaletteEntries,
|
||||
int paletteEntryCount)
|
||||
{
|
||||
BOOL success = FALSE;
|
||||
|
||||
BOOL ret = MxDirectDraw::Create(hWnd, fullscreen_1, surface_fullscreen,
|
||||
onlySystemMemory, width, height, bpp,
|
||||
pPaletteEntries, paletteEntryCount);
|
||||
|
||||
if (ret && CreateIDirect3D() && D3DSetMode())
|
||||
success = TRUE;
|
||||
|
||||
if (!success)
|
||||
FUN_1009D920();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009b210
|
||||
void MxDirect3D::Destroy()
|
||||
{
|
||||
if (this->m_pDirect3dDevice) {
|
||||
this->m_pDirect3dDevice->Release();
|
||||
this->m_pDirect3dDevice = NULL;
|
||||
}
|
||||
|
||||
if (this->m_pDirect3d) {
|
||||
this->m_pDirect3d->Release();
|
||||
this->m_pDirect3d = NULL;
|
||||
}
|
||||
|
||||
if (this->m_pDeviceModeFinder) {
|
||||
delete m_pDeviceModeFinder;
|
||||
this->m_pDeviceModeFinder = NULL;
|
||||
}
|
||||
|
||||
// This should get deleted by MxDirectDraw::Destroy
|
||||
if (m_pCurrentDeviceModesList) {
|
||||
// delete m_pCurrentDeviceModesList; // missing?
|
||||
m_pCurrentDeviceModesList = NULL;
|
||||
}
|
||||
|
||||
MxDirectDraw::Destroy();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009b290
|
||||
void MxDirect3D::Clear()
|
||||
{
|
||||
if(this->m_pDirect3dDevice) {
|
||||
this->m_pDirect3dDevice->Release();
|
||||
this->m_pDirect3dDevice = NULL;
|
||||
}
|
||||
if(this->m_pDirect3d) {
|
||||
this->m_pDirect3d->Release();
|
||||
this->m_pDirect3d = NULL;
|
||||
}
|
||||
MxDirectDraw::DestroyButNotDirectDraw();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009b2d0
|
||||
BOOL MxDirect3D::CreateIDirect3D()
|
||||
{
|
||||
MxResult ret = IDirect3D_QueryInterface(m_pDirectDraw,
|
||||
IID_IDirect3D2,
|
||||
(LPVOID*)&m_pDirect3d);
|
||||
|
||||
if (ret) {
|
||||
Error("Creation of IDirect3D failed", ret);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009b310 STUB
|
||||
BOOL MxDirect3D::D3DSetMode()
|
||||
{
|
||||
// TODO
|
||||
//if (m_pDeviceModeFinder)
|
||||
Error("This device cannot support the current display mode", 0);
|
||||
OutputDebugString("MxDirect3D::D3DSetMode() front lock failed\n");
|
||||
OutputDebugString("MxDirect3D::D3DSetMode() back lock failed\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009b8b0
|
||||
MxDeviceModeFinder::MxDeviceModeFinder()
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009b8d0
|
||||
MxDeviceModeFinder::~MxDeviceModeFinder()
|
||||
{
|
||||
if (m_deviceInfo) {
|
||||
delete m_deviceInfo;
|
||||
m_deviceInfo = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009c070 STUB
|
||||
BOOL MxDeviceEnumerate::FUN_1009c070()
|
||||
{
|
||||
// TODO
|
||||
// HRESULT ret = DirectDrawCreate();
|
||||
HRESULT ret = 0;
|
||||
if (ret) {
|
||||
MxDirect3D::BuildErrorString("GetCaps failed: %s\n",
|
||||
EnumerateErrorToString(ret));
|
||||
}
|
||||
//IDirect3D2_EnumDevices
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009c4c0
|
||||
void MxDirect3D::BuildErrorString(const char *p_format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[512];
|
||||
|
||||
va_start(args, p_format);
|
||||
vsprintf(buf, p_format, args);
|
||||
va_end(args);
|
||||
|
||||
OutputDebugString(buf);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009c6c0
|
||||
MxResult MxDeviceEnumerate::_DoEnumerate()
|
||||
{
|
||||
// TODO: what does ECX refer to in this context?
|
||||
if (m_unk010_flag)
|
||||
return FAILURE;
|
||||
|
||||
HRESULT ret = DirectDrawEnumerate(EnumerateCallback, this);
|
||||
if (ret) {
|
||||
MxDirect3D::BuildErrorString("DirectDrawEnumerate returned error %s\n",
|
||||
EnumerateErrorToString(ret));
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_unk010_flag = TRUE;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009c710 STUB
|
||||
BOOL FAR PASCAL EnumerateCallback(GUID FAR *, LPSTR, LPSTR, LPVOID)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009c730 STUB
|
||||
char *MxDeviceEnumerate::EnumerateErrorToString(HRESULT p_error)
|
||||
{
|
||||
// TODO: This is a list of error messages, similar to the function in
|
||||
// MxDirectDraw, except that this one now contains the Direct3D errors.
|
||||
// Probably just copied from a sample file in the dx5 sdk.
|
||||
return "";
|
||||
}
|
||||
@ -2,24 +2,77 @@
|
||||
#define MXDIRECT3D_H
|
||||
|
||||
#include "mxdirectdraw.h"
|
||||
#include "mxtypes.h"
|
||||
#include "decomp.h"
|
||||
|
||||
#include <d3d.h>
|
||||
|
||||
class MxDeviceModeFinder;
|
||||
// SIZE 0xe4
|
||||
class MxDeviceModeFinder
|
||||
{
|
||||
public:
|
||||
MxDeviceModeFinder();
|
||||
~MxDeviceModeFinder();
|
||||
|
||||
undefined4 m_unknown[56];
|
||||
MxDirectDraw::DeviceModesInfo *m_deviceInfo; // +0xe0
|
||||
};
|
||||
|
||||
// VTABLE 0x100db814 (or 0x100d9cc8?)
|
||||
// SIZE 0x198
|
||||
class MxDeviceEnumerate
|
||||
{
|
||||
public:
|
||||
MxDeviceEnumerate();
|
||||
virtual MxResult _DoEnumerate();
|
||||
BOOL FUN_1009c070();
|
||||
|
||||
char *EnumerateErrorToString(HRESULT p_error);
|
||||
|
||||
undefined4 m_unk004;
|
||||
undefined4 m_unk008;
|
||||
undefined4 m_unk00c;
|
||||
MxBool m_unk010_flag; // +0x10
|
||||
|
||||
undefined4 m_unknown[97];
|
||||
};
|
||||
|
||||
// VTABLE 0x100db800
|
||||
// SIZE 0x894
|
||||
class MxDirect3D : public MxDirectDraw
|
||||
{
|
||||
public:
|
||||
MxDirect3D();
|
||||
|
||||
void Clear();
|
||||
inline MxDeviceModeFinder *GetDeviceModeFinder() { return this->m_pDeviceModeFinder; };
|
||||
|
||||
virtual ~MxDirect3D();
|
||||
virtual BOOL Create(
|
||||
HWND hWnd,
|
||||
BOOL fullscreen_1,
|
||||
BOOL surface_fullscreen,
|
||||
BOOL onlySystemMemory,
|
||||
int width,
|
||||
int height,
|
||||
int bpp,
|
||||
const PALETTEENTRY* pPaletteEntries,
|
||||
int paletteEntryCount);
|
||||
virtual void Destroy();
|
||||
|
||||
BOOL CreateIDirect3D();
|
||||
BOOL D3DSetMode();
|
||||
|
||||
static void BuildErrorString(const char *, ...);
|
||||
|
||||
private:
|
||||
MxDeviceModeFinder *m_pDeviceModeFinder;
|
||||
IDirect3D *m_pDirect3d;
|
||||
MxDeviceModeFinder *m_pDeviceModeFinder; // +0x880
|
||||
IDirect3D *m_pDirect3d; // +0x884
|
||||
IDirect3DDevice *m_pDirect3dDevice;
|
||||
undefined4 m_unk88c;
|
||||
undefined4 m_unk890;
|
||||
};
|
||||
|
||||
BOOL FAR PASCAL EnumerateCallback(GUID FAR *, LPSTR, LPSTR, LPVOID);
|
||||
|
||||
#endif // MXDIRECT3D_H
|
||||
@ -1,8 +1,8 @@
|
||||
|
||||
#include "mxdirectdraw.h"
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDirectDraw, 0x880);
|
||||
DECOMP_SIZE_ASSERT(MxDirectDraw::DeviceModesInfo, 0x17c);
|
||||
|
||||
#ifndef DDSCAPS_3DDEVICE
|
||||
#define DDSCAPS_3DDEVICE 0x00002000l
|
||||
@ -30,6 +30,12 @@ void EnableResizing(HWND hwnd, BOOL flag)
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009efb0
|
||||
MxDirectDraw::DeviceModesInfo::DeviceModesInfo()
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1009EFD0
|
||||
MxDirectDraw::DeviceModesInfo::~DeviceModesInfo()
|
||||
{
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
#ifndef MXDIRECTDRAW_H
|
||||
#define MXDIRECTDRAW_H
|
||||
|
||||
@ -7,6 +6,7 @@
|
||||
|
||||
extern BOOL g_is_PALETTEINDEXED8;
|
||||
|
||||
// VTABLE 0x100db818
|
||||
// SIZE 0x880
|
||||
class MxDirectDraw
|
||||
{
|
||||
@ -37,11 +37,12 @@ class MxDirectDraw
|
||||
DDCAPS m_ddcaps;
|
||||
void* a_178;
|
||||
|
||||
DeviceModesInfo();
|
||||
~DeviceModesInfo();
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
protected:
|
||||
BOOL m_bOnlySoftRender;
|
||||
BOOL m_bFlipSurfaces;
|
||||
IDirectDraw* m_pDirectDraw;
|
||||
@ -94,7 +95,7 @@ class MxDirectDraw
|
||||
virtual void DestroyButNotDirectDraw();
|
||||
virtual const char* ErrorToString(HRESULT error);
|
||||
|
||||
private:
|
||||
protected:
|
||||
BOOL CacheOriginalPaletteEntries();
|
||||
HRESULT CreateDDSurface(
|
||||
LPDDSURFACEDESC a2,
|
||||
|
||||
@ -13,9 +13,55 @@ MxDiskStreamController::~MxDiskStreamController()
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c8640 STUB
|
||||
MxLong MxDiskStreamController::Tickle()
|
||||
MxResult MxDiskStreamController::Tickle()
|
||||
{
|
||||
// TODO
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c7790 STUB
|
||||
MxResult MxDiskStreamController::Open(const char *p_filename)
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c7880
|
||||
MxResult MxDiskStreamController::vtable0x18(undefined4 p_unknown, undefined4 p_unknown2)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c7ff0 STUB
|
||||
MxResult MxDiskStreamController::vtable0x20(MxDSAction* p_action)
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c8160 STUB
|
||||
MxResult MxDiskStreamController::vtable0x24(undefined4 p_unknown)
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c7ac0 STUB
|
||||
MxResult MxDiskStreamController::vtable0x28()
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c7c00 STUB
|
||||
MxResult MxDiskStreamController::vtable0x30(undefined4 p_unknown)
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c7960
|
||||
MxResult MxDiskStreamController::vtable0x34(undefined4 p_unknown)
|
||||
{
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -14,7 +14,14 @@ class MxDiskStreamController : public MxStreamController
|
||||
MxDiskStreamController();
|
||||
virtual ~MxDiskStreamController() override;
|
||||
|
||||
virtual MxLong Tickle() override; // vtable+0x8
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
virtual MxResult Open(const char *p_filename) override; // vtable+0x14
|
||||
virtual MxResult vtable0x18(undefined4 p_unknown, undefined4 p_unknown2) override; //vtable+0x18
|
||||
virtual MxResult vtable0x20(MxDSAction* p_action) override; //vtable+0x20
|
||||
virtual MxResult vtable0x24(undefined4 p_unknown) override; //vtable+0x24
|
||||
virtual MxResult vtable0x28() override; //vtable+0x28
|
||||
virtual MxResult vtable0x30(undefined4 p_unknown) override; //vtable+0x30
|
||||
virtual MxResult vtable0x34(undefined4 p_unknown); //vtable+0x34
|
||||
|
||||
// OFFSET: LEGO1 0x100c7360
|
||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
#include "mxthread.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDiskStreamProvider, 0x60);
|
||||
|
||||
// OFFSET: LEGO1 0x100d0f30
|
||||
MxResult MxDiskStreamProviderThread::Run()
|
||||
{
|
||||
@ -15,7 +17,9 @@ MxResult MxDiskStreamProviderThread::Run()
|
||||
// OFFSET: LEGO1 0x100d0f70
|
||||
MxDiskStreamProvider::MxDiskStreamProvider()
|
||||
{
|
||||
// TODO
|
||||
this->m_pFile = NULL;
|
||||
this->m_remainingWork = 0;
|
||||
this->m_unk35 = 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100d1240
|
||||
@ -31,7 +35,7 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete()
|
||||
while (m_remainingWork != 0)
|
||||
{
|
||||
m_busySemaphore.Wait(INFINITE);
|
||||
if (m_unk1 != 0)
|
||||
if (m_unk35 != 0)
|
||||
PerformWork();
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -41,4 +45,41 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete()
|
||||
void MxDiskStreamProvider::PerformWork()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100d13d0 STUB
|
||||
MxResult MxDiskStreamProvider::SetResourceToGet(void* p_resource)
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100d1e90
|
||||
MxU32 MxDiskStreamProvider::GetFileSize()
|
||||
{
|
||||
return m_pFile->GetBufferSize();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100d1ea0
|
||||
MxU32 MxDiskStreamProvider::GetStreamBuffersNum()
|
||||
{
|
||||
return m_pFile->GetStreamBuffersNum();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100d15e0 STUB
|
||||
void MxDiskStreamProvider::vtable0x20(undefined4 p_unknown1)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100d1eb0
|
||||
MxU32 MxDiskStreamProvider::GetLengthInDWords()
|
||||
{
|
||||
return m_pFile->GetLengthInDWords();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100d1ec0
|
||||
MxU32* MxDiskStreamProvider::GetBufferForDWords()
|
||||
{
|
||||
return m_pFile->GetBuffer();
|
||||
}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
#ifndef MXDISKSTREAMPROVIDER_H
|
||||
#define MXDISKSTREAMPROVIDER_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxstreamprovider.h"
|
||||
#include "mxthread.h"
|
||||
#include "mxcriticalsection.h"
|
||||
#include "mxunklist.h"
|
||||
|
||||
class MxDiskStreamProvider;
|
||||
|
||||
@ -47,15 +49,20 @@ class MxDiskStreamProvider : public MxStreamProvider
|
||||
|
||||
void PerformWork();
|
||||
|
||||
virtual MxResult SetResourceToGet(void* p_resource) override; //vtable+0x14
|
||||
virtual MxU32 GetFileSize() override; //vtable+0x18
|
||||
virtual MxU32 GetStreamBuffersNum() override; //vtable+0x1c
|
||||
virtual void vtable0x20(undefined4 p_unknown1) override; //vtable+0x20
|
||||
virtual MxU32 GetLengthInDWords() override; //vtable+0x24
|
||||
virtual MxU32* GetBufferForDWords() override; //vtable+0x28
|
||||
|
||||
private:
|
||||
MxDiskStreamProviderThread m_thread;
|
||||
MxSemaphore m_busySemaphore;
|
||||
byte m_remainingWork;
|
||||
byte m_unk1;
|
||||
MxCriticalSection m_criticalSection;
|
||||
byte unk2[4];
|
||||
void* unk3;
|
||||
void *unk4;
|
||||
MxDiskStreamProviderThread m_thread; // 0x10
|
||||
MxSemaphore m_busySemaphore; // 0x2c
|
||||
undefined m_remainingWork; // 0x34
|
||||
undefined m_unk35; // 0x35
|
||||
MxCriticalSection m_criticalSection; // 0x38
|
||||
MxUnkList m_list;
|
||||
};
|
||||
|
||||
#endif // MXDISKSTREAMPROVIDER_H
|
||||
|
||||
@ -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(undefined4, 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(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool)
|
||||
MxBool MxDisplaySurface::vtable2c(LPDDSURFACEDESC, MxBitmap*, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -230,3 +232,9 @@ undefined4 MxDisplaySurface::vtable44(undefined4, undefined4*, undefined4, undef
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ba640 STUB
|
||||
void MxDisplaySurface::FUN_100ba640()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include <ddraw.h>
|
||||
|
||||
#include "mxbitmap.h"
|
||||
#include "mxcore.h"
|
||||
#include "mxpalette.h"
|
||||
#include "mxvideoparam.h"
|
||||
@ -19,13 +20,15 @@ class MxDisplaySurface : public MxCore
|
||||
|
||||
void Reset();
|
||||
|
||||
void FUN_100ba640();
|
||||
|
||||
virtual MxResult Init(MxVideoParam &p_videoParam, LPDIRECTDRAWSURFACE p_ddSurface1, LPDIRECTDRAWSURFACE p_ddSurface2, LPDIRECTDRAWCLIPPER p_ddClipper);
|
||||
virtual MxResult Create(MxVideoParam &p_videoParam);
|
||||
virtual void Clear();
|
||||
virtual void SetPalette(MxPalette *p_palette);
|
||||
virtual void vtable24(undefined4, 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(undefined4, 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);
|
||||
@ -33,6 +36,9 @@ class MxDisplaySurface : public MxCore
|
||||
virtual void ReleaseDC(HDC p_hdc);
|
||||
virtual undefined4 vtable44(undefined4, undefined4*, undefined4, undefined4);
|
||||
|
||||
inline LPDIRECTDRAWSURFACE GetDirectDrawSurface1() { return this->m_ddSurface1; }
|
||||
inline LPDIRECTDRAWSURFACE GetDirectDrawSurface2() { return this->m_ddSurface2; }
|
||||
|
||||
private:
|
||||
MxVideoParam m_videoParam;
|
||||
LPDIRECTDRAWSURFACE m_ddSurface1;
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
#include "mxdsaction.h"
|
||||
|
||||
#include "mxomni.h"
|
||||
#include "mxtimer.h"
|
||||
#include "legoutil.h"
|
||||
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
|
||||
@ -13,28 +17,15 @@ MxDSAction::MxDSAction()
|
||||
{
|
||||
this->m_flags = 32;
|
||||
this->m_startTime = INT_MIN;
|
||||
this->m_unkData = NULL;
|
||||
this->m_unkLength = 0;
|
||||
this->m_extraData = NULL;
|
||||
this->m_extraLength = 0;
|
||||
this->m_duration = INT_MIN;
|
||||
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;
|
||||
@ -44,7 +35,7 @@ MxDSAction::MxDSAction()
|
||||
// OFFSET: LEGO1 0x100ada80
|
||||
MxDSAction::~MxDSAction()
|
||||
{
|
||||
delete[] this->m_unkData;
|
||||
delete[] this->m_extraData;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100adaf0
|
||||
@ -60,7 +51,7 @@ void MxDSAction::CopyFrom(MxDSAction &p_dsAction)
|
||||
this->m_direction.CopyFrom(p_dsAction.m_direction);
|
||||
this->m_up.CopyFrom(p_dsAction.m_up);
|
||||
|
||||
AppendData(p_dsAction.m_unkLength, p_dsAction.m_unkData);
|
||||
AppendData(p_dsAction.m_extraLength, p_dsAction.m_extraData);
|
||||
this->m_unk84 = p_dsAction.m_unk84;
|
||||
this->m_unk88 = p_dsAction.m_unk88;
|
||||
this->m_omni = p_dsAction.m_omni;
|
||||
@ -83,7 +74,7 @@ MxU32 MxDSAction::GetSizeOnDisk()
|
||||
{
|
||||
MxU32 totalSizeOnDisk;
|
||||
|
||||
totalSizeOnDisk = MxDSObject::GetSizeOnDisk() + 90 + this->m_unkLength;
|
||||
totalSizeOnDisk = MxDSObject::GetSizeOnDisk() + 90 + this->m_extraLength;
|
||||
this->m_sizeOnDisk = totalSizeOnDisk - MxDSObject::GetSizeOnDisk();
|
||||
|
||||
return totalSizeOnDisk;
|
||||
@ -94,38 +85,24 @@ void MxDSAction::Deserialize(char **p_source, MxS16 p_unk24)
|
||||
{
|
||||
MxDSObject::Deserialize(p_source, p_unk24);
|
||||
|
||||
this->m_flags = *(MxU32*) *p_source;
|
||||
*p_source += sizeof(MxU32);
|
||||
this->m_startTime = *(DWORD*) *p_source;
|
||||
*p_source += sizeof(DWORD);
|
||||
this->m_duration = *(MxLong*) *p_source;
|
||||
*p_source += sizeof(MxLong);
|
||||
this->m_loopCount = *(MxS32*) *p_source;
|
||||
*p_source += sizeof(MxS32);
|
||||
this->m_location[0] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_location[1] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_location[2] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_direction[0] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_direction[1] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_direction[2] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_up[0] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_up[1] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_up[2] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
GetScalar(p_source, this->m_flags);
|
||||
GetScalar(p_source, this->m_startTime);
|
||||
GetScalar(p_source, this->m_duration);
|
||||
GetScalar(p_source, this->m_loopCount);
|
||||
GetDouble(p_source, this->m_location[0]);
|
||||
GetDouble(p_source, this->m_location[1]);
|
||||
GetDouble(p_source, this->m_location[2]);
|
||||
GetDouble(p_source, this->m_direction[0]);
|
||||
GetDouble(p_source, this->m_direction[1]);
|
||||
GetDouble(p_source, this->m_direction[2]);
|
||||
GetDouble(p_source, this->m_up[0]);
|
||||
GetDouble(p_source, this->m_up[1]);
|
||||
GetDouble(p_source, this->m_up[2]);
|
||||
|
||||
MxU16 unkLength = *(MxU16*) *p_source;
|
||||
*p_source += sizeof(MxU16);
|
||||
if (unkLength) {
|
||||
AppendData(unkLength, *p_source);
|
||||
*p_source += unkLength;
|
||||
MxU16 extraLength = GetScalar((MxU16**) p_source);
|
||||
if (extraLength) {
|
||||
AppendData(extraLength, *p_source);
|
||||
*p_source += extraLength;
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,13 +163,13 @@ void MxDSAction::MergeFrom(MxDSAction &p_dsAction)
|
||||
this->m_up[2] = p_dsAction.m_up[2];
|
||||
|
||||
// TODO
|
||||
MxU16 unkLength = p_dsAction.m_unkLength;
|
||||
char *unkData = p_dsAction.m_unkData;
|
||||
if (unkLength && unkData) {
|
||||
if (!this->m_unkData || !strncmp("XXX", this->m_unkData, 3)) {
|
||||
delete[] this->m_unkData;
|
||||
this->m_unkLength = 0;
|
||||
AppendData(unkLength, unkData);
|
||||
MxU16 extraLength = p_dsAction.m_extraLength;
|
||||
char *extraData = p_dsAction.m_extraData;
|
||||
if (extraLength && extraData) {
|
||||
if (!this->m_extraData || !strncmp("XXX", this->m_extraData, 3)) {
|
||||
delete[] this->m_extraData;
|
||||
this->m_extraLength = 0;
|
||||
AppendData(extraLength, extraData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -215,6 +192,9 @@ MxLong MxDSAction::GetSomeTimingField()
|
||||
return this->m_someTimingField;
|
||||
}
|
||||
|
||||
// Win32 defines GetCurrentTime to GetTickCount
|
||||
#undef GetCurrentTime
|
||||
|
||||
// OFFSET: LEGO1 0x100adcd0
|
||||
MxLong MxDSAction::GetCurrentTime()
|
||||
{
|
||||
@ -222,29 +202,29 @@ MxLong MxDSAction::GetCurrentTime()
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ade60
|
||||
void MxDSAction::AppendData(MxU16 p_unkLength, const char *p_unkData)
|
||||
void MxDSAction::AppendData(MxU16 p_extraLength, const char *p_extraData)
|
||||
{
|
||||
if (this->m_unkData == p_unkData || !p_unkData)
|
||||
if (this->m_extraData == p_extraData || !p_extraData)
|
||||
return;
|
||||
|
||||
if (this->m_unkLength) {
|
||||
char *concat = new char[p_unkLength + this->m_unkLength + sizeof(g_unkSep)];
|
||||
memcpy(concat, this->m_unkData, this->m_unkLength);
|
||||
if (this->m_extraLength) {
|
||||
char *concat = new char[p_extraLength + this->m_extraLength + sizeof(g_unkSep)];
|
||||
memcpy(concat, this->m_extraData, this->m_extraLength);
|
||||
|
||||
*(MxU16*) &concat[this->m_unkLength] = g_unkSep;
|
||||
memcpy(&concat[this->m_unkLength + sizeof(g_unkSep)], p_unkData, p_unkLength);
|
||||
*(MxU16*) &concat[this->m_extraLength] = g_unkSep;
|
||||
memcpy(&concat[this->m_extraLength + sizeof(g_unkSep)], p_extraData, p_extraLength);
|
||||
|
||||
this->m_unkLength += p_unkLength + sizeof(g_unkSep);
|
||||
delete[] this->m_unkData;
|
||||
this->m_unkData = concat;
|
||||
this->m_extraLength += p_extraLength + sizeof(g_unkSep);
|
||||
delete[] this->m_extraData;
|
||||
this->m_extraData = concat;
|
||||
}
|
||||
else {
|
||||
char *copy = new char[p_unkLength];
|
||||
this->m_unkData = copy;
|
||||
char *copy = new char[p_extraLength];
|
||||
this->m_extraData = copy;
|
||||
|
||||
if (copy) {
|
||||
this->m_unkLength = p_unkLength;
|
||||
memcpy(copy, p_unkData, p_unkLength);
|
||||
this->m_extraLength = p_extraLength;
|
||||
memcpy(copy, p_extraData, p_extraLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@
|
||||
#define MXDSACTION_H
|
||||
|
||||
#include "mxdsobject.h"
|
||||
#include "mxtypes.h"
|
||||
#include "mxvector.h"
|
||||
#include "mxomni.h"
|
||||
|
||||
class MxOmni;
|
||||
|
||||
// VTABLE 0x100dc098
|
||||
// SIZE 0x94
|
||||
@ -12,7 +14,12 @@ class MxDSAction : public MxDSObject
|
||||
public:
|
||||
enum
|
||||
{
|
||||
Flag_Looping = 0x01,
|
||||
Flag_Bit3 = 0x04,
|
||||
Flag_Bit5 = 0x10,
|
||||
Flag_Enabled = 0x20,
|
||||
Flag_Parsed = 0x80,
|
||||
Flag_Bit9 = 0x200,
|
||||
};
|
||||
|
||||
__declspec(dllexport) MxDSAction();
|
||||
@ -34,10 +41,10 @@ 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(LONG p_duration); // vtable+28;
|
||||
virtual void SetDuration(MxLong p_duration); // vtable+28;
|
||||
virtual MxDSAction *Clone(); // vtable+2c;
|
||||
virtual void MergeFrom(MxDSAction &p_dsAction); // vtable+30;
|
||||
virtual MxBool HasId(MxU32 p_objectId); // vtable+34;
|
||||
@ -45,15 +52,25 @@ class MxDSAction : public MxDSObject
|
||||
virtual MxLong GetSomeTimingField(); // vtable+3c;
|
||||
virtual MxLong GetCurrentTime(); // vtable+40;
|
||||
|
||||
void AppendData(MxU16 p_unkLength, const char *p_unkData);
|
||||
void AppendData(MxU16 p_extraLength, const char *p_extraData);
|
||||
|
||||
inline MxU32 GetFlags() { return this->m_flags; }
|
||||
inline void SetFlags(MxU32 m_flags) { this->m_flags = m_flags; }
|
||||
inline MxU32 GetFlags() { return m_flags; }
|
||||
inline void SetFlags(MxU32 p_flags) { m_flags = p_flags; }
|
||||
inline char *GetExtraData() { return m_extraData; }
|
||||
inline MxU16 GetExtraLength() const { return m_extraLength; }
|
||||
inline MxLong GetStartTime() const { return m_startTime; }
|
||||
inline MxS32 GetLoopCount() { return m_loopCount; }
|
||||
inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; }
|
||||
inline const MxVector3Data &GetLocation() const { return m_location; }
|
||||
inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; }
|
||||
|
||||
inline MxBool IsLooping() const { return m_flags & Flag_Looping; }
|
||||
inline MxBool IsBit3() const { return m_flags & Flag_Bit3; }
|
||||
|
||||
private:
|
||||
MxU32 m_sizeOnDisk;
|
||||
MxU32 m_flags;
|
||||
DWORD m_startTime;
|
||||
MxLong m_startTime;
|
||||
|
||||
protected:
|
||||
MxLong m_duration;
|
||||
@ -63,11 +80,13 @@ class MxDSAction : public MxDSObject
|
||||
MxVector3Data m_location;
|
||||
MxVector3Data m_direction;
|
||||
MxVector3Data m_up;
|
||||
char *m_unkData;
|
||||
MxU16 m_unkLength;
|
||||
char *m_extraData;
|
||||
MxU16 m_extraLength;
|
||||
undefined4 m_unk84;
|
||||
undefined4 m_unk88;
|
||||
MxOmni *m_omni; // 0x8c
|
||||
|
||||
protected:
|
||||
MxLong m_someTimingField; // 0x90
|
||||
};
|
||||
|
||||
|
||||
22
LEGO1/mxdsactionlist.cpp
Normal file
22
LEGO1/mxdsactionlist.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "mxdsactionlist.h"
|
||||
#include "mxdsaction.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDSActionList, 0x1c);
|
||||
DECOMP_SIZE_ASSERT(MxDSActionListCursor, 0x10);
|
||||
|
||||
// OFFSET: LEGO1 0x100c9c90
|
||||
MxS8 MxDSActionList::Compare(MxDSAction *p_var0, MxDSAction *p_var1)
|
||||
{
|
||||
if (p_var1 == p_var0)
|
||||
return 0;
|
||||
if (p_var1 <= p_var0)
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c9cb0
|
||||
void MxDSActionList::Destroy(MxDSAction *p_action)
|
||||
{
|
||||
if (p_action)
|
||||
delete p_action;
|
||||
}
|
||||
37
LEGO1/mxdsactionlist.h
Normal file
37
LEGO1/mxdsactionlist.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef MXDSACTIONLIST_H
|
||||
#define MXDSACTIONLIST_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxlist.h"
|
||||
|
||||
class MxDSAction;
|
||||
|
||||
// VTABLE 0x100dced8
|
||||
// SIZE 0x1c
|
||||
class MxDSActionList : public MxList<MxDSAction*>
|
||||
{
|
||||
public:
|
||||
MxDSActionList() {
|
||||
this->m_unk18 = 0;
|
||||
}
|
||||
|
||||
virtual MxS8 Compare(MxDSAction *, MxDSAction *); // +0x14
|
||||
|
||||
static void Destroy(MxDSAction *p_action);
|
||||
|
||||
private:
|
||||
undefined m_unk18;
|
||||
};
|
||||
|
||||
typedef MxListCursorChild<MxDSAction*> MxDSActionListCursor;
|
||||
|
||||
// OFFSET: LEGO1 0x100c9cc0 TEMPLATE
|
||||
// MxListParent<MxDSAction *>::Compare
|
||||
|
||||
// OFFSET: LEGO1 0x100c9d20 TEMPLATE
|
||||
// MxListParent<MxDSAction *>::Destroy
|
||||
|
||||
// OFFSET: LEGO1 0x100c9d30 TEMPLATE
|
||||
// MxList<MxDSAction *>::~MxList<MxDSAction *>
|
||||
|
||||
#endif // MXDSACTIONLIST_H
|
||||
@ -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
|
||||
|
||||
13
LEGO1/mxdsbuffer.cpp
Normal file
13
LEGO1/mxdsbuffer.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "mxdsbuffer.h"
|
||||
|
||||
// OFFSET: LEGO1 0x100c6470
|
||||
MxDSBuffer::MxDSBuffer()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c6530
|
||||
MxDSBuffer::~MxDSBuffer()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
20
LEGO1/mxdsbuffer.h
Normal file
20
LEGO1/mxdsbuffer.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef MXDSBUFFER_H
|
||||
#define MXDSBUFFER_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxcore.h"
|
||||
|
||||
// VTABLE 0x100dcca0
|
||||
// SIZE 0x34
|
||||
class MxDSBuffer : public MxCore
|
||||
{
|
||||
public:
|
||||
MxDSBuffer();
|
||||
virtual ~MxDSBuffer() override;
|
||||
|
||||
private:
|
||||
undefined m_unk08[0x2C];
|
||||
|
||||
};
|
||||
|
||||
#endif // MXDSBUFFER_H
|
||||
@ -1,7 +1,6 @@
|
||||
#ifndef MXDSCHUNK_H
|
||||
#define MXDSCHUNK_H
|
||||
|
||||
|
||||
#include "mxcore.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -47,13 +47,13 @@ MxLong MxDSFile::Open(MxULong uStyle)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100cc780
|
||||
MxLong MxDSFile::Read(unsigned char *pch, MxULong cch)
|
||||
MxResult MxDSFile::Read(unsigned char *p_buf, MxULong p_nbytes)
|
||||
{
|
||||
if (m_io.Read((char*)pch, cch) != cch)
|
||||
return -1;
|
||||
if (m_io.Read(p_buf, p_nbytes) != p_nbytes)
|
||||
return FAILURE;
|
||||
|
||||
m_position += cch;
|
||||
return 0;
|
||||
m_position += p_nbytes;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100cc620
|
||||
@ -72,7 +72,7 @@ MxLong MxDSFile::ReadChunks()
|
||||
return -1;
|
||||
}
|
||||
|
||||
m_io.Read((char*)&m_header, 0xc);
|
||||
m_io.Read(&m_header, 0xc);
|
||||
if ((m_header.majorVersion == SI_MAJOR_VERSION) && (m_header.minorVersion == SI_MINOR_VERSION))
|
||||
{
|
||||
childChunk.ckid = FOURCC('M', 'x', 'O', 'f');
|
||||
@ -80,9 +80,9 @@ MxLong MxDSFile::ReadChunks()
|
||||
return -1;
|
||||
}
|
||||
MxULong* pLengthInDWords = &m_lengthInDWords;
|
||||
m_io.Read((char *)pLengthInDWords, 4);
|
||||
m_pBuffer = malloc(*pLengthInDWords * 4);
|
||||
m_io.Read((char*)m_pBuffer, *pLengthInDWords * 4);
|
||||
m_io.Read(pLengthInDWords, 4);
|
||||
m_pBuffer = new MxU32[*pLengthInDWords];
|
||||
m_io.Read(m_pBuffer, *pLengthInDWords * 4);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@ -120,7 +120,7 @@ MxLong MxDSFile::Close()
|
||||
if (m_lengthInDWords != 0)
|
||||
{
|
||||
m_lengthInDWords = 0;
|
||||
free(m_pBuffer);
|
||||
delete[] m_pBuffer;
|
||||
m_pBuffer = NULL;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "mxdssource.h"
|
||||
#include "mxioinfo.h"
|
||||
#include "mxstring.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
// VTABLE 0x100dc890
|
||||
class MxDSFile : public MxDSSource
|
||||
@ -27,7 +28,7 @@ class MxDSFile : public MxDSSource
|
||||
|
||||
__declspec(dllexport) virtual MxLong Open(MxULong); // vtable+0x14
|
||||
__declspec(dllexport) virtual MxLong Close(); // vtable+0x18
|
||||
__declspec(dllexport) virtual MxLong Read(unsigned char *,MxULong); // vtable+0x20
|
||||
__declspec(dllexport) virtual MxResult Read(unsigned char *,MxULong); // vtable+0x20
|
||||
__declspec(dllexport) virtual MxLong Seek(MxLong,int); // vtable+0x24
|
||||
__declspec(dllexport) virtual MxULong GetBufferSize(); // vtable+0x28
|
||||
__declspec(dllexport) virtual MxULong GetStreamBuffersNum(); // vtable+0x2c
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
#include "mxdsmediaaction.h"
|
||||
|
||||
#include "legoutil.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDSMediaAction, 0xb8)
|
||||
|
||||
// OFFSET: LEGO1 0x100c8b40
|
||||
MxDSMediaAction::MxDSMediaAction()
|
||||
{
|
||||
this->m_mediaSrcPath = NULL;
|
||||
this->m_unk9c = 0;
|
||||
this->m_unka0 = 0;
|
||||
this->m_unk9c.m_unk00 = 0;
|
||||
this->m_unk9c.m_unk04 = 0;
|
||||
this->m_framesPerSecond = 0;
|
||||
this->m_mediaFormat = 0;
|
||||
this->m_paletteManagement = 1;
|
||||
@ -27,10 +29,7 @@ void MxDSMediaAction::CopyFrom(MxDSMediaAction &p_dsMediaAction)
|
||||
{
|
||||
CopyMediaSrcPath(p_dsMediaAction.m_mediaSrcPath);
|
||||
|
||||
// TODO
|
||||
this->m_unk9c = p_dsMediaAction.m_unk9c;
|
||||
this->m_unka0 = p_dsMediaAction.m_unka0;
|
||||
|
||||
this->m_framesPerSecond = p_dsMediaAction.m_framesPerSecond;
|
||||
this->m_mediaFormat = p_dsMediaAction.m_mediaFormat;
|
||||
this->m_paletteManagement = p_dsMediaAction.m_paletteManagement;
|
||||
@ -68,21 +67,13 @@ void MxDSMediaAction::Deserialize(char **p_source, MxS16 p_unk24)
|
||||
{
|
||||
MxDSAction::Deserialize(p_source, p_unk24);
|
||||
|
||||
CopyMediaSrcPath(*p_source);
|
||||
*p_source += strlen(this->m_mediaSrcPath) + 1;
|
||||
|
||||
this->m_unk9c = *(undefined4*) *p_source;
|
||||
*p_source += sizeof(undefined4);
|
||||
this->m_unka0 = *(undefined4*) *p_source;
|
||||
*p_source += sizeof(undefined4);
|
||||
this->m_framesPerSecond = *(MxS32*) *p_source;
|
||||
*p_source += sizeof(MxS32);
|
||||
this->m_mediaFormat = *(MxS32*) *p_source;
|
||||
*p_source += sizeof(MxS32);
|
||||
this->m_paletteManagement = *(MxS32*) *p_source;
|
||||
*p_source += sizeof(MxS32);
|
||||
this->m_sustainTime = *(MxLong*) *p_source;
|
||||
*p_source += sizeof(MxLong);
|
||||
GetString(p_source, this->m_mediaSrcPath, this, &MxDSMediaAction::CopyMediaSrcPath);
|
||||
GetScalar(p_source, this->m_unk9c.m_unk00);
|
||||
GetScalar(p_source, this->m_unk9c.m_unk04);
|
||||
GetScalar(p_source, this->m_framesPerSecond);
|
||||
GetScalar(p_source, this->m_mediaFormat);
|
||||
GetScalar(p_source, this->m_paletteManagement);
|
||||
GetScalar(p_source, this->m_sustainTime);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c8e80
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxpoint32.h"
|
||||
|
||||
// VTABLE 0x100dcd40
|
||||
// SIZE 0xb8
|
||||
@ -28,15 +29,20 @@ 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);
|
||||
|
||||
inline MxS32 GetMediaFormat() const { return this->m_mediaFormat; }
|
||||
inline MxLong GetSustainTime() const { return this->m_sustainTime; }
|
||||
private:
|
||||
MxU32 m_sizeOnDisk;
|
||||
char *m_mediaSrcPath;
|
||||
undefined4 m_unk9c;
|
||||
undefined4 m_unka0;
|
||||
struct {
|
||||
undefined4 m_unk00;
|
||||
undefined4 m_unk04;
|
||||
} m_unk9c;
|
||||
MxS32 m_framesPerSecond;
|
||||
MxS32 m_mediaFormat;
|
||||
MxS32 m_paletteManagement;
|
||||
|
||||
@ -1,14 +1,154 @@
|
||||
#include "mxdsmultiaction.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDSMultiAction, 0x9c)
|
||||
|
||||
// OFFSET: LEGO1 0x100c9b90
|
||||
MxDSMultiAction::MxDSMultiAction()
|
||||
{
|
||||
// TODO
|
||||
this->SetType(MxDSType_MultiAction);
|
||||
this->m_actions = new MxDSActionList;
|
||||
this->m_actions->SetDestroy(MxDSActionList::Destroy);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca060 STUB
|
||||
// OFFSET: LEGO1 0x100ca060
|
||||
MxDSMultiAction::~MxDSMultiAction()
|
||||
{
|
||||
// TODO
|
||||
if (this->m_actions)
|
||||
delete this->m_actions;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca0d0
|
||||
void MxDSMultiAction::CopyFrom(MxDSMultiAction &p_dsMultiAction)
|
||||
{
|
||||
this->m_actions->DeleteAll();
|
||||
|
||||
MxDSActionListCursor cursor(p_dsMultiAction.m_actions);
|
||||
MxDSAction *action;
|
||||
while (cursor.Next(action))
|
||||
this->m_actions->Append(action->Clone());
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca260
|
||||
MxDSMultiAction &MxDSMultiAction::operator=(MxDSMultiAction &p_dsMultiAction)
|
||||
{
|
||||
if (this == &p_dsMultiAction)
|
||||
return *this;
|
||||
|
||||
MxDSAction::operator=(p_dsMultiAction);
|
||||
this->CopyFrom(p_dsMultiAction);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca290
|
||||
void MxDSMultiAction::SetSomeTimingField(MxLong p_someTimingField)
|
||||
{
|
||||
this->m_someTimingField = p_someTimingField;
|
||||
|
||||
MxDSActionListCursor cursor(this->m_actions);
|
||||
MxDSAction *action;
|
||||
while (cursor.Next(action))
|
||||
action->SetSomeTimingField(p_someTimingField);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca370
|
||||
void MxDSMultiAction::MergeFrom(MxDSAction &p_dsMultiAction)
|
||||
{
|
||||
MxDSAction::MergeFrom(p_dsMultiAction);
|
||||
|
||||
MxDSActionListCursor cursor(this->m_actions);
|
||||
MxDSAction *action;
|
||||
while (cursor.Next(action))
|
||||
action->MergeFrom(p_dsMultiAction);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca450
|
||||
MxBool MxDSMultiAction::HasId(MxU32 p_objectId)
|
||||
{
|
||||
if (this->GetObjectId() == p_objectId)
|
||||
return TRUE;
|
||||
|
||||
MxDSActionListCursor cursor(this->m_actions);
|
||||
MxDSAction *action;
|
||||
while (cursor.Next(action)) {
|
||||
if (action->HasId(p_objectId))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca550
|
||||
MxDSAction *MxDSMultiAction::Clone()
|
||||
{
|
||||
MxDSMultiAction *clone = new MxDSMultiAction();
|
||||
|
||||
if (clone)
|
||||
*clone = *this;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca5e0
|
||||
undefined4 MxDSMultiAction::unk14()
|
||||
{
|
||||
undefined4 result = MxDSAction::unk14();
|
||||
|
||||
MxDSActionListCursor cursor(this->m_actions);
|
||||
MxDSAction *action;
|
||||
while (cursor.Next(action))
|
||||
result += action->unk14();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca6c0
|
||||
MxU32 MxDSMultiAction::GetSizeOnDisk()
|
||||
{
|
||||
MxU32 totalSizeOnDisk = MxDSAction::GetSizeOnDisk() + 16;
|
||||
|
||||
MxDSActionListCursor cursor(this->m_actions);
|
||||
MxDSAction *action;
|
||||
while (cursor.Next(action))
|
||||
totalSizeOnDisk += action->GetSizeOnDisk();
|
||||
|
||||
this->m_sizeOnDisk = totalSizeOnDisk - MxDSAction::GetSizeOnDisk();
|
||||
|
||||
return totalSizeOnDisk;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca7b0
|
||||
void MxDSMultiAction::Deserialize(char **p_source, MxS16 p_unk24)
|
||||
{
|
||||
MxDSAction::Deserialize(p_source, p_unk24);
|
||||
|
||||
MxU32 extraFlag = *(MxU32*)(*p_source + 4) & 1;
|
||||
*p_source += 12;
|
||||
|
||||
MxU32 count = *(MxU32*) *p_source;
|
||||
*p_source += sizeof(count);
|
||||
|
||||
if (count) {
|
||||
while (count--) {
|
||||
MxU32 extraFlag = *(MxU32*)(*p_source + 4) & 1;
|
||||
*p_source += 8;
|
||||
|
||||
MxDSAction *action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_unk24);
|
||||
*p_source += extraFlag;
|
||||
|
||||
this->m_actions->Append(action);
|
||||
}
|
||||
}
|
||||
|
||||
*p_source += extraFlag;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ca8c0
|
||||
void MxDSMultiAction::SetAtomId(MxAtomId p_atomId)
|
||||
{
|
||||
MxDSAction::SetAtomId(p_atomId);
|
||||
|
||||
MxDSActionListCursor cursor(this->m_actions);
|
||||
MxDSAction *action;
|
||||
while (cursor.Next(action))
|
||||
action->SetAtomId(p_atomId);
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
#define MXDSMULTIACTION_H
|
||||
|
||||
#include "mxdsaction.h"
|
||||
#include "mxdsactionlist.h"
|
||||
|
||||
// VTABLE 0x100dcef0
|
||||
// SIZE 0x9c
|
||||
@ -11,6 +12,9 @@ class MxDSMultiAction : public MxDSAction
|
||||
MxDSMultiAction();
|
||||
virtual ~MxDSMultiAction() override;
|
||||
|
||||
void CopyFrom(MxDSMultiAction &p_dsMultiAction);
|
||||
MxDSMultiAction &operator=(MxDSMultiAction &p_dsMultiAction);
|
||||
|
||||
// OFFSET: LEGO1 0x100c9f50
|
||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||
{
|
||||
@ -23,6 +27,19 @@ class MxDSMultiAction : public MxDSAction
|
||||
{
|
||||
return !strcmp(name, MxDSMultiAction::ClassName()) || MxDSAction::IsA(name);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
protected:
|
||||
MxU32 m_sizeOnDisk;
|
||||
MxDSActionList *m_actions;
|
||||
};
|
||||
|
||||
#endif // MXDSMULTIACTION_H
|
||||
|
||||
@ -3,6 +3,20 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mxdstypes.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxdsmediaaction.h"
|
||||
#include "mxdsanim.h"
|
||||
#include "mxdssound.h"
|
||||
#include "mxdsmultiaction.h"
|
||||
#include "mxdsserialaction.h"
|
||||
#include "mxdsparallelaction.h"
|
||||
#include "mxdsevent.h"
|
||||
#include "mxdsselectaction.h"
|
||||
#include "mxdsstill.h"
|
||||
#include "mxdsobjectaction.h"
|
||||
#include "legoutil.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDSObject, 0x2c);
|
||||
|
||||
// OFFSET: LEGO1 0x100bf6a0
|
||||
@ -115,15 +129,66 @@ MxU32 MxDSObject::GetSizeOnDisk()
|
||||
// OFFSET: LEGO1 0x100bfa20
|
||||
void MxDSObject::Deserialize(char **p_source, MxS16 p_unk24)
|
||||
{
|
||||
this->SetSourceName(*p_source);
|
||||
*p_source += strlen(this->m_sourceName) + 1;
|
||||
this->m_unk14 = *(undefined4*) *p_source;
|
||||
*p_source += sizeof(undefined4);
|
||||
|
||||
this->SetObjectName(*p_source);
|
||||
*p_source += strlen(this->m_objectName) + 1;
|
||||
this->m_objectId = *(MxU32*) *p_source;
|
||||
*p_source += sizeof(MxU32);
|
||||
GetString(p_source, this->m_sourceName, this, &MxDSObject::SetSourceName);
|
||||
GetScalar(p_source, this->m_unk14);
|
||||
GetString(p_source, this->m_objectName, this, &MxDSObject::SetObjectName);
|
||||
GetScalar(p_source, this->m_objectId);
|
||||
|
||||
this->m_unk24 = p_unk24;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bfb30
|
||||
MxDSObject *DeserializeDSObjectDispatch(char **p_source, MxS16 p_flags)
|
||||
{
|
||||
MxU16 type = *(MxU16*) *p_source;
|
||||
*p_source += 2;
|
||||
|
||||
MxDSObject *obj = NULL;
|
||||
|
||||
switch (type) {
|
||||
default:
|
||||
return NULL;
|
||||
case MxDSType_Object:
|
||||
obj = new MxDSObject();
|
||||
break;
|
||||
case MxDSType_Action:
|
||||
obj = new MxDSAction();
|
||||
break;
|
||||
case MxDSType_MediaAction:
|
||||
obj = new MxDSMediaAction();
|
||||
break;
|
||||
case MxDSType_Anim:
|
||||
obj = new MxDSAnim();
|
||||
break;
|
||||
case MxDSType_Sound:
|
||||
obj = new MxDSSound();
|
||||
break;
|
||||
case MxDSType_MultiAction:
|
||||
obj = new MxDSMultiAction();
|
||||
break;
|
||||
case MxDSType_SerialAction:
|
||||
obj = new MxDSSerialAction();
|
||||
break;
|
||||
case MxDSType_ParallelAction:
|
||||
obj = new MxDSParallelAction();
|
||||
break;
|
||||
case MxDSType_Event:
|
||||
obj = new MxDSEvent();
|
||||
break;
|
||||
case MxDSType_SelectAction:
|
||||
obj = new MxDSSelectAction();
|
||||
break;
|
||||
case MxDSType_Still:
|
||||
obj = new MxDSStill();
|
||||
break;
|
||||
case MxDSType_ObjectAction:
|
||||
obj = new MxDSObjectAction();
|
||||
break;
|
||||
}
|
||||
|
||||
if (obj) {
|
||||
obj->Deserialize(p_source, p_flags);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -36,24 +36,28 @@ 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; }
|
||||
|
||||
protected:
|
||||
inline char *GetSourceName() const { return this->m_sourceName; }
|
||||
|
||||
inline void SetType(MxDSType p_type) { this->m_type = p_type; }
|
||||
inline MxDSType GetType() { return (MxDSType) this->m_type; }
|
||||
inline MxDSType GetType() const { return (MxDSType) this->m_type; }
|
||||
|
||||
private:
|
||||
MxU32 m_sizeOnDisk;
|
||||
MxU16 m_type;
|
||||
char* m_sourceName;
|
||||
undefined4 m_unk14;
|
||||
char *m_objectName;
|
||||
MxU32 m_objectId;
|
||||
MxAtomId m_atomId;
|
||||
MxS16 m_unk24;
|
||||
undefined4 m_unk28;
|
||||
MxU32 m_sizeOnDisk; // 0x8
|
||||
MxU16 m_type; // 0xc
|
||||
char* m_sourceName; // 0x10
|
||||
undefined4 m_unk14; // 0x14
|
||||
char *m_objectName; // 0x18
|
||||
MxU32 m_objectId; // 0x1c
|
||||
MxAtomId m_atomId; // 0x20
|
||||
MxS16 m_unk24; // 0x24
|
||||
undefined4 m_unk28; // 0x28
|
||||
};
|
||||
|
||||
MxDSObject *DeserializeDSObjectDispatch(char **, MxS16);
|
||||
|
||||
#endif // MXDSOBJECT_H
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user