libElysianVMU 1.6.0
Full-featured, accurate, cross-platform library emulating the Dreamcast's Visual Memory Unit
Loading...
Searching...
No Matches
evmu_ibehavior.h
Go to the documentation of this file.
1/*! \file
2 * \brief EvmuIBehavior interface for emulated entities
3 *
4 * \todo
5 * - static typeinfo
6 *
7 * \author 2023 Falco Girgis
8 * \copyright MIT License
9 */
10#ifndef EVMU_IBEHAVIOR_H
11#define EVMU_IBEHAVIOR_H
12
13#include "evmu_typedefs.h"
14#include <gimbal/meta/instances/gimbal_object.h>
15
16/*! \name Type System
17 * \brief Type UUID and cast operators
18 * @{
19 */
20#define EVMU_IBEHAVIOR_TYPE (GBL_TYPEID(EvmuIBehavior)) //!< Type UUID for EvmuIBehavior
21#define EVMU_IBEHAVIOR(self) (GBL_CAST(EvmuIBehavior, self)) //!< Casts a GblInstance to EvmuIBehavior
22#define EVMU_IBEHAVIOR_CLASS(klass) (GBL_CLASS_CAST(EvmuIBehavior, klass)) //!< Casts a GblClass to EvmuIBehaviorClass
23#define EVMU_IBEHAVIOR_GET_CLASS(self) (GBL_CLASSOF(EvmuIBehavior, self)) //!< Gets an EvmuIBehaviorClass from a GblInstance
24//! @}
25
26#define GBL_SELF_TYPE EvmuIBehavior
27
28GBL_DECLS_BEGIN
29
30GBL_FORWARD_DECLARE_STRUCT(EvmuEmulator);
31
32/*! \struct EvmuIBehaviorClass
33 * \extends GblInterface
34 * \brief GblInterface/VTable for all EvmuBehaviors
35 *
36 * EvmuIBehaviorClass is the virtual table which implements each
37 * emulation event/trigger for a given class.
38 *
39 * \sa EvmuIBehavior
40 */
41GBL_INTERFACE_DERIVE(EvmuIBehavior)
42 //! Called when the reset event is fired
43 EVMU_RESULT (*pFnReset) (GBL_SELF);
44 //! Called when the update event is fired
45 EVMU_RESULT (*pFnUpdate) (GBL_SELF, EvmuTicks ticks);
46 //! Called to save the state of the associated entity
47 EVMU_RESULT (*pFnSaveState) (GBL_CSELF, FILE* pFile);
48 //! Called to load the state of the associated entity
49 EVMU_RESULT (*pFnLoadState) (GBL_SELF, FILE* pFile);
50GBL_INTERFACE_END
51
52/*! \struct EvmuIBehavior
53 * \ingroup evmu_ibehavior.h
54 * \brief Standard events for all emulated entities
55 *
56 * EvmuIBehavior is a common interface which is inherited by all
57 * emulated Entities within ElysianVMU, providing basic event-driven
58 * logic for each hardware block.
59 *
60 * \sa EvmuIBehaviorClass
61 */
62
63//! Returns the GblType UUID associated with EvmuIBehavior
65//! Returns the root EvmuBehavior object associated with the given behavior
66EVMU_EXPORT EvmuEmulator* EvmuIBehavior_emulator (GBL_CSELF) GBL_NOEXCEPT;
67
68EVMU_EXPORT EVMU_RESULT EvmuIBehavior_reset (GBL_SELF) GBL_NOEXCEPT;
69EVMU_EXPORT EVMU_RESULT EvmuIBehavior_update (GBL_SELF, EvmuTicks ticks) GBL_NOEXCEPT;
70EVMU_EXPORT EVMU_RESULT EvmuIBehavior_saveState (GBL_SELF, GblStringBuffer* pString) GBL_NOEXCEPT;
71EVMU_EXPORT EVMU_RESULT EvmuIBehavior_loadState (GBL_SELF, const GblStringBuffer* pString) GBL_NOEXCEPT;
72
73GBL_DECLS_END
74
75#undef GBL_SELF_TYPE
76
77#endif // EVMU_IBEHAVIOR_H
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
Definition evmu_api.h:18
EvmuEmulator * EvmuIBehavior_emulator(const EvmuIBehavior *pSelf)
Returns the root EvmuBehavior object associated with the given behavior.
GblType EvmuIBehavior_type(void)
Returns the GblType UUID associated with EvmuIBehavior.
uint64_t EvmuTicks
Represents a delta time in milliseconds.
uintptr_t GblType
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)