Merge branch 'master' into mxcompositemediapresenter-startaction

This commit is contained in:
Christian Semmler 2023-12-14 11:51:36 -05:00
commit f71dac5895
46 changed files with 780 additions and 329 deletions

View File

@ -21,6 +21,12 @@ class Act1State : public LegoState {
{ {
return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name); return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name);
}; };
inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x18 = p_unk0x18; }
protected:
undefined m_unk0x8[0x10]; // 0x8
MxU32 m_unk0x18; // 0x18
}; };
#endif // ACT1STATE_H #endif // ACT1STATE_H

View File

@ -23,7 +23,7 @@ class Act2Brick : public LegoPathActor {
// FUNCTION: LEGO1 0x1007a370 // FUNCTION: LEGO1 0x1007a370
inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10
{ {
return !strcmp(Act2Brick::ClassName(), p_name) || LegoEntity::IsA(p_name); return !strcmp(p_name, Act2Brick::ClassName()) || LegoEntity::IsA(p_name);
} }
}; };

View File

@ -25,11 +25,13 @@ class Act3 : public LegoWorld {
} }
inline void SetUnkown420c(MxEntity* p_entity) { m_unk0x420c = p_entity; } inline void SetUnkown420c(MxEntity* p_entity) { m_unk0x420c = p_entity; }
inline void SetUnkown4270(MxU32 p_unk0x4270) { m_unk0x4270 = p_unk0x4270; }
protected: protected:
undefined m_unk0xf8[0x4114]; undefined m_unk0xf8[0x4114]; // 0xf8
MxEntity* m_unk0x420c; MxEntity* m_unk0x420c; // 0x420c
undefined m_unk0x4210[0x64]; undefined m_unk0x4210[0x60]; // 0x4210
MxU32 m_unk0x4270; // 0x4270
}; };
#endif // ACT3_H #endif // ACT3_H

View File

@ -1,12 +1,15 @@
#include "helicopter.h" #include "helicopter.h"
#include "act1state.h"
#include "act3.h" #include "act3.h"
#include "isle.h"
#include "legoanimationmanager.h" #include "legoanimationmanager.h"
#include "legocontrolmanager.h" #include "legocontrolmanager.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legoomni.h" #include "legoomni.h"
#include "legoutil.h" #include "legoutil.h"
#include "legoworld.h" #include "legoworld.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(Helicopter, 0x230) DECOMP_SIZE_ASSERT(Helicopter, 0x230)
@ -63,16 +66,263 @@ void Helicopter::VTable0xe4()
} }
} }
m_state->SetUnknown8(0); m_state->SetUnknown8(0);
FUN_1003ee00(m_unk0x22c, 0x16); FUN_1003ee00(m_script, 0x16);
FUN_1003ee00(m_unk0x22c, 0x17); FUN_1003ee00(m_script, 0x17);
FUN_1003ee00(m_unk0x22c, 0x18); FUN_1003ee00(m_script, 0x18);
FUN_1003ee00(m_unk0x22c, 0x19); FUN_1003ee00(m_script, 0x19);
FUN_1003ee00(m_unk0x22c, 0x1a); FUN_1003ee00(m_script, 0x1a);
FUN_1003ee00(m_unk0x22c, 0x1b); FUN_1003ee00(m_script, 0x1b);
FUN_1003ee00(m_unk0x22c, 0x1c); FUN_1003ee00(m_script, 0x1c);
FUN_1003ee00(m_unk0x22c, 0x1d); FUN_1003ee00(m_script, 0x1d);
FUN_1003ee00(m_unk0x22c, 0x1e); FUN_1003ee00(m_script, 0x1e);
FUN_1003ee00(m_unk0x22c, 0x1f); FUN_1003ee00(m_script, 0x1f);
AnimationManager()->FUN_1005f6d0(TRUE); AnimationManager()->FUN_1005f6d0(TRUE);
ControlManager()->Unregister(this); ControlManager()->Unregister(this);
} }
// FUNCTION: LEGO1 0x10003480
MxU32 Helicopter::VTable0xcc()
{
if (!FUN_1003ef60())
return 1;
if (!m_world)
m_world = GetCurrentWorld();
AnimationManager()->FUN_1005f6d0(FALSE);
if (GetCurrentVehicle()) {
if (GetCurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) {
GetCurrentVehicle()->VTable0xe4();
}
}
switch (GameState()->GetUnknown10()) {
case 0:
m_script = *g_isleScript;
AnimationManager()->FUN_10064670(FALSE);
VTable0xe8(0x29, TRUE, 7);
((Isle*) GetCurrentWorld())->SetUnknown13c(0x3c);
FUN_10015820(1, 0);
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, TRUE);
SetUnknownDC(4);
FUN_10015910(9);
break;
case 1:
m_script = *g_act2mainScript;
break;
case 2:
m_script = *g_act3Script;
break;
}
VTable0xe0();
InvokeAction(ExtraActionType_start, m_script, 0x15, NULL);
GetCurrentAction().SetObjectId(-1);
ControlManager()->Register(this);
return 1;
}
// FUNCTION: LEGO1 0x100035e0
MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param)
{
MxU32 ret = 0;
MxAtomId script;
switch (GameState()->GetUnknown10()) {
case 0:
script = *g_isleScript;
break;
case 1:
script = *g_act2mainScript;
break;
case 2:
script = *g_act3Script;
break;
}
if (p_param.GetUnknown28() == 1) {
switch (p_param.GetUnknown20()) {
case 0x17:
if (*g_act3Script == script) {
((Act3*) GetCurrentWorld())->SetUnkown4270(2);
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, FALSE);
}
else if (m_state->GetUnkown8() != 0)
break;
VTable0xe4();
GameState()->SetUnknown424(0x42);
ret = 1;
break;
case 0x18: {
if (*g_act3Script == script)
break;
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
if (m_state->GetUnkown8() == 0) {
state->SetUnknown18(4);
m_state->SetUnknown8(1);
m_world->FUN_1001fc80(this);
InvokeAction(ExtraActionType_start, script, 0x20, NULL);
SetUnknownDC(0);
}
ret = 1;
break;
}
case 0x19:
if (*g_act3Script == script)
break;
if (m_state->GetUnkown8() == 2) {
m_state->SetUnknown8(3);
m_world->FUN_1001fc80(this);
InvokeAction(ExtraActionType_start, script, 0x21, NULL);
SetUnknownDC(4);
}
ret = 1;
break;
case 0x1a:
if (*g_act3Script != script)
break;
ret = 1;
/* fall through */
case 0x1b:
if (*g_act3Script != script)
break;
if (m_world && m_world->GetCamera()) {
Vector3Data loc, dir, lookat;
loc.CopyFrom(m_world->GetCamera()->FUN_100127f0());
dir.CopyFrom(m_world->GetCamera()->FUN_100128a0());
lookat = dir;
float scale = 3;
lookat.Mul(scale);
lookat.Add(&loc);
Vector3Data v68, v7c, v90(0, 1, 0), va4;
v68.CopyFrom(m_world->GetCamera()->FUN_10012740());
va4.EqualsCross(v68, dir);
v7c.EqualsCross(va4, v90);
if (ret)
if (m_world->FUN_100727e0(m_unk0x138, loc, dir, v7c))
break;
else if (m_world->FUN_10072980(m_unk0x138, loc, dir, v7c))
break;
}
ret = 1;
break;
case 0x1c:
if (GameState()->GetUnknown10() == 0) {
((Isle*) GetCurrentWorld())->SetUnknown13c(2);
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, FALSE);
VTable0xe4();
}
ret = 1;
break;
case 0x1d:
ret = 1;
break;
}
}
return ret;
}
// FUNCTION: LEGO1 0x10003c20
MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param)
{
switch (m_state->GetUnkown8()) {
case 1: {
if (GameState()->GetUnknown10() == 0) {
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4);
VTable0xe8(0x2a, TRUE, 7);
}
else
VTable0xe8(0x31, TRUE, 7);
m_state->SetUnknown8(2);
Matrix4Data mat;
mat.SetIdentity();
Matrix4 mat2 = mat.GetMatrix();
float s = sin(0.5235987901687622); // PI / 6, 30 deg
float c = cos(0.5235987901687622); // PI / 6, 30 deg
for (int i = 0; i < 4; i++) {
mat.GetMatrix()[i][1] = mat2[i][1] * c - mat2[i][2] * s;
mat.GetMatrix()[i][2] = mat2[i][2] * c + mat2[i][1] * s;
}
Vector3Impl at(mat.GetMatrix()[3]), dir(mat.GetMatrix()[2]), up(mat.GetMatrix()[1]);
m_world->GetCamera()->LookAt(at, dir, up);
FUN_10010c30();
break;
}
case 3: {
Matrix4Data mat;
mat.SetIdentity();
Vector3Impl at(mat.GetMatrix()[3]), dir(mat.GetMatrix()[2]), up(mat.GetMatrix()[1]);
at[1] = 1.25;
m_world->GetCamera()->LookAt(at, dir, up);
if (GameState()->GetUnknown10() == 0) {
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0);
VTable0xe8(0x29, TRUE, 7);
}
else
VTable0xe8(0x30, TRUE, 7);
m_state->SetUnknown8(0);
break;
}
default:
return 0;
}
return 1;
}
// FUNCTION: LEGO1 0x10003e90
void Helicopter::VTable0x74(Matrix4Impl& p_transform)
{
if (m_unk0xea != 0) {
m_roi->FUN_100a46b0(p_transform);
FUN_10010c30();
}
else {
m_roi->FUN_100a58f0(p_transform);
m_roi->VTable0x14();
if (m_cameraFlag)
FUN_10010c30();
}
}
// FUNCTION: LEGO1 0x10003ee0
void Helicopter::VTable0x70(float p_float)
{
MxU32 state = m_state->GetUnkown8();
switch (state) {
default:
LegoPathActor::VTable0x70(p_float);
return;
case 4:
case 5:
float f = m_unk0x1f0 - p_float + 3000;
if (f >= 0) {
float f2 = f / 3000 + 1;
if (f2 < 0)
f2 = 0;
if (1.0f < f2)
f2 = 1.0f;
Vector3Impl v(m_unk0x160.GetMatrix()[3]);
Matrix4Data mat;
Vector3Impl v2(m_unk0x1a8.GetMatrix()[3]);
float* loc = m_unk0x1a8.GetMatrix()[3];
mat.SetIdentity();
float fa[4];
Vector4Impl v3(fa);
if (m_unk0x1f4.FUN_100040a0(v3, f2) == SUCCESS) {
mat.FromQuaternion(v3);
}
v2.SetVector(loc);
v2.Sub(&v);
v2.Mul(f2);
v2.Add(&v);
m_world->GetCamera()->FUN_100123e0(mat, 0);
}
else {
if (state == 4)
m_world->FUN_10073400();
else
m_world->FUN_10073430();
m_unk0xdc = 4;
}
}
}
// STUB: LEGO1 0x100040a0
MxResult HelicopterSubclass::FUN_100040a0(Vector4Impl& p_v, float p_f)
{
return SUCCESS;
}

