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

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

   switch (device)
   {
      case RETRO_DEVICE_JOYPAD:
         return apple_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 apple_keyboard_state(apple, id);
      case RETRO_DEVICE_MOUSE:
         return apple_mouse_state(apple, id);
      case RETRO_DEVICE_POINTER:
      case RARCH_DEVICE_POINTER_SCREEN:
         return apple_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;
}