Loaders: Rename Path() to GetPath().

Path is going to be a struct name.
This commit is contained in:
Henrik Rydgård 2021-05-09 17:10:14 -07:00 committed by Unknown W. Brackets
parent 96c109e6ce
commit 9480b6672b
15 changed files with 32 additions and 32 deletions

View file

@ -26,21 +26,21 @@
PBPReader::PBPReader(FileLoader *fileLoader) : file_(nullptr), header_(), isELF_(false) {
if (!fileLoader->Exists()) {
ERROR_LOG(LOADER, "Failed to open PBP file %s", fileLoader->Path().c_str());
ERROR_LOG(LOADER, "Failed to open PBP file %s", fileLoader->GetPath().c_str());
return;
}
fileSize_ = (size_t)fileLoader->FileSize();
if (fileLoader->ReadAt(0, sizeof(header_), (u8 *)&header_) != sizeof(header_)) {
ERROR_LOG(LOADER, "PBP is too small to be valid: %s", fileLoader->Path().c_str());
ERROR_LOG(LOADER, "PBP is too small to be valid: %s", fileLoader->GetPath().c_str());
return;
}
if (memcmp(header_.magic, "\0PBP", 4) != 0) {
if (memcmp(header_.magic, "\nFLE", 4) != 0) {
VERBOSE_LOG(LOADER, "%s: File actually an ELF, not a PBP", fileLoader->Path().c_str());
VERBOSE_LOG(LOADER, "%s: File actually an ELF, not a PBP", fileLoader->GetPath().c_str());
isELF_ = true;
} else {
ERROR_LOG(LOADER, "Magic number in %s indicated no PBP: %s", fileLoader->Path().c_str(), header_.magic);
ERROR_LOG(LOADER, "Magic number in %s indicated no PBP: %s", fileLoader->GetPath().c_str(), header_.magic);
}
return;
}

View file

@ -133,7 +133,7 @@ std::vector<std::string> DiskCachingFileLoader::GetCachedPathsInUse() {
void DiskCachingFileLoader::InitCache() {
std::lock_guard<std::mutex> guard(cachesMutex_);
std::string path = ProxiedFileLoader::Path();
std::string path = ProxiedFileLoader::GetPath();
auto &entry = caches_[path];
if (!entry) {
entry = new DiskCachingFileLoaderCache(path, filesize_);
@ -149,7 +149,7 @@ void DiskCachingFileLoader::ShutdownCache() {
if (cache_->Release()) {
// If it ran out of counts, delete it.
delete cache_;
caches_.erase(ProxiedFileLoader::Path());
caches_.erase(ProxiedFileLoader::GetPath());
}
cache_ = nullptr;
}

View file

@ -172,7 +172,7 @@ s64 HTTPFileLoader::FileSize() {
return filesize_;
}
std::string HTTPFileLoader::Path() const {
std::string HTTPFileLoader::GetPath() const {
return filename_;
}

View file

@ -38,7 +38,7 @@ public:
virtual bool ExistsFast() override;
virtual bool IsDirectory() override;
virtual s64 FileSize() override;
virtual std::string Path() const override;
virtual std::string GetPath() const override;
virtual size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags = Flags::NONE) override {
return ReadAt(absolutePos, bytes * count, data, flags) / bytes;

View file

@ -130,7 +130,7 @@ s64 LocalFileLoader::FileSize() {
return filesize_;
}
std::string LocalFileLoader::Path() const {
std::string LocalFileLoader::GetPath() const {
return filename_;
}

View file

@ -33,7 +33,7 @@ public:
virtual bool Exists() override;
virtual bool IsDirectory() override;
virtual s64 FileSize() override;
virtual std::string Path() const override;
virtual std::string GetPath() const override;
virtual size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags = Flags::NONE) override;
private:

View file

@ -129,7 +129,7 @@ bool BlobFileSystem::RemoveFile(const std::string &filename) {
}
bool BlobFileSystem::GetHostPath(const std::string &inpath, std::string &outpath) {
outpath = fileLoader_->Path();
outpath = fileLoader_->GetPath();
return true;
}

View file

@ -202,7 +202,7 @@ CISOFileBlockDevice::CISOFileBlockDevice(FileLoader *fileLoader)
u64 expectedFileSize = lastIndexPos << indexShift;
if (expectedFileSize > fileSize) {
ERROR_LOG(LOADER, "Expected CSO to at least be %lld bytes, but file is %lld bytes. File: '%s'",
expectedFileSize, fileSize, fileLoader->Path().c_str());
expectedFileSize, fileSize, fileLoader->GetPath().c_str());
NotifyReadError();
}
}

View file

@ -63,8 +63,8 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
ERROR_LOG(LOADER, "Invalid fileLoader");
return IdentifiedFileType::ERROR_IDENTIFYING;
}
if (fileLoader->Path().size() == 0) {
ERROR_LOG(LOADER, "Invalid filename %s", fileLoader->Path().c_str());
if (fileLoader->GetPath().size() == 0) {
ERROR_LOG(LOADER, "Invalid filename %s", fileLoader->GetPath().c_str());
return IdentifiedFileType::ERROR_IDENTIFYING;
}
@ -101,7 +101,7 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
// First, check if it's a directory with an EBOOT.PBP in it.
if (fileLoader->IsDirectory()) {
std::string filename = fileLoader->Path();
std::string filename = fileLoader->GetPath();
if (filename.size() > 4) {
// Check for existence of EBOOT.PBP, as required for "Directory games".
if (File::Exists((filename + "/EBOOT.PBP").c_str())) {
@ -142,7 +142,7 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
}
if (id == 'FLE\x7F') {
std::string filename = fileLoader->Path();
std::string filename = fileLoader->GetPath();
// There are a few elfs misnamed as pbp (like Trig Wars), accept that.
if (!strcasecmp(extension.c_str(), ".plf") || strstr(filename.c_str(),"BOOT.BIN") ||
!strcasecmp(extension.c_str(), ".elf") || !strcasecmp(extension.c_str(), ".prx") ||
@ -177,7 +177,7 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
// Let's check if we got pointed to a PBP within such a directory.
// If so we just move up and return the directory itself as the game.
std::string path = File::GetDir(fileLoader->Path());
std::string path = File::GetDir(fileLoader->GetPath());
// If loading from memstick...
size_t pos = path.find("/PSP/GAME/");
if (pos != std::string::npos) {
@ -207,8 +207,8 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
FileLoader *ResolveFileLoaderTarget(FileLoader *fileLoader) {
IdentifiedFileType type = Identify_File(fileLoader);
if (type == IdentifiedFileType::PSP_PBP_DIRECTORY) {
const std::string ebootFilename = ResolvePBPFile(fileLoader->Path());
if (ebootFilename != fileLoader->Path()) {
const std::string ebootFilename = ResolvePBPFile(fileLoader->GetPath());
if (ebootFilename != fileLoader->GetPath()) {
// Switch fileLoader to the actual EBOOT.
delete fileLoader;
fileLoader = ConstructFileLoader(ebootFilename);
@ -262,7 +262,7 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
coreState = CORE_BOOT_ERROR;
return false;
}
std::string path = fileLoader->Path();
std::string path = fileLoader->GetPath();
size_t pos = path.find("/PSP/GAME/");
if (pos != std::string::npos) {
path = ResolvePBPDirectory(path);
@ -369,7 +369,7 @@ bool UmdReplace(std::string filepath, std::string &error) {
if (!loadedFile->Exists()) {
delete loadedFile;
error = loadedFile->Path() + " doesn't exist";
error = loadedFile->GetPath() + " doesn't exist";
return false;
}
UpdateLoadedFile(loadedFile);

View file

@ -74,9 +74,9 @@ public:
}
virtual bool IsDirectory() = 0;
virtual s64 FileSize() = 0;
virtual std::string Path() const = 0;
virtual std::string GetPath() const = 0;
virtual std::string Extension() {
const std::string filename = Path();
const std::string filename = GetPath();
size_t pos = filename.find_last_of('.');
if (pos == filename.npos) {
return "";
@ -121,8 +121,8 @@ public:
s64 FileSize() override {
return backend_->FileSize();
}
std::string Path() const override {
return backend_->Path();
std::string GetPath() const override {
return backend_->GetPath();
}
void Cancel() override {
backend_->Cancel();

View file

@ -84,7 +84,7 @@ void InitMemoryForGameISO(FileLoader *fileLoader) {
IFileSystem *blockSystem = nullptr;
if (fileLoader->IsDirectory()) {
fileSystem = new VirtualDiscFileSystem(&pspFileSystem, fileLoader->Path());
fileSystem = new VirtualDiscFileSystem(&pspFileSystem, fileLoader->GetPath());
blockSystem = fileSystem;
} else {
auto bd = constructBlockDevice(fileLoader);
@ -152,7 +152,7 @@ bool ReInitMemoryForGameISO(FileLoader *fileLoader) {
IFileSystem *blockSystem = nullptr;
if (fileLoader->IsDirectory()) {
fileSystem = new VirtualDiscFileSystem(&pspFileSystem, fileLoader->Path());
fileSystem = new VirtualDiscFileSystem(&pspFileSystem, fileLoader->GetPath());
blockSystem = fileSystem;
} else {
auto bd = constructBlockDevice(fileLoader);
@ -371,7 +371,7 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) {
}
}
std::string full_path = fileLoader->Path();
std::string full_path = fileLoader->GetPath();
std::string path, file, extension;
SplitPath(ReplaceAll(full_path, "\\", "/"), &path, &file, &extension);

View file

@ -370,7 +370,7 @@ public:
if (pbp.IsELF()) {
goto handleELF;
}
ERROR_LOG(LOADER, "invalid pbp %s\n", pbpLoader->Path().c_str());
ERROR_LOG(LOADER, "invalid pbp %s\n", pbpLoader->GetPath().c_str());
info_->pending = false;
info_->working = false;
return;

View file

@ -131,7 +131,7 @@ s64 StorageFileLoader::FileSize() {
return size_;
}
std::string StorageFileLoader::Path() const {
std::string StorageFileLoader::GetPath() const {
return path_;
}

View file

@ -24,7 +24,7 @@ public:
bool IsDirectory() override;
s64 FileSize() override;
std::string Path() const override;
std::string GetPath() const override;
std::string Extension() override;
size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags = Flags::NONE) override;

View file

@ -21,7 +21,7 @@ public:
StorageFolderBrowser(Windows::Storage::StorageFolder ^folder);
~StorageFolderBrowser();
std::string Path() const {
std::string GetPath() const {
return path_;
}