Пример #1
0
static unsigned menu_input_frame_pointer(unsigned *data)
{
   unsigned ret                            = *data;
   settings_t *settings                    = config_get_ptr();
   menu_input_t *menu_input                = menu_input_get_ptr();
   bool mouse_enabled                      = settings->menu.mouse.enable;
#ifdef HAVE_OVERLAY
   if (!mouse_enabled)
      mouse_enabled = !(settings->input.overlay_enable && input_overlay_is_alive());
#endif
    
   if (mouse_enabled)
      menu_input_mouse(&ret);
   else
      memset(&menu_input->mouse, 0, sizeof(menu_input->mouse));

   if (settings->menu.pointer.enable)
      menu_input_pointer(&ret);
   else
      memset(&menu_input->pointer, 0, sizeof(menu_input->pointer));

   return ret;
}
Пример #2
0
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
{
   unsigned ret                            = MENU_ACTION_NOOP;
   static bool initial_held                = true;
   static bool first_held                  = false;
   static const retro_input_t input_repeat =
        (1UL << RETRO_DEVICE_ID_JOYPAD_UP)
      | (1UL << RETRO_DEVICE_ID_JOYPAD_DOWN)
      | (1UL << RETRO_DEVICE_ID_JOYPAD_LEFT)
      | (1UL << RETRO_DEVICE_ID_JOYPAD_RIGHT)
      | (1UL << RETRO_DEVICE_ID_JOYPAD_L)
      | (1UL << RETRO_DEVICE_ID_JOYPAD_R);
   menu_navigation_t *nav      = menu_navigation_get_ptr();
   menu_handle_t *menu         = menu_driver_get_ptr();
   menu_display_t *disp        = menu_display_get_ptr();
   menu_input_t *menu_input    = menu_input_get_ptr();
   driver_t *driver            = driver_get_ptr();
   settings_t *settings        = config_get_ptr();

   if (!menu || !driver || !nav || !menu_input)
      return 0;

   driver->retro_ctx.poll_cb();

   /* don't run anything first frame, only capture held inputs
    * for old_input_state. */

   if (input & input_repeat)
   {
      if (!first_held)
      {
         first_held = true;
         menu_input->delay.timer = initial_held ? 12 : 6;
         menu_input->delay.count = 0;
      }

      if (menu_input->delay.count >= menu_input->delay.timer)
      {
         first_held = false;
         trigger_input |= input & input_repeat;
         nav->scroll.acceleration =
            min(nav->scroll.acceleration + 1, 64);
      }

      initial_held = false;
   }
   else
   {
      first_held = false;
      initial_held = true;
      nav->scroll.acceleration = 0;
   }

   menu_input->delay.count += menu_animation_get_delta_time(disp->animation) / IDEAL_DT;

   if (menu_input->keyboard.display)
   {
      /* send return key to close keyboard input window */
      if (trigger_input & (UINT64_C(1) << settings->menu_cancel_btn))
         input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD);

      trigger_input = 0;
   }

   if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP))
      ret = MENU_ACTION_UP;
   else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN))
      ret = MENU_ACTION_DOWN;
   else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT))
      ret = MENU_ACTION_LEFT;
   else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT))
      ret = MENU_ACTION_RIGHT;
   else if (trigger_input & (UINT64_C(1) << settings->menu_scroll_up_btn))
      ret = MENU_ACTION_SCROLL_UP;
   else if (trigger_input & (UINT64_C(1) << settings->menu_scroll_down_btn))
      ret = MENU_ACTION_SCROLL_DOWN;
   else if (trigger_input & (UINT64_C(1) << settings->menu_cancel_btn))
      ret = MENU_ACTION_CANCEL;
   else if (trigger_input & (UINT64_C(1) << settings->menu_ok_btn))
      ret = MENU_ACTION_OK;
   else if (trigger_input & (UINT64_C(1) << settings->menu_search_btn))
      ret = MENU_ACTION_SEARCH;
   else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_Y))
      ret = MENU_ACTION_SCAN;
   else if (trigger_input & (UINT64_C(1) << settings->menu_default_btn))
      ret = MENU_ACTION_START;
   else if (trigger_input & (UINT64_C(1) << settings->menu_info_btn))
      ret = MENU_ACTION_INFO;
   else if (trigger_input & (UINT64_C(1) << RARCH_MENU_TOGGLE))
      ret = MENU_ACTION_TOGGLE;

   if (settings->menu.mouse.enable)
      menu_input_mouse(&ret);

   if (settings->menu.pointer.enable)
      menu_input_pointer(&ret);

   return ret;
}
Пример #3
0
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
{
   unsigned ret = 0;
   static bool initial_held = true;
   static bool first_held = false;
   static const retro_input_t input_repeat =
      (1ULL << RETRO_DEVICE_ID_JOYPAD_UP)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_L)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_R);
   menu_handle_t *menu = menu_driver_get_ptr();
   driver_t *driver    = driver_get_ptr();

   if (!menu || !driver)
      return 0;

   driver->retro_ctx.poll_cb();

   /* don't run anything first frame, only capture held inputs
    * for old_input_state. */

   if (input & input_repeat)
   {
      if (!first_held)
      {
         first_held = true;
         menu->delay.timer = initial_held ? 12 : 6;
         menu->delay.count = 0;
      }

      if (menu->delay.count >= menu->delay.timer)
      {
         first_held = false;
         trigger_input |= input & input_repeat;
         menu->navigation.scroll.acceleration = 
            min(menu->navigation.scroll.acceleration + 1, 64);
      }

      initial_held = false;
   }
   else
   {
      first_held = false;
      initial_held = true;
      menu->navigation.scroll.acceleration = 0;
   }

   menu->delay.count += menu->dt / IDEAL_DT;

   if (driver->block_input)
      trigger_input = 0;
   if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_UP))
      ret = MENU_ACTION_UP;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN))
      ret = MENU_ACTION_DOWN;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT))
      ret = MENU_ACTION_LEFT;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT))
      ret = MENU_ACTION_RIGHT;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_L))
      ret = MENU_ACTION_SCROLL_UP;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_R))
      ret = MENU_ACTION_SCROLL_DOWN;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_B))
      ret = MENU_ACTION_CANCEL;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_A))
      ret = MENU_ACTION_OK;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_X))
      ret = MENU_ACTION_SEARCH;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_Y))
      ret = MENU_ACTION_TEST;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_START))
      ret = MENU_ACTION_START;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_SELECT))
      ret = MENU_ACTION_SELECT;
   else if (trigger_input & (1ULL << RARCH_MENU_TOGGLE))
      ret = MENU_ACTION_TOGGLE;
   else
      ret = MENU_ACTION_NOOP;

   menu_input_mouse(&ret);
   menu_input_pointer(&ret);

   return ret;
}
Пример #4
0
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
{
   unsigned ret = 0;
   static bool initial_held = true;
   static bool first_held = false;
   static const retro_input_t input_repeat =
      (1ULL << RETRO_DEVICE_ID_JOYPAD_UP)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_L)
      | (1ULL << RETRO_DEVICE_ID_JOYPAD_R);
   menu_navigation_t *nav = menu_navigation_get_ptr();
   menu_handle_t *menu    = menu_driver_get_ptr();
   driver_t *driver       = driver_get_ptr();
   settings_t *settings   = config_get_ptr();

   if (!menu || !driver || !nav)
      return 0;

   driver->retro_ctx.poll_cb();

   /* don't run anything first frame, only capture held inputs
    * for old_input_state. */

   if (input & input_repeat)
   {
      if (!first_held)
      {
         first_held = true;
         menu->delay.timer = initial_held ? 12 : 6;
         menu->delay.count = 0;
      }

      if (menu->delay.count >= menu->delay.timer)
      {
         first_held = false;
         trigger_input |= input & input_repeat;
         nav->scroll.acceleration =
            min(nav->scroll.acceleration + 1, 64);
      }

      initial_held = false;
   }
   else
   {
      first_held = false;
      initial_held = true;
      nav->scroll.acceleration = 0;
   }

   menu->delay.count += menu->dt / IDEAL_DT;

   if (driver->block_input)
      trigger_input = 0;
   if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_UP))
      ret = MENU_ACTION_UP;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN))
      ret = MENU_ACTION_DOWN;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT))
      ret = MENU_ACTION_LEFT;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT))
      ret = MENU_ACTION_RIGHT;
   else if (trigger_input & (1ULL << settings->menu_scroll_up_btn))
      ret = MENU_ACTION_SCROLL_UP;
   else if (trigger_input & (1ULL << settings->menu_scroll_down_btn))
      ret = MENU_ACTION_SCROLL_DOWN;
   else if (trigger_input & (1ULL << settings->menu_cancel_btn))
      ret = MENU_ACTION_CANCEL;
   else if (trigger_input & (1ULL << settings->menu_ok_btn))
      ret = MENU_ACTION_OK;
   else if (trigger_input & (1ULL << settings->menu_search_btn))
      ret = MENU_ACTION_SEARCH;
   else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_Y))
      ret = MENU_ACTION_TEST;
   else if (trigger_input & (1ULL << settings->menu_default_btn))
      ret = MENU_ACTION_START;
   else if (trigger_input & (1ULL << settings->menu_info_btn))
      ret = MENU_ACTION_SELECT;
   else if (trigger_input & (1ULL << RARCH_MENU_TOGGLE))
      ret = MENU_ACTION_TOGGLE;
   else
      ret = MENU_ACTION_NOOP;

   if (settings->menu.mouse.enable)
      menu_input_mouse(&ret);

   if (settings->menu.pointer.enable)
      menu_input_pointer(&ret);
      
   if (trigger_input && menu_ctx_driver_get_ptr()->perform_action && menu_ctx_driver_get_ptr()->perform_action(menu->userdata, ret))
   {
      return MENU_ACTION_NOOP;
   }
   else
   {
      return ret;
   }
}