mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-22 18:00:28 +00:00
Make IdentifiedFileType a proper enum class
This commit is contained in:
parent
a0688d4161
commit
5b835839fa
100
Core/Loaders.cpp
100
Core/Loaders.cpp
@ -45,15 +45,15 @@ FileLoader *ConstructFileLoader(const std::string &filename) {
|
||||
IdentifiedFileType Identify_File(FileLoader *fileLoader) {
|
||||
if (fileLoader == nullptr) {
|
||||
ERROR_LOG(LOADER, "Invalid fileLoader");
|
||||
return FILETYPE_ERROR;
|
||||
return IdentifiedFileType::ERROR_IDENTIFYING;
|
||||
}
|
||||
if (fileLoader->Path().size() == 0) {
|
||||
ERROR_LOG(LOADER, "Invalid filename %s", fileLoader->Path().c_str());
|
||||
return FILETYPE_ERROR;
|
||||
return IdentifiedFileType::ERROR_IDENTIFYING;
|
||||
}
|
||||
|
||||
if (!fileLoader->Exists()) {
|
||||
return FILETYPE_ERROR;
|
||||
return IdentifiedFileType::ERROR_IDENTIFYING;
|
||||
}
|
||||
|
||||
std::string extension = fileLoader->Extension();
|
||||
@ -68,20 +68,20 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
|
||||
// each sector in a mode2 image starts with these 12 bytes
|
||||
if (memcmp(sync,"\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00",12) == 0)
|
||||
{
|
||||
return FILETYPE_ISO_MODE2;
|
||||
return IdentifiedFileType::ISO_MODE2;
|
||||
}
|
||||
|
||||
// maybe it also just happened to have that size,
|
||||
}
|
||||
return FILETYPE_PSP_ISO;
|
||||
return IdentifiedFileType::PSP_ISO;
|
||||
}
|
||||
else if (!strcasecmp(extension.c_str(),".cso"))
|
||||
{
|
||||
return FILETYPE_PSP_ISO;
|
||||
return IdentifiedFileType::PSP_ISO;
|
||||
}
|
||||
else if (!strcasecmp(extension.c_str(),".ppst"))
|
||||
{
|
||||
return FILETYPE_PPSSPP_SAVESTATE;
|
||||
return IdentifiedFileType::PPSSPP_SAVESTATE;
|
||||
}
|
||||
|
||||
// First, check if it's a directory with an EBOOT.PBP in it.
|
||||
@ -90,28 +90,28 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
|
||||
if (filename.size() > 4) {
|
||||
// Check for existence of EBOOT.PBP, as required for "Directory games".
|
||||
if (File::Exists((filename + "/EBOOT.PBP").c_str())) {
|
||||
return FILETYPE_PSP_PBP_DIRECTORY;
|
||||
return IdentifiedFileType::PSP_PBP_DIRECTORY;
|
||||
}
|
||||
|
||||
// check if it's a disc directory
|
||||
if (File::Exists((filename + "/PSP_GAME").c_str())) {
|
||||
return FILETYPE_PSP_DISC_DIRECTORY;
|
||||
return IdentifiedFileType::PSP_DISC_DIRECTORY;
|
||||
}
|
||||
|
||||
// Not that, okay, let's guess it's a savedata directory if it has a param.sfo...
|
||||
if (File::Exists((filename + "/PARAM.SFO").c_str())) {
|
||||
return FILETYPE_PSP_SAVEDATA_DIRECTORY;
|
||||
return IdentifiedFileType::PSP_SAVEDATA_DIRECTORY;
|
||||
}
|
||||
}
|
||||
|
||||
return FILETYPE_NORMAL_DIRECTORY;
|
||||
return IdentifiedFileType::NORMAL_DIRECTORY;
|
||||
}
|
||||
|
||||
u32_le id;
|
||||
|
||||
size_t readSize = fileLoader->ReadAt(0, 4, 1, &id);
|
||||
if (readSize != 1) {
|
||||
return FILETYPE_ERROR;
|
||||
return IdentifiedFileType::ERROR_IDENTIFYING;
|
||||
}
|
||||
|
||||
u32 psar_offset = 0, psar_id = 0;
|
||||
@ -122,11 +122,11 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
|
||||
fileLoader->ReadAt(psar_offset, 4, 1, &psar_id);
|
||||
break;
|
||||
case '!raR':
|
||||
return FILETYPE_ARCHIVE_RAR;
|
||||
return IdentifiedFileType::ARCHIVE_RAR;
|
||||
case '\x04\x03KP':
|
||||
case '\x06\x05KP':
|
||||
case '\x08\x07KP':
|
||||
return FILETYPE_ARCHIVE_ZIP;
|
||||
return IdentifiedFileType::ARCHIVE_ZIP;
|
||||
}
|
||||
|
||||
if (id == 'FLE\x7F') {
|
||||
@ -135,9 +135,9 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
|
||||
if (!strcasecmp(extension.c_str(), ".plf") || strstr(filename.c_str(),"BOOT.BIN") ||
|
||||
!strcasecmp(extension.c_str(), ".elf") || !strcasecmp(extension.c_str(), ".prx") ||
|
||||
!strcasecmp(extension.c_str(), ".pbp")) {
|
||||
return FILETYPE_PSP_ELF;
|
||||
return IdentifiedFileType::PSP_ELF;
|
||||
}
|
||||
return FILETYPE_UNKNOWN_ELF;
|
||||
return IdentifiedFileType::UNKNOWN_ELF;
|
||||
}
|
||||
else if (id == 'PBP\x00') {
|
||||
// Do this PS1 eboot check FIRST before checking other eboot types.
|
||||
@ -151,16 +151,16 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
|
||||
// PS1 Eboots are supposed to use "ME" as their PARAM SFO category.
|
||||
// If they don't, and they're still malformed (e.g. PSISOIMG0000 isn't found), there's nothing we can do.
|
||||
if (paramSFO.GetValueString("CATEGORY") == "ME")
|
||||
return FILETYPE_PSP_PS1_PBP;
|
||||
return IdentifiedFileType::PSP_PS1_PBP;
|
||||
}
|
||||
}
|
||||
|
||||
if (psar_id == 'MUPN') {
|
||||
return FILETYPE_PSP_ISO_NP;
|
||||
return IdentifiedFileType::PSP_ISO_NP;
|
||||
}
|
||||
// PS1 PSAR begins with "PSISOIMG0000"
|
||||
if (psar_id == 'SISP') {
|
||||
return FILETYPE_PSP_PS1_PBP;
|
||||
return IdentifiedFileType::PSP_PS1_PBP;
|
||||
}
|
||||
|
||||
// Let's check if we got pointed to a PBP within such a directory.
|
||||
@ -169,32 +169,32 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
|
||||
// If loading from memstick...
|
||||
size_t pos = path.find("/PSP/GAME/");
|
||||
if (pos != std::string::npos) {
|
||||
return FILETYPE_PSP_PBP_DIRECTORY;
|
||||
return IdentifiedFileType::PSP_PBP_DIRECTORY;
|
||||
}
|
||||
return FILETYPE_PSP_PBP;
|
||||
return IdentifiedFileType::PSP_PBP;
|
||||
}
|
||||
else if (!strcasecmp(extension.c_str(),".pbp")) {
|
||||
ERROR_LOG(LOADER, "A PBP with the wrong magic number?");
|
||||
return FILETYPE_PSP_PBP;
|
||||
return IdentifiedFileType::PSP_PBP;
|
||||
} else if (!strcasecmp(extension.c_str(),".bin")) {
|
||||
return FILETYPE_UNKNOWN_BIN;
|
||||
return IdentifiedFileType::UNKNOWN_BIN;
|
||||
} else if (!strcasecmp(extension.c_str(),".zip")) {
|
||||
return FILETYPE_ARCHIVE_ZIP;
|
||||
return IdentifiedFileType::ARCHIVE_ZIP;
|
||||
} else if (!strcasecmp(extension.c_str(),".rar")) {
|
||||
return FILETYPE_ARCHIVE_RAR;
|
||||
return IdentifiedFileType::ARCHIVE_RAR;
|
||||
} else if (!strcasecmp(extension.c_str(),".r00")) {
|
||||
return FILETYPE_ARCHIVE_RAR;
|
||||
return IdentifiedFileType::ARCHIVE_RAR;
|
||||
} else if (!strcasecmp(extension.c_str(),".r01")) {
|
||||
return FILETYPE_ARCHIVE_RAR;
|
||||
return IdentifiedFileType::ARCHIVE_RAR;
|
||||
} else if (!extension.empty() && !strcasecmp(extension.substr(1).c_str(), ".7z")) {
|
||||
return FILETYPE_ARCHIVE_7Z;
|
||||
return IdentifiedFileType::ARCHIVE_7Z;
|
||||
}
|
||||
return FILETYPE_UNKNOWN;
|
||||
return IdentifiedFileType::UNKNOWN;
|
||||
}
|
||||
|
||||
FileLoader *ResolveFileLoaderTarget(FileLoader *fileLoader) {
|
||||
IdentifiedFileType type = Identify_File(fileLoader);
|
||||
if (type == FILETYPE_PSP_PBP_DIRECTORY) {
|
||||
if (type == IdentifiedFileType::PSP_PBP_DIRECTORY) {
|
||||
const std::string ebootFilename = ResolvePBPFile(fileLoader->Path());
|
||||
if (ebootFilename != fileLoader->Path()) {
|
||||
// Switch fileLoader to the actual EBOOT.
|
||||
@ -233,19 +233,19 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
|
||||
FileLoader *&fileLoader = *fileLoaderPtr;
|
||||
// Note that this can modify filename!
|
||||
switch (Identify_File(fileLoader)) {
|
||||
case FILETYPE_PSP_PBP_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
{
|
||||
// TODO: Perhaps we should/can never get here now?
|
||||
fileLoader = ResolveFileLoaderTarget(fileLoader);
|
||||
if (fileLoader->Exists()) {
|
||||
INFO_LOG(LOADER, "File is a PBP in a directory!");
|
||||
IdentifiedFileType ebootType = Identify_File(fileLoader);
|
||||
if (ebootType == FILETYPE_PSP_ISO_NP) {
|
||||
if (ebootType == IdentifiedFileType::PSP_ISO_NP) {
|
||||
InitMemoryForGameISO(fileLoader);
|
||||
pspFileSystem.SetStartingDirectory("disc0:/PSP_GAME/USRDIR");
|
||||
return Load_PSP_ISO(fileLoader, error_string);
|
||||
}
|
||||
else if (ebootType == FILETYPE_PSP_PS1_PBP) {
|
||||
else if (ebootType == IdentifiedFileType::PSP_PS1_PBP) {
|
||||
*error_string = "PS1 EBOOTs are not supported by PPSSPP.";
|
||||
return false;
|
||||
}
|
||||
@ -262,29 +262,29 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
|
||||
}
|
||||
}
|
||||
|
||||
case FILETYPE_PSP_PBP:
|
||||
case FILETYPE_PSP_ELF:
|
||||
case IdentifiedFileType::PSP_PBP:
|
||||
case IdentifiedFileType::PSP_ELF:
|
||||
{
|
||||
INFO_LOG(LOADER,"File is an ELF or loose PBP!");
|
||||
return Load_PSP_ELF_PBP(fileLoader, error_string);
|
||||
}
|
||||
|
||||
case FILETYPE_PSP_ISO:
|
||||
case FILETYPE_PSP_ISO_NP:
|
||||
case FILETYPE_PSP_DISC_DIRECTORY: // behaves the same as the mounting is already done by now
|
||||
case IdentifiedFileType::PSP_ISO:
|
||||
case IdentifiedFileType::PSP_ISO_NP:
|
||||
case IdentifiedFileType::PSP_DISC_DIRECTORY: // behaves the same as the mounting is already done by now
|
||||
pspFileSystem.SetStartingDirectory("disc0:/PSP_GAME/USRDIR");
|
||||
return Load_PSP_ISO(fileLoader, error_string);
|
||||
|
||||
case FILETYPE_PSP_PS1_PBP:
|
||||
case IdentifiedFileType::PSP_PS1_PBP:
|
||||
*error_string = "PS1 EBOOTs are not supported by PPSSPP.";
|
||||
break;
|
||||
|
||||
case FILETYPE_ERROR:
|
||||
case IdentifiedFileType::ERROR_IDENTIFYING:
|
||||
ERROR_LOG(LOADER, "Could not read file");
|
||||
*error_string = "Error reading file";
|
||||
break;
|
||||
|
||||
case FILETYPE_ARCHIVE_RAR:
|
||||
case IdentifiedFileType::ARCHIVE_RAR:
|
||||
#ifdef WIN32
|
||||
*error_string = "RAR file detected (Require WINRAR)";
|
||||
#else
|
||||
@ -292,7 +292,7 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
|
||||
#endif
|
||||
break;
|
||||
|
||||
case FILETYPE_ARCHIVE_ZIP:
|
||||
case IdentifiedFileType::ARCHIVE_ZIP:
|
||||
#ifdef WIN32
|
||||
*error_string = "ZIP file detected (Require WINRAR)";
|
||||
#else
|
||||
@ -300,7 +300,7 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
|
||||
#endif
|
||||
break;
|
||||
|
||||
case FILETYPE_ARCHIVE_7Z:
|
||||
case IdentifiedFileType::ARCHIVE_7Z:
|
||||
#ifdef WIN32
|
||||
*error_string = "7z file detected (Require 7-Zip)";
|
||||
#else
|
||||
@ -308,26 +308,26 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
|
||||
#endif
|
||||
break;
|
||||
|
||||
case FILETYPE_ISO_MODE2:
|
||||
case IdentifiedFileType::ISO_MODE2:
|
||||
*error_string = "PSX game image detected.";
|
||||
break;
|
||||
|
||||
case FILETYPE_NORMAL_DIRECTORY:
|
||||
case IdentifiedFileType::NORMAL_DIRECTORY:
|
||||
ERROR_LOG(LOADER, "Just a directory.");
|
||||
*error_string = "Just a directory.";
|
||||
break;
|
||||
|
||||
case FILETYPE_PPSSPP_SAVESTATE:
|
||||
case IdentifiedFileType::PPSSPP_SAVESTATE:
|
||||
*error_string = "This is a saved state, not a game."; // Actually, we could make it load it...
|
||||
break;
|
||||
|
||||
case FILETYPE_PSP_SAVEDATA_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
||||
*error_string = "This is save data, not a game."; // Actually, we could make it load it...
|
||||
break;
|
||||
|
||||
case FILETYPE_UNKNOWN_BIN:
|
||||
case FILETYPE_UNKNOWN_ELF:
|
||||
case FILETYPE_UNKNOWN:
|
||||
case IdentifiedFileType::UNKNOWN_BIN:
|
||||
case IdentifiedFileType::UNKNOWN_ELF:
|
||||
case IdentifiedFileType::UNKNOWN:
|
||||
default:
|
||||
ERROR_LOG(LOADER, "Failed to identify file");
|
||||
*error_string = "Failed to identify file";
|
||||
|
@ -19,34 +19,34 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
enum IdentifiedFileType {
|
||||
FILETYPE_ERROR,
|
||||
enum class IdentifiedFileType {
|
||||
ERROR_IDENTIFYING,
|
||||
|
||||
FILETYPE_PSP_PBP_DIRECTORY,
|
||||
PSP_PBP_DIRECTORY,
|
||||
|
||||
FILETYPE_PSP_PBP,
|
||||
FILETYPE_PSP_ELF,
|
||||
FILETYPE_PSP_ISO,
|
||||
FILETYPE_PSP_ISO_NP,
|
||||
PSP_PBP,
|
||||
PSP_ELF,
|
||||
PSP_ISO,
|
||||
PSP_ISO_NP,
|
||||
|
||||
FILETYPE_PSP_DISC_DIRECTORY,
|
||||
PSP_DISC_DIRECTORY,
|
||||
|
||||
FILETYPE_UNKNOWN_BIN,
|
||||
FILETYPE_UNKNOWN_ELF,
|
||||
UNKNOWN_BIN,
|
||||
UNKNOWN_ELF,
|
||||
|
||||
// Try to reduce support emails...
|
||||
FILETYPE_ARCHIVE_RAR,
|
||||
FILETYPE_ARCHIVE_ZIP,
|
||||
FILETYPE_ARCHIVE_7Z,
|
||||
FILETYPE_PSP_PS1_PBP,
|
||||
FILETYPE_ISO_MODE2,
|
||||
ARCHIVE_RAR,
|
||||
ARCHIVE_ZIP,
|
||||
ARCHIVE_7Z,
|
||||
PSP_PS1_PBP,
|
||||
ISO_MODE2,
|
||||
|
||||
FILETYPE_NORMAL_DIRECTORY,
|
||||
NORMAL_DIRECTORY,
|
||||
|
||||
FILETYPE_PSP_SAVEDATA_DIRECTORY,
|
||||
FILETYPE_PPSSPP_SAVESTATE,
|
||||
PSP_SAVEDATA_DIRECTORY,
|
||||
PPSSPP_SAVESTATE,
|
||||
|
||||
FILETYPE_UNKNOWN
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
class FileLoader {
|
||||
|
@ -217,15 +217,15 @@ void CPU_Init() {
|
||||
Replacement_Init();
|
||||
|
||||
switch (type) {
|
||||
case FILETYPE_PSP_ISO:
|
||||
case FILETYPE_PSP_ISO_NP:
|
||||
case FILETYPE_PSP_DISC_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_ISO:
|
||||
case IdentifiedFileType::PSP_ISO_NP:
|
||||
case IdentifiedFileType::PSP_DISC_DIRECTORY:
|
||||
InitMemoryForGameISO(loadedFile);
|
||||
break;
|
||||
case FILETYPE_PSP_PBP:
|
||||
case IdentifiedFileType::PSP_PBP:
|
||||
InitMemoryForGamePBP(loadedFile);
|
||||
break;
|
||||
case FILETYPE_PSP_PBP_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
// This is normal for homebrew.
|
||||
// ERROR_LOG(LOADER, "PBP directory resolution failed.");
|
||||
break;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "Core/ELF/PBPReader.h"
|
||||
#include "Core/SaveState.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Loaders.h"
|
||||
#include "Core/Util/GameManager.h"
|
||||
#include "Core/Config.h"
|
||||
#include "UI/GameInfoCache.h"
|
||||
@ -44,6 +45,13 @@
|
||||
|
||||
GameInfoCache *g_gameInfoCache;
|
||||
|
||||
GameInfo::GameInfo()
|
||||
: region(-1), fileType(IdentifiedFileType::UNKNOWN), paramSFOLoaded(false),
|
||||
hasConfig(false), iconTexture(nullptr), pic0Texture(nullptr), pic1Texture(nullptr), wantFlags(0),
|
||||
lastAccessedTime(0.0), timeIconWasLoaded(0.0), timePic0WasLoaded(0.0), timePic1WasLoaded(0.0),
|
||||
gameSize(0), saveDataSize(0), installDataSize(0), pending(true), working(false), fileLoader(nullptr) {
|
||||
}
|
||||
|
||||
GameInfo::~GameInfo() {
|
||||
delete iconTexture;
|
||||
delete pic0Texture;
|
||||
@ -53,8 +61,8 @@ GameInfo::~GameInfo() {
|
||||
|
||||
bool GameInfo::Delete() {
|
||||
switch (fileType) {
|
||||
case FILETYPE_PSP_ISO:
|
||||
case FILETYPE_PSP_ISO_NP:
|
||||
case IdentifiedFileType::PSP_ISO:
|
||||
case IdentifiedFileType::PSP_ISO_NP:
|
||||
{
|
||||
// Just delete the one file (TODO: handle two-disk games as well somehow).
|
||||
const char *fileToRemove = filePath_.c_str();
|
||||
@ -65,8 +73,8 @@ bool GameInfo::Delete() {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case FILETYPE_PSP_PBP_DIRECTORY:
|
||||
case FILETYPE_PSP_SAVEDATA_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
||||
{
|
||||
// TODO: This could be handled by Core/Util/GameManager too somehow.
|
||||
std::string directoryToRemove = ResolvePBPDirectory(filePath_);
|
||||
@ -78,19 +86,19 @@ bool GameInfo::Delete() {
|
||||
g_Config.CleanRecent();
|
||||
return true;
|
||||
}
|
||||
case FILETYPE_PSP_ELF:
|
||||
case FILETYPE_UNKNOWN_BIN:
|
||||
case FILETYPE_UNKNOWN_ELF:
|
||||
case FILETYPE_ARCHIVE_RAR:
|
||||
case FILETYPE_ARCHIVE_ZIP:
|
||||
case FILETYPE_ARCHIVE_7Z:
|
||||
case IdentifiedFileType::PSP_ELF:
|
||||
case IdentifiedFileType::UNKNOWN_BIN:
|
||||
case IdentifiedFileType::UNKNOWN_ELF:
|
||||
case IdentifiedFileType::ARCHIVE_RAR:
|
||||
case IdentifiedFileType::ARCHIVE_ZIP:
|
||||
case IdentifiedFileType::ARCHIVE_7Z:
|
||||
{
|
||||
const std::string &fileToRemove = filePath_;
|
||||
File::Delete(fileToRemove);
|
||||
return true;
|
||||
}
|
||||
|
||||
case FILETYPE_PPSSPP_SAVESTATE:
|
||||
case IdentifiedFileType::PPSSPP_SAVESTATE:
|
||||
{
|
||||
const std::string &ppstPath = filePath_;
|
||||
File::Delete(ppstPath);
|
||||
@ -124,8 +132,8 @@ static int64_t GetDirectoryRecursiveSize(const std::string &path) {
|
||||
|
||||
u64 GameInfo::GetGameSizeInBytes() {
|
||||
switch (fileType) {
|
||||
case FILETYPE_PSP_PBP_DIRECTORY:
|
||||
case FILETYPE_PSP_SAVEDATA_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
||||
return GetDirectoryRecursiveSize(ResolvePBPDirectory(filePath_));
|
||||
|
||||
default:
|
||||
@ -154,7 +162,7 @@ std::vector<std::string> GameInfo::GetSaveDataDirectories() {
|
||||
}
|
||||
|
||||
u64 GameInfo::GetSaveDataSizeInBytes() {
|
||||
if (fileType == FILETYPE_PSP_SAVEDATA_DIRECTORY || fileType == FILETYPE_PPSSPP_SAVESTATE) {
|
||||
if (fileType == IdentifiedFileType::PSP_SAVEDATA_DIRECTORY || fileType == IdentifiedFileType::PPSSPP_SAVESTATE) {
|
||||
return 0;
|
||||
}
|
||||
std::vector<std::string> saveDataDir = GetSaveDataDirectories();
|
||||
@ -181,7 +189,7 @@ u64 GameInfo::GetSaveDataSizeInBytes() {
|
||||
}
|
||||
|
||||
u64 GameInfo::GetInstallDataSizeInBytes() {
|
||||
if (fileType == FILETYPE_PSP_SAVEDATA_DIRECTORY || fileType == FILETYPE_PPSSPP_SAVESTATE) {
|
||||
if (fileType == IdentifiedFileType::PSP_SAVEDATA_DIRECTORY || fileType == IdentifiedFileType::PPSSPP_SAVESTATE) {
|
||||
return 0;
|
||||
}
|
||||
std::vector<std::string> saveDataDir = GetSaveDataDirectories();
|
||||
@ -369,12 +377,12 @@ public:
|
||||
}
|
||||
|
||||
switch (info_->fileType) {
|
||||
case FILETYPE_PSP_PBP:
|
||||
case FILETYPE_PSP_PBP_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_PBP:
|
||||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
{
|
||||
FileLoader *pbpLoader = info_->GetFileLoader();
|
||||
std::unique_ptr<FileLoader> altLoader;
|
||||
if (info_->fileType == FILETYPE_PSP_PBP_DIRECTORY) {
|
||||
if (info_->fileType == IdentifiedFileType::PSP_PBP_DIRECTORY) {
|
||||
std::string ebootPath = ResolvePBPFile(gamePath_);
|
||||
if (ebootPath != gamePath_) {
|
||||
pbpLoader = ConstructFileLoader(ebootPath);
|
||||
@ -432,7 +440,7 @@ public:
|
||||
}
|
||||
break;
|
||||
|
||||
case FILETYPE_PSP_ELF:
|
||||
case IdentifiedFileType::PSP_ELF:
|
||||
handleELF:
|
||||
// An elf on its own has no usable information, no icons, no nothing.
|
||||
{
|
||||
@ -448,7 +456,7 @@ handleELF:
|
||||
info_->iconDataLoaded = true;
|
||||
break;
|
||||
|
||||
case FILETYPE_PSP_SAVEDATA_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
||||
{
|
||||
SequentialHandleAllocator handles;
|
||||
VirtualDiscFileSystem umd(&handles, gamePath_.c_str());
|
||||
@ -470,7 +478,7 @@ handleELF:
|
||||
break;
|
||||
}
|
||||
|
||||
case FILETYPE_PPSSPP_SAVESTATE:
|
||||
case IdentifiedFileType::PPSSPP_SAVESTATE:
|
||||
{
|
||||
info_->SetTitle(SaveState::GetTitle(gamePath_));
|
||||
|
||||
@ -486,9 +494,9 @@ handleELF:
|
||||
break;
|
||||
}
|
||||
|
||||
case FILETYPE_PSP_DISC_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_DISC_DIRECTORY:
|
||||
{
|
||||
info_->fileType = FILETYPE_PSP_ISO;
|
||||
info_->fileType = IdentifiedFileType::PSP_ISO;
|
||||
SequentialHandleAllocator handles;
|
||||
VirtualDiscFileSystem umd(&handles, gamePath_.c_str());
|
||||
|
||||
@ -515,10 +523,10 @@ handleELF:
|
||||
break;
|
||||
}
|
||||
|
||||
case FILETYPE_PSP_ISO:
|
||||
case FILETYPE_PSP_ISO_NP:
|
||||
case IdentifiedFileType::PSP_ISO:
|
||||
case IdentifiedFileType::PSP_ISO_NP:
|
||||
{
|
||||
info_->fileType = FILETYPE_PSP_ISO;
|
||||
info_->fileType = IdentifiedFileType::PSP_ISO;
|
||||
SequentialHandleAllocator handles;
|
||||
// Let's assume it's an ISO.
|
||||
// TODO: This will currently read in the whole directory tree. Not really necessary for just a
|
||||
@ -556,7 +564,7 @@ handleELF:
|
||||
break;
|
||||
}
|
||||
|
||||
case FILETYPE_ARCHIVE_ZIP:
|
||||
case IdentifiedFileType::ARCHIVE_ZIP:
|
||||
info_->paramSFOLoaded = true;
|
||||
{
|
||||
ReadVFSToString("zip.png", &info_->iconTextureData, &info_->lock);
|
||||
@ -564,7 +572,7 @@ handleELF:
|
||||
}
|
||||
break;
|
||||
|
||||
case FILETYPE_ARCHIVE_RAR:
|
||||
case IdentifiedFileType::ARCHIVE_RAR:
|
||||
info_->paramSFOLoaded = true;
|
||||
{
|
||||
ReadVFSToString("rargray.png", &info_->iconTextureData, &info_->lock);
|
||||
@ -572,7 +580,7 @@ handleELF:
|
||||
}
|
||||
break;
|
||||
|
||||
case FILETYPE_ARCHIVE_7Z:
|
||||
case IdentifiedFileType::ARCHIVE_7Z:
|
||||
info_->paramSFOLoaded = true;
|
||||
{
|
||||
ReadVFSToString("7z.png", &info_->iconTextureData, &info_->lock);
|
||||
@ -580,7 +588,7 @@ handleELF:
|
||||
}
|
||||
break;
|
||||
|
||||
case FILETYPE_NORMAL_DIRECTORY:
|
||||
case IdentifiedFileType::NORMAL_DIRECTORY:
|
||||
default:
|
||||
info_->paramSFOLoaded = true;
|
||||
break;
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include "file/file_util.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
#include "Core/Loaders.h"
|
||||
#include "UI/TextureUtil.h"
|
||||
|
||||
namespace Draw {
|
||||
@ -55,6 +54,9 @@ enum GameInfoWantFlags {
|
||||
GAMEINFO_WANTSND = 0x04,
|
||||
};
|
||||
|
||||
class FileLoader;
|
||||
enum class IdentifiedFileType;
|
||||
|
||||
// TODO: Need to use std::atomic<bool> instead.
|
||||
class CompletionFlag {
|
||||
public:
|
||||
@ -97,11 +99,7 @@ private:
|
||||
|
||||
class GameInfo {
|
||||
public:
|
||||
GameInfo()
|
||||
: disc_total(0), disc_number(0), region(-1), fileType(FILETYPE_UNKNOWN), paramSFOLoaded(false),
|
||||
hasConfig(false), iconTexture(nullptr), pic0Texture(nullptr), pic1Texture(nullptr), wantFlags(0),
|
||||
lastAccessedTime(0.0), timeIconWasLoaded(0.0), timePic0WasLoaded(0.0), timePic1WasLoaded(0.0),
|
||||
gameSize(0), saveDataSize(0), installDataSize(0), pending(true), working(false), fileLoader(nullptr) {}
|
||||
GameInfo();
|
||||
~GameInfo();
|
||||
|
||||
bool Delete(); // Better be sure what you're doing when calling this.
|
||||
@ -133,9 +131,9 @@ public:
|
||||
|
||||
std::string id;
|
||||
std::string id_version;
|
||||
int disc_total;
|
||||
int disc_number;
|
||||
int region;
|
||||
int disc_total = 0;
|
||||
int disc_number = 0;
|
||||
int region = -1;
|
||||
IdentifiedFileType fileType;
|
||||
ParamSFOData paramSFO;
|
||||
bool paramSFOLoaded;
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "UI/Store.h"
|
||||
#include "UI/ui_atlas.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Loaders.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "i18n/i18n.h"
|
||||
|
||||
@ -1038,7 +1039,7 @@ UI::EventReturn MainScreen::OnGameSelected(UI::EventParams &e) {
|
||||
#endif
|
||||
GameInfo *ginfo = 0;
|
||||
ginfo = g_gameInfoCache->GetInfo(nullptr, path, GAMEINFO_WANTBG);
|
||||
if (ginfo && ginfo->fileType == FILETYPE_PSP_SAVEDATA_DIRECTORY) {
|
||||
if (ginfo && ginfo->fileType == IdentifiedFileType::PSP_SAVEDATA_DIRECTORY) {
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Loaders.h"
|
||||
#include "Core/SaveState.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
@ -75,7 +76,7 @@ public:
|
||||
content->Add(toprow);
|
||||
|
||||
I18NCategory *sa = GetI18NCategory("Savedata");
|
||||
if (ginfo->fileType == FILETYPE_PSP_SAVEDATA_DIRECTORY) {
|
||||
if (ginfo->fileType == IdentifiedFileType::PSP_SAVEDATA_DIRECTORY) {
|
||||
std::string savedata_detail = ginfo->paramSFO.GetValueString("SAVEDATA_DETAIL");
|
||||
std::string savedata_title = ginfo->paramSFO.GetValueString("SAVEDATA_TITLE");
|
||||
|
||||
@ -341,8 +342,8 @@ SavedataScreen::SavedataScreen(std::string gamePath) : UIDialogScreenWithGameBac
|
||||
|
||||
SavedataScreen::~SavedataScreen() {
|
||||
if (g_gameInfoCache) {
|
||||
g_gameInfoCache->PurgeType(FILETYPE_PPSSPP_SAVESTATE);
|
||||
g_gameInfoCache->PurgeType(FILETYPE_PSP_SAVEDATA_DIRECTORY);
|
||||
g_gameInfoCache->PurgeType(IdentifiedFileType::PPSSPP_SAVESTATE);
|
||||
g_gameInfoCache->PurgeType(IdentifiedFileType::PSP_SAVEDATA_DIRECTORY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,29 +1,24 @@
|
||||
// NOTE: Apologies for the quality of this code, this is really from pre-opensource Dolphin - that is, 2003.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Windows/W32Util/DialogManager.h"
|
||||
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
#include "Core/Debugger/DebugInterface.h"
|
||||
|
||||
class CVFPUDlg : public Dialog
|
||||
{
|
||||
class CVFPUDlg : public Dialog {
|
||||
public:
|
||||
CVFPUDlg(HINSTANCE _hInstance, HWND _hParent, DebugInterface *cpu_);
|
||||
~CVFPUDlg();
|
||||
|
||||
void Goto(u32 addr);
|
||||
void Update();
|
||||
void Size();
|
||||
|
||||
private:
|
||||
int index;
|
||||
DebugInterface *cpu;
|
||||
HFONT font;
|
||||
int mode;
|
||||
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
public:
|
||||
int index; //helper
|
||||
|
||||
CVFPUDlg(HINSTANCE _hInstance, HWND _hParent, DebugInterface *cpu_);
|
||||
~CVFPUDlg();
|
||||
|
||||
void Goto(u32 addr);
|
||||
void Update();
|
||||
void Size();
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user