5#include "Engine/GameInstance.h"
6#include "UObject/Object.h"
8#include "ModInstance.generated.h"
17 UPROPERTY(BlueprintReadOnly, Category =
"Mod|Lifecycle")
21 UPROPERTY(BlueprintReadOnly, Category =
"Mod|Lifecycle")
25 UPROPERTY(BlueprintReadOnly, Category =
"Mod|Lifecycle")
29 UPROPERTY(BlueprintReadOnly, Category =
"Mod|Lifecycle")
33 UPROPERTY(BlueprintReadOnly, Category =
"Mod|Lifecycle")
37 UPROPERTY(BlueprintReadOnly, Category =
"Mod|Lifecycle")
41 UPROPERTY(BlueprintReadOnly, Category =
"Mod|Lifecycle")
45 UPROPERTY(BlueprintReadOnly, Category =
"Mod|Lifecycle")
50UCLASS(Abstract, BlueprintType, Blueprintable, MinimalAPI, meta = (DontUseGenericSpawnObject))
57 MODLOADER_API UWorld*
GetWorld()
const override;
71 MODLOADER_API
bool AcquireWorldAPI(FName TypeId,
const TCHAR* Signature, uint64& OutContext, uint64& OutObject);
78 static MODLOADER_API
void*
ResolveHostAPI(
const char* Module,
const char* Symbol);
88 MODLOADER_API
bool AcquireModService(FName ServiceId, FName TypeId,
const TCHAR* Signature, uint64& OutContext,
93 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category =
"Mod|Lifecycle",
94 meta = (DisplayName =
"On Mod Load Completed"))
102 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category =
"Mod|Lifecycle",
103 meta = (DisplayName =
"On Mod Before Unload"))
105 virtual
void ExecuteOnModBeforeUnload_Implementation()
111 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category =
"Mod|Lifecycle",
112 meta = (DisplayName =
"On Mod Register"))
114 virtual
void ExecuteOnModRegister_Implementation()
120 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category =
"Mod|Lifecycle", meta = (DisplayName =
"On Mod Bind"))
122 virtual
void ExecuteOnModBind_Implementation()
127 using FAcquireModService = bool (*)(
UModInstance&, FName, FName,
const TCHAR*, uint64&, uint64&);
128 static MODLOADER_API
void SetServiceBridge(FAcquireModService Acquire);
129 using FAcquireWorldAPI = bool (*)(
UModInstance&, FName,
const TCHAR*, uint64&, uint64&);
130 using FResolveHostAPI =
void* (*)(
const char*,
const char*);
132 static MODLOADER_API
void SetHostAPIBridge(FAcquireWorldAPI Acquire, FResolveHostAPI Resolve,
133 FRevokeWorldAPIs Revoke);
135 static MODLOADER_API
void SetExtensionWorld(
UModInstance& Instance, UWorld& World, FString ModId);
136 MODLOADER_API
void RegisterExtensions();
137 MODLOADER_API
void BindExtensions();
138 MODLOADER_API
void ReleaseExtensions(
bool bNotify =
true);
155 UFUNCTION(BlueprintImplementableEvent, Category =
"Mod|Lifecycle",
156 meta = (DisplayName =
"On Mod Load Completed (Legacy)"))
171 UFUNCTION(BlueprintImplementableEvent, Category =
"Mod|Lifecycle",
172 meta = (DisplayName =
"On Mod Before Unload (Legacy)"))
176 UFUNCTION(BlueprintImplementableEvent, Category =
"Mod|Lifecycle",
177 meta = (DisplayName =
"On Mod Register (Legacy)"))
187 UFUNCTION(BlueprintImplementableEvent, Category =
"Mod|Lifecycle", meta = (DisplayName =
"On Mod Bind (Legacy)"))
197 friend class UModLifecycleSubsystem;
198 void RevokeWorldAPIs();
A game-thread Mod entry point owned by one game instance.
Definition ModInstance.h:52
MODLOADER_API void ReceiveModRegister()
Registers this mod's extensions while its World is preparing.
MODLOADER_API bool AcquireModService(FName ServiceId, FName TypeId, const TCHAR *Signature, uint64 &OutContext, uint64 &OutObject)
Acquires a declared cross-Mod service on the game thread.
virtual void OnModBind()
Binds compiled C++ consumers after all providers are registered.
Definition ModInstance.h:191
MODLOADER_API void ReceiveModBeforeUnload()
Blueprint event dispatched before this Mod's content is unloaded.
virtual void OnModRegister()
Registers compiled C++ extensions before the World is ready.
Definition ModInstance.h:181
MODLOADER_API void ExecuteOnModBeforeUnload()
Dispatches unload notification to Blueprint or the C++ override.
MODLOADER_API void ReceiveModLoadCompleted(const FModLoadNotification &Result)
Blueprint event for a completed Mod load.
MODLOADER_API FString GetModId() const
Returns this instance's active package ID on the game thread.
MODLOADER_API UWorld * GetWorld() const override
Returns the extension World or the World of the owning game instance.
virtual void OnModBeforeUnload()
Releases game state and references before this Mod is unloaded.
Definition ModInstance.h:165
MODLOADER_API void ExecuteOnModBind()
Dispatches the mod bind callback to Blueprint or the native override.
MODLOADER_API void ExecuteOnModRegister()
Dispatches the mod register callback to Blueprint or the native override.
MODLOADER_API bool AcquireWorldAPI(FName TypeId, const TCHAR *Signature, uint64 &OutContext, uint64 &OutObject)
Acquires a host-approved world provider on the game thread.
static MODLOADER_API void * ResolveHostAPI(const char *Module, const char *Symbol)
Resolves a host API table query on the game thread.
virtual void OnModLoadCompleted(const FModLoadNotification &Result)
Receives the result of a load operation on the game thread.
Definition ModInstance.h:146
MODLOADER_API void ReceiveModBind()
Acquires declared services after all providers register.
MODLOADER_API void ExecuteOnModLoadCompleted(const FModLoadNotification &Result)
Dispatches load completion to Blueprint or the C++ override.
Blueprint payload for one finished Mod load attempt.
Definition ModInstance.h:13
bool bSucceeded
Whether the mount succeeded or was already present.
Definition ModInstance.h:30
FString InputName
Name of the archive or of the directory that could not be scanned.
Definition ModInstance.h:26
FString ModId
The identity read from the archive, when available.
Definition ModInstance.h:18
FString Reason
Failure reason supplied by ModLoader.
Definition ModInstance.h:46
FString Version
The version read from the archive, when available.
Definition ModInstance.h:22
bool bStartup
Whether the result came from the configured startup scan.
Definition ModInstance.h:38
int32 ErrorCode
Stable ModLoader error code, zero on success.
Definition ModInstance.h:42
bool bAlreadyMounted
Whether the exact archive was already present before this operation.
Definition ModInstance.h:34