View File

@ -5,11 +5,24 @@
#include "islepathactor.h" #include "islepathactor.h"
#include "realtime/matrix.h" #include "realtime/matrix.h"
// SIZE 0x34
class HelicopterSubclass {
public:
inline HelicopterSubclass() : m_unk0x30(0) {}
MxResult FUN_100040a0(Vector4Impl& p_v, float p_f);
private:
Vector4Data m_unk0x0; // 0x0
Vector4Data m_unk0x18; // 0x18
undefined4 m_unk0x30; // 0x30
};
// VTABLE: LEGO1 0x100d40f8 // VTABLE: LEGO1 0x100d40f8
// SIZE 0x230 // SIZE 0x230
class Helicopter : public IslePathActor { class Helicopter : public IslePathActor {
public: public:
Helicopter(); Helicopter();
virtual ~Helicopter() override; // vtable+0x0
// FUNCTION: LEGO1 0x10003070 // FUNCTION: LEGO1 0x10003070
inline virtual const char* ClassName() const override // vtable+0x0c inline virtual const char* ClassName() const override // vtable+0x0c
@ -24,22 +37,24 @@ class Helicopter : public IslePathActor {
return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name); return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name);
} }
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18
virtual void VTable0xe4() override; void VTable0x70(float p_float) override; // vtable+0x70
void VTable0x74(Matrix4Impl& p_transform) override; // vtable+0x74
virtual MxU32 VTable0xcc() override; // vtable+0xcc
virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4
virtual MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8
virtual void VTable0xe4() override; // vtable+0xe4
// SYNTHETIC: LEGO1 0x10003210 // SYNTHETIC: LEGO1 0x10003210
// Helicopter::`scalar deleting destructor' // Helicopter::`scalar deleting destructor'
virtual ~Helicopter() override; // vtable+0x0
protected: protected:
Matrix4Data m_unk0x160; Matrix4Data m_unk0x160; // 0x160
Matrix4Data m_unk0x1a8; Matrix4Data m_unk0x1a8; // 0x1a8
undefined4 m_unk0x1f0; float m_unk0x1f0; // 0x1f0
Vector4Data m_unk0x1f4; HelicopterSubclass m_unk0x1f4; // 0x1f4
Vector4Data m_unk0x20c; HelicopterState* m_state; // 0x228
undefined4 m_unk0x224; MxAtomId m_script; // 0x22c
HelicopterState* m_state;
MxAtomId m_unk0x22c;
private: private:
void GetState(); void GetState();

View File

@ -21,10 +21,11 @@ class HelicopterState : public LegoState {
return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name); return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name);
} }
inline void SetUnknown8(undefined4 p_unk0x8) { m_unk0x8 = p_unk0x8; } inline void SetUnknown8(MxU32 p_unk0x8) { m_unk0x8 = p_unk0x8; }
inline MxU32 GetUnkown8() { return m_unk0x8; }
protected: protected:
undefined4 m_unk0x8; MxU32 m_unk0x8; // 0x8
}; };
#endif // HELICOPTERSTATE_H #endif // HELICOPTERSTATE_H

View File

@ -22,6 +22,11 @@ class Isle : public LegoWorld {
{ {
return !strcmp(p_name, Isle::ClassName()) || LegoWorld::IsA(p_name); return !strcmp(p_name, Isle::ClassName()) || LegoWorld::IsA(p_name);
} }
inline void SetUnknown13c(MxU32 p_unk0x13c) { m_unk0x13c = p_unk0x13c; }
protected:
undefined m_unk0xf8[0x44]; // 0xf8
MxU32 m_unk0x13c; // 0x13c
}; };
#endif // ISLE_H #endif // ISLE_H

View File

@ -2,38 +2,6 @@
DECOMP_SIZE_ASSERT(IslePathActor, 0x160) DECOMP_SIZE_ASSERT(IslePathActor, 0x160)
// Probably in header
// STUB: LEGO1 0x10002df0
void IslePathActor::VTable0xd0()
{
// TODO
}
// STUB: LEGO1 0x10002e00
void IslePathActor::VTable0xdc()
{
// TODO
}
// STUB: LEGO1 0x10002e70
void IslePathActor::VTable0xcc()
{
// TODO
}
// STUB: LEGO1 0x10002e80
void IslePathActor::VTable0xd4()
{
// TODO
}
// STUB: LEGO1 0x10002e90
void IslePathActor::VTable0xd8()
{
// TODO
}
// End header
// FUNCTION: LEGO1 0x1001a200 // FUNCTION: LEGO1 0x1001a200
IslePathActor::IslePathActor() IslePathActor::IslePathActor()
{ {

View File

@ -3,6 +3,9 @@
#include "legopathactor.h" #include "legopathactor.h"
#include "legoworld.h" #include "legoworld.h"
#include "mxtype17notificationparam.h"
#include "mxtype18notificationparam.h"
#include "mxtype19notificationparam.h"
#include "mxtypes.h" #include "mxtypes.h"
// VTABLE: LEGO1 0x100d4398 // VTABLE: LEGO1 0x100d4398
@ -10,6 +13,7 @@
class IslePathActor : public LegoPathActor { class IslePathActor : public LegoPathActor {
public: public:
IslePathActor(); IslePathActor();
inline virtual ~IslePathActor() override { IslePathActor::Destroy(TRUE); } // vtable+0x0
// FUNCTION: LEGO1 0x10002ea0 // FUNCTION: LEGO1 0x10002ea0
inline virtual const char* ClassName() const override // vtable+0x0c inline virtual const char* ClassName() const override // vtable+0x0c
@ -24,28 +28,32 @@ class IslePathActor : public LegoPathActor {
return !strcmp(p_name, IslePathActor::ClassName()) || LegoPathActor::IsA(p_name); return !strcmp(p_name, IslePathActor::ClassName()) || LegoPathActor::IsA(p_name);
} }
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18
// FUNCTION: LEGO1 0x10002e70
virtual MxU32 VTable0xcc() { return 0; } // vtable+0xcc
// FUNCTION: LEGO1 0x10002df0
virtual MxU32 VTable0xd0() { return 0; } // vtable+0xd0
// FUNCTION: LEGO1 0x10002e80
virtual MxU32 VTable0xd4(MxType17NotificationParam&) { return 0; } // vtable+0xd4
// FUNCTION: LEGO1 0x10002e90
virtual MxU32 VTable0xd8(MxType18NotificationParam&) { return 0; } // vtable+0xd8
// FUNCTION: LEGO1 0x10002e00
virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc
virtual void VTable0xe0(); // vtable+0xe0
virtual void VTable0xe4(); // vtable+0xe4
virtual void VTable0xe8(MxU32, MxBool, MxU8); // vtable+0xe8
virtual void VTable0xec(); // vtable+0xec
// SYNTHETIC: LEGO1 0x10002ff0 // SYNTHETIC: LEGO1 0x10002ff0
// IslePathActor::`scalar deleting destructor' // IslePathActor::`scalar deleting destructor'
inline virtual ~IslePathActor() override { IslePathActor::Destroy(TRUE); }
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18
virtual void VTable0xcc(); // vtable+0xcc
virtual void VTable0xd0(); // vtable+0xd0
virtual void VTable0xd4(); // vtable+0xd4
virtual void VTable0xd8(); // vtable+0xd8
virtual void VTable0xdc(); // vtable+0xdc
virtual void VTable0xe0(); // vtable+0xe0
virtual void VTable0xe4(); // vtable+0xe4
virtual void VTable0xe8(MxU32, MxBool, MxU8); // vtable+0xe8
virtual void VTable0xec(); // vtable+0xec
inline void SetWorld(LegoWorld* p_world) { m_world = p_world; } inline void SetWorld(LegoWorld* p_world) { m_world = p_world; }
inline LegoWorld* GetWorld() { return m_world; } inline LegoWorld* GetWorld() { return m_world; }
private: protected:
LegoWorld* m_world; // 0x154 LegoWorld* m_world; // 0x154
MxFloat m_unk0x158; MxFloat m_unk0x158; // 0x158
MxFloat m_unk0x15c; MxFloat m_unk0x15c; // 0x15c
}; };
#endif // ISLEPATHACTOR_H #endif // ISLEPATHACTOR_H

View File

@ -2,44 +2,6 @@
DECOMP_SIZE_ASSERT(LegoActor, 0x78) DECOMP_SIZE_ASSERT(LegoActor, 0x78)
// Probably in header
// FUNCTION: LEGO1 0x10002cc0
MxFloat LegoActor::VTable0x50()
{
return m_unk0x68;
}
// FUNCTION: LEGO1 0x10002cd0
void LegoActor::VTable0x54(MxFloat p_unk0x68)
{
m_unk0x68 = p_unk0x68;
}
// FUNCTION: LEGO1 0x10002ce0
void LegoActor::VTable0x58(MxFloat p_unk0x70)
{
m_unk0x70 = p_unk0x70;
}
// FUNCTION: LEGO1 0x10002cf0
MxFloat LegoActor::VTable0x5c()
{
return m_unk0x70;
}
// FUNCTION: LEGO1 0x10002d00
undefined LegoActor::VTable0x60()
{
return m_unk0x74;
}
// FUNCTION: LEGO1 0x10002d10
void LegoActor::VTable0x64(undefined p_unk0x74)
{
m_unk0x74 = p_unk0x74;
}
// End header
// FUNCTION: LEGO1 0x1002d110 // FUNCTION: LEGO1 0x1002d110
LegoActor::LegoActor() LegoActor::LegoActor()
{ {

View File

@ -23,18 +23,24 @@ class LegoActor : public LegoEntity {
return !strcmp(p_name, LegoActor::ClassName()) || LegoEntity::IsA(p_name); return !strcmp(p_name, LegoActor::ClassName()) || LegoEntity::IsA(p_name);
} }
virtual MxFloat VTable0x50(); // vtable+0x50 // FUNCTION: LEGO1 0x10002cc0
virtual void VTable0x54(MxFloat p_unk0x68); // vtable+0x54 virtual MxFloat VTable0x50() { return m_unk0x68; } // vtable+0x50
virtual void VTable0x58(MxFloat p_unk0x70); // vtable+0x58 // FUNCTION: LEGO1 0x10002cd0
virtual MxFloat VTable0x5c(); // vtable+0x5c virtual void VTable0x54(MxFloat p_unk0x68) { m_unk0x68 = p_unk0x68; } // vtable+0x54
virtual undefined VTable0x60(); // vtable+0x60 // FUNCTION: LEGO1 0x10002ce0
virtual void VTable0x64(undefined p_unk0x74); // vtable+0x64 virtual void VTable0x58(MxFloat p_unk0x70) { m_unk0x70 = p_unk0x70; } // vtable+0x58
// FUNCTION: LEGO1 0x10002cf0
virtual MxFloat VTable0x5c() { return m_unk0x70; } // vtable+0x5c
// FUNCTION: LEGO1 0x10002d00
virtual MxU8 VTable0x60() { return m_unk0x74; } // vtable+0x60
// FUNCTION: LEGO1 0x10002d10
virtual void VTable0x64(MxU8 p_unk0x74) { m_unk0x74 = p_unk0x74; } // vtable+0x64
private: private:
MxFloat m_unk0x68; MxFloat m_unk0x68; // 0x68
undefined4 m_unk0x6c; undefined4 m_unk0x6c; // 0x6c
MxFloat m_unk0x70; MxFloat m_unk0x70; // 0x70
undefined m_unk0x74; MxU8 m_unk0x74; // 0x74
}; };
#endif // LEGOACTOR_H #endif // LEGOACTOR_H

