mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +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
|
||||
};
|
||||
|
||||
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[] = {
|
||||
&joypad
|
||||
&joypad,
|
||||
&analog
|
||||
};
|
||||
|
||||
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)
|
||||
ol_state->buttons[user] |= 1 << msg->id;
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
ol_state->analog[msg->index * 2 + msg->id][user] = msg->state;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -246,7 +249,13 @@ void input_remote_poll(input_remote_t *handle)
|
||||
input_remote_parse_packet(&msg, user);
|
||||
else if ((ret != -1) || (errno != EAGAIN))
|
||||
#endif
|
||||
{
|
||||
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