Exemplo n.º 1
0
bool GameInfo::LoadFromPath(const std::string &gamePath) {
	// No need to rebuild if we already have it loaded.
	if (filePath_ != gamePath) {
		delete fileLoader;
		fileLoader = ConstructFileLoader(gamePath);
		filePath_ = gamePath;
	}

	return GetFileLoader()->Exists();
}
Exemplo n.º 2
0
u64 GameInfo::GetGameSizeInBytes() {
	switch (fileType) {
	case FILETYPE_PSP_PBP_DIRECTORY:
	case FILETYPE_PSP_SAVEDATA_DIRECTORY:
	{
		return GetDirectoryRecursiveSize(filePath_);
	}
	default:
		return GetFileLoader()->FileSize();
	}
}
Exemplo n.º 3
0
bool GameInfo::LoadFromPath(const std::string &gamePath) {
	lock_guard guard(lock);
	// No need to rebuild if we already have it loaded.
	if (filePath_ != gamePath) {
		delete fileLoader;
		fileLoader = ConstructFileLoader(gamePath);
		filePath_ = gamePath;

		// This is a fallback title, while we're loading / if unable to load.
		title = File::GetFilename(filePath_);
	}

	return GetFileLoader()->Exists();
}
Exemplo n.º 4
0
std::unique_ptr<AppLoader> GetLoader(const std::string& filename) {
    FileUtil::IOFile file(filename, "rb");
    if (!file.IsOpen()) {
        LOG_ERROR(Loader, "Failed to load file %s", filename.c_str());
        return nullptr;
    }

    std::string filename_filename, filename_extension;
    Common::SplitPath(filename, nullptr, &filename_filename, &filename_extension);

    FileType type = IdentifyFile(file);
    FileType filename_type = GuessFromExtension(filename_extension);

    if (type != filename_type) {
        LOG_WARNING(Loader, "File %s has a different type than its extension.", filename.c_str());
        if (FileType::Unknown == type)
            type = filename_type;
    }

    LOG_DEBUG(Loader, "Loading file %s as %s...", filename.c_str(), GetFileTypeString(type));

    return GetFileLoader(std::move(file), type, filename_filename, filename);
}