View File

@ -48,3 +48,8 @@ MxResult LegoAnimationManager::Tickle()
return SUCCESS; return SUCCESS;
} }
// STUB: LEGO1 0x10064670
void LegoAnimationManager::FUN_10064670(MxBool)
{
}

View File

@ -27,6 +27,7 @@ class LegoAnimationManager : public MxCore {
} }
void FUN_1005f6d0(MxBool); void FUN_1005f6d0(MxBool);
void FUN_10064670(MxBool);
__declspec(dllexport) static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig); __declspec(dllexport) static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig);

View File

@ -11,3 +11,31 @@ LegoCameraController::~LegoCameraController()
{ {
// TODO // TODO
} }
// STUB: LEGO1 0x10012260
void LegoCameraController::LookAt(Vector3Impl& p_at, Vector3Impl& p_dir, Vector3Impl& p_up)
{
}
// STUB: LEGO1 0x100123e0
void LegoCameraController::FUN_100123e0(Matrix4Data& p_transform, MxU32)
{
}
// STUB: LEGO1 0x10012740
Vector3Data& LegoCameraController::FUN_10012740()
{
return Vector3Data();
}
// STUB: LEGO1 0x100127f0
Vector3Data& LegoCameraController::FUN_100127f0()
{
return Vector3Data();
}
// STUB: LEGO1 0x100128a0
Vector3Data& LegoCameraController::FUN_100128a0()
{
return Vector3Data();
}

View File

@ -2,6 +2,8 @@
#define LEGOCAMERACONTROLLER_H #define LEGOCAMERACONTROLLER_H
#include "mxcore.h" #include "mxcore.h"
#include "realtime/matrix.h"
#include "realtime/vector.h"
// VTABLE: LEGO1 0x100d57b0 // VTABLE: LEGO1 0x100d57b0
// SIZE 0xc8 // SIZE 0xc8
@ -22,6 +24,12 @@ class LegoCameraController : public MxCore {
{ {
return !strcmp(p_name, ClassName()) || MxCore::IsA(p_name); return !strcmp(p_name, ClassName()) || MxCore::IsA(p_name);
} }
void LookAt(Vector3Impl& p_at, Vector3Impl& p_dir, Vector3Impl& p_up);
void FUN_100123e0(Matrix4Data& p_transform, MxU32);
Vector3Data& FUN_10012740();
Vector3Data& FUN_100127f0();
Vector3Data& FUN_100128a0();
}; };
#endif // LEGOCAMERACONTROLLER_H #endif // LEGOCAMERACONTROLLER_H

View File

@ -76,6 +76,11 @@ void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
// TODO // TODO
} }
// STUB: LEGO1 0x10010c30
void LegoEntity::FUN_10010c30()
{
}
// FUNCTION: LEGO1 0x10010e10 // FUNCTION: LEGO1 0x10010e10
void LegoEntity::ParseAction(char* p_extra) void LegoEntity::ParseAction(char* p_extra)
{ {

View File

@ -47,6 +47,7 @@ class LegoEntity : public MxEntity {
virtual void VTable0x44(); // vtable+0x44 virtual void VTable0x44(); // vtable+0x44
virtual void VTable0x48(); // vtable+0x48 virtual void VTable0x48(); // vtable+0x48
virtual void VTable0x4c(); // vtable+0x4c virtual void VTable0x4c(); // vtable+0x4c
void FUN_10010c30();
protected: protected:
void Init(); void Init();

View File

@ -16,7 +16,7 @@ struct ColorStringStruct {
const char* m_colorName; const char* m_colorName;
}; };
// SIZE 0x430 (at least) // SIZE 0x430
class LegoGameState { class LegoGameState {
public: public:
__declspec(dllexport) LegoGameState(); __declspec(dllexport) LegoGameState();
@ -34,6 +34,7 @@ class LegoGameState {
void FUN_1003a720(MxU32); void FUN_1003a720(MxU32);
void HandleAction(MxU32); void HandleAction(MxU32);
inline MxU8 GetUnknownC() { return m_unk0xc; }
inline MxU32 GetUnknown10() { return m_unk0x10; } inline MxU32 GetUnknown10() { return m_unk0x10; }
inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; } inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; }
@ -45,20 +46,20 @@ class LegoGameState {
void SetROIHandlerFunction(); void SetROIHandlerFunction();
private: private:
char* m_savePath; // 0x0 char* m_savePath; // 0x0
MxS16 m_stateCount; MxS16 m_stateCount; // 0x4
LegoState** m_stateArray; LegoState** m_stateArray; // 0x8
MxU8 m_unk0xc; MxU8 m_unk0xc; // 0xc
MxU32 m_unk0x10; MxU32 m_unk0x10; // 0x10
undefined4 m_unk0x14; undefined4 m_unk0x14; // 0x14
LegoBackgroundColor* m_backgroundColor; // 0x18 LegoBackgroundColor* m_backgroundColor; // 0x18
LegoBackgroundColor* m_tempBackgroundColor; // 0x1c LegoBackgroundColor* m_tempBackgroundColor; // 0x1c
LegoFullScreenMovie* m_fullScreenMovie; // 0x20 LegoFullScreenMovie* m_fullScreenMovie; // 0x20
MxU16 m_unk0x24; // 0x24 MxU16 m_unk0x24; // 0x24
undefined m_unk0x28[1020]; undefined m_unk0x28[1020]; // 0x28
undefined4 m_unk0x424; undefined4 m_unk0x424; // 0x424
undefined4 m_unk0x428; undefined4 m_unk0x428; // 0x428
undefined4 m_unk0x42c; undefined4 m_unk0x42c; // 0x42c
}; };
MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen); MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen);

