mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-12 20:40:49 +00:00
Make GameInfo use FileLoader for more things.
This way it can actually load the assets of a recent http:// entry.
This commit is contained in:
parent
256ea0c062
commit
c16e5513b0
@ -44,13 +44,17 @@
|
||||
|
||||
GameInfoCache g_gameInfoCache;
|
||||
|
||||
GameInfo::~GameInfo() {
|
||||
delete fileLoader;
|
||||
}
|
||||
|
||||
bool GameInfo::DeleteGame() {
|
||||
switch (fileType) {
|
||||
case FILETYPE_PSP_ISO:
|
||||
case FILETYPE_PSP_ISO_NP:
|
||||
{
|
||||
// Just delete the one file (TODO: handle two-disk games as well somehow).
|
||||
const char *fileToRemove = fileInfo.fullName.c_str();
|
||||
const char *fileToRemove = fileLoader->Path().c_str();
|
||||
deleteFile(fileToRemove);
|
||||
auto i = std::find(g_Config.recentIsos.begin(), g_Config.recentIsos.end(), fileToRemove);
|
||||
if (i != g_Config.recentIsos.end()) {
|
||||
@ -62,7 +66,7 @@ bool GameInfo::DeleteGame() {
|
||||
{
|
||||
// TODO: This could be handled by Core/Util/GameManager too somehow.
|
||||
|
||||
const char *directoryToRemove = fileInfo.fullName.c_str();
|
||||
const char *directoryToRemove = fileLoader->Path().c_str();
|
||||
INFO_LOG(HLE, "Deleting %s", directoryToRemove);
|
||||
if (!File::DeleteDirRecursively(directoryToRemove)) {
|
||||
ERROR_LOG(HLE, "Failed to delete file");
|
||||
@ -73,7 +77,7 @@ bool GameInfo::DeleteGame() {
|
||||
}
|
||||
case FILETYPE_PSP_ELF:
|
||||
{
|
||||
const char *fileToRemove = fileInfo.fullName.c_str();
|
||||
const char *fileToRemove = fileLoader->Path().c_str();
|
||||
deleteFile(fileToRemove);
|
||||
return true;
|
||||
}
|
||||
@ -89,7 +93,7 @@ u64 GameInfo::GetGameSizeInBytes() {
|
||||
// TODO: Need to recurse here.
|
||||
return 0;
|
||||
default:
|
||||
return fileInfo.size;
|
||||
return fileLoader->FileSize();
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,14 +250,14 @@ public:
|
||||
}
|
||||
|
||||
virtual void run() {
|
||||
getFileInfo(gamePath_.c_str(), &info_->fileInfo);
|
||||
if (!info_->fileInfo.exists)
|
||||
delete info_->fileLoader;
|
||||
info_->fileLoader = ConstructFileLoader(gamePath_);
|
||||
if (!info_->fileLoader->Exists())
|
||||
return;
|
||||
|
||||
std::string filename = gamePath_;
|
||||
std::unique_ptr<FileLoader> fileLoader(ConstructFileLoader(filename));
|
||||
info_->path = gamePath_;
|
||||
info_->fileType = Identify_File(fileLoader.get());
|
||||
info_->fileType = Identify_File(info_->fileLoader);
|
||||
// Fallback title
|
||||
info_->title = getFilename(info_->path);
|
||||
|
||||
@ -382,7 +386,7 @@ handleELF:
|
||||
// Let's assume it's an ISO.
|
||||
// TODO: This will currently read in the whole directory tree. Not really necessary for just a
|
||||
// few files.
|
||||
BlockDevice *bd = constructBlockDevice(fileLoader.get());
|
||||
BlockDevice *bd = constructBlockDevice(info_->fileLoader);
|
||||
if (!bd)
|
||||
return; // nothing to do here..
|
||||
ISOFileSystem umd(&handles, bd, "/PSP_GAME");
|
||||
|
@ -96,7 +96,8 @@ public:
|
||||
: disc_total(0), disc_number(0), region(-1), fileType(FILETYPE_UNKNOWN), paramSFOLoaded(false),
|
||||
iconTexture(NULL), pic0Texture(NULL), pic1Texture(NULL), wantFlags(0),
|
||||
timeIconWasLoaded(0.0), timePic0WasLoaded(0.0), timePic1WasLoaded(0.0),
|
||||
gameSize(0), saveDataSize(0), installDataSize(0) {}
|
||||
gameSize(0), saveDataSize(0), installDataSize(0), fileLoader(nullptr) {}
|
||||
~GameInfo();
|
||||
|
||||
bool DeleteGame(); // Better be sure what you're doing when calling this.
|
||||
bool DeleteAllSaveData();
|
||||
@ -116,7 +117,6 @@ public:
|
||||
// to it.
|
||||
recursive_mutex lock;
|
||||
|
||||
FileInfo fileInfo;
|
||||
std::string path;
|
||||
std::string title; // for easy access, also available in paramSFO.
|
||||
std::string id;
|
||||
@ -156,6 +156,8 @@ public:
|
||||
u64 gameSize;
|
||||
u64 saveDataSize;
|
||||
u64 installDataSize;
|
||||
|
||||
FileLoader *fileLoader;
|
||||
};
|
||||
|
||||
class GameInfoCache {
|
||||
|
Loading…
x
Reference in New Issue
Block a user