isle-portable/LEGO1/omni/include/mxpresenter.h

146 lines
4 KiB
C
Raw Normal View History

#ifndef MXPRESENTER_H
#define MXPRESENTER_H
2023-10-24 19:38:27 -04:00
#include "decomp.h"
#include "mxcore.h"
#include "mxcriticalsection.h"
2023-10-24 19:38:27 -04:00
#include "mxdsaction.h"
#include "mxomni.h"
2023-10-24 19:38:27 -04:00
#include "mxpoint32.h"
Implement MxObjectFactory::{MxObjectFactory,Create} + match sizes of Mx.*Presenter objects created by it (#59) * Get Isle building on MinGW32 (#63) * Add MxUnknown100dc6b0::~MxUnknown100dc6b0 stub * Declare destructor of MxOmni and MxTransitionManager in class * inline attribute must go first * Stub LegoState::Vtable0x14 for Act3State * MxStreamer::VTable0x14 is not an override * Stub MxEntity::Destroy for LegoState::Destroy * Stub MxUnknown100dc6e0 for MxSoundManager * ::ClassName and ::IsA are const methods * methods in the class body don't need a namespace * MxSoundManager subclasses MxUnknown100dc6e0 * LegoInputManager subclasses MxPresenter * NotificationId is an enum, and does not need __declspec(dllexport) * Fix final #endif of legoomni.h and mxobjectfactory.h * Add const alternative for LegoOmni::Create and MxVideoParam, only available for MinGW * Alternative approach to MinGW compatibility * MinGW on Linux is case sensitve * Don't delete a member variable. C++ automatically destructs member variables --------- Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com> * MxatomId: implement inline operator== * Add decomp.h header, containing macro's only used when matching the original binaries * Add in-line constructor of MxPresenter * MxMediaPresenter: add members to match size * MxVideoPresenter: add members to match size * MxCompositePresenter: add members to match size * MxFlcPresenter: add members to match size * MxSmkPresenter: add members to match size * MxStillPresenter: add members to match size * MxAudioPresenter: add members to match size * MxWavePresenter: add members to match size * MxMIDIPresenter: add members to match size * MxEventPresenter: add members to match size * MxLoopingFlcPresenter: add members to match size * MxLoopingSmkPresenter: add members to match size * MxLoopingMIDIPresenter: add check for size * Implement MxObjectFactory::{MxObjectFactory,Create} Matching of MxObjectFactory::Create is not good, because none of the other objects have been implemented. * Implement a few MxPresenter methods * Fix size of LegoInputManager * Fix name of first padding member of legoinputmanager.h * add DECOMP_SIZE_ASSERT macro * Use DECOMP_SIZE_ASSERT macro + convert to hexadecimal * fixed minor typos --------- Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com> Co-authored-by: itsmattkc <itsmattkc@gmail.com>
2023-07-02 03:00:28 -04:00
class MxCompositePresenter;
class MxStreamController;
class MxEntity;
(Proposal) Adjustments to "decomp" language (#308) * Adjustments to "decomp" language * Fix a comment * Fix accidental clang-formatting * Fix order * Fix order * Remove junk * Fix OFFSET * Adjustments based on new suggestions * Annotate globals * Globals in ISLE * More globals * Merge from parser2 branch * Allow prepending space for exact marker match * To eliminate noise, require the 0x prefix on offset for marker match * fix test from previous * Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise * FUNCTION to SYNTHETIC where needed * Missed marker conversion on SetAtomId * pylint cleanup, remove unused code * Fix unexpected function end, add more unit tests * Be more strict about synthetic name syntax * Revert "Missed marker conversion on SetAtomId" This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2. * Revert "FUNCTION to SYNTHETIC where needed" This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8. * Implicit lookup by name for functions * Fix VTABLE SYNTHETIC and other decomp markers * Get vtable class name * Vtable marker should identify struct * No colon for SIZE comment * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix destructor/annotation * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
2023-12-06 07:10:45 -05:00
// VTABLE: LEGO1 0x100d4d38
// SIZE 0x40
2023-10-24 19:38:27 -04:00
class MxPresenter : public MxCore {
public:
2023-10-24 19:38:27 -04:00
enum TickleState {
e_idle = 0,
e_ready,
e_starting,
e_streaming,
e_repeating,
e_unk5,
e_done,
2023-10-24 19:38:27 -04:00
};
MxPresenter() { Init(); }
// FUNCTION: LEGO1 0x1000bf00
~MxPresenter() override{}; // vtable+0x00
MxResult Tickle() override; // vtable+0x08
2023-10-24 19:38:27 -04:00
(Proposal) Adjustments to "decomp" language (#308) * Adjustments to "decomp" language * Fix a comment * Fix accidental clang-formatting * Fix order * Fix order * Remove junk * Fix OFFSET * Adjustments based on new suggestions * Annotate globals * Globals in ISLE * More globals * Merge from parser2 branch * Allow prepending space for exact marker match * To eliminate noise, require the 0x prefix on offset for marker match * fix test from previous * Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise * FUNCTION to SYNTHETIC where needed * Missed marker conversion on SetAtomId * pylint cleanup, remove unused code * Fix unexpected function end, add more unit tests * Be more strict about synthetic name syntax * Revert "Missed marker conversion on SetAtomId" This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2. * Revert "FUNCTION to SYNTHETIC where needed" This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8. * Implicit lookup by name for functions * Fix VTABLE SYNTHETIC and other decomp markers * Get vtable class name * Vtable marker should identify struct * No colon for SIZE comment * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix destructor/annotation * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
2023-12-06 07:10:45 -05:00
// FUNCTION: LEGO1 0x1000bfe0
inline const char* ClassName() const override // vtable+0x0c
2023-10-24 19:38:27 -04:00
{
// STRING: LEGO1 0x100f0740
2023-10-24 19:38:27 -04:00
return "MxPresenter";
}
(Proposal) Adjustments to "decomp" language (#308) * Adjustments to "decomp" language * Fix a comment * Fix accidental clang-formatting * Fix order * Fix order * Remove junk * Fix OFFSET * Adjustments based on new suggestions * Annotate globals * Globals in ISLE * More globals * Merge from parser2 branch * Allow prepending space for exact marker match * To eliminate noise, require the 0x prefix on offset for marker match * fix test from previous * Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise * FUNCTION to SYNTHETIC where needed * Missed marker conversion on SetAtomId * pylint cleanup, remove unused code * Fix unexpected function end, add more unit tests * Be more strict about synthetic name syntax * Revert "Missed marker conversion on SetAtomId" This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2. * Revert "FUNCTION to SYNTHETIC where needed" This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8. * Implicit lookup by name for functions * Fix VTABLE SYNTHETIC and other decomp markers * Get vtable class name * Vtable marker should identify struct * No colon for SIZE comment * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix destructor/annotation * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
2023-12-06 07:10:45 -05:00
// FUNCTION: LEGO1 0x1000bff0
inline MxBool IsA(const char* p_name) const override // vtable+0x10
2023-10-24 19:38:27 -04:00
{
return !strcmp(p_name, MxPresenter::ClassName()) || MxCore::IsA(p_name);
2023-10-24 19:38:27 -04:00
}
// FUNCTION: LEGO1 0x1000be30
virtual void VTable0x14() {} // vtable+0x14
// FUNCTION: LEGO1 0x1000be40
virtual void ReadyTickle()
{
ParseExtra();
ProgressTickleState(e_starting);
} // vtable+0x18
// FUNCTION: LEGO1 0x1000be60
virtual void StartingTickle() { ProgressTickleState(e_streaming); } // vtable+0x1c
// FUNCTION: LEGO1 0x1000be80
virtual void StreamingTickle() { ProgressTickleState(e_repeating); } // vtable+0x20
// FUNCTION: LEGO1 0x1000bea0
virtual void RepeatingTickle() { ProgressTickleState(e_unk5); } // vtable+0x24
// FUNCTION: LEGO1 0x1000bec0
virtual void Unk5Tickle() { ProgressTickleState(e_done); } // vtable+0x28
protected:
// FUNCTION: LEGO1 0x1000bee0
virtual void DoneTickle() { ProgressTickleState(e_idle); } // vtable+0x2c
virtual void ParseExtra(); // vtable+0x30
inline void ProgressTickleState(TickleState p_tickleState)
{
m_previousTickleStates |= 1 << (MxU8) m_currentTickleState;
m_currentTickleState = p_tickleState;
}
public:
// FUNCTION: LEGO1 0x1000bf70
virtual MxResult AddToManager() { return SUCCESS; } // vtable+0x34
// FUNCTION: LEGO1 0x1000bf80
virtual void Destroy() { Init(); } // vtable+0x38
virtual MxResult StartAction(MxStreamController*, MxDSAction*); // vtable+0x3c
virtual void EndAction(); // vtable+0x40
// FUNCTION: LEGO1 0x1000bf90
virtual void SetTickleState(TickleState p_tickleState) { ProgressTickleState(p_tickleState); } // vtable+0x44
// FUNCTION: LEGO1 0x1000bfb0
virtual MxBool HasTickleStatePassed(TickleState p_tickleState)
{
return m_previousTickleStates & (1 << (MxU8) p_tickleState);
} // vtable+0x48
// FUNCTION: LEGO1 0x1000bfc0
virtual MxResult PutData() { return SUCCESS; } // vtable+0x4c
// FUNCTION: LEGO1 0x1000bfd0
virtual MxBool IsHit(MxS32 p_x, MxS32 p_y) { return FALSE; } // vtable+0x50
virtual void Enable(MxBool p_enable); // vtable+0x54
2023-10-24 19:38:27 -04:00
2024-01-14 16:49:11 -05:00
MxEntity* CreateEntity(const char* p_name);
void SendToCompositePresenter(MxOmni*);
2023-10-24 19:38:27 -04:00
MxBool IsEnabled();
inline MxS32 GetCurrentTickleState() const { return this->m_currentTickleState; }
inline MxPoint32 GetLocation() const { return this->m_location; }
inline MxS32 GetX() const { return this->m_location.GetX(); }
inline MxS32 GetY() const { return this->m_location.GetY(); }
2023-10-24 19:38:27 -04:00
inline MxS32 GetDisplayZ() const { return this->m_displayZ; }
inline MxDSAction* GetAction() const { return this->m_action; }
inline void SetCompositePresenter(MxCompositePresenter* p_compositePresenter)
{
m_compositePresenter = p_compositePresenter;
}
inline void SetDisplayZ(MxS32 p_displayZ) { m_displayZ = p_displayZ; }
// SYNTHETIC: LEGO1 0x1000c070
// MxPresenter::`scalar deleting destructor'
Implement MxObjectFactory::{MxObjectFactory,Create} + match sizes of Mx.*Presenter objects created by it (#59) * Get Isle building on MinGW32 (#63) * Add MxUnknown100dc6b0::~MxUnknown100dc6b0 stub * Declare destructor of MxOmni and MxTransitionManager in class * inline attribute must go first * Stub LegoState::Vtable0x14 for Act3State * MxStreamer::VTable0x14 is not an override * Stub MxEntity::Destroy for LegoState::Destroy * Stub MxUnknown100dc6e0 for MxSoundManager * ::ClassName and ::IsA are const methods * methods in the class body don't need a namespace * MxSoundManager subclasses MxUnknown100dc6e0 * LegoInputManager subclasses MxPresenter * NotificationId is an enum, and does not need __declspec(dllexport) * Fix final #endif of legoomni.h and mxobjectfactory.h * Add const alternative for LegoOmni::Create and MxVideoParam, only available for MinGW * Alternative approach to MinGW compatibility * MinGW on Linux is case sensitve * Don't delete a member variable. C++ automatically destructs member variables --------- Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com> * MxatomId: implement inline operator== * Add decomp.h header, containing macro's only used when matching the original binaries * Add in-line constructor of MxPresenter * MxMediaPresenter: add members to match size * MxVideoPresenter: add members to match size * MxCompositePresenter: add members to match size * MxFlcPresenter: add members to match size * MxSmkPresenter: add members to match size * MxStillPresenter: add members to match size * MxAudioPresenter: add members to match size * MxWavePresenter: add members to match size * MxMIDIPresenter: add members to match size * MxEventPresenter: add members to match size * MxLoopingFlcPresenter: add members to match size * MxLoopingSmkPresenter: add members to match size * MxLoopingMIDIPresenter: add check for size * Implement MxObjectFactory::{MxObjectFactory,Create} Matching of MxObjectFactory::Create is not good, because none of the other objects have been implemented. * Implement a few MxPresenter methods * Fix size of LegoInputManager * Fix name of first padding member of legoinputmanager.h * add DECOMP_SIZE_ASSERT macro * Use DECOMP_SIZE_ASSERT macro + convert to hexadecimal * fixed minor typos --------- Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com> Co-authored-by: itsmattkc <itsmattkc@gmail.com>
2023-07-02 03:00:28 -04:00
protected:
void Init();
TickleState m_currentTickleState; // 0x08
MxU32 m_previousTickleStates; // 0x0c
MxPoint32 m_location; // 0x10
MxS32 m_displayZ; // 0x18
MxDSAction* m_action; // 0x1c
MxCriticalSection m_criticalSection; // 0x20
MxCompositePresenter* m_compositePresenter; // 0x3c
};
2023-10-24 19:38:27 -04:00
const char* PresenterNameDispatch(const MxDSAction&);
#endif // MXPRESENTER_H