|
|
@ -126,7 +126,7 @@ public class UniQuake: MonoBehaviour |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
|
private delegate void UniQuake_InitFunc(QuakeParms parms, IntPtr sysCalls, IntPtr modCalls); |
|
|
|
|
|
|
|
|
private delegate void UniQuake_InitFunc(QuakeParms parms, IntPtr sysCalls, IntPtr glCalls); |
|
|
private UniQuake_InitFunc UniQuake_Init; |
|
|
private UniQuake_InitFunc UniQuake_Init; |
|
|
|
|
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
|
@ -139,7 +139,6 @@ public class UniQuake: MonoBehaviour |
|
|
|
|
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
|
|
private delegate void UniQuake_SetFmodSystemFunc(IntPtr fmodSystem); |
|
|
private delegate void UniQuake_SetFmodSystemFunc(IntPtr fmodSystem); |
|
|
|
|
|
|
|
|
private UniQuake_SetFmodSystemFunc UniQuake_SetFmodSystem; |
|
|
private UniQuake_SetFmodSystemFunc UniQuake_SetFmodSystem; |
|
|
|
|
|
|
|
|
private void LoadLibrary() |
|
|
private void LoadLibrary() |
|
|
@ -157,12 +156,12 @@ public class UniQuake: MonoBehaviour |
|
|
UniQuake_SetFmodSystem = LoadLibraryFunction<UniQuake_SetFmodSystemFunc>("UniQuake_SetFmodSystem"); |
|
|
UniQuake_SetFmodSystem = LoadLibraryFunction<UniQuake_SetFmodSystemFunc>("UniQuake_SetFmodSystem"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private TDelegate LoadLibraryFunction<TDelegate>(string name) |
|
|
|
|
|
|
|
|
private TDelegate LoadLibraryFunction<TDelegate>(string functionName) |
|
|
{ |
|
|
{ |
|
|
IntPtr procAddress = SystemLibrary.GetProcAddress(libraryHandle, name); |
|
|
|
|
|
|
|
|
IntPtr procAddress = SystemLibrary.GetProcAddress(libraryHandle, functionName); |
|
|
if (procAddress == IntPtr.Zero) |
|
|
if (procAddress == IntPtr.Zero) |
|
|
{ |
|
|
{ |
|
|
throw new DllNotFoundException($"Could not find library function: {name}"); |
|
|
|
|
|
|
|
|
throw new DllNotFoundException($"Could not find library function: {functionName}"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return Marshal.GetDelegateForFunctionPointer<TDelegate>(procAddress); |
|
|
return Marshal.GetDelegateForFunctionPointer<TDelegate>(procAddress); |
|
|
|