예제 #1
0
void rarch_main_data_iterate(void)
{
   data_runloop_t *runloop      = rarch_main_data_get_ptr();
   settings_t     *settings     = config_get_ptr();
   
   (void)settings;
#ifdef HAVE_THREADS
   if (settings->menu.threaded_data_runloop_enable)
   {
      switch (runloop->thread_code)
      {
         case THREAD_CODE_INIT:
            rarch_main_data_thread_init();
            break;
         case THREAD_CODE_DEINIT:
         case THREAD_CODE_ALIVE:
            break;
      }
   }
#endif

#ifdef HAVE_OVERLAY
   rarch_main_data_overlay_image_upload_iterate(false);
#endif
#ifdef HAVE_RPNG
   rarch_main_data_nbio_image_upload_iterate(false);
#endif
#ifdef HAVE_OVERLAY
   rarch_main_data_overlay_iterate    (false);
#endif

#ifdef HAVE_MENU
#ifdef HAVE_LIBRETRODB
   if (rarch_main_data_db_pending_scan_finished())
      menu_environment_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST, NULL);
#endif
#endif

   if (data_runloop_msg[0] != '\0')
   {
      rarch_main_msg_queue_push(data_runloop_msg, 1, 10, true);
      data_runloop_msg[0] = '\0';
   }

#ifdef HAVE_MENU
   menu_entries_refresh(MENU_ACTION_REFRESH);
#endif

#ifdef HAVE_THREADS
   if (settings->menu.threaded_data_runloop_enable && runloop->alive)
      return;