View File

@ -165,7 +165,7 @@ LegoNavController* NavController()
} }
// FUNCTION: LEGO1 0x10015790 // FUNCTION: LEGO1 0x10015790
LegoWorld* GetCurrentVehicle() IslePathActor* GetCurrentVehicle()
{ {
return LegoOmni::GetInstance()->GetCurrentVehicle(); return LegoOmni::GetInstance()->GetCurrentVehicle();
} }

View File

@ -7,6 +7,7 @@
class GifManager; class GifManager;
class Isle; class Isle;
class IslePathActor;
class LegoAnimationManager; class LegoAnimationManager;
class LegoBuildingManager; class LegoBuildingManager;
class LegoControlManager; class LegoControlManager;
@ -104,7 +105,7 @@ class LegoOmni : public MxOmni {
GifManager* GetGifManager() { return m_gifManager; } GifManager* GetGifManager() { return m_gifManager; }
LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoWorld* GetCurrentWorld() { return m_currentWorld; }
LegoNavController* GetNavController() { return m_navController; } LegoNavController* GetNavController() { return m_navController; }
LegoWorld* GetCurrentVehicle() { return m_currentVehicle; } IslePathActor* GetCurrentVehicle() { return m_currentVehicle; }
LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } LegoPlantManager* GetLegoPlantManager() { return m_plantManager; }
LegoAnimationManager* GetAnimationManager() { return m_animationManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; }
LegoBuildingManager* GetLegoBuildingManager() { return m_buildingManager; } LegoBuildingManager* GetLegoBuildingManager() { return m_buildingManager; }
@ -122,7 +123,7 @@ class LegoOmni : public MxOmni {
LegoWorld* m_currentWorld; LegoWorld* m_currentWorld;
MxBool m_unk0x80; MxBool m_unk0x80;
LegoNavController* m_navController; // 0x84 LegoNavController* m_navController; // 0x84
LegoWorld* m_currentVehicle; // 0x88 IslePathActor* m_currentVehicle; // 0x88
LegoUnkSaveDataWriter* m_saveDataWriter; LegoUnkSaveDataWriter* m_saveDataWriter;
LegoPlantManager* m_plantManager; // 0x90 LegoPlantManager* m_plantManager; // 0x90
LegoAnimationManager* m_animationManager; LegoAnimationManager* m_animationManager;
@ -152,7 +153,7 @@ __declspec(dllexport) LegoVideoManager* VideoManager();
LegoAnimationManager* AnimationManager(); LegoAnimationManager* AnimationManager();
LegoBuildingManager* BuildingManager(); LegoBuildingManager* BuildingManager();
LegoControlManager* ControlManager(); LegoControlManager* ControlManager();
LegoWorld* GetCurrentVehicle(); IslePathActor* GetCurrentVehicle();
LegoPlantManager* PlantManager(); LegoPlantManager* PlantManager();
MxBool KeyValueStringParse(char*, const char*, const char*); MxBool KeyValueStringParse(char*, const char*, const char*);
LegoWorld* GetCurrentWorld(); LegoWorld* GetCurrentWorld();

View File

@ -2,86 +2,6 @@
DECOMP_SIZE_ASSERT(LegoPathActor, 0x154) DECOMP_SIZE_ASSERT(LegoPathActor, 0x154)
// Probably in header
// STUB: LEGO1 0x10002d20
void LegoPathActor::VTable0x78()
{
// TODO
}
// STUB: LEGO1 0x10002d30
void LegoPathActor::VTable0x7c()
{
// TODO
}
// STUB: LEGO1 0x10002d40
void LegoPathActor::VTable0x90()
{
// TODO
}
// STUB: LEGO1 0x10002d50
void LegoPathActor::VTable0x94()
{
// TODO
}
// STUB: LEGO1 0x10002d60
void LegoPathActor::VTable0xa0()
{
// TODO
}
// STUB: LEGO1 0x10002d70
void LegoPathActor::VTable0xac()
{
// TODO
}
// STUB: LEGO1 0x10002d80
void LegoPathActor::VTable0xb0()
{
// TODO
}
// STUB: LEGO1 0x10002d90
void LegoPathActor::VTable0xb4()
{
// TODO
}
// STUB: LEGO1 0x10002da0
void LegoPathActor::VTable0xb8()
{
// TODO
}
// STUB: LEGO1 0x10002db0
void LegoPathActor::VTable0xbc()
{
// TODO
}
// STUB: LEGO1 0x10002dc0
void LegoPathActor::VTable0xc0()
{
// TODO
}
// STUB: LEGO1 0x10002dd0
void LegoPathActor::VTable0xc4()
{
// TODO
}
// STUB: LEGO1 0x10002de0
void LegoPathActor::VTable0xc8()
{
// TODO
}
// End header
// STUB: LEGO1 0x1002d700 // STUB: LEGO1 0x1002d700
LegoPathActor::LegoPathActor() LegoPathActor::LegoPathActor()
{ {
@ -119,13 +39,13 @@ void LegoPathActor::VTable0x8c()
} }
// STUB: LEGO1 0x1002e740 // STUB: LEGO1 0x1002e740
void LegoPathActor::VTable0x74() void LegoPathActor::VTable0x74(Matrix4Impl& p_transform)
{ {
// TODO // TODO
} }
// STUB: LEGO1 0x1002e790 // STUB: LEGO1 0x1002e790
void LegoPathActor::VTable0x70() void LegoPathActor::VTable0x70(float)
{ {
// TODO // TODO
} }

View File

@ -3,13 +3,13 @@
#include "legoactor.h" #include "legoactor.h"
#include "mxtypes.h" #include "mxtypes.h"
#include "realtime/matrix.h"
// VTABLE: LEGO1 0x100d6e28 // VTABLE: LEGO1 0x100d6e28
// SIZE 0x154 (from inlined construction at 0x1000a346) // SIZE 0x154 (from inlined construction at 0x1000a346)
class LegoPathActor : public LegoActor { class LegoPathActor : public LegoActor {
public: public:
LegoPathActor(); LegoPathActor();
virtual ~LegoPathActor() override; virtual ~LegoPathActor() override;
// FUNCTION: LEGO1 0x1000c430 // FUNCTION: LEGO1 0x1000c430
@ -25,41 +25,60 @@ class LegoPathActor : public LegoActor {
return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name); return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name);
} }
virtual void VTable0x68(); // vtable+0x68 virtual void VTable0x68(); // vtable+0x68
virtual void VTable0x6c(); // vtable+0x6c virtual void VTable0x6c(); // vtable+0x6c
virtual void VTable0x70(); // vtable+0x70 virtual void VTable0x70(float p_float); // vtable+0x70
virtual void VTable0x74(); // vtable+0x74 virtual void VTable0x74(Matrix4Impl& p_transform); // vtable+0x74
virtual void VTable0x78(); // vtable+0x78 // FUNCTION: LEGO1 0x10002d20
virtual void VTable0x7c(); // vtable+0x7c virtual void VTable0x78(MxU8 p_unk0xea) { m_unk0xea = p_unk0xea; } // vtable+0x78
virtual void VTable0x80(); // vtable+0x80 // FUNCTION: LEGO1 0x10002d30
virtual void VTable0x84(); // vtable+0x84 virtual MxU8 VTable0x7c() { return m_unk0xea; } // vtable+0x7c
virtual void VTable0x88(); // vtable+0x88 virtual void VTable0x80(); // vtable+0x80
virtual void VTable0x8c(); // vtable+0x8c virtual void VTable0x84(); // vtable+0x84
virtual void VTable0x90(); // vtable+0x90 virtual void VTable0x88(); // vtable+0x88
virtual void VTable0x94(); // vtable+0x94 virtual void VTable0x8c(); // vtable+0x8c
virtual void VTable0x98(); // vtable+0x98 // FUNCTION: LEGO1 0x10002d40
virtual void VTable0x9c(); // vtable+0x9c virtual MxS32 VTable0x90() { return 0; } // vtable+0x90
virtual void VTable0xa0(); // vtable+0xa0 // FUNCTION: LEGO1 0x10002d50
virtual void VTable0xa4(); // vtable+0xa4 virtual MxS32 VTable0x94() { return 0; } // vtable+0x94
virtual void VTable0xa8(); // vtable+0xa8 virtual void VTable0x98(); // vtable+0x98
virtual void VTable0xac(); // vtable+0xac virtual void VTable0x9c(); // vtable+0x9c
virtual void VTable0xb0(); // vtable+0xb0 // FUNCTION: LEGO1 0x10002d60
virtual void VTable0xb4(); // vtable+0xb4 virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0
virtual void VTable0xb8(); // vtable+0xb8 virtual void VTable0xa4(); // vtable+0xa4
virtual void VTable0xbc(); // vtable+0xbc virtual void VTable0xa8(); // vtable+0xa8
virtual void VTable0xc0(); // vtable+0xc0 // FUNCTION: LEGO1 0x10002d70
virtual void VTable0xc4(); // vtable+0xc4 virtual void VTable0xac(MxFloat p_unk0x13c) { m_unk0x13c = p_unk0x13c; } // vtable+0xac
virtual void VTable0xc8(); // vtable+0xc8 // FUNCTION: LEGO1 0x10002d80
virtual MxFloat VTable0xb0() { return m_unk0x13c; } // vtable+0xb0
// FUNCTION: LEGO1 0x10002d90
virtual MxFloat VTable0xb4() { return m_unk0x140; } // vtable+0xb4
// FUNCTION: LEGO1 0x10002da0
virtual MxFloat VTable0xb8() { return m_unk0x144; } // vtable+0xb8
// FUNCTION: LEGO1 0x10002db0
virtual void VTable0xbc(MxFloat p_unk0x140) { m_unk0x140 = p_unk0x140; } // vtable+0xbc
// FUNCTION: LEGO1 0x10002dc0
virtual void VTable0xc0(MxFloat p_unk0x144) { m_unk0x144 = p_unk0x144; } // vtable+0xc0
// FUNCTION: LEGO1 0x10002dd0
virtual void VTable0xc4() {} // vtable+0xc4
// FUNCTION: LEGO1 0x10002de0
virtual void VTable0xc8(MxU8 p_unk0x148) { m_unk0x148 = p_unk0x148; } // vtable+0xc8
inline void SetUnknownDC(MxU32 p_unk0xdc) { m_unk0xdc = p_unk0xdc; }
protected: protected:
// TODO: the types undefined m_unk0x78[0x64]; // 0x78
undefined m_pad[0xc4]; MxU32 m_unk0xdc; // 0xdc
MxFloat m_unk0x13c; undefined m_unk0xe0[0xa]; // 0xe0
MxS32 m_unk0x140; MxU8 m_unk0xea; // 0xea
MxS32 m_unk0x144; undefined m_unk0xef[0x4d]; // 0xef
undefined m_unk0x148; MxU32 m_unk0x138; // 0x138
MxS32 m_unk0x14c; MxFloat m_unk0x13c; // 0x13c
MxFloat m_unk0x150; MxFloat m_unk0x140; // 0x140
MxFloat m_unk0x144; // 0x144
MxU8 m_unk0x148; // 0x148
MxS32 m_unk0x14c; // 0x14c
MxFloat m_unk0x150; // 0x150
}; };
#endif // LEGOPATHACTOR_H #endif // LEGOPATHACTOR_H

View File

@ -35,6 +35,16 @@ MxS32 g_roiConfig = 100;
// GLOBAL: LEGO1 0x101013ac // GLOBAL: LEGO1 0x101013ac
ROIHandler g_someHandlerFunction = NULL; ROIHandler g_someHandlerFunction = NULL;
// STUB: LEGO1 0x100a46b0
void LegoROI::FUN_100a46b0(Matrix4Impl& p_transform)
{
}
// STUB: LEGO1 0x100a58f0
void LegoROI::FUN_100a58f0(Matrix4Impl& p_transform)
{
}
// FUNCTION: LEGO1 0x100a81c0 // FUNCTION: LEGO1 0x100a81c0
void LegoROI::configureLegoROI(MxS32 p_roiConfig) void LegoROI::configureLegoROI(MxS32 p_roiConfig)
{ {

View File

@ -2,10 +2,11 @@
#define LEGOROI_H #define LEGOROI_H
#include "mxtypes.h" #include "mxtypes.h"
#include "viewmanager/viewroi.h"
typedef MxBool (*ROIHandler)(char*, char*, MxU32); typedef MxBool (*ROIHandler)(char*, char*, MxU32);
class LegoROI { class LegoROI : public ViewROI {
public: public:
__declspec(dllexport) void SetDisplayBB(MxS32 p_displayBB); __declspec(dllexport) void SetDisplayBB(MxS32 p_displayBB);
__declspec(dllexport) static void configureLegoROI(MxS32 p_roi); __declspec(dllexport) static void configureLegoROI(MxS32 p_roi);
@ -19,6 +20,8 @@ class LegoROI {
MxFloat& p_other MxFloat& p_other
); );
static MxBool ColorAliasLookup(char* p_param, MxFloat& p_red, MxFloat& p_green, MxFloat& p_blue, MxFloat& p_other); static MxBool ColorAliasLookup(char* p_param, MxFloat& p_red, MxFloat& p_green, MxFloat& p_blue, MxFloat& p_other);
void FUN_100a46b0(Matrix4Impl& p_transform);
void FUN_100a58f0(Matrix4Impl& p_transform);
}; };
#endif // LEGOROI_H #endif // LEGOROI_H

View File

@ -34,6 +34,11 @@ ExtraActionType MatchActionString(const char* p_str)
return result; return result;
} }
// STUB: LEGO1 0x1003e430
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender)
{
}
// FUNCTION: LEGO1 0x1003eae0 // FUNCTION: LEGO1 0x1003eae0
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut) void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut)
{ {
@ -112,3 +117,9 @@ void SetAppCursor(WPARAM p_wparam)
{ {
PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), 0x5400, p_wparam, 0); PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), 0x5400, p_wparam, 0);
} }
// STUB: LEGO1 0x1003ef60
MxBool FUN_1003ef60()
{
return TRUE;
}

View File

@ -2,7 +2,9 @@
#define LEGOUTIL_H #define LEGOUTIL_H
#include "extra.h" #include "extra.h"
#include "legoentity.h"
#include "mxatomid.h" #include "mxatomid.h"
#include "mxtypes.h"
#include <windows.h> #include <windows.h>
@ -54,8 +56,10 @@ inline void GetString(char** p_source, const char* p_dest, T* p_obj, void (T::*p
} }
ExtraActionType MatchActionString(const char*); ExtraActionType MatchActionString(const char*);
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender);
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut); void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut);
void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id); void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id);
void SetAppCursor(WPARAM p_wparam); void SetAppCursor(WPARAM p_wparam);
MxBool FUN_1003ef60();
#endif // LEGOUTIL_H #endif // LEGOUTIL_H

View File

@ -11,11 +11,6 @@ DECOMP_SIZE_ASSERT(LegoWorld, 0xf8);
MxBool g_isWorldActive; MxBool g_isWorldActive;
// FUNCTION: LEGO1 0x100010a0
void LegoWorld::VTable0x60()
{
}
// STUB: LEGO1 0x10015820 // STUB: LEGO1 0x10015820
void FUN_10015820(MxU32, MxU32) void FUN_10015820(MxU32, MxU32)
{ {
@ -91,6 +86,11 @@ void LegoWorld::VTable0x54()
// TODO // TODO
} }
// STUB: LEGO1 0x1001fc80
void LegoWorld::FUN_1001fc80(IslePathActor* p_actor)
{
}
// STUB: LEGO1 0x10020220 // STUB: LEGO1 0x10020220
void LegoWorld::VTable0x58(MxCore* p_object) void LegoWorld::VTable0x58(MxCore* p_object)
{ {
@ -108,8 +108,36 @@ void LegoWorld::VTable0x68(MxBool p_add)
// TODO // TODO
} }
// STUB: LEGO1 0x10022080
MxResult LegoWorld::Tickle()
{
return SUCCESS;
}
// FUNCTION: LEGO1 0x10022340 // FUNCTION: LEGO1 0x10022340
void LegoWorld::Stop() void LegoWorld::Stop()
{ {
TickleManager()->UnregisterClient(this); TickleManager()->UnregisterClient(this);
} }
// STUB: LEGO1 0x100727e0
MxBool LegoWorld::FUN_100727e0(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up)
{
return FALSE;
}
// STUB: LEGO1 0x10072980
MxBool LegoWorld::FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up)
{
return FALSE;
}
// STUB: LEGO1 0x10073400
void LegoWorld::FUN_10073400()
{
}
// STUB: LEGO1 0x10073400
void LegoWorld::FUN_10073430()
{
}

View File

