コード例 #1
0
ファイル: menu_cbs_select.c プロジェクト: ssangkong/RetroArch
static int action_select_default(const char *path, const char *label, unsigned type,
                                 size_t idx)
{
    menu_entry_t entry;
    int ret                    = 0;
    enum menu_action action    = MENU_ACTION_NOOP;
    menu_file_list_cbs_t *cbs  = NULL;
    file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);

    menu_entry_get(&entry, 0, idx, NULL, false);

    cbs = menu_entries_get_actiondata_at_offset(selection_buf, idx);

    if (!cbs)
        return -1;

    switch (menu_setting_get_type(cbs->setting))
    {
    case ST_BOOL:
    case ST_INT:
    case ST_UINT:
    case ST_FLOAT:
        action = MENU_ACTION_RIGHT;
        break;
    case ST_PATH:
    case ST_DIR:
    case ST_ACTION:
    case ST_STRING:
    case ST_HEX:
    case ST_BIND:
        action = MENU_ACTION_OK;
        break;
    default:
        break;
    }

    if (action == MENU_ACTION_NOOP)
    {
        if (cbs->action_ok)
            action = MENU_ACTION_OK;
        else
        {
            if (cbs->action_start)
                action = MENU_ACTION_START;
            if (cbs->action_right)
                action = MENU_ACTION_RIGHT;
        }
    }

    if (action != MENU_ACTION_NOOP)
        ret = menu_entry_action(&entry, idx, action);

    rarch_main_data_iterate();

    return ret;
}
コード例 #2
0
static void emscripten_mainloop(void)
{
   int ret = rarch_main_iterate();
   rarch_main_data_iterate();
   if (ret != -1)
      return;

   main_exit(NULL);
   exit(0);
}
コード例 #3
0
static void emscripten_mainloop(void)
{
   unsigned sleep_ms = 0;
   int ret = rarch_main_iterate(&sleep_ms);
   if (ret == 1 && sleep_ms > 0)
      rarch_sleep(sleep_ms);
   rarch_main_data_iterate();
   if (ret != -1)
      return;

   main_exit(NULL);
   exit(0);
}
コード例 #4
0
ファイル: menu_entry.c プロジェクト: lordixi/RetroArch
/* 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;
}
コード例 #5
0
static void android_app_entry(void *data)
{
   char *argv[1];
   int argc = 0;
   int ret  = 0;

   if (rarch_main(argc, argv, data) != 0)
      goto end;
#ifndef HAVE_MAIN
   do
   {
      ret = rarch_main_iterate();
      rarch_main_data_iterate();
   }while (ret != -1);

   main_exit(data);
#endif

end:
   exit(0);
}
コード例 #6
0
ファイル: menu_entry.c プロジェクト: PCGeekBrain/RetroArch
// Performs whatever actions are associated with menu entry 'i'. This
// is the most important function because it does all the work
// associated with clicking on things in the UI. This includes loading
// cores and updating the currently displayed menu
int menu_entry_select(uint32_t i)
{
   int ret = 0;
   menu_entry_t entry;
   enum menu_action action   = MENU_ACTION_NOOP;
   menu_file_list_cbs_t *cbs = NULL;
   menu_navigation_t *nav    = menu_navigation_get_ptr();
   menu_list_t    *menu_list = menu_list_get_ptr();
   rarch_setting_t *setting  = menu_setting_find(
         menu_list->selection_buf->list[i].label);

   menu_entry_get(&entry, i, NULL, false);

   cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf, i);

   if (setting_is_of_path_type(setting))
      return 0;

   nav->selection_ptr = i;
   if ((cbs && cbs->action_ok) || setting_is_of_general_type(setting))
       action = MENU_ACTION_OK;
   else
   {
      if (cbs && cbs->action_start)
         action = MENU_ACTION_START;
      if (cbs && cbs->action_right)
         action = MENU_ACTION_RIGHT;
   }
    
   if (action != MENU_ACTION_NOOP)
       ret = menu_entry_action(&entry, i, action);

   rarch_main_data_iterate();
    
   return ret;
}
コード例 #7
0
ファイル: frontend.c プロジェクト: TheDuckMan64/RetroArch
/**
 * main_entry:
 *
 * Main function of RetroArch.
 *
 * If HAVE_MAIN is not defined, will contain main loop and will not
 * be exited from until we exit the program. Otherwise, will 
 * just do initialization.
 *
 * Returns: varies per platform.
 **/
int rarch_main(int argc, char *argv[], void *data)
{
   void *args                      = (void*)data;
   int ret                         = 0;
   settings_t *settings            = NULL;
   driver_t *driver                = NULL;

   rarch_main_alloc();

   driver = driver_get_ptr();

   if (driver)
      driver->frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();

   if (!driver || !driver->frontend_ctx)
      RARCH_WARN("Frontend context could not be initialized.\n");

   if (driver->frontend_ctx && driver->frontend_ctx->init)
      driver->frontend_ctx->init(args);

   rarch_main_new();

   if (driver->frontend_ctx)
   {
      if (!(ret = (main_load_content(argc, argv, args,
                     driver->frontend_ctx->environment_get,
                     driver->frontend_ctx->process_args))))
         return ret;
   }

   event_command(EVENT_CMD_HISTORY_INIT);

   settings = config_get_ptr();

   if (settings->history_list_enable)
   {
      global_t *global             = global_get_ptr();
      rarch_system_info_t *system = rarch_system_info_get_ptr();

      if (global->content_is_init || system->no_content)
         history_playlist_push(
               g_defaults.history,
               global->fullpath,
               settings->libretro,
               system ? &system->info : NULL);
   }

   if (driver)
      driver->ui_companion = (ui_companion_driver_t*)ui_companion_init_first();

   if (driver->ui_companion && driver->ui_companion->toggle)
   {
      if (settings->ui.companion_start_on_boot)
         driver->ui_companion->toggle(driver->ui_companion_data);
   }

#ifndef HAVE_MAIN
   do{
      ret = rarch_main_iterate();
      rarch_main_data_iterate();
   }while(ret != -1);

   main_exit(args);
#endif

   return 0;
}