Implement a few legoomni/mxomni functions (#339)

* LegoOmni functions

* fix build

* Update mxstreamcontroller.cpp

* fixes + improve match

* Update mxomni.cpp

* Update mxdsobject.h

* improve match

* Update mxactionnotificationparam.h

* MxOmni::HandleActionEnd

* fixes

* Update LEGO1/mxstreamer.cpp

Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com>

* A bunch of fixes

---------

Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com>
Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2023-12-16 13:14:01 -05:00 committed by GitHub
parent 72c34949e5
commit d72c767685
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 355 additions and 84 deletions

View file

@ -47,6 +47,7 @@ add_library(lego1 SHARED
LEGO1/jukebox.cpp LEGO1/jukebox.cpp
LEGO1/jukeboxentity.cpp LEGO1/jukeboxentity.cpp
LEGO1/jukeboxstate.cpp LEGO1/jukeboxstate.cpp
LEGO1/lego3dview.cpp
LEGO1/legoact2state.cpp LEGO1/legoact2state.cpp
LEGO1/legoactioncontrolpresenter.cpp LEGO1/legoactioncontrolpresenter.cpp
LEGO1/legoactor.cpp LEGO1/legoactor.cpp

View file

@ -8,9 +8,9 @@ class Lego3DManager {
inline Lego3DView* GetLego3DView() { return this->m_3dView; } inline Lego3DView* GetLego3DView() { return this->m_3dView; }
private: private:
int m_unk0x00; undefined4 m_unk0x00; // 0x00
int m_unk0x04; undefined4 m_unk0x04; // 0x04
Lego3DView* m_3dView; Lego3DView* m_3dView; // 0x08
}; };
#endif // LEGO3DMANAGER_H #endif // LEGO3DMANAGER_H

10
LEGO1/lego3dview.cpp Normal file
View file

@ -0,0 +1,10 @@
#include "lego3dview.h"
#include "legoroi.h"
// STUB: LEGO1 0x100ab2b0
LegoROI* Lego3DView::PickROI(MxLong p_a, MxLong p_b)
{
// TODO
return NULL;
}

View file

@ -1,11 +1,15 @@
#ifndef LEGO3DVIEW_H #ifndef LEGO3DVIEW_H
#define LEGO3DVIEW_H #define LEGO3DVIEW_H
#include "mxtypes.h"
#include "viewmanager/viewmanager.h" #include "viewmanager/viewmanager.h"
class LegoROI;
class Lego3DView { class Lego3DView {
public: public:
inline ViewManager* GetViewManager() { return this->m_viewManager; } inline ViewManager* GetViewManager() { return this->m_viewManager; }
LegoROI* PickROI(MxLong p_a, MxLong p_b);
private: private:
char m_pad[0x88]; char m_pad[0x88];

View file

@ -8,10 +8,12 @@
#include "legoobjectfactory.h" #include "legoobjectfactory.h"
#include "legoplantmanager.h" #include "legoplantmanager.h"
#include "legosoundmanager.h" #include "legosoundmanager.h"
#include "legounksavedatawriter.h"
#include "legoutil.h" #include "legoutil.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "legoworld.h" #include "legoworld.h"
#include "legoworldlist.h" #include "legoworldlist.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h" #include "mxautolocker.h"
#include "mxbackgroundaudiomanager.h" #include "mxbackgroundaudiomanager.h"
#include "mxdsfile.h" #include "mxdsfile.h"
@ -173,7 +175,7 @@ IslePathActor* GetCurrentVehicle()
// FUNCTION: LEGO1 0x100157a0 // FUNCTION: LEGO1 0x100157a0
LegoWorld* GetCurrentWorld() LegoWorld* GetCurrentWorld()
{ {
return LegoOmni::GetInstance()->GetCurrentWorld(); return LegoOmni::GetInstance()->GetCurrentOmniWorld();
} }
// FUNCTION: LEGO1 0x100157e0 // FUNCTION: LEGO1 0x100157e0
@ -227,13 +229,14 @@ void PlayMusic(MxU32 p_index)
void FUN_1001a700() void FUN_1001a700()
{ {
// TODO // TODO
// This function seems to populate an unknown structure, and then calls 0x1001b230
} }
// STUB: LEGO1 0x1003dd70 // FUNCTION: LEGO1 0x1003dd70
LegoROI* PickROI(MxLong, MxLong) LegoROI* PickROI(MxLong p_a, MxLong p_b)
{ {
// TODO return VideoManager()->Get3DManager()->GetLego3DView()->PickROI(p_a, p_b);
return NULL;
} }
// STUB: LEGO1 0x1003ddc0 // STUB: LEGO1 0x1003ddc0
@ -379,10 +382,83 @@ void LegoOmni::Init()
m_transitionManager = NULL; m_transitionManager = NULL;
} }
// STUB: LEGO1 0x10058c30 // FUNCTION: LEGO1 0x10058c30
void LegoOmni::Destroy() void LegoOmni::Destroy()
{ {
// TODO MxAutoLocker lock(&this->m_criticalsection);
m_notificationManager->Unregister(this);
if (m_worldList) {
delete m_worldList;
m_worldList = NULL;
}
if (m_gameState) {
delete m_gameState;
m_gameState = NULL;
}
if (m_animationManager) {
delete m_animationManager;
m_animationManager = NULL;
}
if (m_saveDataWriter) {
delete m_saveDataWriter;
m_saveDataWriter = NULL;
}
if (m_plantManager) {
delete m_plantManager;
m_plantManager = NULL;
}
if (m_buildingManager) {
delete m_buildingManager;
m_buildingManager = NULL;
}
if (m_gifManager) {
delete m_gifManager;
m_gifManager = NULL;
}
if (m_unk0x6c) {
// delete m_unk0x6c; // TODO
m_unk0x6c = NULL;
}
if (m_inputMgr) {
delete m_inputMgr;
m_inputMgr = NULL;
}
if (m_inputMgr) {
delete m_inputMgr;
m_inputMgr = NULL;
}
// todo FUN_10046de0
if (m_bkgAudioManager) {
m_bkgAudioManager->Stop();
delete m_bkgAudioManager;
m_bkgAudioManager = NULL;
}
if (m_transitionManager) {
delete m_transitionManager;
m_transitionManager = NULL;
}
m_action.ClearAtom();
UnregisterScripts();
delete[] m_unk0x68;
MxOmni::Destroy();
} }
// FUNCTION: LEGO1 0x10058e70 // FUNCTION: LEGO1 0x10058e70
@ -485,10 +561,9 @@ LegoEntity* LegoOmni::FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_ent
} }
// STUB: LEGO1 0x1005b1d0 // STUB: LEGO1 0x1005b1d0
MxResult LegoOmni::DeleteObject(MxDSAction& p_dsAction) void LegoOmni::DeleteObject(MxDSAction& p_dsAction)
{ {
// TODO // TODO
return FAILURE;
} }
// FUNCTION: LEGO1 0x1005b2f0 // FUNCTION: LEGO1 0x1005b2f0
@ -527,11 +602,14 @@ MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction)
return FALSE; return FALSE;
} }
// STUB: LEGO1 0x1005b400 // FUNCTION: LEGO1 0x1005b400
int LegoOmni::GetCurrPathInfo(LegoPathBoundary**, int&) MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
{ {
// TODO if (GetCurrentWorld() == NULL) {
return 0; return -1;
}
return GetCurrentWorld()->GetCurrPathInfo(p_path, p_value);
} }
// FUNCTION: LEGO1 0x1005b560 // FUNCTION: LEGO1 0x1005b560
@ -551,11 +629,23 @@ MxResult LegoOmni::Start(MxDSAction* p_dsAction)
return result; return result;
} }
// STUB: LEGO1 0x1005b5f0 // FUNCTION: LEGO1 0x1005b5f0
MxLong LegoOmni::Notify(MxParam& p_param) MxLong LegoOmni::Notify(MxParam& p_param)
{ {
// TODO MxBool isCD = FALSE;
return 0;
if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAction &&
((MxActionNotificationParam&) p_param).GetAction()->GetAtomId() == *g_nocdSourceName) {
isCD = TRUE;
}
MxLong result = MxOmni::Notify(p_param);
if (isCD) {
// Exit the game if nocd.si ended
PostMessageA(m_windowHandle, WM_CLOSE, 0, 0);
}
return result;
} }
// FUNCTION: LEGO1 0x1005b640 // FUNCTION: LEGO1 0x1005b640

View file

@ -89,7 +89,7 @@ class LegoOmni : public MxOmni {
virtual MxResult Create(MxOmniCreateParam& p_param) override; // vtable+18 virtual MxResult Create(MxOmniCreateParam& p_param) override; // vtable+18
virtual void Destroy() override; // vtable+1c virtual void Destroy() override; // vtable+1c
virtual MxResult Start(MxDSAction* p_dsAction) override; // vtable+20 virtual MxResult Start(MxDSAction* p_dsAction) override; // vtable+20
virtual MxResult DeleteObject(MxDSAction& p_dsAction) override; // vtable+24 virtual void DeleteObject(MxDSAction& p_dsAction) override; // vtable+24
virtual MxBool DoesEntityExist(MxDSAction& p_dsAction) override; // vtable+28 virtual MxBool DoesEntityExist(MxDSAction& p_dsAction) override; // vtable+28
virtual MxEntity* FindWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) override; // vtable+30 virtual MxEntity* FindWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) override; // vtable+30
virtual void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34 virtual void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34
@ -103,7 +103,7 @@ class LegoOmni : public MxOmni {
LegoInputManager* GetInputManager() { return m_inputMgr; } LegoInputManager* GetInputManager() { return m_inputMgr; }
GifManager* GetGifManager() { return m_gifManager; } GifManager* GetGifManager() { return m_gifManager; }
LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoWorld* GetCurrentOmniWorld() { return m_currentWorld; }
LegoNavController* GetNavController() { return m_navController; } LegoNavController* GetNavController() { return m_navController; }
IslePathActor* GetCurrentVehicle() { return m_currentVehicle; } IslePathActor* GetCurrentVehicle() { return m_currentVehicle; }
LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } LegoPlantManager* GetLegoPlantManager() { return m_plantManager; }
@ -115,24 +115,24 @@ class LegoOmni : public MxOmni {
MxDSAction& GetCurrentAction() { return m_action; } MxDSAction& GetCurrentAction() { return m_action; }
private: private:
undefined4 m_unk0x68; undefined4* m_unk0x68; // 0x68
undefined4 m_unk0x6c; undefined4 m_unk0x6c; // 0x6c
LegoInputManager* m_inputMgr; // 0x70 LegoInputManager* m_inputMgr; // 0x70
GifManager* m_gifManager; GifManager* m_gifManager; // 0x74
LegoWorldList* m_worldList; // 0x78 LegoWorldList* m_worldList; // 0x78
LegoWorld* m_currentWorld; LegoWorld* m_currentWorld; // 0x7c
MxBool m_unk0x80; MxBool m_unk0x80; // 0x80
LegoNavController* m_navController; // 0x84 LegoNavController* m_navController; // 0x84
IslePathActor* m_currentVehicle; // 0x88 IslePathActor* m_currentVehicle; // 0x88
LegoUnkSaveDataWriter* m_saveDataWriter; LegoUnkSaveDataWriter* m_saveDataWriter; // 0x8c
LegoPlantManager* m_plantManager; // 0x90 LegoPlantManager* m_plantManager; // 0x90
LegoAnimationManager* m_animationManager; LegoAnimationManager* m_animationManager; // 0x94
LegoBuildingManager* m_buildingManager; // 0x98 LegoBuildingManager* m_buildingManager; // 0x98
LegoGameState* m_gameState; // 0x9c LegoGameState* m_gameState; // 0x9c
MxDSAction m_action; MxDSAction m_action; // 0xa0
MxBackgroundAudioManager* m_bkgAudioManager; // 0x134 MxBackgroundAudioManager* m_bkgAudioManager; // 0x134
MxTransitionManager* m_transitionManager; // 0x138 MxTransitionManager* m_transitionManager; // 0x138
MxBool m_unk0x13c; MxBool m_unk0x13c; // 0x13c
}; };
__declspec(dllexport) MxBackgroundAudioManager* BackgroundAudioManager(); __declspec(dllexport) MxBackgroundAudioManager* BackgroundAudioManager();

View file

@ -91,6 +91,13 @@ void LegoWorld::FUN_1001fc80(IslePathActor* p_actor)
{ {
} }
// STUB: LEGO1 0x10020120
MxS32 LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10020220 // STUB: LEGO1 0x10020220
void LegoWorld::VTable0x58(MxCore* p_object) void LegoWorld::VTable0x58(MxCore* p_object)
{ {

View file

@ -8,6 +8,7 @@
#include "mxpresenterlist.h" #include "mxpresenterlist.h"
class IslePathActor; class IslePathActor;
class LegoPathBoundary;
// VTABLE: LEGO1 0x100d6280 // VTABLE: LEGO1 0x100d6280
// SIZE 0xf8 // SIZE 0xf8
@ -50,6 +51,7 @@ class LegoWorld : public LegoEntity {
MxBool FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up); MxBool FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up);
void FUN_10073400(); void FUN_10073400();
void FUN_10073430(); void FUN_10073430();
MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value);
protected: protected:
LegoPathControllerList m_list0x68; // 0x68 LegoPathControllerList m_list0x68; // 0x68

View file

@ -14,3 +14,15 @@ MxNotificationParam* MxEndActionNotificationParam::Clone()
{ {
return new MxEndActionNotificationParam(c_notificationEndAction, this->m_sender, this->m_action, this->m_realloc); return new MxEndActionNotificationParam(c_notificationEndAction, this->m_sender, this->m_action, this->m_realloc);
} }
// FUNCTION: LEGO1 0x100b0300
MxNotificationParam* MxStartActionNotificationParam::Clone()
{
return new MxEndActionNotificationParam(c_notificationStartAction, this->m_sender, this->m_action, this->m_realloc);
}
// FUNCTION: LEGO1 0x100b04f0
MxNotificationParam* MxType4NotificationParam::Clone()
{
return new MxType4NotificationParam(this->m_sender, this->m_action, this->m_unk0x14);
}

View file

@ -4,6 +4,8 @@
#include "mxdsaction.h" #include "mxdsaction.h"
#include "mxnotificationparam.h" #include "mxnotificationparam.h"
class MxPresenter;
// VTABLE: LEGO1 0x100d8350 // VTABLE: LEGO1 0x100d8350
// SIZE 0x14 // SIZE 0x14
class MxActionNotificationParam : public MxNotificationParam { class MxActionNotificationParam : public MxNotificationParam {
@ -50,6 +52,23 @@ class MxActionNotificationParam : public MxNotificationParam {
MxBool m_realloc; // 0x10 MxBool m_realloc; // 0x10
}; };
// VTABLE: LEGO1 0x100dc210
// SIZE 0x14
class MxStartActionNotificationParam : public MxActionNotificationParam {
public:
inline MxStartActionNotificationParam(
NotificationId p_type,
MxCore* p_sender,
MxDSAction* p_action,
MxBool p_reallocAction
)
: MxActionNotificationParam(p_type, p_sender, p_action, p_reallocAction)
{
}
virtual MxNotificationParam* Clone() override; // vtable+0x4
};
// VTABLE: LEGO1 0x100d8358 // VTABLE: LEGO1 0x100d8358
// SIZE 0x14 // SIZE 0x14
class MxEndActionNotificationParam : public MxActionNotificationParam { class MxEndActionNotificationParam : public MxActionNotificationParam {
@ -67,7 +86,29 @@ class MxEndActionNotificationParam : public MxActionNotificationParam {
virtual MxNotificationParam* Clone() override; // vtable+0x4 virtual MxNotificationParam* Clone() override; // vtable+0x4
}; };
// VTABLE: LEGO1 0x100dc208
// SIZE 0x18
class MxType4NotificationParam : public MxActionNotificationParam {
public:
inline MxType4NotificationParam(MxCore* p_sender, MxDSAction* p_action, MxPresenter* p_unk0x14)
: MxActionNotificationParam(TYPE4, p_sender, p_action, FALSE)
{
m_unk0x14 = p_unk0x14;
}
virtual MxNotificationParam* Clone() override; // vtable+0x4
private:
MxPresenter* m_unk0x14; // 0x14
};
// SYNTHETIC: LEGO1 0x100513a0 // SYNTHETIC: LEGO1 0x100513a0
// MxEndActionNotificationParam::`scalar deleting destructor' // MxEndActionNotificationParam::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x100b0430
// MxStartActionNotificationParam::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x100b05c0
// MxType4NotificationParam::`scalar deleting destructor'
#endif #endif

View file

@ -226,7 +226,7 @@ void MxBackgroundAudioManager::StopAction(MxParam& p_param)
m_action2.SetObjectId(-1); m_action2.SetObjectId(-1);
} }
Lego()->HandleNotificationType2(p_param); Lego()->HandleActionEnd(p_param);
} }
// FUNCTION: LEGO1 0x1007f2f0 // FUNCTION: LEGO1 0x1007f2f0

View file

@ -6,6 +6,8 @@
#include "mxcore.h" #include "mxcore.h"
#include "mxdstypes.h" #include "mxdstypes.h"
class MxPresenter;
// VTABLE: LEGO1 0x100dc868 // VTABLE: LEGO1 0x100dc868
// SIZE 0x2c // SIZE 0x2c
class MxDSObject : public MxCore { class MxDSObject : public MxCore {
@ -38,23 +40,25 @@ class MxDSObject : public MxCore {
inline MxU32 GetObjectId() { return this->m_objectId; } inline MxU32 GetObjectId() { return this->m_objectId; }
inline const MxAtomId& GetAtomId() { return this->m_atomId; } inline const MxAtomId& GetAtomId() { return this->m_atomId; }
inline MxS16 GetUnknown24() { return this->m_unk0x24; } inline MxS16 GetUnknown24() { return this->m_unk0x24; }
inline undefined4 GetUnknown28() { return this->m_unk0x28; } inline MxPresenter* GetUnknown28() { return this->m_unk0x28; }
inline void SetType(MxDSType p_type) { this->m_type = p_type; } inline void SetType(MxDSType p_type) { this->m_type = p_type; }
inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; } inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; }
inline void SetUnknown24(MxS16 p_unk0x24) { this->m_unk0x24 = p_unk0x24; } inline void SetUnknown24(MxS16 p_unk0x24) { this->m_unk0x24 = p_unk0x24; }
inline void SetUnknown28(undefined4 p_unk0x28) { this->m_unk0x28 = p_unk0x28; } inline void SetUnknown28(MxPresenter* p_unk0x28) { this->m_unk0x28 = p_unk0x28; }
inline void ClearAtom() { m_atomId.Clear(); }
private: private:
MxU32 m_sizeOnDisk; // 0x8 MxU32 m_sizeOnDisk; // 0x8
MxU16 m_type; // 0xc MxU16 m_type; // 0xc
char* m_sourceName; // 0x10 char* m_sourceName; // 0x10
undefined4 m_unk0x14; // 0x14 undefined4 m_unk0x14; // 0x14
char* m_objectName; // 0x18 char* m_objectName; // 0x18
MxU32 m_objectId; // 0x1c MxU32 m_objectId; // 0x1c
MxAtomId m_atomId; // 0x20 MxAtomId m_atomId; // 0x20
MxS16 m_unk0x24; // 0x24 MxS16 m_unk0x24; // 0x24
undefined4 m_unk0x28; // 0x28 MxPresenter* m_unk0x28; // 0x28
}; };
MxDSObject* DeserializeDSObjectDispatch(char**, MxS16); MxDSObject* DeserializeDSObjectDispatch(char**, MxS16);

View file

