mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 07:37:59 -05:00
Implement MxVideoManager::vtable0x28 and Create (#208)
* MxVideoManager::Destroy / destructor * Consistency * Add missing override * Implement MxVideoManager::vtable28 * Implement vtable2c * Rename to Create
This commit is contained in:
parent
e08717f496
commit
e4f87ad7dd
8 changed files with 200 additions and 30 deletions
|
@ -159,6 +159,7 @@ add_library(lego1 SHARED
|
|||
LEGO1/mxpresenterlist.cpp
|
||||
LEGO1/mxramstreamcontroller.cpp
|
||||
LEGO1/mxramstreamprovider.cpp
|
||||
LEGO1/mxregion.cpp
|
||||
LEGO1/mxscheduler.cpp
|
||||
LEGO1/mxsemaphore.cpp
|
||||
LEGO1/mxsmkpresenter.cpp
|
||||
|
|
|
@ -120,44 +120,32 @@ void MxMusicManager::SetVolume(MxS32 p_volume)
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0840
|
||||
MxResult MxMusicManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_noRegister)
|
||||
MxResult MxMusicManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_createThread)
|
||||
{
|
||||
MxResult status = FAILURE;
|
||||
MxBool locked = FALSE;
|
||||
|
||||
MxResult result = MxAudioManager::InitPresenters();
|
||||
if (result == SUCCESS)
|
||||
{
|
||||
if (p_noRegister)
|
||||
{
|
||||
if (MxAudioManager::InitPresenters() == SUCCESS) {
|
||||
if (p_createThread) {
|
||||
m_criticalSection.Enter();
|
||||
locked = TRUE;
|
||||
m_thread = new MxTickleThread(this, p_frequencyMS);
|
||||
|
||||
if (m_thread)
|
||||
{
|
||||
if (m_thread->Start(0, 0) == SUCCESS)
|
||||
{
|
||||
status = SUCCESS;
|
||||
}
|
||||
}
|
||||
if (!m_thread || m_thread->Start(0, 0) != SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
{
|
||||
TickleManager()->RegisterClient(this, p_frequencyMS);
|
||||
status = SUCCESS;
|
||||
}
|
||||
|
||||
status = SUCCESS;
|
||||
}
|
||||
|
||||
done:
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
if (locked)
|
||||
{
|
||||
m_criticalSection.Leave();
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
|
@ -14,7 +14,7 @@ class MxMusicManager : public MxAudioManager
|
|||
|
||||
virtual void Destroy() override; // vtable+18
|
||||
virtual void SetVolume(MxS32 p_volume) override; // vtable+2c
|
||||
virtual MxResult StartMIDIThread(MxU32 p_frequencyMS, MxU8 p_noRegister); // vtable+30
|
||||
virtual MxResult StartMIDIThread(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+30
|
||||
|
||||
inline MxBool GetMIDIInitialized() { return m_MIDIInitialized; }
|
||||
|
||||
|
|
|
@ -254,8 +254,7 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
|
|||
MxVideoManager *videoManager = new MxVideoManager();
|
||||
this->m_videoManager = videoManager;
|
||||
|
||||
if (videoManager != NULL && videoManager->vtable0x2c(p.GetVideoParam(), 100, 0) != SUCCESS)
|
||||
{
|
||||
if (videoManager && videoManager->Create(p.GetVideoParam(), 100, 0) != SUCCESS) {
|
||||
delete m_videoManager;
|
||||
m_videoManager = NULL;
|
||||
}
|
||||
|
|
39
LEGO1/mxregion.cpp
Normal file
39
LEGO1/mxregion.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "mxregion.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxRegion, 0x1c);
|
||||
|
||||
// OFFSET: LEGO1 0x100c31c0 STUB
|
||||
MxRegion::MxRegion()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c3690 STUB
|
||||
MxRegion::~MxRegion()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c3700 STUB
|
||||
void MxRegion::Reset()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c3750 STUB
|
||||
void MxRegion::vtable18()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c3e20 STUB
|
||||
void MxRegion::vtable1c()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c3660 STUB
|
||||
void MxRegion::vtable20()
|
||||
{
|
||||
// TODO
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
#define MXREGION_H
|
||||
|
||||
#include "mxcore.h"
|
||||
#include "decomp.h"
|
||||
|
||||
// VTABLE 0x100dcae8
|
||||
// SIZE 0x1c
|
||||
|
@ -21,6 +22,7 @@ class MxRegion : public MxCore
|
|||
// MxList<MxRect32> *m_rects;
|
||||
// 4 coordinates (could be MxRect32)
|
||||
// MxS32 left, top, right, bottom;
|
||||
undefined pad[0x14];
|
||||
};
|
||||
|
||||
#endif // MXREGION_H
|
||||
|
|
|
@ -155,14 +155,146 @@ MxLong MxVideoManager::RealizePalette(MxPalette *p_palette)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100be600 STUB
|
||||
void MxVideoManager::vtable0x28()
|
||||
// OFFSET: LEGO1 0x100be600
|
||||
MxResult MxVideoManager::vtable0x28(
|
||||
MxVideoParam &p_videoParam,
|
||||
LPDIRECTDRAW p_pDirectDraw,
|
||||
LPDIRECTDRAWSURFACE p_pDDSurface,
|
||||
LPDIRECTDRAWSURFACE p_ddSurface1,
|
||||
LPDIRECTDRAWSURFACE p_ddSurface2,
|
||||
LPDIRECTDRAWCLIPPER p_ddClipper,
|
||||
MxU32 p_frequencyMS,
|
||||
MxBool p_createThread)
|
||||
{
|
||||
MxBool locked = FALSE;
|
||||
MxResult status = FAILURE;
|
||||
|
||||
m_unk60 = FALSE;
|
||||
|
||||
if (MxMediaManager::InitPresenters() != SUCCESS)
|
||||
goto done;
|
||||
|
||||
m_criticalSection.Enter();
|
||||
locked = TRUE;
|
||||
|
||||
m_videoParam = p_videoParam;
|
||||
m_region = new MxRegion();
|
||||
|
||||
if (!m_region)
|
||||
goto done;
|
||||
|
||||
m_pDirectDraw = p_pDirectDraw;
|
||||
m_pDDSurface = p_pDDSurface;
|
||||
|
||||
MxPalette *palette;
|
||||
if (p_videoParam.GetPalette() == NULL) {
|
||||
palette = new MxPalette();
|
||||
m_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
goto done;
|
||||
}
|
||||
else {
|
||||
palette = p_videoParam.GetPalette()->Clone();
|
||||
m_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_displaySurface = new MxDisplaySurface();
|
||||
if (m_displaySurface && m_displaySurface->Init(m_videoParam, p_ddSurface1, p_ddSurface2, p_ddClipper) == SUCCESS) {
|
||||
m_displaySurface->SetPalette(m_videoParam.GetPalette());
|
||||
|
||||
if (p_createThread) {
|
||||
m_thread = new MxTickleThread(this, p_frequencyMS);
|
||||
|
||||
if (!m_thread || m_thread->Start(0, 0) != SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
TickleManager()->RegisterClient(this, p_frequencyMS);
|
||||
|
||||
status = SUCCESS;
|
||||
}
|
||||
|
||||
done:
|
||||
if (status != SUCCESS)
|
||||
Destroy();
|
||||
|
||||
if (locked)
|
||||
m_criticalSection.Leave();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bebe0 STUB
|
||||
MxResult MxVideoManager::vtable0x2c(MxVideoParam& p_videoParam, undefined4 p_unknown1, MxU8 p_unknown2)
|
||||
// OFFSET: LEGO1 0x100be820
|
||||
MxResult MxVideoManager::Create(
|
||||
MxVideoParam &p_videoParam,
|
||||
MxU32 p_frequencyMS,
|
||||
MxBool p_createThread)
|
||||
{
|
||||
return FAILURE;
|
||||
MxBool locked = FALSE;
|
||||
MxResult status = FAILURE;
|
||||
|
||||
m_unk60 = TRUE;
|
||||
|
||||
if (MxMediaManager::InitPresenters() != SUCCESS)
|
||||
goto done;
|
||||
|
||||
m_criticalSection.Enter();
|
||||
locked = TRUE;
|
||||
|
||||
m_videoParam = p_videoParam;
|
||||
m_region = new MxRegion();
|
||||
|
||||
if (!m_region)
|
||||
goto done;
|
||||
|
||||
if (DirectDrawCreate(NULL, &m_pDirectDraw, NULL) != DD_OK)
|
||||
goto done;
|
||||
|
||||
if (m_pDirectDraw->SetCooperativeLevel(MxOmni::GetInstance()->GetWindowHandle(), DDSCL_NORMAL) != DD_OK)
|
||||
goto done;
|
||||
|
||||
MxPalette *palette;
|
||||
if (p_videoParam.GetPalette() == NULL) {
|
||||
palette = new MxPalette();
|
||||
m_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
goto done;
|
||||
}
|
||||
else {
|
||||
palette = p_videoParam.GetPalette()->Clone();
|
||||
m_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_displaySurface = new MxDisplaySurface();
|
||||
if (m_displaySurface && m_displaySurface->Create(m_videoParam) == SUCCESS) {
|
||||
m_displaySurface->SetPalette(m_videoParam.GetPalette());
|
||||
|
||||
if (p_createThread) {
|
||||
m_thread = new MxTickleThread(this, p_frequencyMS);
|
||||
|
||||
if (!m_thread || m_thread->Start(0, 0) != SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
TickleManager()->RegisterClient(this, p_frequencyMS);
|
||||
|
||||
status = SUCCESS;
|
||||
}
|
||||
|
||||
done:
|
||||
if (status != SUCCESS)
|
||||
Destroy();
|
||||
|
||||
if (locked)
|
||||
m_criticalSection.Leave();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,17 @@ class MxVideoManager : public MxMediaManager
|
|||
|
||||
virtual MxResult Tickle() override; // vtable+0x8
|
||||
virtual void Destroy() override; // vtable+0x18
|
||||
virtual void vtable0x28(); // vtable+0x28 (TODO ARGUMENTS)
|
||||
virtual MxResult vtable0x2c(MxVideoParam& p_videoParam, undefined4 p_unknown1, MxU8 p_unknown2); // vtable+0x2c
|
||||
virtual MxResult vtable0x28(
|
||||
MxVideoParam& p_videoParam,
|
||||
LPDIRECTDRAW p_pDirectDraw,
|
||||
LPDIRECTDRAWSURFACE p_pDDSurface,
|
||||
LPDIRECTDRAWSURFACE p_ddSurface1,
|
||||
LPDIRECTDRAWSURFACE p_ddSurface2,
|
||||
LPDIRECTDRAWCLIPPER p_ddClipper,
|
||||
MxU32 p_frequencyMS,
|
||||
MxBool p_createThread
|
||||
); // vtable+0x28
|
||||
virtual MxResult Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread); // vtable+0x2c
|
||||
|
||||
__declspec(dllexport) void InvalidateRect(MxRect32 &);
|
||||
__declspec(dllexport) virtual MxLong RealizePalette(MxPalette *); // vtable+0x30
|
||||
|
|
Loading…
Reference in a new issue