#endif

   data_runloop_iterate(false);
}
예제 #2
0
/* Clicks the back button */
int menu_entry_go_back(void)
{
   menu_list_t *menu_list = menu_list_get_ptr();
   if (!menu_list)
      return -1;

   menu_setting_apply_deferred();
   menu_list_pop_stack(menu_list);

   if (menu_entries_needs_refresh())
      menu_entries_refresh(MENU_ACTION_CANCEL);

   rarch_main_data_iterate();

   return 0;
}
예제 #3
0
int menu_list_populate_generic(file_list_t *list, const char *path,
      const char *label, unsigned type)
{
   menu_handle_t *menu = menu_driver_get_ptr();

   if (!menu)
      return -1;

   menu->navigation.scroll.indices.size = 0;

   menu_entries_build_scroll_indices(list);
   menu_entries_refresh(list);

   menu_driver_populate_entries(path, label, type);

   return 0;
}
예제 #4
0
bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data)
{
   /* Flagged when menu entries need to be refreshed */
   static bool menu_entries_need_refresh              = false;
   static bool menu_entries_nonblocking_refresh       = false;
   static size_t menu_entries_begin                   = 0;
   static rarch_setting_t *menu_entries_list_settings = NULL;
   static menu_list_t *menu_entries_list              = NULL;

   switch (state)
   {
      case MENU_ENTRIES_CTL_DEINIT:
         menu_entries_ctl(MENU_ENTRIES_CTL_SETTINGS_DEINIT, NULL);
         menu_entries_ctl(MENU_ENTRIES_CTL_LIST_DEINIT, NULL);

         menu_entries_need_refresh        = false;
         menu_entries_nonblocking_refresh = false;
         menu_entries_begin               = 0;
         break;
      case MENU_ENTRIES_CTL_NEEDS_REFRESH:
         if (menu_entries_nonblocking_refresh)
            return false;
         if (!menu_entries_need_refresh)
            return false;
         break;
      case MENU_ENTRIES_CTL_LIST_GET:
         {
            menu_list_t **list = (menu_list_t**)data;
            if (!list)
               return false;
            *list = menu_entries_list;
         }
         return true;
      case MENU_ENTRIES_CTL_LIST_DEINIT:
         if (menu_entries_list)
            menu_list_free(menu_entries_list);
         menu_entries_list     = NULL;
         break;
      case MENU_ENTRIES_CTL_LIST_INIT:
         if (!(menu_entries_list = (menu_list_t*)menu_list_new()))
            return false;
         break;
      case MENU_ENTRIES_CTL_SETTINGS_GET:
         {
            rarch_setting_t **settings = (rarch_setting_t**)data;
            if (!settings)
               return false;
            *settings = menu_entries_list_settings;
         }
         break;
      case MENU_ENTRIES_CTL_SETTINGS_DEINIT:
         if (menu_entries_list_settings)
            menu_setting_ctl(MENU_SETTING_CTL_FREE, menu_entries_list_settings);
         menu_entries_list_settings = NULL;
         break;
      case MENU_ENTRIES_CTL_SETTINGS_INIT:
         menu_setting_ctl(MENU_SETTING_CTL_NEW, &menu_entries_list_settings);

         if (!menu_entries_list_settings)
            return false;
         break;
      case MENU_ENTRIES_CTL_SET_REFRESH:
         {
            bool *nonblocking = (bool*)data;

            if (*nonblocking)
               menu_entries_nonblocking_refresh = true;
            else
               menu_entries_need_refresh        = true;
         }
         break;
      case MENU_ENTRIES_CTL_UNSET_REFRESH:
         {
            bool *nonblocking = (bool*)data;

            if (*nonblocking)
               menu_entries_nonblocking_refresh = false;
            else
               menu_entries_need_refresh        = false;
         }
         break;
      case MENU_ENTRIES_CTL_SET_START:
         {
            size_t *idx = (size_t*)data;
            if (idx)
               menu_entries_begin = *idx;
         }
      case MENU_ENTRIES_CTL_START_GET:
         {
            size_t *idx = (size_t*)data;
            if (!idx)
               return 0;

            *idx = menu_entries_begin;
         }
         break;
      case MENU_ENTRIES_CTL_REFRESH:
         return menu_entries_refresh(data);
      case MENU_ENTRIES_CTL_CLEAR:
         return menu_entries_clear((file_list_t*)data);
      case MENU_ENTRIES_CTL_INIT:
         return menu_entries_init();
      case MENU_ENTRIES_CTL_SHOW_BACK:
         /* Returns true if a Back button should be shown 
          * (i.e. we are at least
          * one level deep in the menu hierarchy). */
         return (menu_entries_get_stack_size(0) > 1);
      case MENU_ENTRIES_CTL_NONE:
      default:
         break;
   }

   return true;
}
예제 #5
0
bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data)
{
   switch (state)
   {
      case MENU_ENTRIES_CTL_DEINIT:
         menu_entries_ctl(MENU_ENTRIES_CTL_SETTINGS_DEINIT, NULL);
         menu_entries_ctl(MENU_ENTRIES_CTL_LIST_DEINIT, NULL);

         menu_entries_need_refresh        = false;
         menu_entries_nonblocking_refresh = false;
         menu_entries_begin               = 0;
         break;
      case MENU_ENTRIES_CTL_NEEDS_REFRESH:
         if (menu_entries_nonblocking_refresh)
            return false;
         if (!menu_entries_need_refresh)
            return false;
         break;
      case MENU_ENTRIES_CTL_LIST_GET:
         {
            menu_list_t **list = (menu_list_t**)data;
            if (!list)
               return false;
            *list = menu_entries_list;
         }
         return true;
      case MENU_ENTRIES_CTL_LIST_DEINIT:
         if (menu_entries_list)
            menu_list_free(menu_entries_list);
         menu_entries_list     = NULL;
         break;
      case MENU_ENTRIES_CTL_LIST_INIT:
         if (!(menu_entries_list = (menu_list_t*)menu_list_new()))
            return false;
         break;
      case MENU_ENTRIES_CTL_SETTINGS_GET:
         {
            rarch_setting_t **settings = (rarch_setting_t**)data;
            if (!settings)
               return false;
            *settings = menu_entries_list_settings;
         }
         break;
      case MENU_ENTRIES_CTL_SETTINGS_DEINIT:
         menu_setting_free(menu_entries_list_settings);
         if (menu_entries_list_settings)
            free(menu_entries_list_settings);
         menu_entries_list_settings = NULL;
         break;
      case MENU_ENTRIES_CTL_SETTINGS_INIT:
         menu_setting_ctl(MENU_SETTING_CTL_NEW, &menu_entries_list_settings);

         if (!menu_entries_list_settings)
            return false;
         break;
      case MENU_ENTRIES_CTL_SET_REFRESH:
         {
            bool *nonblocking = (bool*)data;

            if (*nonblocking)
               menu_entries_nonblocking_refresh = true;
            else
               menu_entries_need_refresh        = true;
         }
         break;
      case MENU_ENTRIES_CTL_UNSET_REFRESH:
         {
            bool *nonblocking = (bool*)data;

            if (*nonblocking)
               menu_entries_nonblocking_refresh = false;
            else
               menu_entries_need_refresh        = false;
         }
         break;
      case MENU_ENTRIES_CTL_SET_START:
         {
            size_t *idx = (size_t*)data;
            if (idx)
               menu_entries_begin = *idx;
         }
      case MENU_ENTRIES_CTL_START_GET:
         {
            size_t *idx = (size_t*)data;
            if (!idx)
               return 0;

            *idx = menu_entries_begin;
         }
         break;
      case MENU_ENTRIES_CTL_REFRESH:
         if (!data)
            return false;
         return menu_entries_refresh((file_list_t*)data);
      case MENU_ENTRIES_CTL_CLEAR:
         {
            unsigned i;
            file_list_t *list = (file_list_t*)data;

            if (!list)
               return false;

            menu_driver_list_clear(list);

            for (i = 0; i < list->size; i++)
               file_list_free_actiondata(list, i);

            file_list_clear(list);
         }
         break;
      case MENU_ENTRIES_CTL_INIT:
         return menu_entries_init();
      case MENU_ENTRIES_CTL_SHOW_BACK:
         /* Returns true if a Back button should be shown
          * (i.e. we are at least
          * one level deep in the menu hierarchy). */
         if (!menu_entries_list)
            return false;
         return (menu_list_get_stack_size(menu_entries_list, 0) > 1);
      case MENU_ENTRIES_CTL_NONE:
      default:
         break;
   }

   return true;
}