mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Merge pull request #3277 from sronsse/fixes_for_team
Add analog device to Net RetroPad
This commit is contained in:
commit
3b4ff208d4
@ -94,8 +94,19 @@ static struct descriptor joypad = {
|
|||||||
.id_max = RETRO_DEVICE_ID_JOYPAD_R3
|
.id_max = RETRO_DEVICE_ID_JOYPAD_R3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct descriptor analog = {
|
||||||
|
.device = RETRO_DEVICE_ANALOG,
|
||||||
|
.port_min = 0,
|
||||||
|
.port_max = 0,
|
||||||
|
.index_min = RETRO_DEVICE_INDEX_ANALOG_LEFT,
|
||||||
|
.index_max = RETRO_DEVICE_INDEX_ANALOG_RIGHT,
|
||||||
|
.id_min = RETRO_DEVICE_ID_ANALOG_X,
|
||||||
|
.id_max = RETRO_DEVICE_ID_ANALOG_Y
|
||||||
|
};
|
||||||
|
|
||||||
static struct descriptor *descriptors[] = {
|
static struct descriptor *descriptors[] = {
|
||||||
&joypad
|
&joypad,
|
||||||
|
&analog
|
||||||
};
|
};
|
||||||
|
|
||||||
void NETRETROPAD_CORE_PREFIX(retro_init)(void)
|
void NETRETROPAD_CORE_PREFIX(retro_init)(void)
|
||||||
|
@ -171,6 +171,9 @@ static void input_remote_parse_packet(struct message *msg, unsigned user)
|
|||||||
if (msg->state)
|
if (msg->state)
|
||||||
ol_state->buttons[user] |= 1 << msg->id;
|
ol_state->buttons[user] |= 1 << msg->id;
|
||||||
break;
|
break;
|
||||||
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
ol_state->analog[msg->index * 2 + msg->id][user] = msg->state;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -246,7 +249,13 @@ void input_remote_poll(input_remote_t *handle)
|
|||||||
input_remote_parse_packet(&msg, user);
|
input_remote_parse_packet(&msg, user);
|
||||||
else if ((ret != -1) || (errno != EAGAIN))
|
else if ((ret != -1) || (errno != EAGAIN))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
ol_state->buttons[user] = 0;
|
ol_state->buttons[user] = 0;
|
||||||
|
ol_state->analog[0][user] = 0;
|
||||||
|
ol_state->analog[1][user] = 0;
|
||||||
|
ol_state->analog[2][user] = 0;
|
||||||
|
ol_state->analog[3][user] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user