mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-21 15:21:15 +00:00
Merge branch 'master' into scrap
This commit is contained in:
commit
94b85ceb3d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
Debug/
|
Debug/
|
||||||
Release/
|
Release/
|
||||||
*.ncb
|
*.ncb
|
||||||
|
/.vs
|
||||||
ISLE.EXE
|
ISLE.EXE
|
||||||
LEGO1.DLL
|
LEGO1.DLL
|
||||||
build/
|
build/
|
||||||
|
|||||||
@ -45,7 +45,9 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/jukeboxentity.cpp
|
LEGO1/jukeboxentity.cpp
|
||||||
LEGO1/jukeboxstate.cpp
|
LEGO1/jukeboxstate.cpp
|
||||||
LEGO1/legoact2state.cpp
|
LEGO1/legoact2state.cpp
|
||||||
|
LEGO1/legoactor.cpp
|
||||||
LEGO1/legoactioncontrolpresenter.cpp
|
LEGO1/legoactioncontrolpresenter.cpp
|
||||||
|
LEGO1/legoactor.cpp
|
||||||
LEGO1/legoanimactor.cpp
|
LEGO1/legoanimactor.cpp
|
||||||
LEGO1/legoanimationmanager.cpp
|
LEGO1/legoanimationmanager.cpp
|
||||||
LEGO1/legoanimmmpresenter.cpp
|
LEGO1/legoanimmmpresenter.cpp
|
||||||
@ -101,6 +103,7 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/mxdirectdraw.cpp
|
LEGO1/mxdirectdraw.cpp
|
||||||
LEGO1/mxdiskstreamcontroller.cpp
|
LEGO1/mxdiskstreamcontroller.cpp
|
||||||
LEGO1/mxdiskstreamprovider.cpp
|
LEGO1/mxdiskstreamprovider.cpp
|
||||||
|
LEGO1/mxdisplaysurface.cpp
|
||||||
LEGO1/mxdsaction.cpp
|
LEGO1/mxdsaction.cpp
|
||||||
LEGO1/mxdsanim.cpp
|
LEGO1/mxdsanim.cpp
|
||||||
LEGO1/mxdschunk.cpp
|
LEGO1/mxdschunk.cpp
|
||||||
@ -125,6 +128,7 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/mxloopingflcpresenter.cpp
|
LEGO1/mxloopingflcpresenter.cpp
|
||||||
LEGO1/mxloopingmidipresenter.cpp
|
LEGO1/mxloopingmidipresenter.cpp
|
||||||
LEGO1/mxloopingsmkpresenter.cpp
|
LEGO1/mxloopingsmkpresenter.cpp
|
||||||
|
LEGO1/mxmatrix.cpp
|
||||||
LEGO1/mxmediapresenter.cpp
|
LEGO1/mxmediapresenter.cpp
|
||||||
LEGO1/mxmidipresenter.cpp
|
LEGO1/mxmidipresenter.cpp
|
||||||
LEGO1/mxmusicpresenter.cpp
|
LEGO1/mxmusicpresenter.cpp
|
||||||
@ -147,11 +151,13 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/mxstring.cpp
|
LEGO1/mxstring.cpp
|
||||||
LEGO1/mxstringvariable.cpp
|
LEGO1/mxstringvariable.cpp
|
||||||
LEGO1/mxthread.cpp
|
LEGO1/mxthread.cpp
|
||||||
|
LEGO1/mxticklemanager.cpp
|
||||||
LEGO1/mxtimer.cpp
|
LEGO1/mxtimer.cpp
|
||||||
LEGO1/mxtransitionmanager.cpp
|
LEGO1/mxtransitionmanager.cpp
|
||||||
LEGO1/mxunknown100dc6b0.cpp
|
LEGO1/mxunknown100dc6b0.cpp
|
||||||
LEGO1/mxunknown100dc6e0.cpp
|
LEGO1/mxunknown100dc6e0.cpp
|
||||||
LEGO1/mxvariabletable.cpp
|
LEGO1/mxvariabletable.cpp
|
||||||
|
LEGO1/mxvector.cpp
|
||||||
LEGO1/mxvideomanager.cpp
|
LEGO1/mxvideomanager.cpp
|
||||||
LEGO1/mxvideoparam.cpp
|
LEGO1/mxvideoparam.cpp
|
||||||
LEGO1/mxvideoparamflags.cpp
|
LEGO1/mxvideoparamflags.cpp
|
||||||
|
|||||||
@ -121,7 +121,7 @@ BOOL IsleApp::SetupLegoOmni()
|
|||||||
BOOL failure = Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE;
|
BOOL failure = Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE;
|
||||||
if (!failure) {
|
if (!failure) {
|
||||||
VariableTable()->SetVariable("ACTOR_01", "");
|
VariableTable()->SetVariable("ACTOR_01", "");
|
||||||
TickleManager()->vtable1c(VideoManager(), 10);
|
TickleManager()->SetClientTickleInterval(VideoManager(), 10);
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,10 @@
|
|||||||
#define DECOMP_STATIC_ASSERT(V) namespace { typedef int foo[(V)?1:-1]; }
|
#define DECOMP_STATIC_ASSERT(V) namespace { typedef int foo[(V)?1:-1]; }
|
||||||
#define DECOMP_SIZE_ASSERT(T, S) DECOMP_STATIC_ASSERT(sizeof(T) == S)
|
#define DECOMP_SIZE_ASSERT(T, S) DECOMP_STATIC_ASSERT(sizeof(T) == S)
|
||||||
|
|
||||||
|
#ifndef _countof
|
||||||
|
#define _countof(arr) sizeof(arr) / sizeof(arr[0])
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef unsigned char undefined;
|
typedef unsigned char undefined;
|
||||||
typedef unsigned short undefined2;
|
typedef unsigned short undefined2;
|
||||||
typedef unsigned int undefined4;
|
typedef unsigned int undefined4;
|
||||||
|
|||||||
@ -1 +1,4 @@
|
|||||||
#include "isleactor.h"
|
#include "isleactor.h"
|
||||||
|
|
||||||
|
// NOTE: This is copied from base class LegoActor. IsleActor may in fact be larger but we don't know yet.
|
||||||
|
DECOMP_SIZE_ASSERT(IsleActor, 0x78)
|
||||||
|
|||||||
@ -1 +1,17 @@
|
|||||||
#include "islepathactor.h"
|
#include "islepathactor.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(IslePathActor, 0x160)
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1001a200
|
||||||
|
IslePathActor::IslePathActor()
|
||||||
|
{
|
||||||
|
this->m_pLegoWorld = NULL;
|
||||||
|
this->m_unk13c = 6.0;
|
||||||
|
this->m_unk15c = 1.0;
|
||||||
|
this->m_unk158 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002e10
|
||||||
|
IslePathActor::~IslePathActor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
@ -2,12 +2,17 @@
|
|||||||
#define ISLEPATHACTOR_H
|
#define ISLEPATHACTOR_H
|
||||||
|
|
||||||
#include "legopathactor.h"
|
#include "legopathactor.h"
|
||||||
|
#include "legoworld.h"
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
// VTABLE 0x100d4398
|
// VTABLE 0x100d4398
|
||||||
// SIZE >= 0x230
|
// SIZE 0x160
|
||||||
class IslePathActor : public LegoPathActor
|
class IslePathActor : public LegoPathActor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
IslePathActor();
|
||||||
|
~IslePathActor();
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x10002ea0
|
// OFFSET: LEGO1 0x10002ea0
|
||||||
inline virtual const char *ClassName() const override // vtable+0x0c
|
inline virtual const char *ClassName() const override // vtable+0x0c
|
||||||
{
|
{
|
||||||
@ -20,6 +25,11 @@ class IslePathActor : public LegoPathActor
|
|||||||
{
|
{
|
||||||
return !strcmp(name, IslePathActor::ClassName()) || LegoPathActor::IsA(name);
|
return !strcmp(name, IslePathActor::ClassName()) || LegoPathActor::IsA(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
LegoWorld* m_pLegoWorld; // 0x154
|
||||||
|
MxFloat m_unk158;
|
||||||
|
MxFloat m_unk15c;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ISLEPATHACTOR_H
|
#endif // ISLEPATHACTOR_H
|
||||||
|
|||||||
3
LEGO1/legoactor.cpp
Normal file
3
LEGO1/legoactor.cpp
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#include "legoactor.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(LegoActor, 0x78)
|
||||||
@ -1,6 +1,7 @@
|
|||||||
#ifndef LEGOACTOR_H
|
#ifndef LEGOACTOR_H
|
||||||
#define LEGOACTOR_H
|
#define LEGOACTOR_H
|
||||||
|
|
||||||
|
#include "decomp.h"
|
||||||
#include "legoentity.h"
|
#include "legoentity.h"
|
||||||
|
|
||||||
// VTABLE 0x100d6d68
|
// VTABLE 0x100d6d68
|
||||||
@ -20,6 +21,10 @@ class LegoActor : public LegoEntity
|
|||||||
{
|
{
|
||||||
return !strcmp(name, LegoActor::ClassName()) || LegoEntity::IsA(name);
|
return !strcmp(name, LegoActor::ClassName()) || LegoEntity::IsA(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
undefined unk68[0x10];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LEGOACTOR_H
|
#endif // LEGOACTOR_H
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#include "legoentity.h"
|
#include "legoentity.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(LegoEntity, 0x68)
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1000c290
|
// OFFSET: LEGO1 0x1000c290
|
||||||
LegoEntity::~LegoEntity()
|
LegoEntity::~LegoEntity()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include "mxentity.h"
|
#include "mxentity.h"
|
||||||
|
|
||||||
// VTABLE 0x100d4858
|
// VTABLE 0x100d4858
|
||||||
|
// SIZE 0x68 (probably)
|
||||||
class LegoEntity : public MxEntity
|
class LegoEntity : public MxEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#include "legopathactor.h"
|
#include "legopathactor.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(LegoPathActor, 0x154)
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1002d700 STUB
|
// OFFSET: LEGO1 0x1002d700 STUB
|
||||||
LegoPathActor::LegoPathActor()
|
LegoPathActor::LegoPathActor()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#define LEGOPATHACTOR_H
|
#define LEGOPATHACTOR_H
|
||||||
|
|
||||||
#include "legoactor.h"
|
#include "legoactor.h"
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
// VTABLE 0x100d6e28
|
// VTABLE 0x100d6e28
|
||||||
// SIZE 0x154 (from inlined construction at 0x1000a346)
|
// SIZE 0x154 (from inlined construction at 0x1000a346)
|
||||||
@ -25,6 +26,10 @@ class LegoPathActor : public LegoActor
|
|||||||
return !strcmp(name, LegoPathActor::ClassName()) || LegoActor::IsA(name);
|
return !strcmp(name, LegoPathActor::ClassName()) || LegoActor::IsA(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: the types. Pizza needs this as public:
|
||||||
|
undefined unk78[0xc4];
|
||||||
|
MxS32 m_unk13c;
|
||||||
|
undefined unk140[0x14];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LEGOPATHACTOR_H
|
#endif // LEGOPATHACTOR_H
|
||||||
|
|||||||
@ -1,13 +1,29 @@
|
|||||||
#include "mxbackgroundaudiomanager.h"
|
#include "mxbackgroundaudiomanager.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(MxBackgroundAudioManager, 0x150)
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1007ea90
|
// OFFSET: LEGO1 0x1007ea90
|
||||||
MxBackgroundAudioManager::MxBackgroundAudioManager()
|
MxBackgroundAudioManager::MxBackgroundAudioManager()
|
||||||
{
|
{
|
||||||
// TODO
|
NotificationManager()->Register(this);
|
||||||
|
m_unka0 = 0;
|
||||||
|
m_unk138 = 0;
|
||||||
|
m_unk13c = 0;
|
||||||
|
m_unk140 = 0;
|
||||||
|
m_unk144 = 0;
|
||||||
|
m_unk148 = 0;
|
||||||
|
m_musicEnabled = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1007ec20
|
// OFFSET: LEGO1 0x1007ec20
|
||||||
MxBackgroundAudioManager::~MxBackgroundAudioManager()
|
MxBackgroundAudioManager::~MxBackgroundAudioManager()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
NotificationManager()->Unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1007f470
|
||||||
|
void MxBackgroundAudioManager::Stop()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
@ -15,5 +31,17 @@ MxBackgroundAudioManager::~MxBackgroundAudioManager()
|
|||||||
// OFFSET: LEGO1 0x1007f5f0
|
// OFFSET: LEGO1 0x1007f5f0
|
||||||
void MxBackgroundAudioManager::Enable(MxBool p)
|
void MxBackgroundAudioManager::Enable(MxBool p)
|
||||||
{
|
{
|
||||||
// TODO
|
if (this->m_musicEnabled != p) {
|
||||||
|
this->m_musicEnabled = p;
|
||||||
|
if (!p) {
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1007f650
|
||||||
|
void MxBackgroundAudioManager::Init()
|
||||||
|
{
|
||||||
|
this->m_unka0 = 0;
|
||||||
|
this->m_unk13c = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
#define MXBACKGROUNDAUDIOMANAGER_H
|
#define MXBACKGROUNDAUDIOMANAGER_H
|
||||||
|
|
||||||
#include "mxcore.h"
|
#include "mxcore.h"
|
||||||
|
#include "mxdsaction.h"
|
||||||
|
#include "mxtypes.h"
|
||||||
|
#include "mxnotificationmanager.h"
|
||||||
|
|
||||||
// VTABLE 0x100d9fe8
|
// VTABLE 0x100d9fe8
|
||||||
// SIZE 0x150
|
// SIZE 0x150
|
||||||
@ -25,6 +28,20 @@ class MxBackgroundAudioManager : public MxCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) void Enable(unsigned char p);
|
__declspec(dllexport) void Enable(unsigned char p);
|
||||||
|
private:
|
||||||
|
void Stop();
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
MxBool m_musicEnabled; // 0x8
|
||||||
|
MxDSAction m_action1; // 0xc
|
||||||
|
MxS32 m_unka0;
|
||||||
|
MxDSAction m_action2; // 0xa4
|
||||||
|
MxS32 m_unk138;
|
||||||
|
MxS32 m_unk13c;
|
||||||
|
MxS32 m_unk140;
|
||||||
|
MxS32 m_unk144;
|
||||||
|
MxS16 m_unk148;
|
||||||
|
MxAtomId m_unk14c;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MXBACKGROUNDAUDIOMANAGER_H
|
#endif // MXBACKGROUNDAUDIOMANAGER_H
|
||||||
|
|||||||
0
LEGO1/mxdirect3d.cpp
Normal file
0
LEGO1/mxdirect3d.cpp
Normal file
0
LEGO1/mxdirect3d.h
Normal file
0
LEGO1/mxdirect3d.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,130 @@
|
|||||||
|
|
||||||
#ifndef MXDIRECTDRAW_H
|
#ifndef MXDIRECTDRAW_H
|
||||||
#define MXDIRECTDRAW_H
|
#define MXDIRECTDRAW_H
|
||||||
|
|
||||||
|
#include <ddraw.h>
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
|
extern BOOL g_is_PALETTEINDEXED8;
|
||||||
|
|
||||||
|
//size 0x880
|
||||||
class MxDirectDraw
|
class MxDirectDraw
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
typedef void (*ErrorHandler)(const char*, HRESULT, void*);
|
||||||
|
|
||||||
|
//size 0x0c
|
||||||
|
struct Mode
|
||||||
|
{
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int bitsPerPixel;
|
||||||
|
|
||||||
|
int operator==(const Mode& rMode) const
|
||||||
|
{
|
||||||
|
return ((width == rMode.width) &&
|
||||||
|
(height == rMode.height) &&
|
||||||
|
(bitsPerPixel == rMode.bitsPerPixel));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//size 0x17c
|
||||||
|
struct DeviceModesInfo
|
||||||
|
{
|
||||||
|
GUID* p_guid;
|
||||||
|
Mode* m_mode_ARRAY;
|
||||||
|
int count;
|
||||||
|
DDCAPS m_ddcaps;
|
||||||
|
void* a_178;
|
||||||
|
|
||||||
|
~DeviceModesInfo();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
BOOL m_bOnlySoftRender;
|
||||||
|
BOOL m_bFlipSurfaces;
|
||||||
|
IDirectDraw* m_pDirectDraw;
|
||||||
|
IDirectDrawSurface* m_pFrontBuffer;
|
||||||
|
IDirectDrawSurface* m_pBackBuffer;
|
||||||
|
IDirectDrawSurface* m_pZBuffer;
|
||||||
|
IDirectDrawSurface* m_pText1Surface;
|
||||||
|
IDirectDrawSurface* m_pText2Surface;
|
||||||
|
IDirectDrawClipper* m_pClipper;
|
||||||
|
IDirectDrawPalette* m_pPalette;
|
||||||
|
PALETTEENTRY m_paletteEntries[256];
|
||||||
|
PALETTEENTRY m_originalPaletteEntries[256];
|
||||||
|
SIZE m_text1SizeOnSurface;
|
||||||
|
SIZE m_text2SizeOnSurface;
|
||||||
|
HWND m_hWndMain;
|
||||||
|
HFONT m_hFont;
|
||||||
|
BOOL m_bIgnoreWM_SIZE;
|
||||||
|
BOOL m_bPrimaryPalettized;
|
||||||
|
BOOL m_bFullScreen;
|
||||||
|
void* a_850;
|
||||||
|
BOOL m_bOnlySystemMemory;
|
||||||
|
BOOL m_bIsOnPrimaryDevice;
|
||||||
|
ErrorHandler m_pErrorHandler;
|
||||||
|
ErrorHandler m_pFatalErrorHandler;
|
||||||
|
void* m_pErrorHandlerArg;
|
||||||
|
void* m_pFatalErrorHandlerArg;
|
||||||
|
int m_pauseCount;
|
||||||
|
DeviceModesInfo* m_pCurrentDeviceModesList;
|
||||||
|
Mode m_currentMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
__declspec(dllexport) int FlipToGDISurface();
|
__declspec(dllexport) int FlipToGDISurface();
|
||||||
__declspec(dllexport) static int GetPrimaryBitDepth();
|
__declspec(dllexport) static int GetPrimaryBitDepth();
|
||||||
__declspec(dllexport) int Pause(int);
|
__declspec(dllexport) int Pause(int);
|
||||||
|
|
||||||
|
MxDirectDraw();
|
||||||
|
|
||||||
|
virtual ~MxDirectDraw();
|
||||||
|
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();
|
||||||
|
virtual void DestroyButNotDirectDraw();
|
||||||
|
virtual const char* ErrorToString(HRESULT error);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BOOL CacheOriginalPaletteEntries();
|
||||||
|
HRESULT CreateDDSurface(
|
||||||
|
LPDDSURFACEDESC a2,
|
||||||
|
LPDIRECTDRAWSURFACE* a3,
|
||||||
|
IUnknown* a4);
|
||||||
|
BOOL CreateTextSurfaces();
|
||||||
|
BOOL CreateZBuffer(DWORD memorytype, DWORD depth);
|
||||||
|
BOOL DDCreateSurfaces();
|
||||||
|
BOOL DDInit(BOOL fullscreen);
|
||||||
|
BOOL DDSetMode(int width, int height, int bpp);
|
||||||
|
void Error(const char* message, int error);
|
||||||
|
|
||||||
|
BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf);
|
||||||
|
BOOL IsSupportedMode(int width, int height, int bpp);
|
||||||
|
BOOL RecreateDirectDraw(GUID** a2);
|
||||||
|
BOOL RestoreOriginalPaletteEntries();
|
||||||
|
BOOL RestorePaletteEntries();
|
||||||
|
BOOL RestoreSurfaces();
|
||||||
|
BOOL SetPaletteEntries(
|
||||||
|
const PALETTEENTRY* pPaletteEntries,
|
||||||
|
int paletteEntryCount,
|
||||||
|
BOOL fullscreen);
|
||||||
|
BOOL TextToTextSurface(
|
||||||
|
const char* text,
|
||||||
|
IDirectDrawSurface* pSurface,
|
||||||
|
SIZE& textSizeOnSurface);
|
||||||
|
BOOL TextToTextSurface1(const char* text);
|
||||||
|
BOOL TextToTextSurface2(const char* lpString);
|
||||||
|
void FUN_1009E020();
|
||||||
|
void FUN_1009D920();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MXDIRECTDRAW_H
|
#endif // MXDIRECTDRAW_H
|
||||||
|
|||||||
136
LEGO1/mxdisplaysurface.cpp
Normal file
136
LEGO1/mxdisplaysurface.cpp
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
#include "mxdisplaysurface.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac);
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ba500
|
||||||
|
MxDisplaySurface::MxDisplaySurface()
|
||||||
|
{
|
||||||
|
this->Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ba5a0
|
||||||
|
MxDisplaySurface::~MxDisplaySurface()
|
||||||
|
{
|
||||||
|
this->Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ba610
|
||||||
|
void MxDisplaySurface::Reset()
|
||||||
|
{
|
||||||
|
this->m_ddSurface1 = NULL;
|
||||||
|
this->m_ddSurface2 = NULL;
|
||||||
|
this->m_ddClipper = NULL;
|
||||||
|
this->m_16bitPal = NULL;
|
||||||
|
this->m_initialized = FALSE;
|
||||||
|
memset(&this->m_surfaceDesc, 0, sizeof(this->m_surfaceDesc));
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ba790
|
||||||
|
MxResult MxDisplaySurface::Init(MxVideoParam &p_videoParam, LPDIRECTDRAWSURFACE p_ddSurface1, LPDIRECTDRAWSURFACE p_ddSurface2, LPDIRECTDRAWCLIPPER p_ddClipper)
|
||||||
|
{
|
||||||
|
MxResult result = SUCCESS;
|
||||||
|
|
||||||
|
this->m_videoParam = p_videoParam;
|
||||||
|
this->m_ddSurface1 = p_ddSurface1;
|
||||||
|
this->m_ddSurface2 = p_ddSurface2;
|
||||||
|
this->m_ddClipper = p_ddClipper;
|
||||||
|
this->m_initialized = FALSE;
|
||||||
|
|
||||||
|
memset(&this->m_surfaceDesc, 0, sizeof(this->m_surfaceDesc));
|
||||||
|
this->m_surfaceDesc.dwSize = sizeof(this->m_surfaceDesc);
|
||||||
|
|
||||||
|
if (this->m_ddSurface2->GetSurfaceDesc(&this->m_surfaceDesc))
|
||||||
|
result = FAILURE;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100ba7f0 STUB
|
||||||
|
MxResult MxDisplaySurface::Create(MxVideoParam *p_videoParam)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100baa90
|
||||||
|
void MxDisplaySurface::Clear()
|
||||||
|
{
|
||||||
|
if (this->m_initialized) {
|
||||||
|
if (this->m_ddSurface2)
|
||||||
|
this->m_ddSurface2->Release();
|
||||||
|
|
||||||
|
if (this->m_ddSurface1)
|
||||||
|
this->m_ddSurface1->Release();
|
||||||
|
|
||||||
|
if (this->m_ddClipper)
|
||||||
|
this->m_ddClipper->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->m_16bitPal)
|
||||||
|
delete this->m_16bitPal;
|
||||||
|
|
||||||
|
this->Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100baae0 STUB
|
||||||
|
void MxDisplaySurface::SetPalette(MxPalette *p_palette)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bc200 STUB
|
||||||
|
void MxDisplaySurface::vtable24(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bacc0 STUB
|
||||||
|
MxBool MxDisplaySurface::vtable28(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bc630 STUB
|
||||||
|
MxBool MxDisplaySurface::vtable2c(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bb1d0 STUB
|
||||||
|
MxBool MxDisplaySurface::vtable30(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bb850 STUB
|
||||||
|
undefined4 MxDisplaySurface::vtable34(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bba50 STUB
|
||||||
|
void MxDisplaySurface::Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bbc10
|
||||||
|
void MxDisplaySurface::GetDC(HDC *p_hdc)
|
||||||
|
{
|
||||||
|
if (this->m_ddSurface2 && !this->m_ddSurface2->GetDC(p_hdc))
|
||||||
|
return;
|
||||||
|
|
||||||
|
*p_hdc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bbc40
|
||||||
|
void MxDisplaySurface::ReleaseDC(HDC p_hdc)
|
||||||
|
{
|
||||||
|
if (this->m_ddSurface2 && p_hdc)
|
||||||
|
this->m_ddSurface2->ReleaseDC(p_hdc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bbc60 STUB
|
||||||
|
undefined4 MxDisplaySurface::vtable44(undefined4, undefined4*, undefined4, undefined4)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@ -10,13 +10,16 @@
|
|||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
|
|
||||||
// VTABLE 0x100dc768
|
// VTABLE 0x100dc768
|
||||||
|
// SIZE 0xac
|
||||||
class MxDisplaySurface : public MxCore
|
class MxDisplaySurface : public MxCore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MxDisplaySurface();
|
MxDisplaySurface();
|
||||||
virtual ~MxDisplaySurface() override;
|
virtual ~MxDisplaySurface() override;
|
||||||
|
|
||||||
virtual MxResult Init(MxVideoParam *p_videoParam, LPDIRECTDRAWSURFACE p_surface1, LPDIRECTDRAWSURFACE p_surface2, LPDIRECTDRAWCLIPPER p_clipper);
|
void Reset();
|
||||||
|
|
||||||
|
virtual MxResult Init(MxVideoParam &p_videoParam, LPDIRECTDRAWSURFACE p_ddSurface1, LPDIRECTDRAWSURFACE p_ddSurface2, LPDIRECTDRAWCLIPPER p_ddClipper);
|
||||||
virtual MxResult Create(MxVideoParam *p_videoParam);
|
virtual MxResult Create(MxVideoParam *p_videoParam);
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void SetPalette(MxPalette *p_palette);
|
virtual void SetPalette(MxPalette *p_palette);
|
||||||
@ -26,9 +29,18 @@ class MxDisplaySurface : public MxCore
|
|||||||
virtual MxBool vtable30(undefined4, 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 undefined4 vtable34(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
|
||||||
virtual void Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
|
virtual void Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
|
||||||
virtual undefined4 vtable3c(undefined4*);
|
virtual void GetDC(HDC *p_hdc);
|
||||||
virtual undefined4 vtable40(undefined4);
|
virtual void ReleaseDC(HDC p_hdc);
|
||||||
virtual undefined4 vtable44(undefined4, undefined4*, undefined4, undefined4);
|
virtual undefined4 vtable44(undefined4, undefined4*, undefined4, undefined4);
|
||||||
|
|
||||||
|
private:
|
||||||
|
MxVideoParam m_videoParam;
|
||||||
|
LPDIRECTDRAWSURFACE m_ddSurface1;
|
||||||
|
LPDIRECTDRAWSURFACE m_ddSurface2;
|
||||||
|
LPDIRECTDRAWCLIPPER m_ddClipper;
|
||||||
|
MxBool m_initialized;
|
||||||
|
DDSURFACEDESC m_surfaceDesc;
|
||||||
|
MxU16 *m_16bitPal;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MXDISPLAYSURFACE_H
|
#endif // MXDISPLAYSURFACE_H
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#include "mxentity.h"
|
#include "mxentity.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(MxEntity, 0x68)
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1001d190
|
// OFFSET: LEGO1 0x1001d190
|
||||||
MxEntity::MxEntity()
|
MxEntity::MxEntity()
|
||||||
{
|
{
|
||||||
@ -17,4 +19,4 @@ MxResult MxEntity::SetEntityId(MxS32 p_id, const MxAtomId &p_atom)
|
|||||||
this->m_mxEntityId = p_id;
|
this->m_mxEntityId = p_id;
|
||||||
this->m_atom = p_atom;
|
this->m_atom = p_atom;
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
#ifndef MXENTITY_H
|
#ifndef MXENTITY_H
|
||||||
#define MXENTITY_H
|
#define MXENTITY_H
|
||||||
|
|
||||||
|
#include "decomp.h"
|
||||||
#include "mxatomid.h"
|
#include "mxatomid.h"
|
||||||
#include "mxcore.h"
|
#include "mxcore.h"
|
||||||
#include "mxtypes.h"
|
#include "mxtypes.h"
|
||||||
|
|
||||||
// VTABLE 0x100d5390
|
// VTABLE 0x100d5390
|
||||||
|
// SIZE 0x68 or less
|
||||||
class MxEntity : public MxCore
|
class MxEntity : public MxCore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -29,6 +31,7 @@ class MxEntity : public MxCore
|
|||||||
private:
|
private:
|
||||||
MxS32 m_mxEntityId; // 0x8
|
MxS32 m_mxEntityId; // 0x8
|
||||||
MxAtomId m_atom; // 0xc
|
MxAtomId m_atom; // 0xc
|
||||||
|
undefined m_unk10[0x58];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MXENTITY_H
|
#endif // MXENTITY_H
|
||||||
|
|||||||
188
LEGO1/mxmatrix.cpp
Normal file
188
LEGO1/mxmatrix.cpp
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
|
||||||
|
#include "mxmatrix.h"
|
||||||
|
|
||||||
|
#include <memory.h>
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
|
#include "decomp.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(MxMatrix, 0x8);
|
||||||
|
DECOMP_SIZE_ASSERT(MxMatrixData, 0x48);
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002340
|
||||||
|
void MxMatrix::EqualsMxMatrix(const MxMatrix *p_other)
|
||||||
|
{
|
||||||
|
memcpy(m_data, p_other->m_data, 16 * sizeof(float));
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002320
|
||||||
|
void MxMatrix::EqualsMatrixData(const float *p_matrix)
|
||||||
|
{
|
||||||
|
memcpy(m_data, p_matrix, 16 * sizeof(float));
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002370
|
||||||
|
void MxMatrix::SetData(float *p_data)
|
||||||
|
{
|
||||||
|
m_data = p_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002360
|
||||||
|
void MxMatrix::AnotherSetData(float *p_data)
|
||||||
|
{
|
||||||
|
m_data = p_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002390
|
||||||
|
float *MxMatrix::GetData()
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002380
|
||||||
|
const float *MxMatrix::GetData() const
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100023c0
|
||||||
|
float *MxMatrix::Element(int p_row, int p_col)
|
||||||
|
{
|
||||||
|
return &m_data[p_row * 4 + p_col];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100023a0
|
||||||
|
const float *MxMatrix::Element(int p_row, int p_col) const
|
||||||
|
{
|
||||||
|
return &m_data[p_row * 4 + p_col];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100023e0
|
||||||
|
void MxMatrix::Clear()
|
||||||
|
{
|
||||||
|
memset(m_data, 0, 16 * sizeof(float));
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100023f0
|
||||||
|
void MxMatrix::SetIdentity()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
m_data[0] = 1.0f;
|
||||||
|
m_data[5] = 1.0f;
|
||||||
|
m_data[10] = 1.0f;
|
||||||
|
m_data[15] = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002850
|
||||||
|
void MxMatrix::operator=(const MxMatrix& p_other)
|
||||||
|
{
|
||||||
|
EqualsMxMatrix(&p_other);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002430
|
||||||
|
MxMatrix* MxMatrix::operator+=(const float *p_matrix)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 16; ++i)
|
||||||
|
m_data[i] += p_matrix[i];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Matches but instructions are significantly out of order. Probably not wrong
|
||||||
|
// code given that the very similar SetTranslation does match.
|
||||||
|
// OFFSET: LEGO1 0x10002460
|
||||||
|
void MxMatrix::TranslateBy(const float *p_x, const float *p_y, const float *p_z)
|
||||||
|
{
|
||||||
|
m_data[12] += *p_x;
|
||||||
|
m_data[13] += *p_y;
|
||||||
|
m_data[14] += *p_z;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100024a0
|
||||||
|
void MxMatrix::SetTranslation(const float *p_x, const float *p_y, const float *p_z)
|
||||||
|
{
|
||||||
|
m_data[12] = *p_x;
|
||||||
|
m_data[13] = *p_y;
|
||||||
|
m_data[14] = *p_z;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002530
|
||||||
|
void MxMatrix::EqualsMxProduct(const MxMatrix *p_a, const MxMatrix *p_b)
|
||||||
|
{
|
||||||
|
EqualsDataProduct(p_a->m_data, p_b->m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Just a placeholder matrix multiply implementation. I think the decomp will
|
||||||
|
// look roughly like this but it's not close to matching and won't be until
|
||||||
|
// an exact match is found given it's all loop and float crunching.
|
||||||
|
// OFFSET: LEGO1 0x100024d0 STUB
|
||||||
|
void MxMatrix::EqualsDataProduct(const float *p_a, const float *p_b)
|
||||||
|
{
|
||||||
|
for (int row = 0; row < 4; ++row)
|
||||||
|
{
|
||||||
|
for (int col = 0; col < 4; ++col)
|
||||||
|
{
|
||||||
|
m_data[row * 4 + col] = 0.0f;
|
||||||
|
for (int k = 0; k < 4; ++k)
|
||||||
|
{
|
||||||
|
m_data[row * 4 + col] += p_a[row * 4 + k] * p_b[k * 4 + col];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not close, Ghidra struggles understinging this method so it will have to
|
||||||
|
// be manually worked out. Included since I at least figured out what it was
|
||||||
|
// doing with rotateIndex and what overall operation it's trying to do.
|
||||||
|
// OFFSET: LEGO1 0x10002550 STUB
|
||||||
|
void MxMatrix::ToQuaternion(MxVector4 *p_outQuat)
|
||||||
|
{
|
||||||
|
float trace = m_data[0] + m_data[5] + m_data[10];
|
||||||
|
if (trace > 0)
|
||||||
|
{
|
||||||
|
trace = sqrt(trace + 1.0);
|
||||||
|
p_outQuat->GetData()[3] = trace * 0.5f;
|
||||||
|
p_outQuat->GetData()[0] = (m_data[9] - m_data[6]) * trace;
|
||||||
|
p_outQuat->GetData()[1] = (m_data[2] - m_data[8]) * trace;
|
||||||
|
p_outQuat->GetData()[2] = (m_data[4] - m_data[1]) * trace;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100d4090
|
||||||
|
static int rotateIndex[] = {1, 2, 0};
|
||||||
|
|
||||||
|
// Largest element along the trace
|
||||||
|
int largest = m_data[0] < m_data[5];
|
||||||
|
if (*Element(largest, largest) < m_data[10])
|
||||||
|
largest = 2;
|
||||||
|
|
||||||
|
int next = rotateIndex[largest];
|
||||||
|
int nextNext = rotateIndex[next];
|
||||||
|
float valueA = *Element(nextNext, nextNext);
|
||||||
|
float valueB = *Element(next, next);
|
||||||
|
float valueC = *Element(largest, largest);
|
||||||
|
|
||||||
|
// Above is somewhat decomped, below is pure speculation since the automatic
|
||||||
|
// decomp becomes very garbled.
|
||||||
|
float traceValue = sqrt(valueA - valueB - valueC + 1.0);
|
||||||
|
|
||||||
|
p_outQuat->GetData()[largest] = traceValue * 0.5f;
|
||||||
|
traceValue = 0.5f / traceValue;
|
||||||
|
|
||||||
|
p_outQuat->GetData()[3] = (m_data[next + 4 * nextNext] - m_data[nextNext + 4 * next]) * traceValue;
|
||||||
|
p_outQuat->GetData()[next] = (m_data[next + 4 * largest] + m_data[largest + 4 * next]) * traceValue;
|
||||||
|
p_outQuat->GetData()[nextNext] = (m_data[nextNext + 4 * largest] + m_data[largest + 4 * nextNext]) * traceValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No idea what this function is doing and it will be hard to tell until
|
||||||
|
// we have a confirmed usage site.
|
||||||
|
// OFFSET: LEGO1 0x10002710 STUB
|
||||||
|
MxResult MxMatrix::DoSomethingWithLength(const MxVector3 *p_vec)
|
||||||
|
{
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002860
|
||||||
|
void MxMatrixData::operator=(const MxMatrixData& p_other)
|
||||||
|
{
|
||||||
|
EqualsMxMatrix(&p_other);
|
||||||
|
}
|
||||||
70
LEGO1/mxmatrix.h
Normal file
70
LEGO1/mxmatrix.h
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#ifndef MXMATRIX_H
|
||||||
|
#define MXMATRIX_H
|
||||||
|
|
||||||
|
#include "mxvector.h"
|
||||||
|
|
||||||
|
// VTABLE 0x100d4350
|
||||||
|
// SIZE 0x8
|
||||||
|
class MxMatrix
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline MxMatrix(float *p_data) : m_data(p_data) {}
|
||||||
|
|
||||||
|
// vtable + 0x00
|
||||||
|
virtual void EqualsMxMatrix(const MxMatrix *p_other);
|
||||||
|
virtual void EqualsMatrixData(const float *p_matrix);
|
||||||
|
virtual void SetData(float *p_data);
|
||||||
|
virtual void AnotherSetData(float *p_data);
|
||||||
|
|
||||||
|
// vtable + 0x10
|
||||||
|
virtual float *GetData();
|
||||||
|
virtual const float *GetData() const;
|
||||||
|
virtual float *Element(int p_row, int p_col);
|
||||||
|
virtual const float *Element(int p_row, int p_col) const;
|
||||||
|
|
||||||
|
// vtable + 0x20
|
||||||
|
virtual void Clear();
|
||||||
|
virtual void SetIdentity();
|
||||||
|
virtual void operator=(const MxMatrix& p_other);
|
||||||
|
virtual MxMatrix *operator+=(const float *p_matrix);
|
||||||
|
|
||||||
|
// vtable + 0x30
|
||||||
|
virtual void TranslateBy(const float *p_x, const float *p_y, const float *p_z);
|
||||||
|
virtual void SetTranslation(const float *p_x, const float *p_y, const float *p_z);
|
||||||
|
virtual void EqualsMxProduct(const MxMatrix *p_a, const MxMatrix *p_b);
|
||||||
|
virtual void EqualsDataProduct(const float *p_a, const float *p_b);
|
||||||
|
|
||||||
|
// vtable + 0x40
|
||||||
|
virtual void ToQuaternion(MxVector4 *p_resultQuat);
|
||||||
|
virtual MxResult DoSomethingWithLength(const MxVector3 *p_vec);
|
||||||
|
|
||||||
|
private:
|
||||||
|
float *m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d4300
|
||||||
|
// SIZE 0x48
|
||||||
|
class MxMatrixData : public MxMatrix
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline MxMatrixData() : MxMatrix(e) {}
|
||||||
|
|
||||||
|
// No idea why there's another equals. Maybe to some other type like the
|
||||||
|
// DirectX Retained Mode Matrix type which is also a float* alias?
|
||||||
|
// vtable + 0x44
|
||||||
|
virtual void operator=(const MxMatrixData& p_other);
|
||||||
|
|
||||||
|
// Alias an easy way to access the translation part of the matrix, because
|
||||||
|
// various members / other functions benefit from the clarity.
|
||||||
|
union
|
||||||
|
{
|
||||||
|
float e[16];
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float _[12];
|
||||||
|
float x, y, z, w;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MXMATRIX_H
|
||||||
@ -41,7 +41,7 @@ MxNotificationManager::~MxNotificationManager()
|
|||||||
delete m_queue;
|
delete m_queue;
|
||||||
m_queue = NULL;
|
m_queue = NULL;
|
||||||
|
|
||||||
TickleManager()->Unregister(this);
|
TickleManager()->UnregisterClient(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100ac800
|
// OFFSET: LEGO1 0x100ac800
|
||||||
@ -80,7 +80,7 @@ MxResult MxNotificationManager::Create(MxS32 p_unk1, MxS32 p_unk2)
|
|||||||
result = FAILURE;
|
result = FAILURE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TickleManager()->Register(this, 10);
|
TickleManager()->RegisterClient(this, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
113
LEGO1/mxticklemanager.cpp
Normal file
113
LEGO1/mxticklemanager.cpp
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
#include "mxomni.h"
|
||||||
|
#include "mxticklemanager.h"
|
||||||
|
#include "mxtimer.h"
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
|
#include "decomp.h"
|
||||||
|
|
||||||
|
#define TICKLE_MANAGER_FLAG_DESTROY 0x1
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(MxTickleClient, 0x10);
|
||||||
|
DECOMP_SIZE_ASSERT(MxTickleManager, 0x14);
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bdd10
|
||||||
|
MxTickleClient::MxTickleClient(MxCore *p_client, MxTime p_interval)
|
||||||
|
{
|
||||||
|
m_flags = 0;
|
||||||
|
m_client = p_client;
|
||||||
|
m_interval = p_interval;
|
||||||
|
m_lastUpdateTime = -m_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bdd30
|
||||||
|
MxTickleManager::~MxTickleManager()
|
||||||
|
{
|
||||||
|
while (m_clients.size() != 0) {
|
||||||
|
MxTickleClient *client = m_clients.front();
|
||||||
|
m_clients.pop_front();
|
||||||
|
delete client;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Match.
|
||||||
|
// OFFSET: LEGO1 0x100bdde0
|
||||||
|
MxResult MxTickleManager::Tickle()
|
||||||
|
{
|
||||||
|
MxTime time = Timer()->GetTime();
|
||||||
|
|
||||||
|
MxTickleClientPtrList::iterator it = m_clients.begin();
|
||||||
|
|
||||||
|
while (it != m_clients.end()) {
|
||||||
|
MxTickleClient *client = *it;
|
||||||
|
if ((client->GetFlags() & TICKLE_MANAGER_FLAG_DESTROY) == 0) {
|
||||||
|
if (client->GetLastUpdateTime() >= time)
|
||||||
|
client->SetLastUpdateTime(-client->GetTickleInterval());
|
||||||
|
|
||||||
|
if ((client->GetTickleInterval() + client->GetLastUpdateTime()) < time) {
|
||||||
|
client->GetClient()->Tickle();
|
||||||
|
client->SetLastUpdateTime(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_clients.erase(it++);
|
||||||
|
delete client;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bde80
|
||||||
|
void MxTickleManager::RegisterClient(MxCore *p_client, MxTime p_interval)
|
||||||
|
{
|
||||||
|
MxTime interval = GetClientTickleInterval(p_client);
|
||||||
|
if (interval == TICKLE_MANAGER_NOT_FOUND) {
|
||||||
|
MxTickleClient *client = new MxTickleClient(p_client, p_interval);
|
||||||
|
if (client != NULL)
|
||||||
|
m_clients.push_back(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bdf60
|
||||||
|
void MxTickleManager::UnregisterClient(MxCore *p_client)
|
||||||
|
{
|
||||||
|
MxTickleClientPtrList::iterator it = m_clients.begin();
|
||||||
|
while (it != m_clients.end()) {
|
||||||
|
MxTickleClient *client = *it;
|
||||||
|
if (client->GetClient() == p_client) {
|
||||||
|
client->SetFlags(client->GetFlags() | TICKLE_MANAGER_FLAG_DESTROY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100bdfa0
|
||||||
|
void MxTickleManager::SetClientTickleInterval(MxCore *p_client, MxTime p_interval)
|
||||||
|
{
|
||||||
|
for (MxTickleClientPtrList::iterator it = m_clients.begin(); it != m_clients.end(); it++) {
|
||||||
|
MxTickleClient *client = *it;
|
||||||
|
if ((client->GetClient() == p_client) && ((client->GetFlags() & TICKLE_MANAGER_FLAG_DESTROY) == 0)) {
|
||||||
|
client->SetTickleInterval(p_interval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100be000
|
||||||
|
MxTime MxTickleManager::GetClientTickleInterval(MxCore *p_client)
|
||||||
|
{
|
||||||
|
MxTickleClientPtrList::iterator it = m_clients.begin();
|
||||||
|
while (it != m_clients.end()) {
|
||||||
|
MxTickleClient *client = *it;
|
||||||
|
if ((client->GetClient() == p_client) && ((client->GetFlags() & TICKLE_MANAGER_FLAG_DESTROY) == 0))
|
||||||
|
return client->GetTickleInterval();
|
||||||
|
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TICKLE_MANAGER_NOT_FOUND;
|
||||||
|
}
|
||||||
@ -2,20 +2,77 @@
|
|||||||
#define MXTICKLEMANAGER_H
|
#define MXTICKLEMANAGER_H
|
||||||
|
|
||||||
#include "mxcore.h"
|
#include "mxcore.h"
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
|
#include "compat.h"
|
||||||
|
|
||||||
|
class MxTickleClient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxTickleClient(MxCore *p_client, MxTime p_interval);
|
||||||
|
|
||||||
|
inline MxCore *GetClient() const
|
||||||
|
{
|
||||||
|
return m_client;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline MxTime GetTickleInterval() const
|
||||||
|
{
|
||||||
|
return m_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline MxTime GetLastUpdateTime() const
|
||||||
|
{
|
||||||
|
return m_lastUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline MxU16 GetFlags() const
|
||||||
|
{
|
||||||
|
return m_flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SetTickleInterval(MxTime p_interval)
|
||||||
|
{
|
||||||
|
m_interval = p_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SetLastUpdateTime(MxTime p_lastUpdateTime)
|
||||||
|
{
|
||||||
|
m_lastUpdateTime = p_lastUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SetFlags(MxU16 flags)
|
||||||
|
{
|
||||||
|
m_flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
MxCore *m_client; // 0x0
|
||||||
|
MxTime m_interval; // 0x4
|
||||||
|
MxTime m_lastUpdateTime; // 0x8
|
||||||
|
MxU16 m_flags; // 0xc
|
||||||
|
};
|
||||||
|
|
||||||
|
class MxTickleClientPtrList : public List<MxTickleClient *>
|
||||||
|
{};
|
||||||
|
|
||||||
// VTABLE 0x100d86d8
|
// VTABLE 0x100d86d8
|
||||||
class MxTickleManager : public MxCore
|
class MxTickleManager : public MxCore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~MxTickleManager();
|
inline MxTickleManager() : MxCore(), m_clients() {}
|
||||||
|
virtual ~MxTickleManager(); // vtable+0x0 (scalar deleting destructor)
|
||||||
|
|
||||||
virtual MxLong Tickle();
|
virtual MxResult Tickle(); // vtable+0x8
|
||||||
virtual const char *ClassName() const;
|
virtual void RegisterClient(MxCore *p_client, MxTime p_interval); // vtable+0x14
|
||||||
virtual MxBool IsA(const char *name) const;
|
virtual void UnregisterClient(MxCore *p_client); // vtable+0x18
|
||||||
virtual void Register(MxCore *p_listener, int p_milliseconds);
|
virtual void SetClientTickleInterval(MxCore *p_client, MxTime p_interval); // vtable+0x1c
|
||||||
virtual void Unregister(MxCore *p_listener);
|
virtual MxTime GetClientTickleInterval(MxCore *p_client); // vtable+0x20
|
||||||
virtual void vtable1c(void *v, int p);
|
|
||||||
virtual void vtable20();
|
private:
|
||||||
|
MxTickleClientPtrList m_clients; // 0x8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define TICKLE_MANAGER_NOT_FOUND 0x80000000
|
||||||
|
|
||||||
#endif // MXTICKLEMANAGER_H
|
#endif // MXTICKLEMANAGER_H
|
||||||
|
|||||||
@ -25,6 +25,8 @@ typedef int MxLong;
|
|||||||
typedef unsigned int MxULong;
|
typedef unsigned int MxULong;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef MxS32 MxTime;
|
||||||
|
|
||||||
typedef MxLong MxResult;
|
typedef MxLong MxResult;
|
||||||
const MxResult SUCCESS = 0;
|
const MxResult SUCCESS = 0;
|
||||||
const MxResult FAILURE = -1;
|
const MxResult FAILURE = -1;
|
||||||
|
|||||||
466
LEGO1/mxvector.cpp
Normal file
466
LEGO1/mxvector.cpp
Normal file
@ -0,0 +1,466 @@
|
|||||||
|
|
||||||
|
#include "mxvector.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <memory.h>
|
||||||
|
|
||||||
|
#include "decomp.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(MxVector2, 0x8);
|
||||||
|
DECOMP_SIZE_ASSERT(MxVector3, 0x8);
|
||||||
|
DECOMP_SIZE_ASSERT(MxVector4, 0x8);
|
||||||
|
DECOMP_SIZE_ASSERT(MxVector3Data, 0x14);
|
||||||
|
DECOMP_SIZE_ASSERT(MxVector4Data, 0x18);
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002060
|
||||||
|
void MxVector2::SetData(float *p_data)
|
||||||
|
{
|
||||||
|
m_data = p_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100020a0
|
||||||
|
const float *MxVector2::GetData() const
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002090
|
||||||
|
float *MxVector2::GetData()
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002130
|
||||||
|
float MxVector2::Dot(MxVector2 *p_a, float *p_b) const
|
||||||
|
{
|
||||||
|
return DotImpl(p_a->m_data, p_b);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002110
|
||||||
|
float MxVector2::Dot(float *p_a, MxVector2 *p_b) const
|
||||||
|
{
|
||||||
|
return DotImpl(p_a, p_b->m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100020f0
|
||||||
|
float MxVector2::Dot(MxVector2 *p_a, MxVector2 *p_b) const
|
||||||
|
{
|
||||||
|
return DotImpl(p_a->m_data, p_b->m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100020d0
|
||||||
|
float MxVector2::Dot(float *p_a, float *p_b) const
|
||||||
|
{
|
||||||
|
return DotImpl(p_a, p_b);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002160
|
||||||
|
MxResult MxVector2::Unitize()
|
||||||
|
{
|
||||||
|
float sq = LenSquared();
|
||||||
|
if (sq > 0.0f)
|
||||||
|
{
|
||||||
|
float root = sqrt(sq);
|
||||||
|
if (root > 0)
|
||||||
|
{
|
||||||
|
DivScalarImpl(&root);
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100021e0
|
||||||
|
void MxVector2::AddVector(MxVector2 *p_other)
|
||||||
|
{
|
||||||
|
AddVectorImpl(p_other->m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100021d0
|
||||||
|
void MxVector2::AddVector(float *p_other)
|
||||||
|
{
|
||||||
|
AddVectorImpl(p_other);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100021c0
|
||||||
|
void MxVector2::AddScalar(float p_value)
|
||||||
|
{
|
||||||
|
AddScalarImpl(p_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002200
|
||||||
|
void MxVector2::SubVector(MxVector2 *p_other)
|
||||||
|
{
|
||||||
|
SubVectorImpl(p_other->m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100021f0
|
||||||
|
void MxVector2::SubVector(float *p_other)
|
||||||
|
{
|
||||||
|
SubVectorImpl(p_other);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002230
|
||||||
|
void MxVector2::MullScalar(float *p_value)
|
||||||
|
{
|
||||||
|
MullScalarImpl(p_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002220
|
||||||
|
void MxVector2::MullVector(MxVector2 *p_other)
|
||||||
|
{
|
||||||
|
MullVectorImpl(p_other->m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002210
|
||||||
|
void MxVector2::MullVector(float *p_other)
|
||||||
|
{
|
||||||
|
MullVectorImpl(p_other);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002240
|
||||||
|
void MxVector2::DivScalar(float *p_value)
|
||||||
|
{
|
||||||
|
DivScalarImpl(p_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002260
|
||||||
|
void MxVector2::SetVector(MxVector2 *p_other)
|
||||||
|
{
|
||||||
|
EqualsImpl(p_other->m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002250
|
||||||
|
void MxVector2::SetVector(float *p_other)
|
||||||
|
{
|
||||||
|
EqualsImpl(p_other);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10001fa0
|
||||||
|
void MxVector2::AddScalarImpl(float p_value)
|
||||||
|
{
|
||||||
|
m_data[0] += p_value;
|
||||||
|
m_data[1] += p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10001f80
|
||||||
|
void MxVector2::AddVectorImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] += p_value[0];
|
||||||
|
m_data[1] += p_value[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10001fc0
|
||||||
|
void MxVector2::SubVectorImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] -= p_value[0];
|
||||||
|
m_data[1] -= p_value[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002000
|
||||||
|
void MxVector2::MullScalarImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] *= *p_value;
|
||||||
|
m_data[1] *= *p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10001fe0
|
||||||
|
void MxVector2::MullVectorImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] *= p_value[0];
|
||||||
|
m_data[1] *= p_value[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002020
|
||||||
|
void MxVector2::DivScalarImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] /= *p_value;
|
||||||
|
m_data[1] /= *p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002040
|
||||||
|
float MxVector2::DotImpl(float *p_a, float *p_b) const
|
||||||
|
{
|
||||||
|
return p_b[0] * p_a[0] + p_b[1] * p_a[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002070
|
||||||
|
void MxVector2::EqualsImpl(float *p_data)
|
||||||
|
{
|
||||||
|
float *vec = m_data;
|
||||||
|
vec[0] = p_data[0];
|
||||||
|
vec[1] = p_data[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100020b0
|
||||||
|
void MxVector2::Clear()
|
||||||
|
{
|
||||||
|
float *vec = m_data;
|
||||||
|
vec[0] = 0.0f;
|
||||||
|
vec[1] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002150
|
||||||
|
float MxVector2::LenSquared() const
|
||||||
|
{
|
||||||
|
return m_data[0] * m_data[0] + m_data[1] * m_data[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003a90
|
||||||
|
void MxVector3::AddScalarImpl(float p_value)
|
||||||
|
{
|
||||||
|
m_data[0] += p_value;
|
||||||
|
m_data[1] += p_value;
|
||||||
|
m_data[2] += p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003a60
|
||||||
|
void MxVector3::AddVectorImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] += p_value[0];
|
||||||
|
m_data[1] += p_value[1];
|
||||||
|
m_data[2] += p_value[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003ac0
|
||||||
|
void MxVector3::SubVectorImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] -= p_value[0];
|
||||||
|
m_data[1] -= p_value[1];
|
||||||
|
m_data[2] -= p_value[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003b20
|
||||||
|
void MxVector3::MullScalarImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] *= *p_value;
|
||||||
|
m_data[1] *= *p_value;
|
||||||
|
m_data[2] *= *p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003af0
|
||||||
|
void MxVector3::MullVectorImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] *= p_value[0];
|
||||||
|
m_data[1] *= p_value[1];
|
||||||
|
m_data[2] *= p_value[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003b50
|
||||||
|
void MxVector3::DivScalarImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] /= *p_value;
|
||||||
|
m_data[1] /= *p_value;
|
||||||
|
m_data[2] /= *p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003b80
|
||||||
|
float MxVector3::DotImpl(float *p_a, float *p_b) const
|
||||||
|
{
|
||||||
|
return p_a[0] * p_b[0] + p_a[2] * p_b[2] + p_a[1] * p_b[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003ba0
|
||||||
|
void MxVector3::EqualsImpl(float *p_data)
|
||||||
|
{
|
||||||
|
float *vec = m_data;
|
||||||
|
vec[0] = p_data[0];
|
||||||
|
vec[1] = p_data[1];
|
||||||
|
vec[2] = p_data[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003bc0
|
||||||
|
void MxVector3::Clear()
|
||||||
|
{
|
||||||
|
float *vec = m_data;
|
||||||
|
vec[0] = 0.0f;
|
||||||
|
vec[1] = 0.0f;
|
||||||
|
vec[2] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003bd0
|
||||||
|
float MxVector3::LenSquared() const
|
||||||
|
{
|
||||||
|
return m_data[1] * m_data[1] + m_data[0] * m_data[0] + m_data[2] * m_data[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002270
|
||||||
|
void MxVector3::EqualsCrossImpl(float* p_a, float* p_b)
|
||||||
|
{
|
||||||
|
m_data[0] = p_a[1] * p_b[2] - p_a[2] * p_b[1];
|
||||||
|
m_data[1] = p_a[2] * p_b[0] - p_a[0] * p_b[2];
|
||||||
|
m_data[2] = p_a[0] * p_b[1] - p_a[1] * p_b[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002300
|
||||||
|
void MxVector3::EqualsCross(float *p_a, MxVector3 *p_b)
|
||||||
|
{
|
||||||
|
EqualsCrossImpl(p_a, p_b->m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100022e0
|
||||||
|
void MxVector3::EqualsCross(MxVector3 *p_a, float *p_b)
|
||||||
|
{
|
||||||
|
EqualsCrossImpl(p_a->m_data, p_b);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100022c0
|
||||||
|
void MxVector3::EqualsCross(MxVector3 *p_a, MxVector3 *p_b)
|
||||||
|
{
|
||||||
|
EqualsCrossImpl(p_a->m_data, p_b->m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10003bf0
|
||||||
|
void MxVector3::EqualsScalar(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] = *p_value;
|
||||||
|
m_data[1] = *p_value;
|
||||||
|
m_data[2] = *p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100028b0
|
||||||
|
void MxVector4::AddScalarImpl(float p_value)
|
||||||
|
{
|
||||||
|
m_data[0] += p_value;
|
||||||
|
m_data[1] += p_value;
|
||||||
|
m_data[2] += p_value;
|
||||||
|
m_data[3] += p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002870
|
||||||
|
void MxVector4::AddVectorImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] += p_value[0];
|
||||||
|
m_data[1] += p_value[1];
|
||||||
|
m_data[2] += p_value[2];
|
||||||
|
m_data[3] += p_value[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100028f0
|
||||||
|
void MxVector4::SubVectorImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] -= p_value[0];
|
||||||
|
m_data[1] -= p_value[1];
|
||||||
|
m_data[2] -= p_value[2];
|
||||||
|
m_data[3] -= p_value[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002970
|
||||||
|
void MxVector4::MullScalarImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] *= *p_value;
|
||||||
|
m_data[1] *= *p_value;
|
||||||
|
m_data[2] *= *p_value;
|
||||||
|
m_data[3] *= *p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002930
|
||||||
|
void MxVector4::MullVectorImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] *= p_value[0];
|
||||||
|
m_data[1] *= p_value[1];
|
||||||
|
m_data[2] *= p_value[2];
|
||||||
|
m_data[3] *= p_value[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100029b0
|
||||||
|
void MxVector4::DivScalarImpl(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] /= *p_value;
|
||||||
|
m_data[1] /= *p_value;
|
||||||
|
m_data[2] /= *p_value;
|
||||||
|
m_data[3] /= *p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100029f0
|
||||||
|
float MxVector4::DotImpl(float *p_a, float *p_b) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
p_a[0] * p_b[0] + p_a[2] * p_b[2] +
|
||||||
|
p_a[1] * p_b[1] + p_a[3] * p_b[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002a20
|
||||||
|
void MxVector4::EqualsImpl(float *p_data)
|
||||||
|
{
|
||||||
|
float *vec = m_data;
|
||||||
|
vec[0] = p_data[0];
|
||||||
|
vec[1] = p_data[1];
|
||||||
|
vec[2] = p_data[2];
|
||||||
|
vec[3] = p_data[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002b00
|
||||||
|
void MxVector4::Clear()
|
||||||
|
{
|
||||||
|
float *vec = m_data;
|
||||||
|
vec[0] = 0.0f;
|
||||||
|
vec[1] = 0.0f;
|
||||||
|
vec[2] = 0.0f;
|
||||||
|
vec[3] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002b20
|
||||||
|
float MxVector4::LenSquared() const
|
||||||
|
{
|
||||||
|
return m_data[1] * m_data[1] + m_data[0] * m_data[0] +
|
||||||
|
m_data[2] * m_data[2] + m_data[3] * m_data[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002b40
|
||||||
|
void MxVector4::EqualsScalar(float *p_value)
|
||||||
|
{
|
||||||
|
m_data[0] = *p_value;
|
||||||
|
m_data[1] = *p_value;
|
||||||
|
m_data[2] = *p_value;
|
||||||
|
m_data[3] = *p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002ae0 STUB
|
||||||
|
void MxVector4::unk1(MxVector4 *p_a, float *p_b)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002a40
|
||||||
|
void MxVector4::SetMatrixProduct(float *p_vec, float *p_mat)
|
||||||
|
{
|
||||||
|
m_data[0] =
|
||||||
|
p_vec[0] * p_mat[0] + p_vec[1] * p_mat[4] +
|
||||||
|
p_vec[2] * p_mat[8] + p_vec[3] * p_mat[12];
|
||||||
|
m_data[1] =
|
||||||
|
p_vec[0] * p_mat[1] + p_vec[1] * p_mat[5] +
|
||||||
|
p_vec[2] * p_mat[9] + p_vec[4] * p_mat[13];
|
||||||
|
m_data[2] =
|
||||||
|
p_vec[0] * p_mat[2] + p_vec[1] * p_mat[6] +
|
||||||
|
p_vec[2] * p_mat[10] + p_vec[4] * p_mat[14];
|
||||||
|
m_data[3] =
|
||||||
|
p_vec[0] * p_mat[3] + p_vec[1] * p_mat[7] +
|
||||||
|
p_vec[2] * p_mat[11] + p_vec[4] * p_mat[15];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note close yet, included because I'm at least confident I know what operation
|
||||||
|
// it's trying to do.
|
||||||
|
// OFFSET: LEGO1 0x10002b70 STUB
|
||||||
|
MxResult MxVector4::NormalizeQuaternion()
|
||||||
|
{
|
||||||
|
float *v = m_data;
|
||||||
|
float magnitude = v[1] * v[1] + v[2] * v[2] + v[0] * v[0];
|
||||||
|
if (magnitude > 0.0f)
|
||||||
|
{
|
||||||
|
float theta = v[3] * 0.5f;
|
||||||
|
v[3] = cos(theta);
|
||||||
|
float frac = sin(theta);
|
||||||
|
magnitude = frac / sqrt(magnitude);
|
||||||
|
v[0] *= magnitude;
|
||||||
|
v[1] *= magnitude;
|
||||||
|
v[2] *= magnitude;
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10002bf0 STUB
|
||||||
|
void MxVector4::UnknownQuaternionOp(MxVector4 *p_a, MxVector4 *p_b)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
150
LEGO1/mxvector.h
Normal file
150
LEGO1/mxvector.h
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
#ifndef MXVECTOR_H
|
||||||
|
#define MXVECTOR_H
|
||||||
|
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
|
// VTABLE 0x100d4288
|
||||||
|
// SIZE 0x8
|
||||||
|
class MxVector2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// OFFSET: LEGO1 0x1000c0f0
|
||||||
|
inline MxVector2(float* p_data) : m_data(p_data) {}
|
||||||
|
|
||||||
|
// vtable + 0x00 (no virtual destructor)
|
||||||
|
virtual void AddScalarImpl(float p_value) = 0;
|
||||||
|
virtual void AddVectorImpl(float *p_value) = 0;
|
||||||
|
virtual void SubVectorImpl(float *p_value) = 0;
|
||||||
|
virtual void MullScalarImpl(float *p_value) = 0;
|
||||||
|
|
||||||
|
// vtable + 0x10
|
||||||
|
virtual void MullVectorImpl(float *p_value) = 0;
|
||||||
|
virtual void DivScalarImpl(float *p_value) = 0;
|
||||||
|
virtual float DotImpl(float *p_a, float *p_b) const = 0;
|
||||||
|
virtual void SetData(float *p_data);
|
||||||
|
|
||||||
|
// vtable + 0x20
|
||||||
|
virtual void EqualsImpl(float *p_data) = 0;
|
||||||
|
virtual const float *GetData() const;
|
||||||
|
virtual float *GetData();
|
||||||
|
virtual void Clear() = 0;
|
||||||
|
|
||||||
|
// vtable + 0x30
|
||||||
|
virtual float Dot(MxVector2 *p_a, float *p_b) const;
|
||||||
|
virtual float Dot(float *p_a, MxVector2 *p_b) const;
|
||||||
|
virtual float Dot(MxVector2 *p_a, MxVector2 *p_b) const;
|
||||||
|
virtual float Dot(float *p_a, float *p_b) const;
|
||||||
|
|
||||||
|
// vtable + 0x40
|
||||||
|
virtual float LenSquared() const = 0;
|
||||||
|
virtual MxResult Unitize();
|
||||||
|
|
||||||
|
// vtable + 0x48
|
||||||
|
virtual void AddVector(MxVector2 *p_other);
|
||||||
|
virtual void AddVector(float *p_other);
|
||||||
|
virtual void AddScalar(float p_value);
|
||||||
|
|
||||||
|
// vtable + 0x54
|
||||||
|
virtual void SubVector(MxVector2 *p_other);
|
||||||
|
virtual void SubVector(float *p_other);
|
||||||
|
|
||||||
|
// vtable + 0x5C
|
||||||
|
virtual void MullScalar(float *p_value);
|
||||||
|
virtual void MullVector(MxVector2 *p_other);
|
||||||
|
virtual void MullVector(float *p_other);
|
||||||
|
virtual void DivScalar(float *p_value);
|
||||||
|
|
||||||
|
// vtable + 0x6C
|
||||||
|
virtual void SetVector(MxVector2 *other);
|
||||||
|
virtual void SetVector(float *other);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
float *m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d4518
|
||||||
|
// SIZE 0x8
|
||||||
|
class MxVector3 : public MxVector2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline MxVector3(float* p_data) : MxVector2(p_data) {}
|
||||||
|
|
||||||
|
void AddScalarImpl(float p_value);
|
||||||
|
|
||||||
|
void AddVectorImpl(float *p_value);
|
||||||
|
|
||||||
|
void SubVectorImpl(float *p_value);
|
||||||
|
void MullScalarImpl(float *p_value);
|
||||||
|
void MullVectorImpl(float *p_value);
|
||||||
|
void DivScalarImpl(float *p_value);
|
||||||
|
float DotImpl(float *p_a, float *p_b) const;
|
||||||
|
|
||||||
|
void EqualsImpl(float *p_data);
|
||||||
|
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
float LenSquared() const;
|
||||||
|
|
||||||
|
// vtable + 0x74
|
||||||
|
virtual void EqualsCrossImpl(float* p_a, float* p_b);
|
||||||
|
virtual void EqualsCross(float *p_a, MxVector3 *p_b);
|
||||||
|
virtual void EqualsCross(MxVector3 *p_a, float *p_b);
|
||||||
|
virtual void EqualsCross(MxVector3 *p_a, MxVector3 *p_b);
|
||||||
|
virtual void EqualsScalar(float *p_value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d45a0
|
||||||
|
// SIZE 0x8
|
||||||
|
class MxVector4 : public MxVector3
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline MxVector4(float* p_data) : MxVector3(p_data) {}
|
||||||
|
|
||||||
|
void AddScalarImpl(float p_value);
|
||||||
|
|
||||||
|
void AddVectorImpl(float *p_value);
|
||||||
|
|
||||||
|
void SubVectorImpl(float *p_value);
|
||||||
|
void MullScalarImpl(float *p_value);
|
||||||
|
void MullVectorImpl(float *p_value);
|
||||||
|
void DivScalarImpl(float *p_value);
|
||||||
|
float DotImpl(float *p_a, float *p_b) const;
|
||||||
|
|
||||||
|
void EqualsImpl(float *p_data);
|
||||||
|
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
float LenSquared() const;
|
||||||
|
|
||||||
|
void EqualsScalar(float *p_value);
|
||||||
|
|
||||||
|
// vtable + 0x84
|
||||||
|
virtual void unk1(MxVector4 *p_a, float *p_b);
|
||||||
|
virtual void SetMatrixProduct(float *p_vec, float *p_mat);
|
||||||
|
virtual MxResult NormalizeQuaternion();
|
||||||
|
virtual void UnknownQuaternionOp(MxVector4 *p_a, MxVector4 *p_b);
|
||||||
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d4488
|
||||||
|
// SIZE 0x14
|
||||||
|
class MxVector3Data : public MxVector3
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline MxVector3Data() : MxVector3(&x) {}
|
||||||
|
inline MxVector3Data(float p_x, float p_y, float p_z)
|
||||||
|
: MxVector3(&x)
|
||||||
|
, x(p_x), y(p_y), z(p_z)
|
||||||
|
{}
|
||||||
|
float x, y, z;
|
||||||
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d41e8
|
||||||
|
// SIZE 0x18
|
||||||
|
class MxVector4Data : public MxVector4
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline MxVector4Data() : MxVector4(&x) {}
|
||||||
|
float x, y, z, w;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MXVECTOR_H
|
||||||
@ -1,13 +1,30 @@
|
|||||||
#include "pizza.h"
|
#include "pizza.h"
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x10037ef0 STUB
|
#include "decomp.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(Pizza, 0x9c);
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10037ef0
|
||||||
Pizza::Pizza()
|
Pizza::Pizza()
|
||||||
{
|
{
|
||||||
// TODO
|
// FIXME: This inherits from LegoActor, probably why this isn't matching
|
||||||
|
this->m_unk80 = 0;
|
||||||
|
this->m_unk84 = 0;
|
||||||
|
this->m_unk88 = 0;
|
||||||
|
this->m_unk8c = -1;
|
||||||
|
this->m_unk98 = 0;
|
||||||
|
this->m_unk90 = 0x80000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x10038100 STUB
|
// OFFSET: LEGO1 0x10038100
|
||||||
Pizza::~Pizza()
|
Pizza::~Pizza()
|
||||||
{
|
{
|
||||||
// TODO
|
TickleManager()->UnregisterClient(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100388a0
|
||||||
|
MxResult Pizza::Tickle()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,10 @@
|
|||||||
#define PIZZA_H
|
#define PIZZA_H
|
||||||
|
|
||||||
#include "isleactor.h"
|
#include "isleactor.h"
|
||||||
|
#include "mxcore.h"
|
||||||
|
#include "mxomni.h"
|
||||||
|
#include "mxticklemanager.h"
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
// VTABLE 0x100d7380
|
// VTABLE 0x100d7380
|
||||||
// SIZE 0x9c
|
// SIZE 0x9c
|
||||||
@ -11,6 +15,30 @@ class Pizza : public IsleActor
|
|||||||
Pizza();
|
Pizza();
|
||||||
virtual ~Pizza() override;
|
virtual ~Pizza() override;
|
||||||
|
|
||||||
|
virtual MxResult Tickle() override; // vtable+08
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10037f90
|
||||||
|
inline const char *ClassName() const //vtable+0c
|
||||||
|
{
|
||||||
|
// 0x100f038c
|
||||||
|
return "Pizza";
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x10037fa0
|
||||||
|
inline MxBool Pizza::IsA(const char *name) const override //vtable+10
|
||||||
|
{
|
||||||
|
return !strcmp(name, Pizza::ClassName()) || IsleActor::IsA(name);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
MxS32 m_unk78;
|
||||||
|
MxS32 m_unk7c;
|
||||||
|
MxS32 m_unk80;
|
||||||
|
MxS32 m_unk84;
|
||||||
|
MxS32 m_unk88;
|
||||||
|
MxS32 m_unk8c;
|
||||||
|
MxU32 m_unk90;
|
||||||
|
MxS32 m_unk94;
|
||||||
|
MxS32 m_unk98;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PIZZA_H
|
#endif // PIZZA_H
|
||||||
|
|||||||
@ -343,14 +343,15 @@ def replace_register(lines: list[str], start_line: int, reg: str, replacement: s
|
|||||||
|
|
||||||
# Is it possible to make new_asm the same as original_asm by swapping registers?
|
# Is it possible to make new_asm the same as original_asm by swapping registers?
|
||||||
def can_resolve_register_differences(original_asm, new_asm):
|
def can_resolve_register_differences(original_asm, new_asm):
|
||||||
|
# Split the ASM on spaces to get more granularity, and so
|
||||||
|
# that we don't modify the original arrays passed in.
|
||||||
|
original_asm = [part for line in original_asm for part in line.split()]
|
||||||
|
new_asm = [part for line in new_asm for part in line.split()]
|
||||||
|
|
||||||
# Swapping ain't gonna help if the lengths are different
|
# Swapping ain't gonna help if the lengths are different
|
||||||
if len(original_asm) != len(new_asm):
|
if len(original_asm) != len(new_asm):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Make copies so we don't modify the original
|
|
||||||
original_asm = original_asm.copy()
|
|
||||||
new_asm = new_asm.copy()
|
|
||||||
|
|
||||||
# Look for the mismatching lines
|
# Look for the mismatching lines
|
||||||
for i in range(len(original_asm)):
|
for i in range(len(original_asm)):
|
||||||
new_line = new_asm[i]
|
new_line = new_asm[i]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user