Пример #1
0
static void menu_input_key_bind_poll_bind_state_internal(const input_device_driver_t *joypad,
    struct menu_bind_state *state, unsigned port, bool timed_out)
{
   unsigned b, a, h;
    if (!joypad)
        return;
    
    if (joypad->poll)
        joypad->poll();
    
    /* poll only the relevant port */
    /* for (i = 0; i < settings->input.max_users; i++) */
    for (b = 0; b < MENU_MAX_BUTTONS; b++)
        state->state[port].buttons[b] = input_joypad_button_raw(joypad, port, b);
    
    for (a = 0; a < MENU_MAX_AXES; a++)
        state->state[port].axes[a] = input_joypad_axis_raw(joypad, port, a);
    
    for (h = 0; h < MENU_MAX_HATS; h++)
    {
        if (input_joypad_hat_raw(joypad, port, HAT_UP_MASK, h))
            state->state[port].hats[h] |= HAT_UP_MASK;
        if (input_joypad_hat_raw(joypad, port, HAT_DOWN_MASK, h))
            state->state[port].hats[h] |= HAT_DOWN_MASK;
        if (input_joypad_hat_raw(joypad, port, HAT_LEFT_MASK, h))
            state->state[port].hats[h] |= HAT_LEFT_MASK;
        if (input_joypad_hat_raw(joypad, port, HAT_RIGHT_MASK, h))
            state->state[port].hats[h] |= HAT_RIGHT_MASK;
    }
}
Пример #2
0
void menu_poll_bind_state(struct menu_bind_state *state)
{
   if (!state)
      return;

   unsigned i, b, a, h;
   memset(state->state, 0, sizeof(state->state));
   state->skip = input_input_state_func(NULL, 0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);

   const rarch_joypad_driver_t *joypad = NULL;
   if (driver.input && driver.input_data && driver.input->get_joypad_driver)
      joypad = driver.input->get_joypad_driver(driver.input_data);

   if (!joypad)
   {
      RARCH_ERR("Cannot poll raw joypad state.");
      return;
   }

   input_joypad_poll(joypad);
   for (i = 0; i < MAX_PLAYERS; i++)
   {
      for (b = 0; b < MENU_MAX_BUTTONS; b++)
         state->state[i].buttons[b] = input_joypad_button_raw(joypad, i, b);
      for (a = 0; a < MENU_MAX_AXES; a++)
         state->state[i].axes[a] = input_joypad_axis_raw(joypad, i, a);
      for (h = 0; h < MENU_MAX_HATS; h++)
      {
         state->state[i].hats[h] |= input_joypad_hat_raw(joypad, i, HAT_UP_MASK, h) ? HAT_UP_MASK : 0;
         state->state[i].hats[h] |= input_joypad_hat_raw(joypad, i, HAT_DOWN_MASK, h) ? HAT_DOWN_MASK : 0;
         state->state[i].hats[h] |= input_joypad_hat_raw(joypad, i, HAT_LEFT_MASK, h) ? HAT_LEFT_MASK : 0;
         state->state[i].hats[h] |= input_joypad_hat_raw(joypad, i, HAT_RIGHT_MASK, h) ? HAT_RIGHT_MASK : 0;
      }
   }
}
Пример #3
0
static void poll_joypad(const rarch_joypad_driver_t *driver,
      unsigned pad,
      struct poll_data *data)
{
   unsigned i;

   if (driver)
      driver->poll();

   for (i = 0; i < MAX_BUTTONS; i++)
      data->buttons[i] = input_joypad_button_raw(driver, pad, i);

   for (i = 0; i < MAX_AXES; i++)
      data->axes[i] = input_joypad_axis_raw(driver, pad, i);

   for (i = 0; i < MAX_HATS; i++)
   {
      uint16_t hat = 0;
      hat |= input_joypad_hat_raw(driver, pad, HAT_UP_MASK, i)    << HAT_UP_SHIFT;
      hat |= input_joypad_hat_raw(driver, pad, HAT_DOWN_MASK, i)  << HAT_DOWN_SHIFT;
      hat |= input_joypad_hat_raw(driver, pad, HAT_LEFT_MASK, i)  << HAT_LEFT_SHIFT;
      hat |= input_joypad_hat_raw(driver, pad, HAT_RIGHT_MASK, i) << HAT_RIGHT_SHIFT;

      data->hats[i] = hat;
   }
}
Пример #4
0
static void menu_input_poll_bind_state(struct menu_bind_state *state)
{
   unsigned i, b, a, h;
   const input_device_driver_t *joypad = input_driver_get_joypad_driver();
   settings_t *settings                = config_get_ptr();

   if (!state)
      return;

   memset(state->state, 0, sizeof(state->state));
   state->skip = input_driver_state(NULL, 0,
         RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);

   if (!joypad)
   {
      RARCH_ERR("Cannot poll raw joypad state.");
      return;
   }

   if (joypad->poll)
      joypad->poll();

   for (i = 0; i < settings->input.max_users; i++)
   {
      for (b = 0; b < MENU_MAX_BUTTONS; b++)
         state->state[i].buttons[b] = input_joypad_button_raw(joypad, i, b);

      for (a = 0; a < MENU_MAX_AXES; a++)
         state->state[i].axes[a] = input_joypad_axis_raw(joypad, i, a);

      for (h = 0; h < MENU_MAX_HATS; h++)
      {
         if (input_joypad_hat_raw(joypad, i, HAT_UP_MASK, h))
            state->state[i].hats[h] |= HAT_UP_MASK;
         if (input_joypad_hat_raw(joypad, i, HAT_DOWN_MASK, h))
            state->state[i].hats[h] |= HAT_DOWN_MASK;
         if (input_joypad_hat_raw(joypad, i, HAT_LEFT_MASK, h))
            state->state[i].hats[h] |= HAT_LEFT_MASK;
         if (input_joypad_hat_raw(joypad, i, HAT_RIGHT_MASK, h))
            state->state[i].hats[h] |= HAT_RIGHT_MASK;
      }
   }
}
Пример #5
0
static void menu_input_key_bind_poll_bind_state(struct menu_bind_state *state, unsigned port,
      bool timed_out)
{
   unsigned b, a, h;
   const input_device_driver_t *joypad = input_driver_get_joypad_driver();

   if (!state)
      return;

   memset(state->state, 0, sizeof(state->state));
   state->skip = timed_out || input_driver_state(NULL, 0,
         RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);

   if (!joypad)
      return;

   if (joypad->poll)
      joypad->poll();

   /* poll only the relevant port */
   /* for (i = 0; i < settings->input.max_users; i++) */
   for (b = 0; b < MENU_MAX_BUTTONS; b++)
      state->state[port].buttons[b] = input_joypad_button_raw(joypad, port, b);

   for (a = 0; a < MENU_MAX_AXES; a++)
      state->state[port].axes[a] = input_joypad_axis_raw(joypad, port, a);

   for (h = 0; h < MENU_MAX_HATS; h++)
   {
      if (input_joypad_hat_raw(joypad, port, HAT_UP_MASK, h))
         state->state[port].hats[h] |= HAT_UP_MASK;
      if (input_joypad_hat_raw(joypad, port, HAT_DOWN_MASK, h))
         state->state[port].hats[h] |= HAT_DOWN_MASK;
      if (input_joypad_hat_raw(joypad, port, HAT_LEFT_MASK, h))
         state->state[port].hats[h] |= HAT_LEFT_MASK;
      if (input_joypad_hat_raw(joypad, port, HAT_RIGHT_MASK, h))
         state->state[port].hats[h] |= HAT_RIGHT_MASK;
   }
}