Repository navigation
Expand file tree
/
Copy pathDekiRTCPackage.cpp
More file actions
75 lines (66 loc) · 1.96 KB
/
Copy pathDekiRTCPackage.cpp
File metadata and controls
75 lines (66 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Package entry point for deki-rtc.
#include "DekiRTCPackage.h"
#include <deki/interop/Plugin.h>
#include <deki/LogSystem.h>
#include "DekiRTC.h"
extern void DekiRTCRegisterComponents();
extern int DekiRTCGetAutoComponentCount();
extern const Deki::ComponentMeta* DekiRTCGetAutoComponentMeta(int index);
namespace DekiRtc
{
#ifdef DEKI_EDITOR
static bool s_RTCRegistered = false;
// The exports below are C symbols at global scope; the package's own
// registration helpers and statics live in its namespace.
using namespace DekiRtc;
extern "C"
{
DEKI_RTC_API int DekiRTCEnsureRegistered(void)
{
if (s_RTCRegistered)
{
return ::DekiRTCGetAutoComponentCount();
}
s_RTCRegistered = true;
::DekiRTCRegisterComponents();
return ::DekiRTCGetAutoComponentCount();
}
DEKI_PLUGIN_API const char* DekiPluginGetName(void)
{
return "Deki RTC Package";
}
DEKI_PLUGIN_API const char* DekiPluginGetVersion(void)
{
#ifdef DEKI_PACKAGE_VERSION
return DEKI_PACKAGE_VERSION;
#else
return "0.0.0-dev";
#endif
}
DEKI_PLUGIN_API int DekiPluginInit(void)
{
return 0;
}
DEKI_PLUGIN_API void DekiPluginShutdown(void)
{
s_RTCRegistered = false;
// Clear the provider so a hot reload leaves no pointer to a driver
// whose code unloads with the DLL. The driver object itself is leaked
// on purpose: as on a device, a driver lives until the process exits.
DekiRTC::SetCurrent(nullptr);
}
DEKI_PLUGIN_API int DekiPluginGetComponentCount(void)
{
return ::DekiRTCGetAutoComponentCount();
}
DEKI_PLUGIN_API const Deki::ComponentMeta* DekiPluginGetComponentMeta(int index)
{
return ::DekiRTCGetAutoComponentMeta(index);
}
DEKI_PLUGIN_API void DekiPluginRegisterComponents(void)
{
DekiRTCEnsureRegistered();
}
} // extern "C"
#endif // DEKI_EDITOR
} // namespace DekiRtc