예제 #1
0
static int16_t cocoa_input_state(void *data,
      const struct retro_keybind **binds, unsigned port,
      unsigned device, unsigned idx, unsigned id)
{
   cocoa_input_data_t *apple = (cocoa_input_data_t*)data;

   if (!apple || !apple->joypad)
      return 0;

   switch (device)
   {
      case RETRO_DEVICE_JOYPAD:
         return cocoa_input_is_pressed(apple, port, binds[port], id) ||
            input_joypad_pressed(apple->joypad, port, binds[port], id);
      case RETRO_DEVICE_ANALOG:
         return input_joypad_analog(apple->joypad, port,
               idx, id, binds[port]);
      case RETRO_DEVICE_KEYBOARD:
         return cocoa_keyboard_state(apple, id);
      case RETRO_DEVICE_MOUSE:
         return cocoa_mouse_state(apple, id);
      case RETRO_DEVICE_POINTER:
      case RARCH_DEVICE_POINTER_SCREEN:
         return cocoa_pointer_state(apple, device, idx, id);
   }

   return 0;
}
예제 #2
0
static int16_t cocoa_input_state(void *data,
      const struct retro_keybind **binds, unsigned port,
      unsigned device, unsigned idx, unsigned id)
{
   int16_t ret               = 0;
   cocoa_input_data_t *apple = (cocoa_input_data_t*)data;

   if (!apple || !apple->joypad)
      return 0;

   switch (device)
   {
      case RETRO_DEVICE_JOYPAD:
         if (binds[port] && binds[port][id].valid)
         {
            return apple_input_is_pressed(port, binds[port], id) ||
               input_joypad_pressed(apple->joypad, port, binds[port], id)
#ifdef HAVE_MFI
               || input_joypad_pressed(apple->sec_joypad, port, binds[port], id)
#endif
               ;
         }
         break;
      case RETRO_DEVICE_ANALOG:
#ifdef HAVE_MFI
         if (binds[port])
            ret = input_joypad_analog(apple->sec_joypad, port,
               idx, id, binds[port]);
#endif
         if (!ret && binds[port])
            ret = input_joypad_analog(apple->joypad, port,
                  idx, id, binds[port]);
         return ret;
      case RETRO_DEVICE_KEYBOARD:
         return apple_keyboard_state(id);
      case RETRO_DEVICE_MOUSE:
         return cocoa_mouse_state(apple, id);
       case RARCH_DEVICE_MOUSE_SCREEN:
           return cocoa_mouse_state_screen(apple, id);
      case RETRO_DEVICE_POINTER:
      case RARCH_DEVICE_POINTER_SCREEN:
         return cocoa_pointer_state(apple, device, idx, id);
   }

   return 0;
}
예제 #3
0
static int16_t cocoa_input_state(void *data,
      rarch_joypad_info_t joypad_info,
      const struct retro_keybind **binds, unsigned port,
      unsigned device, unsigned idx, unsigned id)
{
   int16_t ret               = 0;
   cocoa_input_data_t *apple = (cocoa_input_data_t*)data;

   switch (device)
   {
      case RETRO_DEVICE_JOYPAD:
         if (id < RARCH_BIND_LIST_END)
            ret = apple_key_state[rarch_keysym_lut[binds[port][id].key]];
         if (!ret)
            ret = input_joypad_pressed(apple->joypad, joypad_info, port, binds[port], id);
#ifdef HAVE_MFI
         if (!ret)
            ret = input_joypad_pressed(apple->sec_joypad, joypad_info, port, binds[port], id);
#endif
         return ret;
      case RETRO_DEVICE_ANALOG:
#ifdef HAVE_MFI
         ret = input_joypad_analog(apple->sec_joypad, joypad_info, port,
               idx, id, binds[port]);
#endif
         if (!ret && binds[port])
            ret = input_joypad_analog(apple->joypad, joypad_info, port,
                  idx, id, binds[port]);
         return ret;
      case RETRO_DEVICE_KEYBOARD:
         return (id < RETROK_LAST) && apple_key_state[rarch_keysym_lut[(enum retro_key)id]];
      case RETRO_DEVICE_MOUSE:
         return cocoa_mouse_state(apple, id);
      case RARCH_DEVICE_MOUSE_SCREEN:
         return cocoa_mouse_state_screen(apple, id);
      case RETRO_DEVICE_POINTER:
      case RARCH_DEVICE_POINTER_SCREEN:
         return cocoa_pointer_state(apple, device, idx, id);
   }

   return 0;
}