mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-13 00:58:31 +00:00
Changed native CUE-Wrapper to dynamically load the correct library (x64/x86)
This commit is contained in:
parent
4fc6d0e6ad
commit
ded61df85b
@ -8,11 +8,22 @@ namespace CUE.NET.Native
|
|||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
internal static class _CUESDK
|
internal static class _CUESDK
|
||||||
{
|
{
|
||||||
#if WIN64
|
#region Libary Management
|
||||||
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
#else
|
static _CUESDK()
|
||||||
|
{
|
||||||
|
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||||
|
LoadLibrary((Environment.Is64BitProcess ? "x64" : "x86") + "/CUESDK_2013.dll");
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
private static extern IntPtr LoadLibrary(string dllToLoad);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SDK-IMPORTS
|
||||||
|
|
||||||
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
#endif
|
|
||||||
// set specified leds to some colors. The color is retained until changed by successive calls. This function does not take logical layout into account
|
// set specified leds to some colors. The color is retained until changed by successive calls. This function does not take logical layout into account
|
||||||
internal static extern bool CorsairSetLedsColors(int size, IntPtr ledsColors);
|
internal static extern bool CorsairSetLedsColors(int size, IntPtr ledsColors);
|
||||||
|
|
||||||
@ -23,60 +34,34 @@ namespace CUE.NET.Native
|
|||||||
//#endif
|
//#endif
|
||||||
//internal static extern bool CorsairSetLedsColorsAsync(int size, CorsairLedColor* ledsColors, void(*CallbackType)(void*, bool, CorsairError), void* context);
|
//internal static extern bool CorsairSetLedsColorsAsync(int size, CorsairLedColor* ledsColors, void(*CallbackType)(void*, bool, CorsairError), void* context);
|
||||||
|
|
||||||
#if WIN64
|
|
||||||
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
#else
|
|
||||||
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
#endif
|
|
||||||
// returns number of connected Corsair devices that support lighting control.
|
// returns number of connected Corsair devices that support lighting control.
|
||||||
internal static extern int CorsairGetDeviceCount();
|
internal static extern int CorsairGetDeviceCount();
|
||||||
|
|
||||||
#if WIN64
|
|
||||||
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
#else
|
|
||||||
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
#endif
|
|
||||||
// returns information about device at provided index
|
// returns information about device at provided index
|
||||||
internal static extern IntPtr CorsairGetDeviceInfo(int deviceIndex);
|
internal static extern IntPtr CorsairGetDeviceInfo(int deviceIndex);
|
||||||
|
|
||||||
#if WIN64
|
|
||||||
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
#else
|
|
||||||
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
#endif
|
|
||||||
// provides list of keyboard LEDs with their physical positions.
|
// provides list of keyboard LEDs with their physical positions.
|
||||||
internal static extern IntPtr CorsairGetLedPositions();
|
internal static extern IntPtr CorsairGetLedPositions();
|
||||||
|
|
||||||
#if WIN64
|
|
||||||
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
#else
|
|
||||||
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
#endif
|
|
||||||
// retrieves led id for key name taking logical layout into account.
|
// retrieves led id for key name taking logical layout into account.
|
||||||
internal static extern CorsairKeyboardKeyId CorsairGetLedIdForKeyName(char keyName);
|
internal static extern CorsairKeyboardKeyId CorsairGetLedIdForKeyName(char keyName);
|
||||||
|
|
||||||
#if WIN64
|
|
||||||
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
#else
|
|
||||||
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
#endif
|
|
||||||
// requestes control using specified access mode. By default client has shared control over lighting so there is no need to call CorsairRequestControl unless client requires exclusive control
|
// requestes control using specified access mode. By default client has shared control over lighting so there is no need to call CorsairRequestControl unless client requires exclusive control
|
||||||
internal static extern bool CorsairRequestControl(CorsairAccessMode accessMode);
|
internal static extern bool CorsairRequestControl(CorsairAccessMode accessMode);
|
||||||
|
|
||||||
#if WIN64
|
|
||||||
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
#else
|
|
||||||
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
#endif
|
|
||||||
// checks file and protocol version of CUE to understand which of SDK functions can be used with this version of CUE
|
// checks file and protocol version of CUE to understand which of SDK functions can be used with this version of CUE
|
||||||
internal static extern _CorsairProtocolDetails CorsairPerformProtocolHandshake();
|
internal static extern _CorsairProtocolDetails CorsairPerformProtocolHandshake();
|
||||||
|
|
||||||
#if WIN64
|
|
||||||
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
#else
|
|
||||||
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
#endif
|
|
||||||
// returns last error that occured while using any of Corsair* functions
|
// returns last error that occured while using any of Corsair* functions
|
||||||
internal static extern CorsairError CorsairGetLastError();
|
internal static extern CorsairError CorsairGetLastError();
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user