예제 #1
0
/**
 * check_pause:
 * @pressed              : was libretro pause key pressed?
 * @frameadvance_pressed : was frameadvance key pressed?
 *
 * Check if libretro pause key was pressed. If so, pause or
 * unpause the libretro core.
 *
 * Returns: true if libretro pause key was toggled, otherwise false.
 **/
static bool check_pause(settings_t *settings,
      bool focus, bool pause_pressed,
      bool frameadvance_pressed)
{
   static bool old_focus    = true;
   enum event_command cmd   = EVENT_CMD_NONE;
   bool old_is_paused       = runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL);

   /* FRAMEADVANCE will set us into pause mode. */
   pause_pressed |= !old_is_paused && frameadvance_pressed;

   if (focus && pause_pressed)
      cmd = EVENT_CMD_PAUSE_TOGGLE;
   else if (focus && !old_focus)
      cmd = EVENT_CMD_UNPAUSE;
   else if (!focus && old_focus)
      cmd = EVENT_CMD_PAUSE;

   old_focus = focus;

   if (cmd != EVENT_CMD_NONE)
      event_command(cmd);

   if (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) == old_is_paused)
      return false;

   return true;
}
예제 #2
0
/**
 * menu_content_find_first_core:
 * @core_info            : Core info list handle.
 * @dir                  : Directory. Gets joined with @path.
 * @path                 : Path. Gets joined with @dir.
 * @menu_label           : Label identifier of menu setting.
 * @s                    : Deferred core path. Will be filled in
 *                         by function.
 * @len                  : Size of @s.
 *
 * Gets deferred core.
 *
 * Returns: false if there are multiple deferred cores and a
 * selection needs to be made from a list, otherwise
 * returns true and fills in @s with path to core.
 **/
static bool menu_content_find_first_core(void *data)
{
   char new_core_path[PATH_MAX_LENGTH];
   const core_info_t *info                 = NULL;
   size_t supported                        = 0;
   menu_content_ctx_defer_info_t *def_info = 
      (menu_content_ctx_defer_info_t *)data;
   core_info_list_t *core_info             = 
      (core_info_list_t*)def_info->data;
   uint32_t menu_label_hash                = 
      menu_hash_calculate(def_info->menu_label);

   if (     !string_is_empty(def_info->dir) 
         && !string_is_empty(def_info->path))
      fill_pathname_join(def_info->s, 
            def_info->dir, def_info->path, def_info->len);

#ifdef HAVE_COMPRESSION
   if (path_is_compressed_file(def_info->dir))
   {
      /* In case of a compressed archive, we have to join with a hash */
      /* We are going to write at the position of dir: */
      retro_assert(strlen(def_info->dir) < strlen(def_info->s));
      def_info->s[strlen(def_info->dir)] = '#';
   }
#endif

   if (core_info)
      core_info_list_get_supported_cores(core_info,
            def_info->s, &info,
            &supported);

   /* We started the menu with 'Load Content', we are 
    * going to use the current core to load this. */
   if (menu_label_hash == MENU_LABEL_LOAD_CONTENT)
   {
      core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_GET, (void*)&info);
      if (info)
      {
         RARCH_LOG("Use the current core (%s) to load this content...\n",
               info->path);
         supported = 1;
      }
   }

   /* There are multiple deferred cores and a
    * selection needs to be made from a list, return 0. */
   if (supported != 1)
      return false;

    if (info)
      strlcpy(new_core_path, info->path, sizeof(new_core_path));

   runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, def_info->s);

   if (path_file_exists(new_core_path))
      runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, new_core_path);

   return true;
}
예제 #3
0
static bool event_update_system_info(struct retro_system_info *_info,
      bool *load_no_content)
{
   core_info_list_t *core_info_list = NULL;
   core_info_t *core_info           = NULL;
   settings_t *settings             = config_get_ptr();

#if defined(HAVE_DYNAMIC)
   if (!(*settings->libretro))
      return false;

   libretro_get_system_info(settings->libretro, _info,
         load_no_content);
#endif
   runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, &core_info);
   runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);

   if (!core_info_list)
      return false;

   if (!core_info_list_get_info(core_info_list,
            core_info, settings->libretro))
      return false;

   return true;
}
예제 #4
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;
}
예제 #5
0
static void menu_driver_toggle(bool latch)
{
   retro_keyboard_event_t *key_event          = NULL;
   retro_keyboard_event_t *frontend_key_event = NULL;
   settings_t                 *settings       = config_get_ptr();
   
   menu_driver_ctl(RARCH_MENU_CTL_TOGGLE, &latch);

   if (latch)
      menu_driver_ctl(RARCH_MENU_CTL_SET_ALIVE, NULL);
   else
      menu_driver_ctl(RARCH_MENU_CTL_UNSET_ALIVE, NULL);

   runloop_ctl(RUNLOOP_CTL_FRONTEND_KEY_EVENT_GET, &frontend_key_event);
   runloop_ctl(RUNLOOP_CTL_KEY_EVENT_GET,          &key_event);

   if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
   {
      bool refresh = false;
      menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);

      /* Menu should always run with vsync on. */
      command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL);
      /* Stop all rumbling before entering the menu. */
      command_event(CMD_EVENT_RUMBLE_STOP, NULL);

      if (settings->menu.pause_libretro)
         command_event(CMD_EVENT_AUDIO_STOP, NULL);

      /* Override keyboard callback to redirect to menu instead.
       * We'll use this later for something ... */

      if (key_event && frontend_key_event)
      {
         *frontend_key_event        = *key_event;
         *key_event                 = menu_input_key_event;

         runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL);
      }
   }
   else
   {
      if (!runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
         driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);

      if (settings && settings->menu.pause_libretro)
         command_event(CMD_EVENT_AUDIO_START, NULL);

      /* Prevent stray input from going to libretro core */
      input_driver_set_flushing_input();

      /* Restore libretro keyboard callback. */
      if (key_event && frontend_key_event)
         *key_event = *frontend_key_event;
   }
}
예제 #6
0
const char *runloop_msg_queue_pull(void)
{
   const char *ret = NULL;

   runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_LOCK, NULL);
   runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &ret);
   runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_UNLOCK, NULL);

   return ret;
}
예제 #7
0
/* Loads dummy core instead of exiting RetroArch completely.
 * Aborts core shutdown if invoked. */
