mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-06 15:05:59 +00:00
kernel: Add GlobalKernelObject utility
This commit is contained in:
parent
fd9bf42538
commit
e66ce512d2
6 changed files with 180 additions and 3 deletions
26
kernel/orbis/include/orbis/GlobalKernelObject.hpp
Normal file
26
kernel/orbis/include/orbis/GlobalKernelObject.hpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
#include <kernel/GlobalKernelObject.hpp>
|
||||
|
||||
namespace orbis {
|
||||
struct OrbisNamespace;
|
||||
|
||||
template <rx::Serializable T>
|
||||
using GlobalKernelObject = kernel::GlobalKernelObject<T, OrbisNamespace>;
|
||||
|
||||
template <rx::Serializable T> GlobalKernelObject<T> createGlobalObject() {
|
||||
return {};
|
||||
}
|
||||
|
||||
inline void constructAllGlobals() {
|
||||
kernel::GlobalKernelObjectStorage<OrbisNamespace>::ConstructAll();
|
||||
}
|
||||
inline void destructAllGlobals() {
|
||||
kernel::GlobalKernelObjectStorage<OrbisNamespace>::DestructAll();
|
||||
}
|
||||
|
||||
template <typename T> T &getGlobalObject() {
|
||||
assert(detail::GlobalKernelObjectInstance<GlobalKernelObject<T>>::instance);
|
||||
return kernel::detail::GlobalKernelObjectInstance<
|
||||
OrbisNamespace, GlobalKernelObject<T>>::instance->get();
|
||||
}
|
||||
} // namespace orbis
|
||||
Loading…
Add table
Add a link
Reference in a new issue