示例#1
0
int pl_file_open_directory(const char *path,
                           const char *subdir,
                           char *result,
                           int  result_len)
{
  /* This routine should be made more robust */
  /* to accept subdirs like ../../ etc... */
  int path_len = strlen(path);
  int copy_len;

  /* Ascend one level */
  if (strcmp(subdir, "..") == 0)
  {
    pl_file_get_parent_directory(path,
                                 result,
                                 result_len);
    return 1;
  }
  else
  {
    copy_len = MIN(result_len - 1, strlen(subdir) + path_len + 2);
    snprintf(result, copy_len, "%s%s/", path, subdir);
    result[copy_len] = '\0';
    return 1;
  }

  /* If we're here, then we couldn't figure out final path */
  /* Just copy the original path */
  copy_len = MIN(result_len - 1, path_len);
  strncpy(result, path, copy_len);
  result[copy_len] = '\0';

  return (strcmp(subdir, ".") == 0);
}
示例#2
0
int OnQuickloadOk(const void *browser, const void *path)
{
  int first_time = 0;
  if (!GAME_LOADED)
    first_time = 1;

  if (!load_rom((char*)path))
  {
    pspUiAlert("Error loading cartridge");
    return 0;
  }

  SET_AS_CURRENT_GAME((char*)path);
  pl_file_get_parent_directory((const char*)path,
                               GamePath,
                               sizeof(GamePath));

  /* Reset selected state */
  SaveStateGallery.Menu.selected = NULL;

  if (first_time)
  {
    pspUiFlashMessage("Initializing for first-time use\nPlease wait...");
    audio_init(SOUND_FREQUENCY, 0);
    system_init();
    //error_init();
    system_reset();
  }
  else{
    system_init();
    system_reset();
    audio_reset();
  }
  pl_rewind_reset(&Rewinder);

  ResumeEmulation = 1;
  return 1;
}