@ -1,5 +1,6 @@
#include "mxomni.h" #include "mxomni.h"
#include "mxactionnotificationparam.h"
#include "mxatomidcounter.h" #include "mxatomidcounter.h"
#include "mxautolocker.h" #include "mxautolocker.h"
#include "mxeventmanager.h" #include "mxeventmanager.h"
@ -7,6 +8,7 @@
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
#include "mxobjectfactory.h" #include "mxobjectfactory.h"
#include "mxomnicreateparam.h" #include "mxomnicreateparam.h"
#include "mxpresenter.h"
#include "mxsoundmanager.h" #include "mxsoundmanager.h"
#include "mxstreamer.h" #include "mxstreamer.h"
#include "mxticklemanager.h" #include "mxticklemanager.h"
@ -112,9 +114,9 @@ MxEventManager* EventManager()
} }
// FUNCTION: LEGO1 0x100acf70 // FUNCTION: LEGO1 0x100acf70
MxResult DeleteObject(MxDSAction& p_dsAction) void DeleteObject(MxDSAction& p_dsAction)
{ {
return MxOmni::GetInstance()->DeleteObject(p_dsAction); MxOmni::GetInstance()->DeleteObject(p_dsAction);
} }
// FUNCTION: LEGO1 0x100aef10 // FUNCTION: LEGO1 0x100aef10
@ -310,17 +312,51 @@ MxResult MxOmni::Start(MxDSAction* p_dsAction)
return result; return result;
} }
// STUB: LEGO1 0x100b00c0 // FUNCTION: LEGO1 0x100b00c0
MxResult MxOmni::DeleteObject(MxDSAction& p_dsAction) void MxOmni::DeleteObject(MxDSAction& p_dsAction)
{ {
// TODO if (m_streamer != NULL) {
return FAILURE; m_streamer->DeleteObject(&p_dsAction);
}
} }
// STUB: LEGO1 0x100b00e0 // FUNCTION: LEGO1 0x100b00e0
void MxOmni::Vtable0x2c() MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p_action)
{ {
// TODO MxResult result = FAILURE;
MxPresenter* object = (MxPresenter*) m_objectFactory->Create(PresenterNameDispatch(p_action));
if (object) {
if (object->AddToManager() == SUCCESS) {
MxPresenter* sender = p_action.GetUnknown28();
if (sender == NULL && (sender = p_controller->FUN_100c1e70(p_action)) == NULL) {
if (p_action.GetOrigin() == NULL) {
p_action.SetOrigin(this);
}
object->SetCompositePresenter(NULL);
}
else {
p_action.SetOrigin(sender);
object->SetCompositePresenter((MxCompositePresenter*) sender);
}
if (object->StartAction(p_controller, &p_action) == SUCCESS) {
if (sender) {
NotificationManager()->Send(sender, &MxType4NotificationParam(this, &p_action, object));
}
if (p_action.GetUnknown84()) {
NotificationManager()->Send(
p_action.GetUnknown84(),
&MxStartActionNotificationParam(c_notificationStartAction, this, &p_action, FALSE)
);
}
result = SUCCESS;
}
}
}
return result;
} }
// FUNCTION: LEGO1 0x100b0680 // FUNCTION: LEGO1 0x100b0680
@ -338,6 +374,13 @@ void MxOmni::DestroyInstance()
} }
} }
// STUB: LEGO1 0x100b06b0
MxBool MxOmni::FUN_100b06b0(MxDSAction* p_action, const char* p_name)
{
// TODO
return FAILURE;
}
// FUNCTION: LEGO1 0x100b07f0 // FUNCTION: LEGO1 0x100b07f0
MxLong MxOmni::Notify(MxParam& p_param) MxLong MxOmni::Notify(MxParam& p_param)
{ {
@ -346,14 +389,33 @@ MxLong MxOmni::Notify(MxParam& p_param)
if (((MxNotificationParam&) p_param).GetNotification() != c_notificationEndAction) if (((MxNotificationParam&) p_param).GetNotification() != c_notificationEndAction)
return 0; return 0;
return HandleNotificationType2(p_param); return HandleActionEnd(p_param);
} }
// STUB: LEGO1 0x100b0880 // FUNCTION: LEGO1 0x100b0880
MxResult MxOmni::HandleNotificationType2(MxParam& p_param) MxLong MxOmni::HandleActionEnd(MxParam& p_param)
{ {
// TODO STUB MxDSAction* action = ((MxEndActionNotificationParam&) p_param).GetAction();
return FAILURE; MxStreamController* controller = Streamer()->GetOpenStream(action->GetAtomId().GetInternal());
if (controller != NULL) {
action = controller->GetUnk0x54().Find(action, FALSE);
if (action) {
if (FUN_100b06b0(action, "LegoLoopingAnimPresenter") == FALSE) {
delete controller->GetUnk0x54().Find(action, TRUE);
}
}
}
if (((MxEndActionNotificationParam&) p_param).GetSender()) {
delete ((MxEndActionNotificationParam&) p_param).GetSender();
}
if (((MxEndActionNotificationParam&) p_param).GetAction()) {
delete ((MxEndActionNotificationParam&) p_param).GetAction();
}
return 1;
} }
// FUNCTION: LEGO1 0x100b0900 // FUNCTION: LEGO1 0x100b0900

View file

@ -22,6 +22,7 @@ class MxTimer;
class MxVariableTable; class MxVariableTable;
class MxVideoManager; class MxVideoManager;
class MxEntity; class MxEntity;
class MxStreamController;
// VTABLE: LEGO1 0x100dc168 // VTABLE: LEGO1 0x100dc168
// SIZE 0x68 // SIZE 0x68
@ -39,20 +40,23 @@ class MxOmni : public MxCore {
MxOmni(); MxOmni();
virtual ~MxOmni() override; virtual ~MxOmni() override;
virtual MxLong Notify(MxParam& p_param) override; // vtable+04 virtual MxLong Notify(MxParam& p_param) override; // vtable+04
virtual void Init(); // vtable+14 virtual void Init(); // vtable+14
virtual MxResult Create(MxOmniCreateParam& p_param); // vtable+18 virtual MxResult Create(MxOmniCreateParam& p_param); // vtable+18
virtual void Destroy(); // vtable+1c virtual void Destroy(); // vtable+1c
virtual MxResult Start(MxDSAction* p_dsAction); // vtable+20 virtual MxResult Start(MxDSAction* p_dsAction); // vtable+20
virtual MxResult DeleteObject(MxDSAction& p_dsAction); // vtable+24 virtual void DeleteObject(MxDSAction& p_dsAction); // vtable+24
virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28 virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28
virtual void Vtable0x2c(); // vtable+2c virtual MxResult CreatePresenter(MxStreamController* p_controller, MxDSAction& p_action); // vtable+2c
virtual MxEntity* FindWorld(const char*, MxS32, MxPresenter*); // vtable+30 virtual MxEntity* FindWorld(const char*, MxS32, MxPresenter*); // vtable+30
virtual void NotifyCurrentEntity(MxNotificationParam* p_param); // vtable+34 virtual void NotifyCurrentEntity(MxNotificationParam* p_param); // vtable+34
virtual void StartTimer(); // vtable+38 virtual void StartTimer(); // vtable+38
virtual void StopTimer(); // vtable+3c virtual void StopTimer(); // vtable+3c
virtual MxBool IsTimerRunning(); // vtable+40 virtual MxBool IsTimerRunning(); // vtable+40
static void SetInstance(MxOmni* p_instance); static void SetInstance(MxOmni* p_instance);
static MxBool FUN_100b06b0(MxDSAction* p_action, const char* p_name);
HWND GetWindowHandle() const { return this->m_windowHandle; } HWND GetWindowHandle() const { return this->m_windowHandle; }
MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; } MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; }
MxNotificationManager* GetNotificationManager() const { return this->m_notificationManager; } MxNotificationManager* GetNotificationManager() const { return this->m_notificationManager; }
@ -65,7 +69,7 @@ class MxOmni : public MxCore {
MxMusicManager* GetMusicManager() const { return this->m_musicManager; } MxMusicManager* GetMusicManager() const { return this->m_musicManager; }
MxEventManager* GetEventManager() const { return this->m_eventManager; } MxEventManager* GetEventManager() const { return this->m_eventManager; }
MxAtomIdCounterSet* GetAtomIdCounterSet() const { return this->m_atomIdCounterSet; } MxAtomIdCounterSet* GetAtomIdCounterSet() const { return this->m_atomIdCounterSet; }
MxResult HandleNotificationType2(MxParam& p_param); MxLong HandleActionEnd(MxParam& p_param);
protected: protected:
static MxOmni* g_instance; static MxOmni* g_instance;
@ -82,13 +86,11 @@ class MxOmni : public MxCore {
MxEventManager* m_eventManager; // 0x38 MxEventManager* m_eventManager; // 0x38
MxTimer* m_timer; // 0x3C MxTimer* m_timer; // 0x3C
MxStreamer* m_streamer; // 0x40 MxStreamer* m_streamer; // 0x40
MxAtomIdCounterSet* m_atomIdCounterSet; // 0x44
MxAtomIdCounterSet* m_atomIdCounterSet; // 0x44 MxCriticalSection m_criticalsection; // 0x48
MxBool m_timerRunning; // 0x64
MxCriticalSection m_criticalsection; // 0x48
MxBool m_timerRunning; // 0x64
}; };
__declspec(dllexport) MxTickleManager* TickleManager(); __declspec(dllexport) MxTickleManager* TickleManager();
__declspec(dllexport) MxTimer* Timer(); __declspec(dllexport) MxTimer* Timer();
__declspec(dllexport) MxStreamer* Streamer(); __declspec(dllexport) MxStreamer* Streamer();
@ -101,7 +103,7 @@ __declspec(dllexport) MxNotificationManager* NotificationManager();
MxVideoManager* MVideoManager(); MxVideoManager* MVideoManager();
MxAtomIdCounterSet* AtomIdCounterSet(); MxAtomIdCounterSet* AtomIdCounterSet();
MxObjectFactory* ObjectFactory(); MxObjectFactory* ObjectFactory();
MxResult DeleteObject(MxDSAction& p_dsAction); void DeleteObject(MxDSAction& p_dsAction);
void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last); void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last);
#endif // MXOMNI_H #endif // MXOMNI_H

View file

@ -133,6 +133,21 @@ MxResult MxStreamController::VTable0x30(MxDSAction* p_action)
return result; return result;
} }
// FUNCTION: LEGO1 0x100c1e70
MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action)
{
MxAutoLocker locker(&m_criticalSection);
MxPresenter* result = NULL;
if (p_action.GetObjectId() != -1) {
MxDSAction* action = m_unk0x3c.Find(&p_action, FALSE);
if (action != NULL) {
result = action->GetUnknown28();
}
}
return result;
}
// STUB: LEGO1 0x100c1f00 // STUB: LEGO1 0x100c1f00
MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
{ {

View file

@ -44,9 +44,11 @@ class MxStreamController : public MxCore {
MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val); MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val);
MxBool FUN_100c20d0(MxDSObject& p_obj); MxBool FUN_100c20d0(MxDSObject& p_obj);
MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval); MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval);
MxPresenter* FUN_100c1e70(MxDSAction& p_action);
MxResult FUN_100c1f00(MxDSAction* p_action); MxResult FUN_100c1f00(MxDSAction* p_action);
inline MxAtomId& GetAtom() { return m_atom; }; inline MxAtomId& GetAtom() { return m_atom; };
inline MxStreamListMxDSAction& GetUnk0x54() { return m_unk0x54; };
protected: protected:
MxCriticalSection m_criticalSection; // 0x8 MxCriticalSection m_criticalSection; // 0x8

View file

@ -143,6 +143,24 @@ MxResult MxStreamer::FUN_100b99b0(MxDSAction* p_action)
return FAILURE; return FAILURE;
} }
// STUB: LEGO1 0x100b99f0
MxResult MxStreamer::DeleteObject(MxDSAction* p_dsAction)
{
MxDSAction tempAction;
if (p_dsAction == NULL) {
tempAction.SetUnknown24(-2);
}
else {
tempAction.SetObjectId(p_dsAction->GetObjectId());
tempAction.SetAtomId(p_dsAction->GetAtomId());
tempAction.SetUnknown24(p_dsAction->GetUnknown24());
}
// TODO: remove action from list
return FAILURE;
}
// FUNCTION: LEGO1 0x100b9b30 // FUNCTION: LEGO1 0x100b9b30
MxBool MxStreamer::FUN_100b9b30(MxDSObject& p_dsObject) MxBool MxStreamer::FUN_100b9b30(MxDSObject& p_dsObject)
{ {

View file

@ -94,6 +94,7 @@ class MxStreamer : public MxCore {
MxStreamController* GetOpenStream(const char* p_name); MxStreamController* GetOpenStream(const char* p_name);
MxResult AddStreamControllerToOpenList(MxStreamController* p_stream); MxResult AddStreamControllerToOpenList(MxStreamController* p_stream);
MxResult FUN_100b99b0(MxDSAction* p_action); MxResult FUN_100b99b0(MxDSAction* p_action);
MxResult DeleteObject(MxDSAction* p_dsAction);
inline const MxStreamerSubClass2& GetSubclass1() { return m_subclass1; } inline const MxStreamerSubClass2& GetSubclass1() { return m_subclass1; }
inline const MxStreamerSubClass3& GetSubclass2() { return m_subclass2; } inline const MxStreamerSubClass3& GetSubclass2() { return m_subclass2; }