Move dinput_joypad_get_vidpid_from_xinput_index to

xinput_hybrid_joypad.c
This commit is contained in:
twinaphex 2020-07-31 19:54:15 +02:00
parent 212fc885ed
commit 65af2828da
3 changed files with 27 additions and 30 deletions

View File

@ -50,32 +50,6 @@ extern int g_xinput_pad_indexes[MAX_USERS];
#include "dinput_joypad_inl.h"
bool dinput_joypad_get_vidpid_from_xinput_index(
int32_t index, int32_t *vid,
int32_t *pid, int32_t *dinput_index)
{
int i;
for (i = 0; i < ARRAY_SIZE(g_xinput_pad_indexes); i++)
{
/* Found XInput pad? */
if (index == g_xinput_pad_indexes[i])
{
if (vid)
*vid = g_pads[i].vid;
if (pid)
*pid = g_pads[i].pid;
if (dinput_index)
*dinput_index = i;
return true;
}
}
return false;
}
/* Based on SDL2's implementation. */
bool guid_is_xinput_device(const GUID* product_guid)

View File

@ -41,10 +41,6 @@ struct dinput_joypad_data
DIEFFECT rumble_props;
};
bool dinput_joypad_get_vidpid_from_xinput_index(
int32_t index, int32_t *vid,
int32_t *pid, int32_t *dinput_index);
RETRO_END_DECLS
#endif

View File

@ -117,6 +117,33 @@ static const uint16_t button_index_to_bitmap_code[] = {
/* Forward declaration */
bool guid_is_xinput_device(const GUID* product_guid);
static bool dinput_joypad_get_vidpid_from_xinput_index(
int32_t index, int32_t *vid,
int32_t *pid, int32_t *dinput_index)
{
int i;
for (i = 0; i < ARRAY_SIZE(g_xinput_pad_indexes); i++)
{
/* Found XInput pad? */
if (index == g_xinput_pad_indexes[i])
{
if (vid)
*vid = g_pads[i].vid;
if (pid)
*pid = g_pads[i].pid;
if (dinput_index)
*dinput_index = i;
return true;
}
}
return false;
}
static BOOL CALLBACK enum_joypad_cb_hybrid(
const DIDEVICEINSTANCE *inst, void *p)
{