static int runloop_iterate_time_to_exit_load_dummy(void)
{
   if (!runloop_ctl(RUNLOOP_CTL_PREPARE_DUMMY, NULL))
      return -1;

   runloop_ctl(RUNLOOP_CTL_UNSET_SHUTDOWN,      NULL);
   runloop_ctl(RUNLOOP_CTL_UNSET_CORE_SHUTDOWN, NULL);

   return 1;
}
예제 #8
0
static void menu_driver_toggle(bool latch)
{
   const menu_ctx_driver_t *menu_driver = menu_ctx_driver_get_ptr();
   settings_t                 *settings = config_get_ptr();
   global_t                   *global   = global_get_ptr();
   rarch_system_info_t          *system = rarch_system_info_get_ptr();

   if (menu_driver->toggle)
      menu_driver->toggle(latch);

   if (latch)
      menu_driver_ctl(RARCH_MENU_CTL_SET_ALIVE, NULL);
   else
      menu_driver_ctl(RARCH_MENU_CTL_UNSET_ALIVE, NULL);

   if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
   {
      menu_entries_set_refresh(false);

      /* Menu should always run with vsync on. */
      event_command(EVENT_CMD_VIDEO_SET_BLOCKING_STATE);
      /* Stop all rumbling before entering the menu. */
      event_command(EVENT_CMD_RUMBLE_STOP);

      if (settings->menu.pause_libretro)
         event_command(EVENT_CMD_AUDIO_STOP);

      /* Override keyboard callback to redirect to menu instead.
       * We'll use this later for something ...
       * FIXME: This should probably be moved to menu_common somehow. */
      if (global)
      {
         global->frontend_key_event = system->key_event;
         system->key_event          = menu_input_key_event;

         runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL);
      }
   }
   else
   {
      if (!runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
         driver_set_nonblock_state();

      if (settings && settings->menu.pause_libretro)
         event_command(EVENT_CMD_AUDIO_START);

      /* Prevent stray input from going to libretro core */
      input_driver_ctl(RARCH_INPUT_CTL_SET_FLUSHING_INPUT, NULL);

      /* Restore libretro keyboard callback. */
      if (global)
         system->key_event = global->frontend_key_event;
   }
}
예제 #9
0
static void xui_frame(void *data)
{
   XUIMessage msg;
   XUIMessageRender msgRender;
   D3DXMATRIX matOrigView;
   LPDIRECT3DDEVICE d3dr;
   const char *message   = NULL;
   D3DVIEWPORT vp_full   = {0};
   d3d_video_t *d3d      = (d3d_video_t*)video_driver_get_ptr(false);
   
   if (!d3d)
      return;

   d3dr = (LPDIRECT3DDEVICE)d3d->dev;

   if (!d3dr)
      return;

   menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);

   app.RunFrame();
   XuiTimersRun();
   XuiRenderBegin( app.GetDC(), D3DCOLOR_ARGB( 255, 0, 0, 0 ) );

   XuiRenderGetViewTransform( app.GetDC(), &matOrigView );

   XuiMessageRender( &msg, &msgRender,
         app.GetDC(), 0xffffffff, XUI_BLEND_NORMAL );
   XuiSendMessage( app.GetRootObj(), &msg );

   XuiRenderSetViewTransform( app.GetDC(), &matOrigView );

   runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &message);

   if (message)
      xui_render_message(message);
   else
   {
      runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &message);

      if (message)
         xui_render_message(message);
   }

   XuiRenderEnd( app.GetDC() );

   menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
}
예제 #10
0
/* Loads dummy core instead of exiting RetroArch completely.
 * Aborts core shutdown if invoked. */
