Doxygen Samurai Engine 0.0.1
Doxygen Samurai Engine Documentation
Loading...
Searching...
No Matches
dllLoader.h
Go to the documentation of this file.
1#pragma once
2#include <baseContainer.h>
4#include <filesystem>
5#include <string>
6#include <unordered_map>
7#include <vector>
8
10#include "runtimeContainer.h"
11#include "settings/log.h"
12
13#define GAMEPLAYSTART(x) void x(samurai::Context &context)
14typedef GAMEPLAYSTART(gameplayStart_t);
15#undef GAMEPLAYSTART
16
17#define GAMEPLAYRELOAD(x) void x(samurai::Context &context)
18typedef GAMEPLAYRELOAD(gameplayReload_t);
19#undef GAMEPLAYRELOAD
20
21#define GETCONTAINERSINFO(x) void x(std::vector<samurai::ContainerInformation> &info)
22typedef GETCONTAINERSINFO(getContainersInfo_t);
23#undef GETCONTAINERSINFO
24
25#define CONSTRUCTCONTAINER(x) bool x(Container **c, samurai::memory::MemoryArena *arena, const char *name);
26typedef CONSTRUCTCONTAINER(constructContainer_t);
27#undef CONSTRUCTCONTAINER
28
29#define DESTRUCTCONTAINER(x) void x(Container **c, samurai::memory::MemoryArena *arena);
30typedef DESTRUCTCONTAINER(destructContainer_t);
31#undef DESTRUCTCONTAINER
32
33#define BINDALLOCATOR(x) void x(samurai::memory::CustomAllocator *arena);
34typedef BINDALLOCATOR(bindAllocator_t);
35#undef BINDALLOCATOR
36
37#define RESETALLOCATOR(x) void x();
38typedef RESETALLOCATOR(resetAllocator_t)
39#undef RESETALLOCATOR
40
41#define DISSABLEALLOCATORS(x) void x();
42typedef DISSABLEALLOCATORS(dissableAllocators_t)
43#undef DISSABLEALLOCATORS
44
45
46
47
48#ifdef SAMURAI_WINDOWS
49#define NOMINMAX
50#include <Windows.h>
51#endif
52
53namespace samurai
54{
55
56
57struct LoadedDll
58{
59 gameplayStart_t *gameplayStart_ = {};
60 gameplayReload_t *gameplayReload_ = {};
61 getContainersInfo_t *getContainersInfo_ = {};
62 constructContainer_t *constructContainer_ = {};
63 destructContainer_t *destructContainer_ = {};
64 bindAllocator_t *bindAllocator_ = {};
65 resetAllocator_t *resetAllocator_ = {};
66 dissableAllocators_t *dissableAllocators_ = {};
67
68#ifdef SAMURAI_WINDOWS
69 FILETIME filetime = {};
70 HMODULE dllHand = {};
71#endif
72
73 int id = 0;
74
75 bool loadDll(int id, samurai::LogManager &logs);
76
77 bool tryToloadDllUntillPossible(int id, samurai::LogManager &logs, std::chrono::duration<long long> timeout =
78 std::chrono::seconds(0));
79
80 void unloadDll();
81
82 //no need to call since it is called in load dll function
83 void getContainerInfoAndCheck(samurai::LogManager &logs);
84
85 bool shouldReloadDll();
86
87 void reloadContainerExtensionsSupport();
88
89 std::vector<samurai::ContainerInformation> containerInfo;
90
91 std::unordered_map<std::string, std::string> containerExtensionsSupport;
92
93 bool constructRuntimeContainer(samurai::RuntimeContainer &c, const char *name);
94
95 void bindAllocatorDllRealm(samurai::memory::CustomAllocator *allocator);
96
97 void resetAllocatorDllRealm();
98
99 bool checkIfDllIsOpenable();
100};
101
102
103
104};
#define GAMEPLAYRELOAD(x)
Definition dllLoader.h:17
#define CONSTRUCTCONTAINER(x)
Definition dllLoader.h:25
#define GETCONTAINERSINFO(x)
Definition dllLoader.h:21
#define GAMEPLAYSTART(x)
Definition dllLoader.h:13
#define BINDALLOCATOR(x)
Definition dllLoader.h:33
#define DISSABLEALLOCATORS(x)
#define DESTRUCTCONTAINER(x)
Definition dllLoader.h:29
#define RESETALLOCATOR(x)
Definition dllLoader.h:37