Beispiel #1
0
static int16_t linuxraw_analog_pressed(linuxraw_input_t *linuxraw,
      const struct retro_keybind *binds, unsigned index, unsigned id)
{
   unsigned id_minus = 0;
   unsigned id_plus  = 0;
   input_conv_analog_id_to_bind_id(index, id, &id_minus, &id_plus);

   int16_t pressed_minus = linuxraw_is_pressed(linuxraw,
         binds, id_minus) ? -0x7fff : 0;
   int16_t pressed_plus = linuxraw_is_pressed(linuxraw,
         binds, id_plus) ? 0x7fff : 0;
   return pressed_plus + pressed_minus;
}
Beispiel #2
0
static bool linuxraw_input_key_pressed(void *data, int key)
{
   linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
   settings_t *settings       = config_get_ptr();
   int port                   = 0;

   if (linuxraw_is_pressed(linuxraw, settings->input.binds[0], key))
      return true;

   if (settings->input.all_users_control_menu)
   {
      for (port = 0; port < MAX_USERS; port++)
         if (settings->input.binds[0][key].valid &&
               input_joypad_pressed(linuxraw->joypad,
               port, settings->input.binds[0], key))
            return true;
   }
   else
      if (settings->input.binds[0][key].valid &&
            input_joypad_pressed(linuxraw->joypad,
            0, settings->input.binds[0], key))
         return true;

   return false;
}
static bool linuxraw_bind_button_pressed(void *data, int key)
{
   linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
   settings_t *settings       = config_get_ptr();

   return linuxraw_is_pressed(linuxraw, settings->input.binds[0], key) ||
      input_joypad_pressed(linuxraw->joypad, 0, settings->input.binds[0], key);
}
Beispiel #4
0
static bool linuxraw_input_key_pressed(void *data, int key)
{
   linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
   settings_t *settings       = config_get_ptr();

   if (linuxraw_is_pressed(linuxraw, settings->input.binds[0], key))
      return true;

   if (input_joypad_pressed(linuxraw->joypad, 0, settings->input.binds[0], key))
      return true;

   return false;
}
Beispiel #5
0
static int16_t linuxraw_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id)
{
   linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;

   switch (device)
   {
      case RETRO_DEVICE_JOYPAD:
         return linuxraw_is_pressed(linuxraw, binds[port], id) ||
            input_sdl.input_state(linuxraw->sdl, binds, port, device, index, id);

      default:
         return 0;
   }
}
Beispiel #6
0
static int16_t linuxraw_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id)
{
   linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;

   switch (device)
   {
      case RETRO_DEVICE_JOYPAD:
         return linuxraw_is_pressed(linuxraw, binds[port], id) ||
            input_joypad_pressed(linuxraw->joypad, port, binds[port], id);

      case RETRO_DEVICE_ANALOG:
         return input_joypad_analog(linuxraw->joypad, port, index, id, binds[port]);

      default:
         return 0;
   }
}
Beispiel #7
0
static int16_t linuxraw_input_state(void *data,
      const struct retro_keybind **binds, unsigned port,
      unsigned device, unsigned idx, unsigned id)
{
   int16_t ret;
   linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;

   switch (device)
   {
      case RETRO_DEVICE_JOYPAD:
         if (binds[port][id].valid)
            return linuxraw_is_pressed(linuxraw, binds[port], id) ||
               input_joypad_pressed(linuxraw->joypad, port, binds[port], id);
         break;
      case RETRO_DEVICE_ANALOG:
         ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id);
         if (!ret)
            ret = input_joypad_analog(linuxraw->joypad, port, idx, id, binds[port]);
         return ret;
   }

   return 0;
}
Beispiel #8
0
static bool linuxraw_bind_button_pressed(void *data, int key)
{
   linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
   return linuxraw_is_pressed(linuxraw, g_settings.input.binds[0], key) ||
      input_joypad_pressed(linuxraw->joypad, 0, g_settings.input.binds[0], key);
}