static int runloop_iterate_time_to_exit_load_dummy(void)
{
   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;

   runloop_ctl(RUNLOOP_CTL_UNSET_SHUTDOWN,      NULL);
   runloop_ctl(RUNLOOP_CTL_UNSET_CORE_SHUTDOWN, NULL);

   return 1;
}
예제 #11
0
static void history_playlist_push(content_playlist_t *playlist,
      const char *path, const char *core_path,
      struct retro_system_info *info)
{
   char tmp[PATH_MAX_LENGTH];
   rarch_system_info_t *system           = NULL;
   
   runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

   if (!playlist || rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) || !info)
      return;

   /* Path can be relative here.
    * Ensure we're pushing absolute path. */

   strlcpy(tmp, path, sizeof(tmp));

   if (*tmp)
      path_resolve_realpath(tmp, sizeof(tmp));

   if (system->no_content || *tmp)
      content_playlist_push(playlist,
            *tmp ? tmp : NULL,
            NULL,
            core_path,
            info->library_name,
            NULL,
            NULL);
}
예제 #12
0
static void menu_content_environment_get(int *argc, char *argv[],
      void *args, void *params_data)
{
   struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)params_data;
   char *fullpath       = NULL;
   global_t *global     = global_get_ptr();
   settings_t *settings = config_get_ptr();
    
   if (!wrap_args)
      return;

   runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);

   wrap_args->no_content       = menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL);
   if (!global->has_set.verbosity)
      wrap_args->verbose       = *retro_main_verbosity();

   wrap_args->config_path      = *global->path.config   ? global->path.config   : NULL;
   wrap_args->sram_path        = *global->dir.savefile  ? global->dir.savefile  : NULL;
   wrap_args->state_path       = *global->dir.savestate ? global->dir.savestate : NULL;
   wrap_args->content_path     = *fullpath              ? fullpath              : NULL;

   if (!global->has_set.libretro)
      wrap_args->libretro_path = *settings->libretro ? settings->libretro : NULL;
   wrap_args->touched       = true;
}
예제 #13
0
static void menu_content_push_to_history_playlist(void)
{
   struct retro_system_info *system = NULL;
   settings_t *settings        = config_get_ptr();
   char *fullpath              = NULL;

   if (!settings->history_list_enable)
      return;

   runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);

   if (*fullpath)
   {
      char tmp[PATH_MAX_LENGTH];
      char str[PATH_MAX_LENGTH];

      fill_pathname_base(tmp, fullpath, sizeof(tmp));
      snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
      menu_display_msg_queue_push(str, 1, 1, false);
   }

   menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
         &system);

   content_playlist_push(g_defaults.history,
         fullpath,
         NULL,
         settings->libretro,
         system->library_name,
         NULL,
         NULL);

   content_playlist_write_file(g_defaults.history);
}
예제 #14
0
bool menu_content_load(void)
{
   bool msg_force       = true;
   char *fullpath       = NULL;

   runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
   /* redraw menu frame */
   menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force);
   menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);

   if (!(main_load_content(0, NULL, NULL, menu_content_environment_get)))
   {
      char name[PATH_MAX_LENGTH];
      char msg[PATH_MAX_LENGTH];

      fill_pathname_base(name, fullpath, sizeof(name));
      snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);
      menu_display_msg_queue_push(msg, 1, 90, false);

      return false;
   }

   menu_driver_ctl(RARCH_MENU_CTL_SHADER_MANAGER_INIT, NULL);

   event_cmd_ctl(EVENT_CMD_HISTORY_INIT, NULL);

   if (*fullpath || menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
      menu_content_push_to_history_playlist();

   event_cmd_ctl(EVENT_CMD_VIDEO_SET_ASPECT_RATIO, NULL);
   event_cmd_ctl(EVENT_CMD_RESUME, NULL);

   return true;
}
예제 #15
0
static void menu_push_to_history_playlist(void)
{
   settings_t *settings = config_get_ptr();
   char *fullpath       = NULL;

   if (!settings->history_list_enable)
      return;

   runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);

   if (*fullpath)
   {
      char tmp[PATH_MAX_LENGTH];
      char str[PATH_MAX_LENGTH];

      fill_pathname_base(tmp, fullpath, sizeof(tmp));
      snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
      menu_display_msg_queue_push(str, 1, 1, false);
   }

   content_playlist_push(g_defaults.history,
         fullpath,
         NULL,
         settings->libretro,
         g_system_menu.library_name,
         NULL,
         NULL);
}
예제 #16
0
void init_camera(void)
{
   settings_t        *settings = config_get_ptr();
   rarch_system_info_t *system = NULL;

   runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

   /* Resource leaks will follow if camera is initialized twice. */
   if (camera_data)
      return;

   find_camera_driver();

   camera_data = camera_driver->init(
         *settings->camera.device ? settings->camera.device : NULL,
         system->camera_callback.caps,
         settings->camera.width ?
         settings->camera.width : system->camera_callback.width,
         settings->camera.height ?
         settings->camera.height : system->camera_callback.height);

   if (!camera_data)
   {
      RARCH_ERR("Failed to initialize camera driver. Will continue without camera.\n");
      camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
   }

   if (system->camera_callback.initialized)
      system->camera_callback.initialized();
}
예제 #17
0
char* runloop_msg_queue_pull(void)
{
   runloop_ctx_msg_info_t msg_info;
   runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &msg_info);

   return strdup(msg_info.msg);
}
예제 #18
0
static void frontend_psp_exec(const char *path, bool should_load_game)
{
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER)
   char argp[512] = {0};
   SceSize   args = 0;

   argp[0] = '\0';
   strlcpy(argp, eboot_path, sizeof(argp));
   args = strlen(argp) + 1;

#ifndef IS_SALAMANDER
   char *fullpath = NULL;

   runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);

   if (should_load_game && !string_is_empty(fullpath))
   {
      argp[args] = '\0';
      strlcat(argp + args, fullpath, sizeof(argp) - args);
      args += strlen(argp + args) + 1;
   }
#endif

   RARCH_LOG("Attempt to load executable: [%s].\n", path);

   exitspawn_kernel(path, args, argp);

#endif
}
예제 #19
0
INT_PTR CALLBACK PickCoreProc(HWND hDlg, UINT message, 
        WPARAM wParam, LPARAM lParam)
{
   size_t list_size;
   core_info_list_t *core_info_list = NULL;
   const core_info_t *core_info     = NULL;

   switch (message)
   {
      case WM_INITDIALOG:
         {
            HWND hwndList;
            unsigned i;
            /* Add items to list.  */

            core_info_get_list(&core_info_list);
            core_info_list_get_supported_cores(core_info_list,
                  path_get(RARCH_PATH_CONTENT), &core_info, &list_size);

            hwndList = GetDlgItem(hDlg, ID_CORELISTBOX);  

            for (i = 0; i < list_size; i++)
            {
               const core_info_t *info = (const core_info_t*)&core_info[i];
               SendMessage(hwndList, LB_ADDSTRING, 0, 
                     (LPARAM)info->display_name); 
            }
            SetFocus(hwndList); 
            return TRUE;  
         }

      case WM_COMMAND:
         switch (LOWORD(wParam))
         {
            case IDOK:
            case IDCANCEL:
               EndDialog(hDlg, LOWORD(wParam));
               break;
            case ID_CORELISTBOX:
               switch (HIWORD(wParam)) 
               { 
                  case LBN_SELCHANGE:
                     {
                        int lbItem;
                        const core_info_t *info = NULL;
                        HWND hwndList = GetDlgItem(hDlg, ID_CORELISTBOX); 
                        lbItem = (int)SendMessage(hwndList, LB_GETCURSEL, 0, 0); 
                        core_info_get_list(&core_info_list);
                        core_info_list_get_supported_cores(core_info_list,
                              path_get(RARCH_PATH_CONTENT), &core_info, &list_size);
                        info = (const core_info_t*)&core_info[lbItem];
                        runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH,info->path);
                     } 
                     break;
               }
               return TRUE;
         }
   }
   return FALSE;
}
예제 #20
0
/**
 * np_impl_magic:
 *
 * Not really a hash, but should be enough to differentiate 
 * implementations from each other.
 *
 * Subtle differences in the implementation will not be possible to spot.
 * The alternative would have been checking serialization sizes, but it 
 * was troublesome for cross platform compat.
 **/
