Skip to content

Commit 26b184d

Browse files
committed
Use GetUnknownPointerDelegate for PluginVersion and StandardVersion
1 parent fb3cc1f commit 26b184d

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

SharedStatic.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public class SharedStatic
5353
{
5454
static unsafe SharedStatic()
5555
{
56-
TryRegisterApiExport<GetVersionPointerDelegate> ("GetPluginStandardVersion", GetPluginStandardVersion);
57-
TryRegisterApiExport<GetVersionPointerDelegate> ("GetPluginVersion", GetPluginVersion);
56+
TryRegisterApiExport<GetUnknownPointerDelegate> ("GetPluginStandardVersion", GetPluginStandardVersion);
57+
TryRegisterApiExport<GetUnknownPointerDelegate> ("GetPluginVersion", GetPluginVersion);
5858
TryRegisterApiExport<GetUnknownPointerDelegate> ("GetPlugin", GetPlugin);
5959
TryRegisterApiExport<GetPluginUpdateCdnListDelegate>("GetPluginUpdateCdnList", GetPluginUpdateCdnList);
6060
TryRegisterApiExport<SetCallbackPointerDelegate> ("SetLoggerCallback", SetLoggerCallback);
@@ -85,17 +85,16 @@ static unsafe SharedStatic()
8585
#else
8686
internal static bool IsDebug = false;
8787
#endif
88-
internal static unsafe GameVersion CurrentPluginVersion => *GetPluginVersion();
88+
internal static unsafe GameVersion CurrentPluginVersion => *(GameVersion*)GetPluginVersion();
8989
#endregion
9090

9191
#region API Exports
9292
private static readonly Dictionary<string, nint> RegisteredApiExports = new(StringComparer.OrdinalIgnoreCase);
9393
private static readonly Dictionary<string, nint>.AlternateLookup<ReadOnlySpan<char>> RegisteredApiExportsLookup = RegisteredApiExports.GetAlternateLookup<ReadOnlySpan<char>>();
9494

95-
protected unsafe delegate GameVersion* GetVersionPointerDelegate();
96-
protected unsafe delegate void* GetUnknownPointerDelegate();
97-
protected unsafe delegate void GetPluginUpdateCdnListDelegate(int* count, ushort*** ptr);
98-
protected delegate void SetCallbackPointerDelegate(nint callbackP);
95+
protected unsafe delegate void* GetUnknownPointerDelegate();
96+
protected unsafe delegate void GetPluginUpdateCdnListDelegate(int* count, ushort*** ptr);
97+
protected delegate void SetCallbackPointerDelegate(nint callbackP);
9998

10099
private static unsafe void GetPluginUpdateCdnList(int* count, ushort*** ptr)
101100
{
@@ -138,15 +137,15 @@ private static unsafe void GetPluginUpdateCdnList(int* count, ushort*** ptr)
138137
}
139138
}
140139

141-
private static unsafe GameVersion* GetPluginStandardVersion()
140+
private static unsafe void* GetPluginStandardVersion()
142141
{
143-
fixed (GameVersion* ptr = &LibraryStandardVersion)
142+
fixed (void* ptr = &LibraryStandardVersion)
144143
{
145144
return ptr;
146145
}
147146
}
148147

149-
private static unsafe GameVersion* GetPluginVersion()
148+
private static unsafe void* GetPluginVersion()
150149
{
151150
if (_currentDllVersion != GameVersion.Empty)
152151
{

0 commit comments

Comments
 (0)