Make LocalFileLoader essentially private.
This commit is contained in:
parent
967b589778
commit
fd2d7406d1
5 changed files with 33 additions and 27 deletions
|
@ -469,7 +469,7 @@ void __UmdReplace(std::string filepath) {
|
|||
if (!currentUMD)
|
||||
return;
|
||||
|
||||
FileLoader *loadedFile = new LocalFileLoader(filepath);
|
||||
FileLoader *loadedFile = ConstructFileLoader(filepath);
|
||||
|
||||
IFileSystem* umd2;
|
||||
FileInfo info;
|
||||
|
|
|
@ -31,6 +31,34 @@
|
|||
#include "Core/ELF/PBPReader.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
|
||||
class LocalFileLoader : public FileLoader {
|
||||
public:
|
||||
LocalFileLoader(const std::string &filename);
|
||||
virtual ~LocalFileLoader();
|
||||
|
||||
virtual bool Reopen(const std::string &filename);
|
||||
|
||||
virtual bool Exists() override;
|
||||
virtual bool IsDirectory() override;
|
||||
virtual s64 FileSize() override;
|
||||
virtual std::string Path() const override;
|
||||
|
||||
virtual void Seek(s64 absolutePos) override;
|
||||
virtual size_t Read(size_t bytes, size_t count, void *data) override;
|
||||
virtual size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data) override;
|
||||
|
||||
private:
|
||||
// First only used by Android, but we can keep it here for everyone.
|
||||
int fd_;
|
||||
FILE *f_;
|
||||
u64 filesize_;
|
||||
std::string filename_;
|
||||
};
|
||||
|
||||
FileLoader *ConstructFileLoader(const std::string &filename) {
|
||||
return new LocalFileLoader(filename);
|
||||
}
|
||||
|
||||
LocalFileLoader::LocalFileLoader(const std::string &filename) {
|
||||
Reopen(filename);
|
||||
}
|
||||
|
|
|
@ -78,29 +78,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class LocalFileLoader : public FileLoader {
|
||||
public:
|
||||
LocalFileLoader(const std::string &filename);
|
||||
virtual ~LocalFileLoader();
|
||||
|
||||
virtual bool Reopen(const std::string &filename);
|
||||
|
||||
virtual bool Exists() override;
|
||||
virtual bool IsDirectory() override;
|
||||
virtual s64 FileSize() override;
|
||||
virtual std::string Path() const override;
|
||||
|
||||
virtual void Seek(s64 absolutePos) override;
|
||||
virtual size_t Read(size_t bytes, size_t count, void *data) override;
|
||||
virtual size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data) override;
|
||||
|
||||
private:
|
||||
// First only used by Android, but we can keep it here for everyone.
|
||||
int fd_;
|
||||
FILE *f_;
|
||||
u64 filesize_;
|
||||
std::string filename_;
|
||||
};
|
||||
FileLoader *ConstructFileLoader(const std::string &filename);
|
||||
|
||||
// This can modify the string, for example for stripping off the "/EBOOT.PBP"
|
||||
// for a FILETYPE_PSP_PBP_DIRECTORY.
|
||||
|
|
|
@ -182,12 +182,12 @@ void CPU_Init() {
|
|||
Memory::g_PSPModel = g_Config.iPSPModel;
|
||||
|
||||
std::string filename = coreParameter.fileToStart;
|
||||
loadedFile = new LocalFileLoader(filename);
|
||||
loadedFile = ConstructFileLoader(filename);
|
||||
IdentifiedFileType type = Identify_File(loadedFile);
|
||||
|
||||
// TODO: Put this somewhere better?
|
||||
if (coreParameter.mountIso != "") {
|
||||
coreParameter.mountIsoLoader = new LocalFileLoader(coreParameter.mountIso);
|
||||
coreParameter.mountIsoLoader = ConstructFileLoader(coreParameter.mountIso);
|
||||
}
|
||||
|
||||
MIPSAnalyst::Reset();
|
||||
|
|
|
@ -247,7 +247,7 @@ public:
|
|||
return;
|
||||
|
||||
std::string filename = gamePath_;
|
||||
std::unique_ptr<FileLoader> fileLoader(new LocalFileLoader(filename));
|
||||
std::unique_ptr<FileLoader> fileLoader(ConstructFileLoader(filename));
|
||||
info_->path = gamePath_;
|
||||
info_->fileType = Identify_File(fileLoader.get());
|
||||
// Fallback title
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue