6#include "Delegates/Delegate.h"
7#include "Subsystems/GameInstanceSubsystem.h"
9#include "ModAPIHostSubsystem.generated.h"
12struct FModExtensionSession;
13struct FModExtensionWorld;
71 TSet<FName> Permissions);
90 OpenLocalPlayer(ULocalPlayer* Player, FName TypeId,
const TCHAR* Signature, TSet<FName> Permissions);
102 return OpenLocalPlayer(Player, FTraits::TypeId(), FTraits::Signature, MoveTemp(Permissions));
117 virtual void Initialize(FSubsystemCollectionBase& Collection)
override;
118 virtual void Deinitialize()
override;
119 static void* ResolveHostQuery(
const char* Module,
const char* Symbol);
124 return Registry.Get();
129 friend struct FModExtensionWorld;
130 TSharedPtr<FModExtensionSession> ExtensionSession;
134 TWeakObjectPtr<UWorld> World;
136 FDelegateHandle ControllerChanged;
137 TMap<FName, Mod::API::FRegistration> Providers;
141 void CloseLocalPlayer(ULocalPlayer* Player);
142 void OnWorldCleanup(UWorld* World,
bool bSessionEnded,
bool bCleanupResources);
143 void ReleasePlayerScope(
const TWeakObjectPtr<ULocalPlayer>& Player,
const FPlayerScope& Entry);
145 TUniquePtr<Mod::API::FRegistry> Registry;
146 TArray<Mod::API::FRegistration> Types;
148 TMap<TWeakObjectPtr<ULocalPlayer>, FPlayerScope> Players;
149 TSharedPtr<const FAuthorizeWorldCaller> WorldCallerPolicy;
150 TMap<TWeakObjectPtr<UModInstance>, TMap<FName, Mod::API::FWorldCaller>> ModCallers;
A host-issued caller identity and permission grant.
Definition ModAPIRegistry.h:107
An opaque, non-owning object binding with a cached typed calling table.
Definition ModAPIObject.h:18
Owns a session's generated definitions, providers, scopes, and callers.
Definition ModAPIRegistry.h:117
A host-issued scope; a player scope also references its world scope.
Definition ModAPIRegistry.h:99
A synchronous API result containing either a value or a stable error.
Definition ModAPIResult.h:47
Owns the generated API registry for one game instance.
Definition ModAPIHostSubsystem.h:52
DECLARE_DELEGATE_RetVal_TwoParams(TModResult< Mod::API::FWorldAPIGrant >, FAuthorizeWorldCaller, const UModInstance &, FName)
Handles a game-thread request for a mounted mod's native API caller.
MODAPI_API void SetWorldCallerPolicy(FAuthorizeWorldCaller Policy)
Sets the Mod authorization policy on the game thread.
MODAPI_API TModResult< Mod::API::FLocalPlayerCaller > OpenLocalPlayer(ULocalPlayer *Player, FName TypeId, const TCHAR *Signature, TSet< FName > Permissions)
Binds a generated local-player service.
MODAPI_API bool EndExtensionSession()
Releases the selected Mod set on the game thread.
MODAPI_API TModResult< Mod::API::FWorldCaller > OpenWorldCaller(UWorld *World, FName TypeId, const TCHAR *Signature, TSet< FName > Permissions)
Issues a caller and provider token on the game thread.
MODAPI_API TModResult< Mod::API::FRegistration > RegisterWorldProvider(FName TypeId, UObject *Instance)
Registers a live world provider on the game thread.
TModResult< Mod::API::FLocalPlayerCaller > OpenLocalPlayer(ULocalPlayer *Player, TSet< FName > Permissions)
Binds a typed local-player service.
Definition ModAPIHostSubsystem.h:99
MODAPI_API TModResult< void > RevokeCaller(const Mod::API::FCaller &Caller)
Revokes one caller and all of its bindings.
A game-thread Mod entry point owned by one game instance.
Definition ModInstance.h:52
An authorized caller and its generated player service binding.
Definition ModAPIHostSubsystem.h:19
FNativeContext Native
Context and scope tokens for a native client.
Definition ModAPIHostSubsystem.h:25
FCaller Caller
Revocable caller identity.
Definition ModAPIHostSubsystem.h:21
FObjectBinding Binding
Binding suitable for the generated view factory.
Definition ModAPIHostSubsystem.h:23
Process-local tokens issued by the host for an authorized caller.
Definition ModAPINative.h:11
Selects the world provider and exact permissions for an authorized mod.
Definition ModAPIHostSubsystem.h:41
TSet< FName > Permissions
Permission identifiers approved by the host.
Definition ModAPIHostSubsystem.h:45
UWorld * World
World containing the registered provider.
Definition ModAPIHostSubsystem.h:43
A world-scoped caller and the native tokens for one authorized provider.
Definition ModAPIHostSubsystem.h:30
uint64 Object
Object token for the selected provider.
Definition ModAPIHostSubsystem.h:36
FCaller Caller
Revocable identity owned by the host.
Definition ModAPIHostSubsystem.h:32
FNativeContext Native
Context and scope tokens owned by the caller.
Definition ModAPIHostSubsystem.h:34
Specialized by MHT with stable type and calling-table identities.
Definition ModAPIObject.h:14