uint32_t np_impl_magic(void)
{
   size_t i, len;
   uint32_t res                        = 0;
   rarch_system_info_t *info           = NULL;
   const char *lib                     = NULL;
   const char *ver                     = PACKAGE_VERSION;
   unsigned api                        = core.retro_api_version();
   
   runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
   
   if (info)
      lib = info->info.library_name;

   res |= api;

   len = strlen(lib);
   for (i = 0; i < len; i++)
      res ^= lib[i] << (i & 0xf);

   lib = info->info.library_version;
   len = strlen(lib);

   for (i = 0; i < len; i++)
      res ^= lib[i] << (i & 0xf);

   len = strlen(ver);
   for (i = 0; i < len; i++)
      res ^= ver[i] << ((i & 0xf) + 16);

   return res;
}
예제 #21
0
/**
 * menu_load_content:
 *
 * Loads content into currently selected core.
 * Will also optionally push the content entry to the history playlist.
 *
 * Returns: true (1) if successful, otherwise false (0).
 **/
bool menu_load_content(enum rarch_core_type type)
{
   bool msg_force       = true;
   char *fullpath       = NULL;

   runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
   /* redraw menu frame */
   menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force);
   menu_iterate_render();

   if (!(main_load_content(0, NULL, NULL, menu_environment_get)))
   {
      char name[PATH_MAX_LENGTH] = {0};
      char msg[PATH_MAX_LENGTH]  = {0};

      fill_pathname_base(name, fullpath, sizeof(name));
      snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);
      menu_display_msg_queue_push(msg, 1, 90, false);

      return false;
   }

   menu_shader_manager_init(menu_driver_get_ptr());

   event_command(EVENT_CMD_HISTORY_INIT);

   if (*fullpath || menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
      menu_push_to_history_playlist();

   event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO);
   event_command(EVENT_CMD_RESUME);

   return true;
}
static void menu_action_setting_disp_set_label_core_options(file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   core_option_manager_t *coreopts = NULL;
   const char *core_opt = NULL;

   *s = '\0';
   *w = 19;

   if (runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_LIST_GET, &coreopts))
   {
      core_opt = core_option_manager_get_val(coreopts,
            type - MENU_SETTINGS_CORE_OPTION_START);

      strlcpy(s, "", len);

      if (core_opt)
         strlcpy(s, core_opt, len);
   }

   strlcpy(s2, path, len2);
}
예제 #23
0
static int runloop_iterate_menu(enum menu_action action, unsigned *sleep_ms)
{
   menu_ctx_iterate_t iter;
   settings_t *settings    = config_get_ptr();
   bool focused            = runloop_is_focused() &&
      !ui_companion_is_on_foreground();
   bool is_idle            = runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL);

   iter.action             = action;

   if (!menu_driver_ctl(RARCH_MENU_CTL_ITERATE, &iter))
      rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);

   if (focused || !is_idle)
      menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);

   if (!focused || is_idle)
   {
      *sleep_ms = 10;
      return 1;
   }

   if (!settings->menu.throttle_framerate && !settings->fastforward_ratio)
      return 0;

   return -1;
}
void performance_counter_stop(struct retro_perf_counter *perf)
{
   if (!runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL) || !perf)
      return;

   perf->total += cpu_features_get_perf_counter() - perf->start;
}
예제 #25
0
static bool runloop_check_pause_state(event_cmd_state_t *cmd)
{
   bool check_is_oneshot = false;

   if (!cmd)
      return false;

   check_is_oneshot      = runloop_cmd_triggered(cmd,
         RARCH_FRAMEADVANCE) 
      || runloop_cmd_press(cmd, RARCH_REWIND);

   if (!runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
      return true;

   if (runloop_cmd_triggered(cmd, RARCH_FULLSCREEN_TOGGLE_KEY))
   {
      command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL);
      video_driver_cached_frame_render();
   }

   if (!check_is_oneshot)
      return false;

   return true;
}
예제 #26
0
static void menu_action_setting_disp_set_label_core_option_create(
      file_list_t* list,
      unsigned *w, unsigned type, unsigned i,
      const char *label,
      char *s, size_t len,
      const char *entry_label,
      const char *path,
      char *s2, size_t len2)
{
   rarch_system_info_t *system = NULL;
   global_t            *global = global_get_ptr();

   runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
   if (!system)
      return;

   *s = '\0';
   *w = 19;

   strlcpy(s, "", len);

   if (!string_is_empty(global->name.base))
      strlcpy(s,  path_basename(global->name.base), len);

   strlcpy(s2, path, len2);
}
예제 #27
0
static int mui_get_core_title(char *s, size_t len)
{
   struct retro_system_info    *system = NULL;
   rarch_system_info_t      *info = NULL;
   settings_t *settings           = config_get_ptr();
   const char *core_name          = NULL;
   const char *core_version       = NULL;

   menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
         &system);
   
   core_name    = system->library_name;
   core_version = system->library_version;

   runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);

   if (!settings->menu.core_enable)
      return -1; 

   if (string_is_empty(core_name))
      core_name = info->info.library_name;
   if (string_is_empty(core_name))
      core_name = menu_hash_to_str(MENU_VALUE_NO_CORE);

   if (!core_version)
      core_version = info->info.library_version;
   if (!core_version)
      core_version = "";

   snprintf(s, len, "%s %s", core_name, core_version);

   return 0;
}
예제 #28
0
static void callback_sysutil_exit(uint64_t status,
      uint64_t param, void *userdata)
{

   (void)param;
   (void)userdata;
   (void)status;

#ifndef IS_SALAMANDER

   switch (status)
   {
      case CELL_SYSUTIL_REQUEST_EXITGAME:
         {
            frontend_ctx_driver_t *frontend = frontend_get_ptr();

            if (frontend)
               frontend->shutdown = frontend_ps3_shutdown;

            runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
         }
         break;
   }
#endif
}
void performance_counter_start(struct retro_perf_counter *perf)
{
   if (!runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL) || !perf)
      return;

   perf->call_cnt++;
   perf->start = cpu_features_get_perf_counter();
}
예제 #30
0
const char *core_info_list_get_all_extensions(void)
{
   core_info_list_t *list = NULL;
   runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
   if (!list)
      return NULL;
   return list->all_ext;
}