Add recommended remapping for `SDL_hidapi.h`

This commit is contained in:
Susko3 2024-04-06 12:22:50 +02:00
parent 2788460013
commit 8d1a377e72
2 changed files with 23 additions and 19 deletions

View File

@ -27,7 +27,7 @@ using System.Runtime.InteropServices;
namespace SDL namespace SDL
{ {
public partial struct SDL_hid_device_ public partial struct SDL_hid_device
{ {
} }
@ -102,54 +102,52 @@ namespace SDL
public static extern void SDL_hid_free_enumeration(SDL_hid_device_info* devs); public static extern void SDL_hid_free_enumeration(SDL_hid_device_info* devs);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_hid_device *")] 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 *")] ushort* serial_number);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("SDL_hid_device *")] public static extern SDL_hid_device* SDL_hid_open_path([NativeTypeName("const char *")] sbyte* path);
public static extern SDL_hid_device_* SDL_hid_open_path([NativeTypeName("const char *")] sbyte* path);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_write([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); public static extern int SDL_hid_write(SDL_hid_device* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_read_timeout([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length, int milliseconds); public static extern int SDL_hid_read_timeout(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length, int milliseconds);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_read([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); public static extern int SDL_hid_read(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_set_nonblocking([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, int nonblock); public static extern int SDL_hid_set_nonblocking(SDL_hid_device* dev, int nonblock);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_send_feature_report([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); public static extern int SDL_hid_send_feature_report(SDL_hid_device* dev, [NativeTypeName("const unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_get_feature_report([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); public static extern int SDL_hid_get_feature_report(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_get_input_report([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length); public static extern int SDL_hid_get_input_report(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* data, [NativeTypeName("size_t")] nuint length);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_close([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev); public static extern int SDL_hid_close(SDL_hid_device* dev);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_get_manufacturer_string([NativeTypeName("SDL_hid_device *")] 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 *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_get_product_string([NativeTypeName("SDL_hid_device *")] 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 *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_get_serial_number_string([NativeTypeName("SDL_hid_device *")] 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 *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_get_indexed_string([NativeTypeName("SDL_hid_device *")] 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 *")] ushort* @string, [NativeTypeName("size_t")] nuint maxlen);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SDL_hid_device_info* SDL_hid_get_device_info([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev); public static extern SDL_hid_device_info* SDL_hid_get_device_info(SDL_hid_device* dev);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int SDL_hid_get_report_descriptor([NativeTypeName("SDL_hid_device *")] SDL_hid_device_* dev, [NativeTypeName("unsigned char *")] byte* buf, [NativeTypeName("size_t")] nuint buf_size); public static extern int SDL_hid_get_report_descriptor(SDL_hid_device* dev, [NativeTypeName("unsigned char *")] byte* buf, [NativeTypeName("size_t")] nuint buf_size);
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_hid_ble_scan([NativeTypeName("SDL_bool")] int active); public static extern void SDL_hid_ble_scan([NativeTypeName("SDL_bool")] int active);

View File

@ -0,0 +1,6 @@
# Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
# See the LICENCE file in the repository root for full licence text.
# ClangSharp recommended remapping
--remap
SDL_hid_device_=SDL_hid_device