예제 #1
0
파일: runloop.c 프로젝트: notaz/RetroArch
/**
 * do_state_checks:
 * @input                : input sample for this frame
 * @old_input            : input sample of the previous frame
 * @trigger_input        : difference' input sample - difference
 *                         between 'input' and 'old_input'
 *
 * Checks for state changes in this frame.
 *
 * Returns: 1 if RetroArch is in pause mode, 0 otherwise.
 **/
static int do_state_checks(
    retro_input_t input, retro_input_t old_input,
    retro_input_t trigger_input)
{
    if (BIT64_GET(trigger_input, RARCH_SCREENSHOT))
        rarch_main_command(RARCH_CMD_TAKE_SCREENSHOT);

    if (BIT64_GET(trigger_input, RARCH_MUTE))
        rarch_main_command(RARCH_CMD_AUDIO_MUTE_TOGGLE);

    if (BIT64_GET(input, RARCH_VOLUME_UP))
        set_volume(0.5f);
    else if (BIT64_GET(input, RARCH_VOLUME_DOWN))
        set_volume(-0.5f);

#ifdef HAVE_NETPLAY
    if (driver.netplay_data)
        return do_netplay_state_checks(input,
                                       old_input, trigger_input);
#endif

    if (do_pause_state_checks(input, old_input,
                              trigger_input))
        return 1;

    check_fast_forward_button_func(input, old_input, trigger_input);

    check_stateslots_func(trigger_input);

    if (BIT64_GET(trigger_input, RARCH_SAVE_STATE_KEY))
        rarch_main_command(RARCH_CMD_SAVE_STATE);
    else if (BIT64_GET(trigger_input, RARCH_LOAD_STATE_KEY))
        rarch_main_command(RARCH_CMD_LOAD_STATE);

    check_rewind_func(input);

    check_slowmotion_func(input);

    if (BIT64_GET(trigger_input, RARCH_MOVIE_RECORD_TOGGLE))
        check_movie();

    check_shader_dir_func(trigger_input);

    if (BIT64_GET(trigger_input, RARCH_DISK_EJECT_TOGGLE))
        rarch_main_command(RARCH_CMD_DISK_EJECT_TOGGLE);
    else if (BIT64_GET(trigger_input, RARCH_DISK_NEXT))
        rarch_main_command(RARCH_CMD_DISK_NEXT);
    else if (BIT64_GET(trigger_input, RARCH_DISK_PREV))
        rarch_main_command(RARCH_CMD_DISK_PREV);

    if (BIT64_GET(trigger_input, RARCH_RESET))
        rarch_main_command(RARCH_CMD_RESET);

    if (g_extern.cheat)
        check_cheats(trigger_input);

    return 0;
}
예제 #2
0
static int do_state_checks(
      retro_input_t input, retro_input_t old_input,
      retro_input_t trigger_input)
{
   if (BIT64_GET(trigger_input, RARCH_SCREENSHOT))
      rarch_main_command(RARCH_CMD_TAKE_SCREENSHOT);

   if (BIT64_GET(trigger_input, RARCH_MUTE))
      rarch_main_command(RARCH_CMD_AUDIO_MUTE_TOGGLE);

   if (BIT64_GET(input, RARCH_VOLUME_UP))
      set_volume(0.5f);
   else if (BIT64_GET(input, RARCH_VOLUME_DOWN))
      set_volume(-0.5f);

   if (BIT64_GET(trigger_input, RARCH_GRAB_MOUSE_TOGGLE))
      rarch_main_command(RARCH_CMD_GRAB_MOUSE_TOGGLE);

   if (BIT64_GET(trigger_input, RARCH_OVERLAY_NEXT))
      rarch_main_command(RARCH_CMD_OVERLAY_NEXT);

   if (!g_extern.is_paused)
   {
      if (BIT64_GET(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
         rarch_main_command(RARCH_CMD_FULLSCREEN_TOGGLE);
   }

#ifdef HAVE_NETPLAY
   if (driver.netplay_data)
   {
      if (BIT64_GET(trigger_input, RARCH_NETPLAY_FLIP))
         rarch_main_command(RARCH_CMD_NETPLAY_FLIP_PLAYERS);

      if (BIT64_GET(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
         rarch_main_command(RARCH_CMD_FULLSCREEN_TOGGLE);
      return 0;
   }
#endif
   if (check_pause_func(trigger_input))
      rarch_main_command(RARCH_CMD_PAUSE_TOGGLE);

   if (g_extern.is_paused)
   {
      if (BIT64_GET(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
      {
         rarch_main_command(RARCH_CMD_FULLSCREEN_TOGGLE);
         rarch_render_cached_frame();
      }

      if (!check_oneshot_func(trigger_input))
         return 1;
   }

   check_fast_forward_button_func(input, old_input, trigger_input);

   check_stateslots_func(trigger_input);

   if (BIT64_GET(trigger_input, RARCH_SAVE_STATE_KEY))
      rarch_main_command(RARCH_CMD_SAVE_STATE);
   else if (BIT64_GET(trigger_input, RARCH_LOAD_STATE_KEY))
      rarch_main_command(RARCH_CMD_LOAD_STATE);

   check_rewind_func(input);

   check_slowmotion_func(input);

   if (BIT64_GET(trigger_input, RARCH_MOVIE_RECORD_TOGGLE))
      check_movie();

   check_shader_dir_func(trigger_input);

   if (BIT64_GET(trigger_input, RARCH_CHEAT_INDEX_PLUS))
      cheat_manager_index_next(g_extern.cheat);
   else if (BIT64_GET(trigger_input, RARCH_CHEAT_INDEX_MINUS))
      cheat_manager_index_prev(g_extern.cheat);
   else if (BIT64_GET(trigger_input, RARCH_CHEAT_TOGGLE))
      cheat_manager_toggle(g_extern.cheat);

   if (BIT64_GET(trigger_input, RARCH_DISK_EJECT_TOGGLE))
      rarch_main_command(RARCH_CMD_DISK_EJECT_TOGGLE);
   else if (BIT64_GET(trigger_input, RARCH_DISK_NEXT))
      rarch_main_command(RARCH_CMD_DISK_NEXT);
   else if (BIT64_GET(trigger_input, RARCH_DISK_PREV))
      rarch_main_command(RARCH_CMD_DISK_PREV);	  

   if (BIT64_GET(trigger_input, RARCH_RESET))
      rarch_main_command(RARCH_CMD_RESET);

   return 0;
}