mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
Implement new functions in hid_driver_t in WiiU driver
== DETAILS This implements the WiiU-specific functions. Since the wiiu_hid_t data structure contains the handle and interface index, the method signatures can be simplified quite a bit. And since (at least for now) we want these to be synchronous, we don't need to expose the callback parameters.
This commit is contained in:
parent
678c4093c1
commit
661e5bf50b
@ -133,13 +133,44 @@ static void wiiu_hid_poll(void *data)
|
|||||||
(void)data;
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wiiu_hid_device_send_control(void *data,
|
static int32_t wiiu_hid_set_report(void *data, uint8_t report_type, report_id,
|
||||||
uint8_t *buffer,
|
void *report_data, uint32_t report_length)
|
||||||
size_t buffer_size) {
|
{
|
||||||
struct wiiu_adapter *adapter = (struct wiiu_adapter *)data;
|
wiiu_hid_t *hid = (wiiu_hid_t)data;
|
||||||
|
|
||||||
if(!adapter)
|
if(!hid)
|
||||||
return;
|
return -1;
|
||||||
|
|
||||||
|
return HIDSetReport(hid->handle,
|
||||||
|
report_type,
|
||||||
|
report_id,
|
||||||
|
report_data,
|
||||||
|
report_length,
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t wiiu_hid_set_idle(void *data, uint8_t duration)
|
||||||
|
{
|
||||||
|
wiiu_hid_t *hid = (wiiu_hid_t)data;
|
||||||
|
if(!hid)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return HIDSetIdle(hid->handle,
|
||||||
|
hid->interface_index,
|
||||||
|
duration,
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t wiiu_hid_set_protocol(void *data, uint8_t protocol)
|
||||||
|
{
|
||||||
|
wiiu_hid_t *hid = (wiiu_hid_t)data;
|
||||||
|
if(!hid)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return HIDSetProtocol(hid->handle,
|
||||||
|
hid->interface_index,
|
||||||
|
protocol,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void start_polling_thread(wiiu_hid_t *hid) {
|
static void start_polling_thread(wiiu_hid_t *hid) {
|
||||||
@ -419,4 +450,8 @@ hid_driver_t wiiu_hid = {
|
|||||||
wiiu_hid_joypad_rumble,
|
wiiu_hid_joypad_rumble,
|
||||||
wiiu_hid_joypad_name,
|
wiiu_hid_joypad_name,
|
||||||
"wiiu",
|
"wiiu",
|
||||||
|
NULL, // send_control
|
||||||
|
wiiu_hid_set_report,
|
||||||
|
wiiu_hid_set_idle,
|
||||||
|
wiiu_hid_set_protocol
|
||||||
};
|
};
|
||||||
|
@ -195,7 +195,7 @@ struct hid_driver
|
|||||||
const char *ident;
|
const char *ident;
|
||||||
void (*send_control)(void *data, uint8_t *buf, size_t size);
|
void (*send_control)(void *data, uint8_t *buf, size_t size);
|
||||||
int32_t (*set_report)(void *, uint8_t, uint8_t, void *, uint32_t);
|
int32_t (*set_report)(void *, uint8_t, uint8_t, void *, uint32_t);
|
||||||
int32_t (*set_idle)(void *, uint8_t, uint8_t);
|
int32_t (*set_idle)(void *, uint8_t);
|
||||||
int32_t (*set_protocol)(void *, uint8_t);
|
int32_t (*set_protocol)(void *, uint8_t);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -104,7 +104,7 @@ HIDSetIdle(uint32_t handle,
|
|||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDSetProtocol(uint32_t handle,
|
HIDSetProtocol(uint32_t handle,
|
||||||
uint8_t int32_terface_index,
|
uint8_t interface_index,
|
||||||
uint8_t protocol,
|
uint8_t protocol,
|
||||||
HIDCallback hc,
|
HIDCallback hc,
|
||||||
void *p_user);
|
void *p_user);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user