Skip to content

Commit 2baf72f

Browse files
committed
Make RunGameFromGameManagerContext.PrintGameLogCallback nullable
1 parent da2d777 commit 2baf72f

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Utility/GameManagerExtension.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class RunGameFromGameManagerContext
5151
/// <summary>
5252
/// A delegate which is pointed to a callback to print game log while the game is running.
5353
/// </summary>
54-
public required PrintGameLog PrintGameLogCallback { get; init; }
54+
public required PrintGameLog? PrintGameLogCallback { get; set; }
5555

5656
/// <summary>
5757
/// Indicates whether the Game Launch API is supported on the plugin.
@@ -96,7 +96,7 @@ public class RunGameFromGameManagerContext
9696
nint gameManagerP = GetPointerFromInterface(context.GameManager);
9797
nint pluginP = GetPointerFromInterface(context.Plugin);
9898
nint presetConfigP = GetPointerFromInterface(context.PresetConfig);
99-
nint printGameLogCallbackP = Marshal.GetFunctionPointerForDelegate(context.PrintGameLogCallback);
99+
nint printGameLogCallbackP = context.PrintGameLogCallback == null ? nint.Zero : Marshal.GetFunctionPointerForDelegate(context.PrintGameLogCallback);
100100

101101
if (gameManagerP == nint.Zero)
102102
{
@@ -113,11 +113,6 @@ public class RunGameFromGameManagerContext
113113
return (false, new COMException("Cannot cast IPluginPresetConfig interface to pointer!"));
114114
}
115115

116-
if (printGameLogCallbackP == nint.Zero)
117-
{
118-
return (false, new COMException("Cannot cast PrintGameLog delegate/callback to pointer!"));
119-
}
120-
121116
nint argumentsP = startArgument.GetPinnableStringPointerSafe();
122117
int argumentsLen = startArgument?.Length ?? 0;
123118

0 commit comments

Comments
 (0)