lego: implement SetControlMax and related partials (MxVideoManager, MxPalette, MxUnknown100dc6b0) (#42)

* lego: implement LegoNavController::SetControlMax and related

* use MxResult

* fix name
This commit is contained in:
Christian Semmler 2023-06-24 19:09:46 +02:00 committed by GitHub
parent 579ee84049
commit 64d2b9e02b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 219 additions and 44 deletions

View file

@ -100,22 +100,18 @@ LegoNavController::LegoNavController()
// inputManager->UnRegister(this); // inputManager->UnRegister(this);
// } // }
// TODO: VideoManager()
// OFFSET: LEGO1 0x10054ca0 // OFFSET: LEGO1 0x10054ca0
// void LegoNavController::SetControlMax(int p_hMax, int p_vMax) void LegoNavController::SetControlMax(int p_hMax, int p_vMax)
// { {
// LegoVideoManager* videoManager = VideoManager(); this->m_hMax = p_hMax;
this->m_vMax = p_vMax;
// this->m_hMax = p_hMax; if (VideoManager()->GetVideoParam().flags().GetFullScreen())
// this->m_vMax = p_vMax; {
this->m_hMax = 640;
// Probably checks for MxVideoParamFlags: FULL_SCREEN this->m_vMax = 480;
// if ((videoManager->m_unk44 & 0x01) != 0) }
// { }
// this->m_hMax = 640;
// this->m_vMax = 480;
// }
// }
// OFFSET: LEGO1 0x10054cd0 // OFFSET: LEGO1 0x10054cd0
void LegoNavController::ResetToDefault() void LegoNavController::ResetToDefault()

View file

@ -20,7 +20,7 @@ class LegoNavController : public MxCore
LegoNavController(); LegoNavController();
// virtual ~LegoNavController(); // virtual ~LegoNavController();
// void SetControlMax(int p_hMax, int p_vMax); void SetControlMax(int p_hMax, int p_vMax);
void ResetToDefault(); void ResetToDefault();
void SetTargets(int p_hPos, int p_vPos, MxBool p_accel); void SetTargets(int p_hPos, int p_vPos, MxBool p_accel);
float CalculateNewTargetSpeed(int p_pos, int p_center, float p_maxSpeed); float CalculateNewTargetSpeed(int p_pos, int p_center, float p_maxSpeed);

View file

@ -1,10 +1,10 @@
#ifndef LEGOVIDEOMANAGER_H #ifndef LEGOVIDEOMANAGER_H
#define LEGOVIDEOMANAGER_H #define LEGOVIDEOMANAGER_H
#include "mxvideomanager.h"
#include "lego3dmanager.h" #include "lego3dmanager.h"
// class LegoVideoManager : public MxVideoManager class LegoVideoManager : public MxVideoManager
class LegoVideoManager
{ {
public: public:
__declspec(dllexport) int EnableRMDevice(); __declspec(dllexport) int EnableRMDevice();
@ -14,31 +14,6 @@ class LegoVideoManager
inline Lego3DManager *Get3DManager() { return this->m_3dManager; } inline Lego3DManager *Get3DManager() { return this->m_3dManager; }
int m_unk00;
int m_unk04;
int m_unk08;
int m_unk0c;
int m_unk10;
int m_unk14;
int m_unk18;
int m_unk1c;
int m_unk20;
int m_unk24;
int m_unk28;
int m_unk2c;
int m_unk30;
int m_unk34;
int m_unk38;
int m_unk3c;
int m_unk40;
int m_unk44;
int m_unk48;
int m_unk4c;
int m_unk50;
int m_unk54;
int m_unk58;
int m_unk5c;
int m_unk60;
int m_unk64; int m_unk64;
Lego3DManager *m_3dManager; Lego3DManager *m_3dManager;
int m_unk6c; int m_unk6c;

8
LEGO1/mxpalette.cpp Executable file
View file

@ -0,0 +1,8 @@
#include "mxpalette.h"
// OFFSET: LEGO1 0x100bf150
MxResult MxPalette::GetEntries(LPPALETTEENTRY p_entries)
{
memcpy(p_entries, this->m_entries, sizeof(this->m_entries));
return SUCCESS;
}

View file

@ -1,11 +1,23 @@
#ifndef MXPALETTE_H #ifndef MXPALETTE_H
#define MXPALETTE_H #define MXPALETTE_H
class MxPalette #include <ddraw.h>
#include "mxcore.h"
#include "mxresult.h"
class MxPalette : public MxCore
{ {
public: public:
__declspec(dllexport) unsigned char operator==(MxPalette &); __declspec(dllexport) unsigned char operator==(MxPalette &);
__declspec(dllexport) void Detach(); __declspec(dllexport) void Detach();
MxResult GetEntries(LPPALETTEENTRY p_entries);
private:
LPDIRECTDRAWPALETTE m_pDirectDrawPalette;
PALETTEENTRY m_entries[256];
// there's a bit more here
}; };
#endif // MXPALETTE_H #endif // MXPALETTE_H

15
LEGO1/mxunknown100dc6b0.cpp Executable file
View file

@ -0,0 +1,15 @@
#include "mxunknown100dc6b0.h"
// OFFSET: LEGO1 0x100b84c0
MxUnknown100dc6b0::MxUnknown100dc6b0()
{
Init();
}
// OFFSET: LEGO1 0x100b85d0
MxResult MxUnknown100dc6b0::Init()
{
this->m_unk08 = 0;
this->m_unk0c = 0;
return SUCCESS;
}

23
LEGO1/mxunknown100dc6b0.h Executable file
View file

@ -0,0 +1,23 @@
#ifndef MXUNKNOWN100DC6B0_H
#define MXUNKNOWN100DC6B0_H
#include "mxcore.h"
#include "mxresult.h"
#include "mxcriticalsection.h"
class MxUnknown100dc6b0 : public MxCore
{
public:
MxUnknown100dc6b0();
MxResult Init();
private:
int m_unk08;
int m_unk0c;
protected:
MxCriticalSection m_criticalSection;
};
#endif // MXUNKNOWN100DC6B0_H

36
LEGO1/mxvideomanager.cpp Executable file
View file

@ -0,0 +1,36 @@
#include "mxvideomanager.h"
// OFFSET: LEGO1 0x100be1f0
MxVideoManager::MxVideoManager()
{
Init();
}
// OFFSET: LEGO1 0x100be320
int MxVideoManager::Init()
{
this->m_unk50 = 0;
this->m_unk54 = NULL;
this->m_unk58 = NULL;
this->m_unk5c = 0;
this->m_videoParam.SetPalette(NULL);
this->m_unk60 = MX_FALSE;
return 0;
}
// OFFSET: LEGO1 0x100bebe0
long MxVideoManager::RealizePalette(MxPalette *p_palette)
{
PALETTEENTRY paletteEntries[256];
this->m_criticalSection.Enter();
if (p_palette && this->m_videoParam.GetPalette())
{
p_palette->GetEntries(paletteEntries);
// TODO
}
this->m_criticalSection.Leave();
return 0;
}

View file

@ -1,11 +1,28 @@
#ifndef MXVIDEOMANAGER_H #ifndef MXVIDEOMANAGER_H
#define MXVIDEOMANAGER_H #define MXVIDEOMANAGER_H
class MxVideoManager #include "mxunknown100dc6b0.h"
#include "mxvideoparam.h"
class MxVideoManager : public MxUnknown100dc6b0
{ {
public: public:
__declspec(dllexport) void InvalidateRect(MxRect32 &); __declspec(dllexport) void InvalidateRect(MxRect32 &);
__declspec(dllexport) virtual long RealizePalette(MxPalette *); __declspec(dllexport) virtual long RealizePalette(MxPalette *);
MxVideoManager();
int Init();
inline MxVideoParam& GetVideoParam() { return this->m_videoParam; }
private:
MxVideoParam m_videoParam;
int m_unk50;
LPDIRECTDRAWSURFACE m_unk54;
void* m_unk58;
int m_unk5c;
MxBool m_unk60;
}; };
#endif // MXVIDEOMANAGER_H #endif // MXVIDEOMANAGER_H

View file

@ -1,7 +1,10 @@
#ifndef MXVIDEOPARAM_H #ifndef MXVIDEOPARAM_H
#define MXVIDEOPARAM_H #define MXVIDEOPARAM_H
#include <ddraw.h>
#include "mxpalette.h" #include "mxpalette.h"
#include "mxbool.h"
#include "mxrect32.h" #include "mxrect32.h"
#include "mxvariabletable.h" #include "mxvariabletable.h"
#include "mxvideoparamflags.h" #include "mxvideoparamflags.h"
@ -19,6 +22,9 @@ class MxVideoParam
inline MxVideoParamFlags &flags() { return m_flags; } inline MxVideoParamFlags &flags() { return m_flags; }
inline void SetPalette(MxPalette *p_palette) { this->m_palette = p_palette; }
inline MxPalette *GetPalette() { return this->m_palette; }
private: private:
MxRect32 m_rect; MxRect32 m_rect;
MxPalette *m_palette; MxPalette *m_palette;

View file

@ -40,6 +40,23 @@ class MxVideoParamFlags
inline void Set_f2bit6(BOOL e) { m_flags2.bit6 = e; } inline void Set_f2bit6(BOOL e) { m_flags2.bit6 = e; }
inline void Set_f2bit7(BOOL e) { m_flags2.bit7 = e; } inline void Set_f2bit7(BOOL e) { m_flags2.bit7 = e; }
inline BYTE GetFullScreen() { return m_flags1.bit0; }
inline BYTE GetFlipSurfaces() { return m_flags1.bit1; }
inline BYTE GetBackBuffers() { return m_flags1.bit2; }
inline BYTE Get_f1bit3() { return m_flags1.bit3; }
inline BYTE Get_f1bit4() { return m_flags1.bit4; }
inline BYTE Get16Bit() { return m_flags1.bit5; }
inline BYTE GetWideViewAngle() { return m_flags1.bit6; }
inline BYTE Get_f1bit7() { return m_flags1.bit7; }
inline BYTE Get_f2bit0() { return m_flags2.bit0; }
inline BYTE Get_f2bit1() { return m_flags2.bit1; }
inline BYTE Get_f2bit2() { return m_flags2.bit2; }
inline BYTE Get_f2bit3() { return m_flags2.bit3; }
inline BYTE Get_f2bit4() { return m_flags2.bit4; }
inline BYTE Get_f2bit5() { return m_flags2.bit5; }
inline BYTE Get_f2bit6() { return m_flags2.bit6; }
inline BYTE Get_f2bit7() { return m_flags2.bit7; }
private: private:
flag_bitfield m_flags1; flag_bitfield m_flags1;
flag_bitfield m_flags2; flag_bitfield m_flags2;

View file

@ -66,8 +66,11 @@ CLEAN :
-@erase "$(INTDIR)\mxomnicreateflags.obj" -@erase "$(INTDIR)\mxomnicreateflags.obj"
-@erase "$(INTDIR)\mxomnicreateparam.obj" -@erase "$(INTDIR)\mxomnicreateparam.obj"
-@erase "$(INTDIR)\mxomnicreateparambase.obj" -@erase "$(INTDIR)\mxomnicreateparambase.obj"
-@erase "$(INTDIR)\mxpalette.obj"
-@erase "$(INTDIR)\mxstring.obj" -@erase "$(INTDIR)\mxstring.obj"
-@erase "$(INTDIR)\mxtimer.obj" -@erase "$(INTDIR)\mxtimer.obj"
-@erase "$(INTDIR)\mxunknown100dc6b0.obj"
-@erase "$(INTDIR)\mxvideomanager.obj"
-@erase "$(INTDIR)\mxvideoparam.obj" -@erase "$(INTDIR)\mxvideoparam.obj"
-@erase "$(INTDIR)\mxvideoparamflags.obj" -@erase "$(INTDIR)\mxvideoparamflags.obj"
-@erase "$(INTDIR)\vc40.pdb" -@erase "$(INTDIR)\vc40.pdb"
@ -140,8 +143,11 @@ LINK32_OBJS= \
"$(INTDIR)\mxomnicreateflags.obj" \ "$(INTDIR)\mxomnicreateflags.obj" \
"$(INTDIR)\mxomnicreateparam.obj" \ "$(INTDIR)\mxomnicreateparam.obj" \
"$(INTDIR)\mxomnicreateparambase.obj" \ "$(INTDIR)\mxomnicreateparambase.obj" \
"$(INTDIR)\mxpalette.obj" \
"$(INTDIR)\mxstring.obj" \ "$(INTDIR)\mxstring.obj" \
"$(INTDIR)\mxtimer.obj" \ "$(INTDIR)\mxtimer.obj" \
"$(INTDIR)\mxunknown100dc6b0.obj" \
"$(INTDIR)\mxvideomanager.obj" \
"$(INTDIR)\mxvideoparam.obj" \ "$(INTDIR)\mxvideoparam.obj" \
"$(INTDIR)\mxvideoparamflags.obj" "$(INTDIR)\mxvideoparamflags.obj"
@ -180,8 +186,11 @@ CLEAN :
-@erase "$(INTDIR)\mxomnicreateflags.obj" -@erase "$(INTDIR)\mxomnicreateflags.obj"
-@erase "$(INTDIR)\mxomnicreateparam.obj" -@erase "$(INTDIR)\mxomnicreateparam.obj"
-@erase "$(INTDIR)\mxomnicreateparambase.obj" -@erase "$(INTDIR)\mxomnicreateparambase.obj"
-@erase "$(INTDIR)\mxpalette.obj"
-@erase "$(INTDIR)\mxstring.obj" -@erase "$(INTDIR)\mxstring.obj"
-@erase "$(INTDIR)\mxtimer.obj" -@erase "$(INTDIR)\mxtimer.obj"
-@erase "$(INTDIR)\mxunknown100dc6b0.obj"
-@erase "$(INTDIR)\mxvideomanager.obj"
-@erase "$(INTDIR)\mxvideoparam.obj" -@erase "$(INTDIR)\mxvideoparam.obj"
-@erase "$(INTDIR)\mxvideoparamflags.obj" -@erase "$(INTDIR)\mxvideoparamflags.obj"
-@erase "$(INTDIR)\vc40.idb" -@erase "$(INTDIR)\vc40.idb"
@ -256,8 +265,11 @@ LINK32_OBJS= \
"$(INTDIR)\mxomnicreateflags.obj" \ "$(INTDIR)\mxomnicreateflags.obj" \
"$(INTDIR)\mxomnicreateparam.obj" \ "$(INTDIR)\mxomnicreateparam.obj" \
"$(INTDIR)\mxomnicreateparambase.obj" \ "$(INTDIR)\mxomnicreateparambase.obj" \
"$(INTDIR)\mxpalette.obj" \
"$(INTDIR)\mxstring.obj" \ "$(INTDIR)\mxstring.obj" \
"$(INTDIR)\mxtimer.obj" \ "$(INTDIR)\mxtimer.obj" \
"$(INTDIR)\mxunknown100dc6b0.obj" \
"$(INTDIR)\mxvideomanager.obj" \
"$(INTDIR)\mxvideoparam.obj" \ "$(INTDIR)\mxvideoparam.obj" \
"$(INTDIR)\mxvideoparamflags.obj" "$(INTDIR)\mxvideoparamflags.obj"
@ -530,6 +542,7 @@ DEP_CPP_LEGOO=\
".\LEGO1\mxticklemanager.h"\ ".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\ ".\LEGO1\mxtimer.h"\
".\LEGO1\mxtransitionmanager.h"\ ".\LEGO1\mxtransitionmanager.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\ ".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\ ".\LEGO1\mxvideomanager.h"\
".\LEGO1\mxvideoparam.h"\ ".\LEGO1\mxvideoparam.h"\
@ -614,6 +627,7 @@ DEP_CPP_MXOMN=\
".\LEGO1\mxstring.h"\ ".\LEGO1\mxstring.h"\
".\LEGO1\mxticklemanager.h"\ ".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\ ".\LEGO1\mxtimer.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\ ".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\ ".\LEGO1\mxvideomanager.h"\
".\LEGO1\mxvideoparam.h"\ ".\LEGO1\mxvideoparam.h"\
@ -777,6 +791,7 @@ DEP_CPP_LEGON=\
".\LEGO1\mxticklemanager.h"\ ".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\ ".\LEGO1\mxtimer.h"\
".\LEGO1\mxtransitionmanager.h"\ ".\LEGO1\mxtransitionmanager.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\ ".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\ ".\LEGO1\mxvideomanager.h"\
".\LEGO1\mxvideoparam.h"\ ".\LEGO1\mxvideoparam.h"\
@ -817,6 +832,59 @@ DEP_CPP_MXATO=\
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxunknown100dc6b0.cpp
DEP_CPP_MXUNK=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxunknown100dc6b0.h"\
"$(INTDIR)\mxunknown100dc6b0.obj" : $(SOURCE) $(DEP_CPP_MXUNK) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxvideomanager.cpp
DEP_CPP_MXVIDEO=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxpalette.h"\
".\LEGO1\mxrect32.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\
".\LEGO1\mxvideoparam.h"\
".\LEGO1\mxvideoparamflags.h"\
"$(INTDIR)\mxvideomanager.obj" : $(SOURCE) $(DEP_CPP_MXVIDEO) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxpalette.cpp
DEP_CPP_MXPAL=\
".\LEGO1\mxpalette.h"\
"$(INTDIR)\mxpalette.obj" : $(SOURCE) $(DEP_CPP_MXPAL) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File # End Source File
# End Target # End Target
################################################################################ ################################################################################
@ -894,6 +962,7 @@ DEP_CPP_ISLE_=\
".\LEGO1\mxticklemanager.h"\ ".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\ ".\LEGO1\mxtimer.h"\
".\LEGO1\mxtransitionmanager.h"\ ".\LEGO1\mxtransitionmanager.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\ ".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\ ".\LEGO1\mxvideomanager.h"\
".\LEGO1\mxvideoparam.h"\ ".\LEGO1\mxvideoparam.h"\
@ -949,6 +1018,7 @@ DEP_CPP_MAIN_=\
".\LEGO1\mxticklemanager.h"\ ".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\ ".\LEGO1\mxtimer.h"\
".\LEGO1\mxtransitionmanager.h"\ ".\LEGO1\mxtransitionmanager.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\ ".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\ ".\LEGO1\mxvideomanager.h"\
".\LEGO1\mxvideoparam.h"\ ".\LEGO1\mxvideoparam.h"\

BIN
isle.mdp

Binary file not shown.