Revert changes to joypad API

== DETAILS

Premature. Still learning my way around the codebase.
This commit is contained in:
gblues 2017-12-12 21:38:35 -08:00 committed by twinaphex
parent c1496a8600
commit d0adbd194e
2 changed files with 7 additions and 24 deletions

View File

@ -24,18 +24,13 @@
#include "joypad_connection.h"
int pad_connection_find_vacant_pad(joypad_connection_t *joyconn)
{
return pad_connection_find_vacant_pad_max(joyconn, MAX_USERS);
}
int pad_connection_find_vacant_pad_max(joypad_connection_t *joyconn, unsigned max)
{
unsigned i;
if (!joyconn)
return -1;
for (i = 0; i < max; i++)
for (i = 0; i < MAX_USERS; i++)
{
joypad_connection_t *conn = &joyconn[i];
@ -68,17 +63,8 @@ joypad_connection_t *pad_connection_init(unsigned pads)
}
int32_t pad_connection_pad_init(joypad_connection_t *joyconn,
const char* name, uint16_t vid, uint16_t pid,
void *data, send_control_t ptr)
{
int pad = pad_connection_find_vacant_pad(joyconn);
return pad_connection_pad_init_with_slot(joyconn, name,
vid, pid, data, ptr, pad);
}
int32_t pad_connection_pad_init_with_slot(joypad_connection_t *joyconn,
const char *name, uint16_t vid, uint16_t pid,
void *data, send_control_t ptr, int slot)
void *data, send_control_t ptr)
{
static const struct
@ -103,11 +89,12 @@ int32_t pad_connection_pad_init_with_slot(joypad_connection_t *joyconn,
{ 0, 0}
};
joypad_connection_t *s = NULL;
int pad = pad_connection_find_vacant_pad(joyconn);
if (slot == -1)
if (pad == -1)
return -1;
s = &joyconn[slot];
s = &joyconn[pad];
if (s)
{
@ -133,7 +120,7 @@ int32_t pad_connection_pad_init_with_slot(joypad_connection_t *joyconn,
if (name_match || (pad_map[i].vid == vid && pad_map[i].pid == pid))
{
s->iface = pad_map[i].iface;
s->data = s->iface->init(data, slot, ptr);
s->data = s->iface->init(data, pad, ptr);
s->connected = true;
#if 0
RARCH_LOG("%s found \n", pad_map[i].name);
@ -158,7 +145,7 @@ int32_t pad_connection_pad_init_with_slot(joypad_connection_t *joyconn,
}
}
return slot;
return pad;
}
void pad_connection_pad_deinit(joypad_connection_t *joyconn, uint32_t pad)

View File

@ -59,9 +59,6 @@ extern pad_connection_interface_t pad_connection_psxadapter;
int32_t pad_connection_pad_init(joypad_connection_t *joyconn,
const char* name, uint16_t vid, uint16_t pid,
void *data, send_control_t ptr);
int32_t pad_connection_pad_init_with_slot(joypad_connection_t *joyconn,
const char* name, uint16_t vid, uint16_t pid,
void *data, send_control_t ptr, int slot);
joypad_connection_t *pad_connection_init(unsigned pads);
@ -86,7 +83,6 @@ bool pad_connection_has_interface(joypad_connection_t *joyconn,
unsigned idx);
int pad_connection_find_vacant_pad(joypad_connection_t *joyconn);
int pad_connection_find_vacant_pad_max(joypad_connection_t *joyconn, unsigned max);
bool pad_connection_rumble(joypad_connection_t *s,
unsigned pad, enum retro_rumble_effect effect, uint16_t strength);