(iOS) Add Classic Controller support.

This commit is contained in:
meancoot 2013-03-05 20:45:15 -05:00
parent dbc3e3f7ff
commit 92d0cac17a
2 changed files with 13 additions and 3 deletions

View File

@ -53,7 +53,14 @@ static int16_t ios_joypad_axis(unsigned port, uint32_t joyaxis)
static void ios_joypad_poll(void)
{
for (int i = 0; i != MAX_PLAYERS; i ++)
g_buttons[i] = (i < myosd_num_of_joys) ? joys[i].btns : 0;
{
g_buttons[i] = 0;
if (i < myosd_num_of_joys)
{
g_buttons[i] = joys[i].btns;
g_buttons[i] |= (joys[i].exp.type == EXP_CLASSIC) ? (joys[i].exp.classic.btns << 16) : 0;
}
}
}
const rarch_joypad_driver_t ios_joypad = {

View File

@ -149,9 +149,12 @@ static NSString* get_key_config_name(uint32_t hid_id)
{
for (int i = 0; i != myosd_num_of_joys; i ++)
{
for (int j = 0; j != sizeof(joys[i].btns) * 8; j ++)
uint32_t buttons = joys[i].btns;
buttons |= (joys[i].exp.type == EXP_CLASSIC) ? (joys[i].exp.classic.btns << 16) : 0;
for (int j = 0; j != sizeof(buttons) * 8; j ++)
{
if (joys[i].btns & (1 << j))
if (buttons & (1 << j))
{
_value.msubValues[1] = [NSString stringWithFormat:@"%d", j];
[self finish];