@ -7,6 +7,8 @@
#include "mxpresenter.h" #include "mxpresenter.h"
#include "mxpresenterlist.h" #include "mxpresenterlist.h"
class IslePathActor;
// VTABLE: LEGO1 0x100d6280 // VTABLE: LEGO1 0x100d6280
// SIZE 0xf8 // SIZE 0xf8
class LegoWorld : public LegoEntity { class LegoWorld : public LegoEntity {
@ -15,6 +17,7 @@ class LegoWorld : public LegoEntity {
__declspec(dllexport) virtual ~LegoWorld(); // vtable+0x0 __declspec(dllexport) virtual ~LegoWorld(); // vtable+0x0
virtual MxLong Notify(MxParam& p_param) override; // vtable+0x4 virtual MxLong Notify(MxParam& p_param) override; // vtable+0x4
virtual MxResult Tickle() override; // vtable+0x8
// FUNCTION: LEGO1 0x1001d690 // FUNCTION: LEGO1 0x1001d690
inline virtual const char* ClassName() const override // vtable+0x0c inline virtual const char* ClassName() const override // vtable+0x0c
@ -33,22 +36,30 @@ class LegoWorld : public LegoEntity {
virtual void VTable0x54(); // vtable+54 virtual void VTable0x54(); // vtable+54
virtual void VTable0x58(MxCore* p_object); // vtable+58 virtual void VTable0x58(MxCore* p_object); // vtable+58
virtual MxBool VTable0x5c(); // vtable+5c virtual MxBool VTable0x5c(); // vtable+5c
virtual void VTable0x60(); // vtable+60 // FUNCTION: LEGO1 0x100010a0
virtual MxBool VTable0x64(); // vtable+64 virtual void VTable0x60() {} // vtable+60
virtual void VTable0x68(MxBool p_add); // vtable+68 virtual MxBool VTable0x64(); // vtable+64
virtual void VTable0x68(MxBool p_add); // vtable+68
inline LegoCameraController* GetCamera() { return m_camera; }
MxResult SetAsCurrentWorld(MxDSObject& p_dsObject); MxResult SetAsCurrentWorld(MxDSObject& p_dsObject);
void EndAction(MxPresenter* p_presenter); void EndAction(MxPresenter* p_presenter);
void FUN_1001fc80(IslePathActor* p_actor);
MxBool FUN_100727e0(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up);
MxBool FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up);
void FUN_10073400();
void FUN_10073430();
protected: protected:
LegoPathControllerList m_list0x68; // 0x68 LegoPathControllerList m_list0x68; // 0x68
MxPresenterList m_list0x80; // 0x80 MxPresenterList m_list0x80; // 0x80
LegoCameraController* m_camera; // 0x98 LegoCameraController* m_camera; // 0x98
undefined m_unk0x9c[0x1c]; undefined m_unk0x9c[0x1c]; // 0x9c
MxPresenterList m_list0xb8; // 0xb8 MxPresenterList m_list0xb8; // 0xb8
undefined m_unk0xd0[0x26]; undefined m_unk0xd0[0x26]; // 0xd0
undefined m_unk0xf6; undefined m_unk0xf6; // 0xf6
undefined m_unk0xf7; undefined m_unk0xf7; // 0xf7
}; };
void FUN_10015820(MxU32, MxU32); void FUN_10015820(MxU32, MxU32);

View File

@ -372,7 +372,7 @@ BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp)
m_bIgnoreWMSIZE = TRUE; m_bIgnoreWMSIZE = TRUE;
dwStyle = GetWindowLong(m_hWndMain, GWL_STYLE); dwStyle = GetWindowLong(m_hWndMain, GWL_STYLE);
dwStyle &= ~(WS_POPUP | WS_CAPTION | WS_THICKFRAME | WS_OVERLAPPED); dwStyle &= ~WS_POPUP;
dwStyle |= WS_CAPTION | WS_THICKFRAME | WS_OVERLAPPED; dwStyle |= WS_CAPTION | WS_THICKFRAME | WS_OVERLAPPED;
SetWindowLong(m_hWndMain, GWL_STYLE, dwStyle); SetWindowLong(m_hWndMain, GWL_STYLE, dwStyle);

View File

@ -1,6 +1,7 @@
#include "mxdsbuffer.h" #include "mxdsbuffer.h"
#include "mxomni.h" #include "mxomni.h"
#include "mxstreamcontroller.h"
#include "mxstreamer.h" #include "mxstreamer.h"
DECOMP_SIZE_ASSERT(MxDSBuffer, 0x34); DECOMP_SIZE_ASSERT(MxDSBuffer, 0x34);
@ -118,6 +119,13 @@ MxResult MxDSBuffer::SetBufferPointer(MxU32* p_buffer, MxU32 p_size)
return SUCCESS; return SUCCESS;
} }
// STUB: LEGO1 0x100c67b0
MxResult MxDSBuffer::FUN_100c67b0(MxStreamController* p_controller, MxDSAction* p_action, undefined4*)
{
// TODO STUB
return FAILURE;
}
// FUNCTION: LEGO1 0x100c6f80 // FUNCTION: LEGO1 0x100c6f80
void MxDSBuffer::FUN_100c6f80(MxU32 p_writeOffset) void MxDSBuffer::FUN_100c6f80(MxU32 p_writeOffset)
{ {

View File

@ -4,6 +4,9 @@
#include "decomp.h" #include "decomp.h"
#include "mxcore.h" #include "mxcore.h"
class MxStreamController;
class MxDSAction;
enum MxDSBufferType { enum MxDSBufferType {
MxDSBufferType_Chunk = 0, MxDSBufferType_Chunk = 0,
MxDSBufferType_Allocate = 1, MxDSBufferType_Allocate = 1,
@ -27,6 +30,7 @@ class MxDSBuffer : public MxCore {
MxResult AllocateBuffer(MxU32 p_bufferSize, MxDSBufferType p_mode); MxResult AllocateBuffer(MxU32 p_bufferSize, MxDSBufferType p_mode);
MxResult SetBufferPointer(MxU32* p_buffer, MxU32 p_size); MxResult SetBufferPointer(MxU32* p_buffer, MxU32 p_size);
MxResult FUN_100c67b0(MxStreamController* p_controller, MxDSAction* p_action, undefined4*);
void FUN_100c6f80(MxU32 p_writeOffset); void FUN_100c6f80(MxU32 p_writeOffset);
inline MxU8* GetBuffer() { return m_pBuffer; } inline MxU8* GetBuffer() { return m_pBuffer; }
@ -43,7 +47,7 @@ class MxDSBuffer : public MxCore {
MxDSBufferType m_mode; MxDSBufferType m_mode;
MxU32 m_writeOffset; MxU32 m_writeOffset;
MxU32 m_bytesRemaining; MxU32 m_bytesRemaining;
undefined4 m_unk0x30; MxDSAction* m_unk0x30;
}; };
#endif // MXDSBUFFER_H #endif // MXDSBUFFER_H

View File

@ -6,6 +6,8 @@
#include "mxstring.h" #include "mxstring.h"
#include "mxtypes.h" #include "mxtypes.h"
#include <windows.h>
// VTABLE: LEGO1 0x100dc890 // VTABLE: LEGO1 0x100dc890
class MxDSFile : public MxDSSource { class MxDSFile : public MxDSSource {
public: public:
@ -34,6 +36,8 @@ class MxDSFile : public MxDSSource {
inline void SetFileName(const char* p_filename) { m_filename = p_filename; } inline void SetFileName(const char* p_filename) { m_filename = p_filename; }
inline MxS32 CalcFileSize() { return GetFileSize(m_io.m_info.hmmio, NULL); }
private: private:
MxLong ReadChunks(); MxLong ReadChunks();
struct ChunkHeader { struct ChunkHeader {

View File

@ -1,11 +1,12 @@
#include "mxramstreamcontroller.h" #include "mxramstreamcontroller.h"
#include "mxautolocker.h" #include "mxautolocker.h"
#include "mxdsstreamingaction.h"
#include "mxramstreamprovider.h" #include "mxramstreamprovider.h"
DECOMP_SIZE_ASSERT(MxRAMStreamController, 0x98); DECOMP_SIZE_ASSERT(MxRAMStreamController, 0x98);
undefined* __cdecl FUN_100d0d80(MxU32* p_fileSizeBuffer, MxU32 p_fileSize); undefined* __cdecl ReadData(MxU32* p_fileSizeBuffer, MxU32 p_fileSize);
// FUNCTION: LEGO1 0x100c6110 // FUNCTION: LEGO1 0x100c6110
MxResult MxRAMStreamController::Open(const char* p_filename) MxResult MxRAMStreamController::Open(const char* p_filename)
@ -21,7 +22,7 @@ MxResult MxRAMStreamController::Open(const char* p_filename)
return FAILURE; return FAILURE;
} }
FUN_100d0d80( ReadData(
((MxRAMStreamProvider*) m_provider)->GetBufferOfFileSize(), ((MxRAMStreamProvider*) m_provider)->GetBufferOfFileSize(),
((MxRAMStreamProvider*) m_provider)->GetFileSize() ((MxRAMStreamProvider*) m_provider)->GetFileSize()
); );
@ -35,11 +36,32 @@ MxResult MxRAMStreamController::Open(const char* p_filename)
return FAILURE; return FAILURE;
} }
// STUB: LEGO1 0x100c6210 // FUNCTION: LEGO1 0x100c6210
MxResult MxRAMStreamController::VTable0x20(MxDSAction* p_action) MxResult MxRAMStreamController::VTable0x20(MxDSAction* p_action)
{ {
// TODO STUB MxAutoLocker locker(&m_criticalSection);
return FAILURE; MxS16 unk0x24 = 0;
MxResult result = FAILURE;
if (p_action->GetUnknown24() == -1) {
p_action->SetUnknown24(-3);
MxDSAction* action = m_unk0x54.Find(p_action, FALSE);
if (action != NULL) {
unk0x24 = action->GetUnknown24() + 1;
}
p_action->SetUnknown24(unk0x24);
}
else {
if (m_unk0x54.Find(p_action, FALSE)) {
return FAILURE;
}
}
if (MxStreamController::VTable0x20(p_action) == SUCCESS) {
MxDSStreamingAction* action = (MxDSStreamingAction*) m_unk0x3c.Find(p_action, FALSE);
MxDSStreamingAction streamingaction(*action);
result = DeserializeObject(streamingaction);
}
return result;
} }
// FUNCTION: LEGO1 0x100c6320 // FUNCTION: LEGO1 0x100c6320
@ -57,8 +79,21 @@ MxResult MxRAMStreamController::VTable0x24(MxDSAction* p_action)
return SUCCESS; return SUCCESS;
} }
// FUNCTION: LEGO1 0x100c63c0
MxResult MxRAMStreamController::DeserializeObject(MxDSStreamingAction& p_action)
{
MxAutoLocker locker(&m_criticalSection);
MxResult result;
undefined4 value = 0;
do {
m_buffer.FUN_100c6f80(p_action.GetUnknown94());
result = m_buffer.FUN_100c67b0(this, &p_action, &value);
} while (m_unk0x3c.Find(&p_action, FALSE) != NULL);
return result;
}
// STUB: LEGO1 0x100d0d80 // STUB: LEGO1 0x100d0d80
undefined* __cdecl FUN_100d0d80(MxU32* p_fileSizeBuffer, MxU32 p_fileSize) undefined* __cdecl ReadData(MxU32* p_fileSizeBuffer, MxU32 p_fileSize)
{ {
return NULL; return NULL;
} }

View File

@ -2,6 +2,7 @@
#define MXRAMSTREAMCONTROLLER_H #define MXRAMSTREAMCONTROLLER_H
#include "mxdsbuffer.h" #include "mxdsbuffer.h"
#include "mxdsstreamingaction.h"
#include "mxstreamcontroller.h" #include "mxstreamcontroller.h"
// VTABLE: LEGO1 0x100dc728 // VTABLE: LEGO1 0x100dc728
@ -30,6 +31,8 @@ class MxRAMStreamController : public MxStreamController {
private: private:
MxDSBuffer m_buffer; MxDSBuffer m_buffer;
MxResult DeserializeObject(MxDSStreamingAction& p_action);
}; };
#endif // MXRAMSTREAMCONTROLLER_H #endif // MXRAMSTREAMCONTROLLER_H

View File

@ -1,6 +1,8 @@
#include "mxramstreamprovider.h" #include "mxramstreamprovider.h"
#include "decomp.h" #include "decomp.h"
#include "mxomni.h"
#include "mxstreamcontroller.h"
DECOMP_SIZE_ASSERT(MxRAMStreamProvider, 0x24); DECOMP_SIZE_ASSERT(MxRAMStreamProvider, 0x24);
@ -53,8 +55,44 @@ MxRAMStreamProvider::~MxRAMStreamProvider()
m_bufferForDWords = NULL; m_bufferForDWords = NULL;
} }
// STUB: LEGO1 0x100d0ae0 // FUNCTION: LEGO1 0x100d0ae0
MxResult MxRAMStreamProvider::SetResourceToGet(MxStreamController* p_resource) MxResult MxRAMStreamProvider::SetResourceToGet(MxStreamController* p_resource)
{ {
return FAILURE; MxResult result = FAILURE;
MxString path;
m_pLookup = p_resource;
path = (MxString(MxOmni::GetHD()) + p_resource->GetAtom().GetInternal() + ".si");
m_pFile = new MxDSFile(path.GetData(), 0);
if (m_pFile != NULL) {
if (m_pFile->Open(0) != 0) {
path = MxString(MxOmni::GetCD()) + p_resource->GetAtom().GetInternal() + ".si";
m_pFile->SetFileName(path.GetData());
if (m_pFile->Open(0) != 0)
goto done;
}
m_fileSize = m_pFile->CalcFileSize();
if (m_fileSize != 0) {
m_bufferSize = m_pFile->GetBufferSize();
m_pBufferOfFileSize = new MxU32[m_fileSize];
if (m_pBufferOfFileSize != NULL &&
m_pFile->Read((unsigned char*) m_pBufferOfFileSize, m_fileSize) == SUCCESS) {
m_lengthInDWords = m_pFile->GetLengthInDWords();
m_bufferForDWords = new MxU32[m_lengthInDWords * sizeof(MxU32)];
if (m_bufferForDWords != NULL) {
memcpy(m_bufferForDWords, m_pFile->GetBuffer(), m_lengthInDWords);
result = SUCCESS;
}
}
}
}
done:
delete m_pFile;
m_pFile = NULL;
return result;
} }

View File

@ -0,0 +1,14 @@
#ifndef MXTYPE18NOTIFICATIONPARAM_H
#define MXTYPE18NOTIFICATIONPARAM_H
#include "decomp.h"
#include "mxnotificationparam.h"
// VTABLE: LEGO1 0x100d7e80
// SIZE 0x10
class MxType18NotificationParam : public MxNotificationParam {
protected:
undefined4 m_unk0xc; // 0xc
};
#endif // MXTYPE18NOTIFICATIONPARAM_H

View File

@ -0,0 +1,15 @@
#ifndef MXTYPE19NOTIFICATIONPARAM_H
#define MXTYPE19NOTIFICATIONPARAM_H
#include "decomp.h"
#include "mxnotificationparam.h"
// VTABLE: LEGO1 0x100d6230
// SIZE 0x10
class MxType19NotificationParam : public MxNotificationParam {
protected:
MxU16 m_unk0xc; // 0xc
MxU8 m_unk0xe; // 0xe
};
#endif // MXTYPE19NOTIFICATIONPARAM_H

View File

@ -168,7 +168,7 @@ void Matrix4Impl::ToQuaternion(Vector4Impl* p_outQuat)
// No idea what this function is doing and it will be hard to tell until // No idea what this function is doing and it will be hard to tell until
// we have a confirmed usage site. // we have a confirmed usage site.
// STUB: LEGO1 0x10002710 // STUB: LEGO1 0x10002710
int Matrix4Impl::FUN_10002710(const Vector3Impl* p_vec) int Matrix4Impl::FromQuaternion(const Vector4Impl& p_vec)
{ {
return -1; return -1;
} }

View File

@ -63,7 +63,7 @@ class Matrix4Impl {
// vtable + 0x40 // vtable + 0x40
virtual void ToQuaternion(Vector4Impl* p_resultQuat); virtual void ToQuaternion(Vector4Impl* p_resultQuat);
virtual int FUN_10002710(const Vector3Impl* p_vec); virtual int FromQuaternion(const Vector4Impl& p_vec);
inline float& operator[](size_t idx) { return ((float*) m_data)[idx]; } inline float& operator[](size_t idx) { return ((float*) m_data)[idx]; }

View File

@ -4,6 +4,8 @@
#include "matrix.h" #include "matrix.h"
#include "roi.h" #include "roi.h"
// VTABLE: LEGO1 0x100dbc08
// SIZE 0xdc
class OrientableROI : public ROI { class OrientableROI : public ROI {
public: public:
// FUNCTION: LEGO1 0x100a4420 // FUNCTION: LEGO1 0x100a4420
@ -16,34 +18,30 @@ class OrientableROI : public ROI {
ZEROVEC3(m_world_velocity); ZEROVEC3(m_world_velocity);
IDENTMAT4(m_local2world.GetMatrix()); IDENTMAT4(m_local2world.GetMatrix());
} }
virtual const Vector3& GetWorldVelocity() const override; // vtable+0x8
virtual const BoundingBox& GetWorldBoundingBox() const override; // vtable+0xc
virtual const BoundingSphere& GetWorldBoundingSphere() const override; // vtable+0x10
// FUNCTION: LEGO1 0x100a5db0
virtual void VTable0x14() { VTable0x1c(); } // vtable+0x14
virtual void UpdateWorldBoundingVolumes() = 0; // vtable+0x18
virtual void VTable0x1c(); // vtable+0x1c
virtual void SetLocalTransform(const Matrix4Impl& p_transform); // vtable+0x20
virtual void VTable0x24(const Matrix4Data& p_transform); // vtable+0x24
virtual void UpdateWorldData(const Matrix4Data& p_transform); // vtable+0x28
virtual void UpdateWorldVelocity(); // vtable+0x2c
// SYNTHETIC: LEGO1 0x100a4630 // SYNTHETIC: LEGO1 0x100a4630
// OrientableROI::`scalar deleting destructor' // OrientableROI::`scalar deleting destructor'
virtual const Vector3& GetWorldVelocity() const;
virtual const BoundingBox& GetWorldBoundingBox() const;
virtual const BoundingSphere& GetWorldBoundingSphere() const;
protected: protected:
// vtable + 0x14 char m_unk0xc; // 0xc
virtual void VTable0x14() { VTable0x1c(); }
virtual void UpdateWorldBoundingVolumes() = 0;
public:
virtual void VTable0x1c();
// vtable + 0x20
virtual void SetLocalTransform(const Matrix4Impl& p_transform);
virtual void VTable0x24(const Matrix4Data& p_transform);
virtual void UpdateWorldData(const Matrix4Data& p_transform);
virtual void UpdateWorldVelocity();
protected:
char m_unk0xc;
Matrix4Data m_local2world; // 0x10 Matrix4Data m_local2world; // 0x10
BoundingBox m_world_bounding_box; // 0x58 BoundingBox m_world_bounding_box; // 0x58
BoundingSphere m_world_bounding_sphere; // 0xa8 BoundingSphere m_world_bounding_sphere; // 0xa8
Vector3Data m_world_velocity; // 0xc0 Vector3Data m_world_velocity; // 0xc0
unsigned int m_unk0xd4; unsigned int m_unk0xd4; // 0xd4
unsigned int m_unk0xd8; unsigned int m_unk0xd8; // 0xd8
}; };
#endif // ORIENTABLEROI_H #endif // ORIENTABLEROI_H

View File

