mirror of https://github.com/ppy/SDL3-CS.git
Remap `wchar_t *` to `IntPtr`
These map to 16-bit `ushort` on windows, but are 32-bit on Unix.
This commit is contained in:
parent
8d1a377e72
commit
b904699261
|
|
@ -23,6 +23,7 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SDL
|
||||
|
|
@ -52,16 +53,16 @@ namespace SDL
|
|||
public ushort product_id;
|
||||
|
||||
[NativeTypeName("wchar_t *")]
|
||||
public ushort* serial_number;
|
||||
public IntPtr serial_number;
|
||||
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort release_number;
|
||||
|
||||
[NativeTypeName("wchar_t *")]
|
||||
public ushort* manufacturer_string;
|
||||
public IntPtr manufacturer_string;
|
||||
|
||||
[NativeTypeName("wchar_t *")]
|
||||
public ushort* product_string;
|
||||
public IntPtr product_string;
|
||||
|
||||
[NativeTypeName("unsigned short")]
|
||||
public ushort usage_page;
|
||||
|
|
@ -102,7 +103,7 @@ namespace SDL
|
|||
public static extern void SDL_hid_free_enumeration(SDL_hid_device_info* devs);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern SDL_hid_device* SDL_hid_open([NativeTypeName("unsigned short")] ushort vendor_id, [NativeTypeName("unsigned short")] ushort product_id, [NativeTypeName("const wchar_t *")] ushort* serial_number);
|
||||
public static extern SDL_hid_device* SDL_hid_open([NativeTypeName("unsigned short")] ushort vendor_id, [NativeTypeName("unsigned short")] ushort product_id, [NativeTypeName("const wchar_t *")] IntPtr serial_number);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern SDL_hid_device* SDL_hid_open_path([NativeTypeName("const char *")] sbyte* path);
|
||||
|
|
@ -132,16 +133,16 @@ namespace SDL
|
|||
public static extern int SDL_hid_close(SDL_hid_device* dev);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_hid_get_manufacturer_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern int SDL_hid_get_manufacturer_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] IntPtr @string, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_hid_get_product_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern int SDL_hid_get_product_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] IntPtr @string, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_hid_get_serial_number_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern int SDL_hid_get_serial_number_string(SDL_hid_device* dev, [NativeTypeName("wchar_t *")] IntPtr @string, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_hid_get_indexed_string(SDL_hid_device* dev, int string_index, [NativeTypeName("wchar_t *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern int SDL_hid_get_indexed_string(SDL_hid_device* dev, int string_index, [NativeTypeName("wchar_t *")] IntPtr @string, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern SDL_hid_device_info* SDL_hid_get_device_info(SDL_hid_device* dev);
|
||||
|
|
|
|||
|
|
@ -158,47 +158,47 @@ namespace SDL
|
|||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("size_t")]
|
||||
public static extern nuint SDL_wcslen([NativeTypeName("const wchar_t *")] ushort* wstr);
|
||||
public static extern nuint SDL_wcslen([NativeTypeName("const wchar_t *")] IntPtr wstr);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("size_t")]
|
||||
public static extern nuint SDL_wcsnlen([NativeTypeName("const wchar_t *")] ushort* wstr, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern nuint SDL_wcsnlen([NativeTypeName("const wchar_t *")] IntPtr wstr, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("size_t")]
|
||||
public static extern nuint SDL_wcslcpy([NativeTypeName("wchar_t *")] ushort* dst, [NativeTypeName("const wchar_t *")] ushort* src, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern nuint SDL_wcslcpy([NativeTypeName("wchar_t *")] IntPtr dst, [NativeTypeName("const wchar_t *")] IntPtr src, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("size_t")]
|
||||
public static extern nuint SDL_wcslcat([NativeTypeName("wchar_t *")] ushort* dst, [NativeTypeName("const wchar_t *")] ushort* src, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern nuint SDL_wcslcat([NativeTypeName("wchar_t *")] IntPtr dst, [NativeTypeName("const wchar_t *")] IntPtr src, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("wchar_t *")]
|
||||
public static extern ushort* SDL_wcsdup([NativeTypeName("const wchar_t *")] ushort* wstr);
|
||||
public static extern IntPtr SDL_wcsdup([NativeTypeName("const wchar_t *")] IntPtr wstr);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("wchar_t *")]
|
||||
public static extern ushort* SDL_wcsstr([NativeTypeName("const wchar_t *")] ushort* haystack, [NativeTypeName("const wchar_t *")] ushort* needle);
|
||||
public static extern IntPtr SDL_wcsstr([NativeTypeName("const wchar_t *")] IntPtr haystack, [NativeTypeName("const wchar_t *")] IntPtr needle);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("wchar_t *")]
|
||||
public static extern ushort* SDL_wcsnstr([NativeTypeName("const wchar_t *")] ushort* haystack, [NativeTypeName("const wchar_t *")] ushort* needle, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern IntPtr SDL_wcsnstr([NativeTypeName("const wchar_t *")] IntPtr haystack, [NativeTypeName("const wchar_t *")] IntPtr needle, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_wcscmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2);
|
||||
public static extern int SDL_wcscmp([NativeTypeName("const wchar_t *")] IntPtr str1, [NativeTypeName("const wchar_t *")] IntPtr str2);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_wcsncmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern int SDL_wcsncmp([NativeTypeName("const wchar_t *")] IntPtr str1, [NativeTypeName("const wchar_t *")] IntPtr str2, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_wcscasecmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2);
|
||||
public static extern int SDL_wcscasecmp([NativeTypeName("const wchar_t *")] IntPtr str1, [NativeTypeName("const wchar_t *")] IntPtr str2);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_wcsncasecmp([NativeTypeName("const wchar_t *")] ushort* str1, [NativeTypeName("const wchar_t *")] ushort* str2, [NativeTypeName("size_t")] nuint maxlen);
|
||||
public static extern int SDL_wcsncasecmp([NativeTypeName("const wchar_t *")] IntPtr str1, [NativeTypeName("const wchar_t *")] IntPtr str2, [NativeTypeName("size_t")] nuint maxlen);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("long")]
|
||||
public static extern int SDL_wcstol([NativeTypeName("const wchar_t *")] ushort* str, [NativeTypeName("wchar_t **")] ushort** endp, int @base);
|
||||
public static extern int SDL_wcstol([NativeTypeName("const wchar_t *")] IntPtr str, [NativeTypeName("wchar_t **")] IntPtr* endp, int @base);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("size_t")]
|
||||
|
|
@ -343,13 +343,13 @@ namespace SDL
|
|||
public static extern int SDL_snprintf([NativeTypeName("char *")] sbyte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] sbyte* fmt, __arglist);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_swprintf([NativeTypeName("wchar_t *")] ushort* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] ushort* fmt, __arglist);
|
||||
public static extern int SDL_swprintf([NativeTypeName("wchar_t *")] IntPtr text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] IntPtr fmt, __arglist);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_vsnprintf([NativeTypeName("char *")] sbyte* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const char *")] sbyte* fmt, [NativeTypeName("va_list")] sbyte* ap);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_vswprintf([NativeTypeName("wchar_t *")] ushort* text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] ushort* fmt, [NativeTypeName("va_list")] sbyte* ap);
|
||||
public static extern int SDL_vswprintf([NativeTypeName("wchar_t *")] IntPtr text, [NativeTypeName("size_t")] nuint maxlen, [NativeTypeName("const wchar_t *")] IntPtr fmt, [NativeTypeName("va_list")] sbyte* ap);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
public static extern int SDL_asprintf([NativeTypeName("char **")] sbyte** strp, [NativeTypeName("const char *")] sbyte* fmt, __arglist);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
|
|
@ -49,7 +50,7 @@ namespace SDL
|
|||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("const wchar_t *")]
|
||||
[SupportedOSPlatform("Windows")]
|
||||
public static extern ushort* SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
|
||||
public static extern IntPtr SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
|
||||
|
||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: NativeTypeName("const char *")]
|
||||
|
|
|
|||
|
|
@ -174,6 +174,9 @@ base_command = [
|
|||
"--methodClassName", "SDL3",
|
||||
"--namespace", "SDL",
|
||||
|
||||
"--remap",
|
||||
"wchar_t *=IntPtr", # wchar_t has a platform-defined size
|
||||
|
||||
"--additional",
|
||||
"--undefine-macro=_WIN32",
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in New Issue