Example #1
0
/* Time to exit out of the main loop?
 * Reasons for exiting:
 * a) Shutdown environment callback was invoked.
 * b) Quit key was pressed.
 * c) Frame count exceeds or equals maximum amount of frames to run.
 * d) Video driver no longer alive.
 * e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
 */
static INLINE int runloop_iterate_time_to_exit(bool quit_key_pressed)
{
   settings_t *settings          = NULL;
   bool time_to_exit             = runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL);
   time_to_exit                  = time_to_exit || quit_key_pressed;
   time_to_exit                  = time_to_exit || !video_driver_is_alive();
   time_to_exit                  = time_to_exit || bsv_movie_ctl(BSV_MOVIE_CTL_END_EOF, NULL);
   time_to_exit                  = time_to_exit || runloop_is_frame_count_end();
   time_to_exit                  = time_to_exit || runloop_ctl(RUNLOOP_CTL_IS_EXEC, NULL);

   if (!time_to_exit)
      return 1;

   if (runloop_ctl(RUNLOOP_CTL_IS_EXEC, NULL))
      runloop_ctl(RUNLOOP_CTL_UNSET_EXEC, NULL);

   if (!runloop_ctl(RUNLOOP_CTL_IS_CORE_SHUTDOWN, NULL))
      return -1;

   /* Quits out of RetroArch main loop. */

   settings = config_get_ptr();

   if (settings->load_dummy_on_core_shutdown)
      return runloop_iterate_time_to_exit_load_dummy();

   return -1;
}
Example #2
0
/**
 * time_to_exit:
 * @input                : input sample for this frame
 *
 * rarch_main_iterate() checks this to see if it's time to
 * exit out of the main loop.
 *
 * Reasons for exiting:
 * a) Shutdown environment callback was invoked.
 * b) Quit key was pressed.
 * c) Frame count exceeds or equals maximum amount of frames to run.
 * d) Video driver no longer alive.
 * e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
 *
 * Returns: 1 if any of the above conditions are true, otherwise 0.
 **/
static inline int time_to_exit(retro_input_t input)
{
    if (
        g_extern.system.shutdown
        || check_quit_key_func(input)
        || (g_extern.max_frames && g_extern.frame_count >=
            g_extern.max_frames)
        || (g_extern.bsv.movie_end && g_extern.bsv.eof_exit)
        || !video_driver_is_alive()
    )
        return 1;
    return 0;
}
Example #3
0
/* Time to exit out of the main loop?
 * Reasons for exiting:
 * a) Shutdown environment callback was invoked.
 * b) Quit key was pressed.
 * c) Frame count exceeds or equals maximum amount of frames to run.
 * d) Video driver no longer alive.
 * e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
 */
static INLINE int runloop_iterate_time_to_exit(bool quit_key_pressed)
{
   settings_t *settings          = config_get_ptr();
   bool time_to_exit             = runloop_shutdown_initiated;
   time_to_exit                  = time_to_exit || quit_key_pressed;
   time_to_exit                  = time_to_exit || !video_driver_is_alive();
   time_to_exit                  = time_to_exit || bsv_movie_ctl(BSV_MOVIE_CTL_END_EOF, NULL);
   time_to_exit                  = time_to_exit || (runloop_max_frames && 
                                   (*(video_driver_get_frame_count_ptr()) 
                                    >= runloop_max_frames));
   time_to_exit                  = time_to_exit || runloop_exec;

   if (!time_to_exit)
      return 1;

#ifdef HAVE_MENU
   if (!runloop_is_quit_confirm())
   {
      if (settings && settings->confirm_on_exit)
      {
         if (menu_dialog_is_active())
            return 1;

         if (content_is_inited())
         {
            if(menu_display_toggle_get_reason() != MENU_TOGGLE_REASON_USER)
               menu_display_toggle_set_reason(MENU_TOGGLE_REASON_MESSAGE);
            rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
         }

         menu_dialog_show_message(MENU_DIALOG_QUIT_CONFIRM, MENU_ENUM_LABEL_CONFIRM_ON_EXIT);
         return 1;
      }
   }
#endif

   if (runloop_exec)
      runloop_exec = false;

   if (runloop_core_shutdown_initiated &&
         settings && settings->load_dummy_on_core_shutdown)
   {
      content_ctx_info_t content_info = {0};
      if (!task_push_content_load_default(
               NULL, NULL,
               &content_info,
               CORE_TYPE_DUMMY,
               CONTENT_MODE_LOAD_NOTHING_WITH_DUMMY_CORE,
               NULL, NULL))
         return -1;

      /* Loads dummy core instead of exiting RetroArch completely.
       * Aborts core shutdown if invoked. */
      runloop_shutdown_initiated      = false;
      runloop_core_shutdown_initiated = false;

      return 1;
   }

   /* Quits out of RetroArch main loop. */
   return -1;
}