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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "NVIDIAGfeSDKPrivatePCH.h"
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Kismet/BlueprintAsyncActionBase.h"
#include <gfesdk/bindings/cpp/highlights/highlights_types_cpp.h>
#include "NVIDIAGfeSDKTypes.h"
#include "HighLightBlueprint.generated.h"
//---------------------------------------------------------------------------
UCLASS()
class UHighlightsFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_UCLASS_BODY()
public:
// This function should be called periodically.
// It is used to receive callbacks.
// Can be called in Tick event
UFUNCTION(BlueprintCallable, Category = "Shadowplay Highlights")
static void Poll();
// This function is for convenience
// It chesks if the permissions to use Video or Screenshots functions are granted
// It returns the actual enumeration values for each function
UFUNCTION(BlueprintCallable, Category = "Shadowplay Highlights")
static void ChekIfHighlightsAvailable(const FGfeSDKCreateResponse& InitProperties, bool &VideoGranted, bool &ScreenshotsGranted, EGfeSDKPermission &Video, EGfeSDKPermission &Screenshots);
};
//---------------------------------------------------------------------------
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnHighlightsCallback);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnHighlightsOperationResultCallback, EGfeSDKReturnCode, GfeSdkReturnCode);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnHighlightsInitCallback, EGfeSDKReturnCode, GfeSdkReturnCode, FGfeSDKCreateResponse, GfeSdkProperties);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnGetNumberOfHighlightsCallback, EGfeSDKReturnCode, GfeSdkReturnCode, int32, NumberOfHighlights);
UCLASS()
class UInitHighlights : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// Called when there is a successful init
UPROPERTY(BlueprintAssignable)
FOnHighlightsInitCallback OnSuccess;
// Called when there is an unsuccessful init
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnFailure;
// Initializes the Highlights client. Should be called first, all other functions will fail otherwise. Takes the game name and desired Highlights options as an input.
// Requests Highlights permissions to recorde Video or Screenshots according to the input checkboxes
// Use the GFE Request Permissions function if desired permissions are not granted to you.
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Shadowplay Highlights")
static UInitHighlights* InitHighlights(UObject* WorldContextObject, const FString InGameName, const bool Video, const bool Screenshots);
// UBlueprintAsyncActionBase interface
virtual void Activate() override;
// End of UBlueprintAsyncActionBase interface
private:
FCriticalSection CS;
UObject* WorldContextObject;
FString GameName;
TArray<EGfeSDKScope> RequestedPermissions;
// Permissions for Highlights
TMap<EGfeSDKScope, EGfeSDKPermission> mLastScopePermissions;
TArray<EGfeSDKScope> mPermissionsNeeded;
void Callback();
void OnPermissionsChanged(FGfeSDKPermissionsChangedData const& PermissionsChangedData);
};
//---------------------------------------------------------------------------
UCLASS()
class UHighlightsConfigureAsync : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// Called when there is a successful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnSuccess;
// Called when there is an unsuccessful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnFailure;
// Configures the highlights system and defines the highlight types.
// Should be called once in game (or can be called if the highlight type list changed, for example for another game type).
// Should be called after init and before the OpenGroup functions
// Uses Poll function to receive callbacks
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Shadowplay Highlights")
static UHighlightsConfigureAsync* HighlightsConfigure(UObject* WorldContextObject, const FGfeSDKHighlightConfigParams& ConfigParams);
// UBlueprintAsyncActionBase interface
virtual void Activate() override;
// End of UBlueprintAsyncActionBase interface
private:
UObject* WorldContextObject;
FGfeSDKHighlightConfigParams ConfigParams;
static void __stdcall OnConfigureCallback(GfeSDK::NVGSDK_RetCode rt, void* context);
};
//---------------------------------------------------------------------------
UCLASS()
class UHighlightsOpenGroupAsync : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// Called when there is a successful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnSuccess;
// Called when there is an unsuccessful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnFailure;
// Opens the group of highlights
// Uses Poll function to receive callbacks
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Shadowplay Highlights")
static UHighlightsOpenGroupAsync* HighlightsOpenGroup(UObject* WorldContextObject, const FGfeSDKHighlightOpenGroupParams& Params);
// UBlueprintAsyncActionBase interface
virtual void Activate() override;
// End of UBlueprintAsyncActionBase interface
private:
UObject* WorldContextObject;
FGfeSDKHighlightOpenGroupParams Params;
static void __stdcall OnOpenGroupCallback(GfeSDK::NVGSDK_RetCode rt, void* context);
};
//---------------------------------------------------------------------------
UCLASS()
class UHighlightsCloseGroupAsync : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// Called when there is a successful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnSuccess;
// Called when there is an unsuccessful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnFailure;
// Closes the group of highlights
// Uses Poll function to receive callbacks
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Shadowplay Highlights")
static UHighlightsCloseGroupAsync* HighlightsCloseGroup(UObject* WorldContextObject, const FString& GroupId, const bool& DestroyHighlights);
// UBlueprintAsyncActionBase interface
virtual void Activate() override;
// End of UBlueprintAsyncActionBase interface
private:
UObject* WorldContextObject;
FGfeSDKHighlightCloseGroupParams Params;
static void __stdcall OnCloseGroupCallback(GfeSDK::NVGSDK_RetCode rt, void* context);
};
//---------------------------------------------------------------------------
UCLASS()
class UHighlightsSetScreenshotAsync : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// Called when there is a successful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnSuccess;
// Called when there is an unsuccessful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnFailure;
// Takes screenshot of the game
// Uses Poll function to receive callbacks
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Shadowplay Highlights")
static UHighlightsSetScreenshotAsync* HighlightsSetScreenshot(UObject* WorldContextObject, const FString& GroupId, const FString& HighlightId);
// UBlueprintAsyncActionBase interface
virtual void Activate() override;
// End of UBlueprintAsyncActionBase interface
private:
UObject* WorldContextObject;
FGfeSDKHighlightScreenshotParams Params;
static void __stdcall OnSetScreenshotCallback(GfeSDK::NVGSDK_RetCode rt, void* context);
};
//---------------------------------------------------------------------------
UCLASS()
class UHighlightsSetVideoAsync : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// Called when there is a successful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnSuccess;
// Called when there is an unsuccessful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnFailure;
// Records the video of the gameplay
// GroupID is the name of the group this highlight is related to
// HighlightID is the name of the Highlight
// StartDelta and EndDelta are the time range in miliseconds from the current moment.
// For example StartDelta can be set to -2000 and EndDelta to 3000 - that corresponds to {get the video of two seconds before this moment and record 3 seconds more from this moment}
// Uses Poll function to receive callbacks
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Shadowplay Highlights")
static UHighlightsSetVideoAsync* HighlightsSetVideo(UObject* WorldContextObject, const FString& GroupId, const FString& HighlightId, const int32& StartDelta, const int32& EndDelta);
// UBlueprintAsyncActionBase interface
virtual void Activate() override;
// End of UBlueprintAsyncActionBase interface
private:
UObject* WorldContextObject;
FGfeSDKHighlightVideoParams Params;
static void __stdcall OnSetVideoCallback(GfeSDK::NVGSDK_RetCode rt, void* context);
};
//---------------------------------------------------------------------------
UCLASS()
class UHighlightsSummaryAsync : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// Called when there is a successful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnSuccess;
// Called when there is an unsuccessful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnFailure;
// Shows the Shadowplay Highlights Summary interface
// Uses Poll function to receive callbacks
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Shadowplay Highlights")
static UHighlightsSummaryAsync* HighlightsOpenSummary(UObject* WorldContextObject, const FGfeSDKHighlightSummaryParams& Params);
// UBlueprintAsyncActionBase interface
virtual void Activate() override;
// End of UBlueprintAsyncActionBase interface
private:
UObject* WorldContextObject;
FGfeSDKHighlightSummaryParams Params;
static void __stdcall OnOpenSummaryCallback(GfeSDK::NVGSDK_RetCode rt, void* context);
};
//---------------------------------------------------------------------------
UCLASS()
class UHighlightsGetNumberAsync : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// Called when there is a successful query
UPROPERTY(BlueprintAssignable)
FOnGetNumberOfHighlightsCallback OnSuccess;
// Called when there is an unsuccessful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnFailure;
// Gets number of highlights recorded according to the specified input filtering values
// Uses Poll function to receive callbacks
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Shadowplay Highlights")
static UHighlightsGetNumberAsync* HighlightsGetNumberOfHighlights(UObject* WorldContextObject, const FString& GroupID, const EGfeSDKHighlightType& TagFilter, const EGfeSDKHighlightSignificance& SignificanceFilter);
// UBlueprintAsyncActionBase interface
virtual void Activate() override;
// End of UBlueprintAsyncActionBase interface
private:
UObject* WorldContextObject;
FGfeSDKHighlightGroupView Params;
static void __stdcall OnGetNumberCallback(GfeSDK::NVGSDK_RetCode rt, GfeSDK::NVGSDK_Highlights_NumberOfHighlights const* NumberOfHighlights, void* context);
};
//---------------------------------------------------------------------------
UCLASS()
class URequestPermissionsAsync : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// Called when there is a successful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnSuccess;
// Called when there is an unsuccessful query
UPROPERTY(BlueprintAssignable)
FOnHighlightsOperationResultCallback OnFailure;
// Requests permissions to use the specified Shadowplay Highlights features
// Use this function to request the permission if the InitHighlights function failed to grant the desired permissions
// Uses Poll function to receive callbacks
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Shadowplay Highlights")
static URequestPermissionsAsync* GFERequestPermissions(UObject* WorldContextObject, const bool Video, const bool Screenshots);
// UBlueprintAsyncActionBase interface
virtual void Activate() override;
// End of UBlueprintAsyncActionBase interface
private:
UObject* WorldContextObject;
FGfeSDKRequestPermissionsParams Params;
static void __stdcall OnGetNumberCallback(GfeSDK::NVGSDK_RetCode rt, void* context);
};
|