Merge branch 'master' into pr/93

This commit is contained in:
itsmattkc 2023-08-03 11:01:37 -07:00
commit 500f1fc4db
14 changed files with 1428 additions and 19 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
Debug/
Release/
*.ncb
/.vs
ISLE.EXE
LEGO1.DLL
build/

View File

@ -47,6 +47,7 @@ add_library(lego1 SHARED
LEGO1/legoact2state.cpp
LEGO1/legoactor.cpp
LEGO1/legoactioncontrolpresenter.cpp
LEGO1/legoactor.cpp
LEGO1/legoanimactor.cpp
LEGO1/legoanimationmanager.cpp
LEGO1/legoanimmmpresenter.cpp

View File

@ -4,6 +4,10 @@
#define DECOMP_STATIC_ASSERT(V) namespace { typedef int foo[(V)?1:-1]; }
#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 short undefined2;
typedef unsigned int undefined4;

View File

@ -1 +1,4 @@
#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)

View File

@ -1,6 +1,7 @@
#ifndef LEGOACTOR_H
#define LEGOACTOR_H
#include "decomp.h"
#include "legoentity.h"
// VTABLE 0x100d6d68

0
LEGO1/mxdirect3d.cpp Normal file
View File

0
LEGO1/mxdirect3d.h Normal file
View File

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,130 @@
#ifndef MXDIRECTDRAW_H
#define MXDIRECTDRAW_H
#include <ddraw.h>
#include <Windows.h>
extern BOOL g_is_PALETTEINDEXED8;
//size 0x880
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:
__declspec(dllexport) int FlipToGDISurface();
__declspec(dllexport) static int GetPrimaryBitDepth();
__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

34
LEGO1/mxdisplaysurface.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef MXDISPLAYSURFACE_H
#define MXDISPLAYSURFACE_H
#include <ddraw.h>
#include "mxcore.h"
#include "mxpalette.h"
#include "mxvideoparam.h"
#include "decomp.h"
// VTABLE 0x100dc768
class MxDisplaySurface : public MxCore
{
public:
MxDisplaySurface();
virtual ~MxDisplaySurface() override;
virtual MxResult Init(MxVideoParam *p_videoParam, LPDIRECTDRAWSURFACE p_surface1, LPDIRECTDRAWSURFACE p_surface2, LPDIRECTDRAWCLIPPER p_clipper);
virtual MxResult Create(MxVideoParam *p_videoParam);
virtual void Clear();
virtual void SetPalette(MxPalette *p_palette);
virtual void vtable24(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
virtual MxBool vtable28(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
virtual MxBool vtable2c(undefined4, 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 void Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4);
virtual undefined4 vtable3c(undefined4*);
virtual undefined4 vtable40(undefined4);
virtual undefined4 vtable44(undefined4, undefined4*, undefined4, undefined4);
};
#endif // MXDISPLAYSURFACE_H

View File

@ -25,7 +25,7 @@ int MxVideoManager::Init()
{
this->m_pDirectDraw = NULL;
this->m_unk54 = NULL;
this->m_unk58 = NULL;
this->m_displaySurface = NULL;
this->m_unk5c = 0;
this->m_videoParam.SetPalette(NULL);
this->m_unk60 = FALSE;
@ -45,10 +45,10 @@ MxLong MxVideoManager::RealizePalette(MxPalette *p_palette)
this->m_criticalSection.Enter();
if (p_palette && this->m_videoParam.GetPalette())
{
if (p_palette && this->m_videoParam.GetPalette()) {
p_palette->GetEntries(paletteEntries);
// TODO
this->m_videoParam.GetPalette()->SetEntries(paletteEntries);
this->m_displaySurface->SetPalette(this->m_videoParam.GetPalette());
}
this->m_criticalSection.Leave();

View File

@ -2,6 +2,7 @@
#define MXVIDEOMANAGER_H
#include "mxunknown100dc6b0.h"
#include "mxdisplaysurface.h"
#include "mxvideoparam.h"
// VTABLE 0x100dc810
@ -26,7 +27,7 @@ class MxVideoManager : public MxUnknown100dc6b0
MxVideoParam m_videoParam;
LPDIRECTDRAW m_pDirectDraw;
LPDIRECTDRAWSURFACE m_unk54;
void* m_unk58;
MxDisplaySurface *m_displaySurface;
int m_unk5c;
MxBool m_unk60;
};

View File

@ -1,13 +1,30 @@
#include "pizza.h"
// OFFSET: LEGO1 0x10037ef0 STUB
#include "decomp.h"
DECOMP_SIZE_ASSERT(Pizza, 0x9c);
// OFFSET: LEGO1 0x10037ef0
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()
{
// TODO
TickleManager()->Unregister(this);
}
// OFFSET: LEGO1 0x100388a0
MxResult Pizza::Tickle()
{
// TODO
return SUCCESS;
}

View File

@ -2,6 +2,10 @@
#define PIZZA_H
#include "isleactor.h"
#include "mxcore.h"
#include "mxomni.h"
#include "mxticklemanager.h"
#include "mxtypes.h"
// VTABLE 0x100d7380
// SIZE 0x9c
@ -11,6 +15,30 @@ class Pizza : public IsleActor
Pizza();
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