Skip to content

Commit 5382e4d

Browse files
committed
Add new argument for IsGameRunningCore and KillRunningGameCore
+ out DateTime gameStartTime
1 parent 2baf72f commit 5382e4d

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

SharedStatic.Generic.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,12 @@ public static unsafe int LaunchGameFromGameManagerAsync(nint gameManagerP,
153153

154154
/// <summary>
155155
/// This method is an ABI proxy function between the PInvoke Export and the actual plugin's method.<br/>
156-
/// See the documentation for <see cref="SharedStatic.IsGameRunningCore(RunGameFromGameManagerContext, out bool)"/> method for more information.
156+
/// See the documentation for <see cref="SharedStatic.IsGameRunningCore(RunGameFromGameManagerContext, out bool, out DateTime)"/> method for more information.
157157
/// </summary>
158-
public static unsafe int IsGameRunning(nint gameManagerP, nint presetConfigP, out int isGameRunningInt)
158+
public static unsafe int IsGameRunning(nint gameManagerP, nint presetConfigP, out int isGameRunningInt, out DateTime gameStartTime)
159159
{
160160
isGameRunningInt = 0;
161+
gameStartTime = default;
161162

162163
try
163164
{
@@ -188,7 +189,7 @@ public static unsafe int IsGameRunning(nint gameManagerP, nint presetConfigP, ou
188189
PluginHandle = nint.Zero
189190
};
190191

191-
bool isSupported = ThisPluginExport.IsGameRunningCore(context, out bool isGameRunning);
192+
bool isSupported = ThisPluginExport.IsGameRunningCore(context, out bool isGameRunning, out gameStartTime);
192193
isGameRunningInt = isGameRunning ? 1 : 0;
193194
return isSupported ? 0 : throw new NotSupportedException("Method isn't overriden, yet");
194195
}
@@ -269,11 +270,12 @@ public static unsafe int WaitRunningGameAsync(nint gameManagerP, nint pluginP, n
269270

270271
/// <summary>
271272
/// This method is an ABI proxy function between the PInvoke Export and the actual plugin's method.<br/>
272-
/// See the documentation for <see cref="SharedStatic.KillRunningGameCore(RunGameFromGameManagerContext, out bool)"/> method for more information.
273+
/// See the documentation for <see cref="SharedStatic.KillRunningGameCore(RunGameFromGameManagerContext, out bool, out DateTime)"/> method for more information.
273274
/// </summary>
274-
public static unsafe int KillRunningGame(nint gameManagerP, nint presetConfigP, out int wasGameRunningInt)
275+
public static unsafe int KillRunningGame(nint gameManagerP, nint presetConfigP, out int wasGameRunningInt, out DateTime gameStartTime)
275276
{
276277
wasGameRunningInt = 0;
278+
gameStartTime = default;
277279

278280
try
279281
{
@@ -304,7 +306,7 @@ public static unsafe int KillRunningGame(nint gameManagerP, nint presetConfigP,
304306
PluginHandle = nint.Zero
305307
};
306308

307-
bool isSupported = ThisPluginExport.KillRunningGameCore(context, out bool wasGameRunning);
309+
bool isSupported = ThisPluginExport.KillRunningGameCore(context, out bool wasGameRunning, out gameStartTime);
308310
wasGameRunningInt = wasGameRunning ? 1 : 0;
309311
return isSupported ? 0 : throw new NotSupportedException("Method isn't overriden which mark this plugin doesn't support this feature!");
310312
}

SharedStatic.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static unsafe SharedStatic()
129129

130130
internal delegate int LaunchGameFromGameManagerAsyncDelegate(nint gameManagerP, nint pluginP, nint presetConfigP, nint printGameLogCallbackP, nint arguments, int argumentsLen, int runBoostedInt, int processPriorityInt, ref Guid cancelToken, out nint taskResult);
131131
internal delegate int WaitRunningGameAsyncDelegate(nint gameManagerP, nint pluginP, nint presetConfigP, ref Guid cancelToken, out nint taskResult);
132-
internal delegate int IsGameRunningDelegate(nint gameManagerP, nint presetConfigP, out int isGameRunning);
132+
internal delegate int IsGameRunningDelegate(nint gameManagerP, nint presetConfigP, out int isGameRunning, out DateTime processStartTime);
133133

134134
/// <summary>
135135
/// Gets the array of CDN URLs used by the launcher to perform an update.
@@ -398,15 +398,17 @@ public virtual Task<bool> LaunchGameFromGameManagerCoreAsync(RunGameFromGameMana
398398
/// </summary>
399399
/// <param name="context">The context to launch the game from <see cref="IGameManager"/>.</param>
400400
/// <param name="isGameRunning">Whether the game is currently running or not.</param>
401+
/// <param name="gameStartTime">The date time stamp of when the process was started.</param>
401402
/// <returns>
402403
/// To find the actual return value, please use <paramref name="isGameRunning"/> out-argument.<br/><br/>
403404
///
404405
/// Returns <c>false</c> if the plugin doesn't have game launch mechanism (or API Standard is equal or lower than v0.1.0) or if this method isn't overriden.<br/>
405406
/// Otherwise, <c>true</c> if the plugin supports game launch mechanism.
406407
/// </returns>
407-
public virtual bool IsGameRunningCore(RunGameFromGameManagerContext context, out bool isGameRunning)
408+
public virtual bool IsGameRunningCore(RunGameFromGameManagerContext context, out bool isGameRunning, out DateTime gameStartTime)
408409
{
409410
isGameRunning = false;
411+
gameStartTime = default;
410412
return false;
411413
}
412414

@@ -432,15 +434,17 @@ public virtual Task<bool> WaitRunningGameCoreAsync(RunGameFromGameManagerContext
432434
/// </summary>
433435
/// <param name="context">The context to launch the game from <see cref="IGameManager"/>.</param>
434436
/// <param name="wasGameRunning">Whether to indicate that the game was running or not.</param>
437+
/// <param name="gameStartTime">The date time stamp of when the process was started.</param>
435438
/// <returns>
436439
/// To find the actual return value, please use <paramref name="wasGameRunning"/> out-argument.<br/><br/>
437440
///
438441
/// Returns <c>false</c> if the plugin doesn't have game launch mechanism (or API Standard is equal or lower than v0.1.0) or if this method isn't overriden.<br/>
439442
/// Otherwise, <c>true</c> if the plugin supports game launch mechanism.
440443
/// </returns>
441-
public virtual bool KillRunningGameCore(RunGameFromGameManagerContext context, out bool wasGameRunning)
444+
public virtual bool KillRunningGameCore(RunGameFromGameManagerContext context, out bool wasGameRunning, out DateTime gameStartTime)
442445
{
443446
wasGameRunning = false;
447+
gameStartTime = default;
444448
return false;
445449
}
446450
}

0 commit comments

Comments
 (0)