Пример #1
0
static bool btstack_hid_joypad_button(void *data, unsigned port, uint16_t joykey)
{
  retro_bits_t buttons;
  btstack_hid_joypad_get_buttons(data, port, &buttons);

  /* Check hat. */
  if (GET_HAT_DIR(joykey))
    return false;

  /* Check the button. */
  if ((port < MAX_USERS) && (joykey < 32))
    return (BIT256_GET(buttons, joykey) != 0);

  return false;
}
Пример #2
0
static bool btstack_hid_joypad_button(void *data, unsigned port, uint16_t joykey)
{
   uint64_t buttons          = btstack_hid_joypad_get_buttons(data, port);

   if (joykey == NO_BTN)
      return false;

   /* Check hat. */
   if (GET_HAT_DIR(joykey))
      return false;

   /* Check the button. */
   if ((port < MAX_USERS) && (joykey < 32))
      return ((buttons & (1 << joykey)) != 0);
   return false;
}