libElysianVMU 1.6.0
Full-featured, accurate, cross-platform library emulating the Dreamcast's Visual Memory Unit
Loading...
Searching...
No Matches
evmu_emulator.h
Go to the documentation of this file.
1/*! \file
2 * \brief EvmuEmulator top-level emulation module
3 *
4 * This file provides everything pertaining to the public
5 * API of the EvmuEmulator module.
6 *
7 * \bug Pac-It runs slowly as hell
8 * \bug Mini Pac-Man partial audio
9 * \bug Sleep mode not handled properly
10 * \bug Scene doesn't immediately update upon resizing
11 * \bug Scene doesn't immediately update upon modifying effects
12 *
13 * \todo manage EvmuDevice children lifetimes
14 * \todo handle command-line options
15 * \todo persist user-settings
16 *
17 * \author 2023 Falco Girgis
18 * \copyright MIT License
19*/
20#ifndef EVMU_EMULATOR_H
21#define EVMU_EMULATOR_H
22
23#include <gimbal/core/gimbal_module.h>
24#include "evmu_ibehavior.h"
25
26/*! \name Type System
27 * \brief Type UUID and cast operators
28 * @{
29 */
30#define EVMU_EMULATOR_TYPE (GBL_TYPEID(EvmuEmulator)) //!< Type UUID for EvmuEmulator
31#define EVMU_EMULATOR(self) (GBL_CAST(EvmuEmulator, self)) //!< Function-style GblInstance cast
32#define EVMU_EMULATOR_CLASS(klass) (GBL_CLASS_CAST(EvmuEmulator, klass)) //!< Function-style GblClass cast
33#define EVMU_EMULATOR_GET_CLASS(self) (GBL_CLASSOF(EvmuEmulator, self)) //!< Get EvmuEmulatorClass from GblInstance
34//! @}
35
36#define GBL_SELF_TYPE EvmuEmulator
37
38GBL_DECLS_BEGIN
39
40GBL_FORWARD_DECLARE_STRUCT(EvmuDevice);
41
42/*! Function signature used for iterator callback with EvmuEmulator_foreachDevice().
43 *
44 * \note
45 * Returning GBL_FALSE will continue iteration, while returning GBL_TRUE will end it.
46 */
47typedef GblBool (*EvmuEmulatorIterFn)(GBL_CSELF, EvmuDevice* pDevice, void* pClosure);
48
49/*! \struct EvmuEmulatorClass
50 * \extends GblModuleClass
51 * \implements EvmuIBehaviorClass
52 * \brief GblClass structure for EvmuEmulator
53 *
54 * No public methods
55 *
56 * \sa EvmuEmulator
57 */
58GBL_CLASS_DERIVE_EMPTY(EvmuEmulator, GblModule, EvmuIBehavior)
59\
60/*! \struct EvmuEmulator
61 * \extends GblModule
62 * \implements EvmuIBehavior
63 * \brief Top-level module for emulator
64 *
65 * EvmuEmulator is a top-level module object for the
66 * emulation core.
67 *
68 * \sa EvmuEmulatorClass
69 */
70GBL_INSTANCE_DERIVE_EMPTY(EvmuEmulator, GblModule)
71
72//! Returns the GblType UUID associated with EvmuEmulator
74//! Returns the runtime version of the libElysianVMU library
76
77/*! \name Lifetime Management
78 * \brief Methods for managing lifetime
79 * @{
80 */
81//! Creates THE (only one) top-level EvmuEmulator instance, returning a pointer to it
82EVMU_EXPORT EvmuEmulator* EvmuEmulator_create (void) GBL_NOEXCEPT;
83//! Decrements the reference counter the gievn EvmuEmulator instance, destroying it when it hits 0
85//! @}
86
87/*! \name Device Management
88 * \brief Methods for managing devices
89 * \relatesalso EvmuEmulator
90 * @{
91 */
92//! Adds the device given by \p pDevice to the top-level EvmuEmulator instance, taking ownership of it
93EVMU_EXPORT EVMU_RESULT EvmuEmulator_addDevice (GBL_SELF, EvmuDevice* pDevice) GBL_NOEXCEPT;
94//! Removes the device given by \p pDevice from the top-level EvmuEmulator instance, relinquishing ownership of it
95EVMU_EXPORT EVMU_RESULT EvmuEmulator_removeDevice (GBL_SELF, EvmuDevice* pDevice) GBL_NOEXCEPT;
96//! Returns the total number of devices owned and managed by the EvmuEmulator instance
97EVMU_EXPORT size_t EvmuEmulator_deviceCount (GBL_CSELF) GBL_NOEXCEPT;
98//! Returns the device managed by the given EvmuEmulator instance at the given \p index
99EVMU_EXPORT EvmuDevice* EvmuEmulator_device (GBL_CSELF, size_t index) GBL_NOEXCEPT;
100//! Iterates over each managed EvmuDevice, passing it to \p pFnIt, along with \p pClosure
102 EvmuEmulatorIterFn pFnIt,
103 void* pClosure) GBL_NOEXCEPT;
104//! @}
105
106GBL_DECLS_END
107
108#undef GBL_SELF_TYPE
109
110#endif // EVMU_EMULATOR_H
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
Definition evmu_api.h:18
EvmuEmulator * EvmuEmulator_create(void)
Creates THE (only one) top-level EvmuEmulator instance, returning a pointer to it.
GblRefCount EvmuEmulator_unref(EvmuEmulator *pSelf)
Decrements the reference counter the gievn EvmuEmulator instance, destroying it when it hits 0.
GblVersion EvmuEmulator_version(void)
Returns the runtime version of the libElysianVMU library.
GblType EvmuEmulator_type(void)
Returns the GblType UUID associated with EvmuEmulator.
uint8_t GblBool
uint16_t GblRefCount
uintptr_t GblType
uint32_t GblVersion
Top-level module for emulator.
EvmuDevice * EvmuEmulator_device(const EvmuEmulator *pSelf, size_t index)
Returns the device managed by the given EvmuEmulator instance at the given index.
GblBool EvmuEmulator_foreachDevice(const EvmuEmulator *pSelf, EvmuEmulatorIterFn pFnIt, void *pClosure)
Iterates over each managed EvmuDevice, passing it to pFnIt, along with pClosure.
EVMU_RESULT EvmuEmulator_addDevice(EvmuEmulator *pSelf, EvmuDevice *pDevice)
Adds the device given by pDevice to the top-level EvmuEmulator instance, taking ownership of it.
size_t EvmuEmulator_deviceCount(const EvmuEmulator *pSelf)
Returns the total number of devices owned and managed by the EvmuEmulator instance.
EVMU_RESULT EvmuEmulator_removeDevice(EvmuEmulator *pSelf, EvmuDevice *pDevice)
Removes the device given by pDevice from the top-level EvmuEmulator instance, relinquishing ownership...
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)