Move dinput_joypad_get_vidpid_from_xinput_index to
xinput_hybrid_joypad.c
This commit is contained in:
parent
212fc885ed
commit
65af2828da
|
@ -50,32 +50,6 @@ extern int g_xinput_pad_indexes[MAX_USERS];
|
||||||
|
|
||||||
#include "dinput_joypad_inl.h"
|
#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. */
|
/* Based on SDL2's implementation. */
|
||||||
bool guid_is_xinput_device(const GUID* product_guid)
|
bool guid_is_xinput_device(const GUID* product_guid)
|
||||||
|
|
|
@ -41,10 +41,6 @@ struct dinput_joypad_data
|
||||||
DIEFFECT rumble_props;
|
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
|
RETRO_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -117,6 +117,33 @@ static const uint16_t button_index_to_bitmap_code[] = {
|
||||||
/* Forward declaration */
|
/* Forward declaration */
|
||||||
bool guid_is_xinput_device(const GUID* product_guid);
|
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(
|
static BOOL CALLBACK enum_joypad_cb_hybrid(
|
||||||
const DIDEVICEINSTANCE *inst, void *p)
|
const DIDEVICEINSTANCE *inst, void *p)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue