WIP - reorganizing input data

== DETAILS

Looking at the apple input driver gave me an idea--moving the
HID driver into the wiiu_input_t data instead of piggy-backing
it off the wiiu_joypad driver.

- Remove changes to wiiu_joypad
- Add equivalent to wiiu_input

This is probably broke as hell. Haven't tried to compile.
This commit is contained in:
gblues 2017-12-11 23:48:59 -08:00 committed by twinaphex
parent 5804233ca8
commit c1496a8600
3 changed files with 19 additions and 11 deletions

View File

@ -44,6 +44,7 @@ typedef struct wiiu_input
{
bool blocked;
const input_device_driver_t *joypad;
const hid_driver_t *hid_joypad;
} wiiu_input_t;
void kb_connection_callback(KBDKeyEvent *key)
@ -120,8 +121,13 @@ static void wiiu_input_poll(void *data)
{
wiiu_input_t *wiiu = (wiiu_input_t*)data;
if (wiiu && wiiu->joypad)
wiiu->joypad->poll();
if(!wiiu)
return;
if(wiiu->joypad)
wiiu->joypad->poll();
if(wiiu->hid_joypad)
wiiu->hid_joypad->poll();
}
static bool wiiu_key_pressed(int key)
@ -175,6 +181,12 @@ static void wiiu_input_free_input(void *data)
if (wiiu && wiiu->joypad)
wiiu->joypad->destroy();
if (wiiu && wiiu->hid_joypad)
{
wiiu->hid_joypad->free(hid_driver_get_data());
hid_driver_reset_data();
}
KBDTeardown();
free(data);
@ -188,6 +200,7 @@ static void* wiiu_input_init(const char *joypad_driver)
DEBUG_STR(joypad_driver);
wiiu->joypad = input_joypad_init_driver(joypad_driver, wiiu);
wiiu->hid_joypad = input_hid_init_first();
KBDSetup(&kb_connection_callback,
&kb_disconnection_callback,&kb_key_callback);

View File

@ -43,8 +43,6 @@
#define GAMEPAD_OFFSET 0
static const hid_driver_t *hid_driver = NULL;
static uint64_t pad_state[MAX_PADS];
static uint8_t pad_type[MAX_PADS-1] = {WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE};
@ -301,7 +299,6 @@ static void wiiu_joypad_poll(void)
static bool wiiu_joypad_init(void* data)
{
hid_driver = input_hid_init_first();
wiiu_joypad_autodetect_add(0);
wiiu_joypad_poll();
@ -318,11 +315,6 @@ static bool wiiu_joypad_query_pad(unsigned pad)
static void wiiu_joypad_destroy(void)
{
if(hid_driver) {
hid_driver->free(hid_driver_get_data());
hid_driver_reset_data();
hid_driver = NULL;
}
wiiu_pad_inited = false;
}

View File

@ -192,8 +192,11 @@ struct hid_driver
void (*poll)(void *);
bool (*set_rumble)(void *, unsigned, enum retro_rumble_effect, uint16_t);
const char *(*name)(void *, unsigned);
const char *ident;
int32_t (*set_report)(void *, uint8_t, uint8_t, void *, uint32_t);
int32_t (*set_idle)(void *, uint8_t, uint8_t);
int32_t (*set_protocol)(void *, uint8_t, uint8_t);
};
/**