@ -49,9 +49,9 @@ class LODObject {
public: public:
// LODObject(); // LODObject();
virtual ~LODObject() {} virtual ~LODObject() {}
virtual float Cost(float pixels_covered) const = 0; virtual float Cost(float pixels_covered) const = 0; // vtable+0x4
virtual float AveragePolyArea() const = 0; virtual float AveragePolyArea() const = 0; // vtable+0x8
virtual int NVerts() const = 0; virtual int NVerts() const = 0; // vtable+0xc
}; };
/* /*
@ -73,6 +73,8 @@ typedef vector<const ROI*> ROIList;
*/ */
typedef vector<int> IntList; typedef vector<int> IntList;
// VTABLE: LEGO1 0x100dbc38
// SIZE 0xc
class ROI { class ROI {
public: public:
ROI() ROI()
@ -86,10 +88,10 @@ class ROI {
assert(!m_comp); assert(!m_comp);
assert(!m_lods); assert(!m_lods);
} }
virtual float IntrinsicImportance() const = 0; virtual float IntrinsicImportance() const = 0; // vtable+0x4
virtual const Vector3& GetWorldVelocity() const = 0; virtual const Vector3& GetWorldVelocity() const = 0; // vtable+0x8
virtual const BoundingBox& GetWorldBoundingBox() const = 0; virtual const BoundingBox& GetWorldBoundingBox() const = 0; // vtable+0xc
virtual const BoundingSphere& GetWorldBoundingSphere() const = 0; virtual const BoundingSphere& GetWorldBoundingSphere() const = 0; // vtable+0x10
const LODListBase* GetLODs() const { return m_lods; } const LODListBase* GetLODs() const { return m_lods; }
const LODObject* GetLOD(int i) const const LODObject* GetLOD(int i) const
@ -101,7 +103,7 @@ class ROI {
const CompoundObject* GetComp() const { return m_comp; } const CompoundObject* GetComp() const { return m_comp; }
protected: protected:
CompoundObject* m_comp; CompoundObject* m_comp; // 0x4
LODListBase* m_lods; LODListBase* m_lods; // 0x8
}; };
#endif // ROI_H #endif // ROI_H

View File

@ -133,57 +133,57 @@ int Vector2Impl::Unitize()
} }
// FUNCTION: LEGO1 0x100021c0 // FUNCTION: LEGO1 0x100021c0
void Vector2Impl::AddScalar(float p_value) void Vector2Impl::Add(float p_value)
{ {
AddScalarImpl(p_value); AddScalarImpl(p_value);
} }
// FUNCTION: LEGO1 0x100021d0 // FUNCTION: LEGO1 0x100021d0
void Vector2Impl::AddVector(float* p_other) void Vector2Impl::Add(float* p_other)
{ {
AddVectorImpl(p_other); AddVectorImpl(p_other);
} }
// FUNCTION: LEGO1 0x100021e0 // FUNCTION: LEGO1 0x100021e0
void Vector2Impl::AddVector(Vector2Impl* p_other) void Vector2Impl::Add(Vector2Impl* p_other)
{ {
AddVectorImpl(p_other->m_data); AddVectorImpl(p_other->m_data);
} }
// FUNCTION: LEGO1 0x100021f0 // FUNCTION: LEGO1 0x100021f0
void Vector2Impl::SubVector(float* p_other) void Vector2Impl::Sub(float* p_other)
{ {
SubVectorImpl(p_other); SubVectorImpl(p_other);
} }
// FUNCTION: LEGO1 0x10002200 // FUNCTION: LEGO1 0x10002200
void Vector2Impl::SubVector(Vector2Impl* p_other) void Vector2Impl::Sub(Vector2Impl* p_other)
{ {
SubVectorImpl(p_other->m_data); SubVectorImpl(p_other->m_data);
} }
// FUNCTION: LEGO1 0x10002210 // FUNCTION: LEGO1 0x10002210
void Vector2Impl::MullVector(float* p_other) void Vector2Impl::Mul(float* p_other)
{ {
MullVectorImpl(p_other); MullVectorImpl(p_other);
} }
// FUNCTION: LEGO1 0x10002220 // FUNCTION: LEGO1 0x10002220
void Vector2Impl::MullVector(Vector2Impl* p_other) void Vector2Impl::Mul(Vector2Impl* p_other)
{ {
MullVectorImpl(p_other->m_data); MullVectorImpl(p_other->m_data);
} }
// FUNCTION: LEGO1 0x10002230 // FUNCTION: LEGO1 0x10002230
void Vector2Impl::MullScalar(float* p_value) void Vector2Impl::Mul(float& p_value)
{ {
MullScalarImpl(p_value); MullScalarImpl(&p_value);
} }
// FUNCTION: LEGO1 0x10002240 // FUNCTION: LEGO1 0x10002240
void Vector2Impl::DivScalar(float* p_value) void Vector2Impl::Div(float& p_value)
{ {
DivScalarImpl(p_value); DivScalarImpl(&p_value);
} }
// FUNCTION: LEGO1 0x10002250 // FUNCTION: LEGO1 0x10002250

View File

@ -93,19 +93,19 @@ class Vector2Impl {
virtual int Unitize(); virtual int Unitize();
// vtable + 0x48 // vtable + 0x48
virtual void AddVector(Vector2Impl* p_other); virtual void Add(Vector2Impl* p_other);
virtual void AddVector(float* p_other); virtual void Add(float* p_other);
virtual void AddScalar(float p_value); virtual void Add(float p_value);
// vtable + 0x54 // vtable + 0x54
virtual void SubVector(Vector2Impl* p_other); virtual void Sub(Vector2Impl* p_other);
virtual void SubVector(float* p_other); virtual void Sub(float* p_other);
// vtable + 0x5C // vtable + 0x5C
virtual void MullScalar(float* p_value); virtual void Mul(float* p_value);
virtual void MullVector(Vector2Impl* p_other); virtual void Mul(Vector2Impl* p_other);
virtual void MullVector(float* p_other); virtual void Mul(float& p_other);
virtual void DivScalar(float* p_value); virtual void Div(float& p_value);
// vtable + 0x6C // vtable + 0x6C
virtual void SetVector(Vector2Impl* p_other); virtual void SetVector(Vector2Impl* p_other);
@ -197,6 +197,7 @@ class Vector3Data : public Vector3Impl {
for (size_t i = sizeof(m_vector) / sizeof(float); i > 0; --i) for (size_t i = sizeof(m_vector) / sizeof(float); i > 0; --i)
*dest++ = *src++; *dest++ = *src++;
} }
inline void EqualsCross(Vector3Data& p_a, Vector3Data& p_b) { EqualsCrossImpl(p_a.m_data, p_b.m_data); }
private: private:
Vector3 m_vector; Vector3 m_vector;

View File

@ -5,6 +5,7 @@
#include "assert.h" #include "assert.h"
#include "compat.h" #include "compat.h"
#pragma warning(disable : 4237)
#pragma warning(disable : 4786) #pragma warning(disable : 4786)
class ViewLOD; class ViewLOD;

View File

@ -72,6 +72,7 @@ def __init__(self, filename, logger=None):
self.imagebase = None self.imagebase = None
self.sections = [] self.sections = []
self.last_section = None self.last_section = None
self._relocated_addrs = set()
def __enter__(self): def __enter__(self):
self._debuglog(f"Bin {self.filename} Enter") self._debuglog(f"Bin {self.filename} Enter")
@ -100,6 +101,8 @@ def __enter__(self):
for i in range(pe_hdr.NumberOfSections) for i in range(pe_hdr.NumberOfSections)
] ]
self._populate_relocations()
text_section = self._get_section_by_name(".text") text_section = self._get_section_by_name(".text")
self.last_section = text_section self.last_section = text_section
@ -116,6 +119,52 @@ def _debuglog(self, msg):
if self.logger is not None: if self.logger is not None:
self.logger.debug(msg) self.logger.debug(msg)
def get_relocated_addresses(self):
return sorted(self._relocated_addrs)
def is_relocated_addr(self, vaddr) -> bool:
return vaddr in self._relocated_addrs
def _populate_relocations(self):
"""The relocation table in .reloc gives each virtual address where the next four
bytes are, itself, another virtual address. During loading, these values will be
patched according to the virtual address space for the image, as provided by Windows.
We can use this information to get a list of where each significant "thing"
in the file is located. Anything that is referenced absolutely (i.e. excluding
jump destinations given by local offset) will be here.
One use case is to tell whether an immediate value in an operand represents
a virtual address or just a big number."""
ofs = self.get_section_offset_by_name(".reloc")
reloc_addrs = []
# Parse the structure in .reloc to get the list locations to check.
# The first 8 bytes are 2 dwords that give the base page address
# and the total block size (including this header).
# The page address is used to compact the list; each entry is only
# 2 bytes, and these are added to the base to get the full location.
# If the entry read in is zero, we are at the end of this section and
# these are padding bytes.
while True:
(page_base, block_size) = struct.unpack("<2I", self.read(ofs, 8))
if block_size == 0:
break
# HACK: ignore the relocation type for now (the top 4 bits of the value).
values = list(struct.iter_unpack("<H", self.read(ofs + 8, block_size - 8)))
reloc_addrs += [
self.imagebase + page_base + (v[0] & 0xFFF) for v in values if v[0] != 0
]
ofs += block_size
# We are now interested in the relocated addresses themselves. Seek to the
# address where there is a relocation, then read the four bytes into our set.
reloc_addrs.sort()
for addr in reloc_addrs:
(relocated_addr,) = struct.unpack("<I", self.read(addr, 4))
self._relocated_addrs.add(relocated_addr)
def _set_section_for_vaddr(self, vaddr): def _set_section_for_vaddr(self, vaddr):
if self.last_section is not None and section_contains_vaddr( if self.last_section is not None and section_contains_vaddr(
self.last_section, self.imagebase, vaddr self.last_section, self.imagebase, vaddr

View File

@ -87,7 +87,7 @@ def filter_out_ptr(ptype, op_str):
for i, word in enumerate(words): for i, word in enumerate(words):
try: try:
inttest = int(word, 16) inttest = int(word, 16)
if inttest >= file.get_section_offset_by_index(1): if file.is_relocated_addr(inttest):
words[i] = placeholder_generator.get(inttest) words[i] = placeholder_generator.get(inttest)
except ValueError: except ValueError:
pass pass