Don't trust the messy error checking in EmuScreen with figuring out what to do with zip files.

Ran into multiple odd bugs, the PSP init process really needs a rework..
This commit is contained in:
Henrik Rydgård committed 2020-07-27 16:55:44 +02:00
1 parent fbaba82c68
commit 0939804a23
2 files changed
+26 -12

No files matched your search

+26 -3
View File
@@ -52,6 +52,7 @@
#include "UI/DisplayLayoutScreen.h"
#include "UI/SavedataScreen.h"
#include "UI/Store.h"
#include "UI/InstallZipScreen.h"
#include "Core/Config.h"
#include "Core/Loaders.h"
#include "GPU/GPUInterface.h"
@@ -74,6 +75,29 @@
bool MainScreen::showHomebrewTab = false;
bool LaunchFile(ScreenManager *screenManager, std::string path) {
// Depending on the file type, we don't want to launch EmuScreen at all.
auto loader = ConstructFileLoader(path);
if (!loader) {
return false;
}
IdentifiedFileType type = Identify_File(loader);
delete loader;
switch (type) {
case IdentifiedFileType::ARCHIVE_ZIP:
// Special handling for ZIP files. It's not very robust to check an error message but meh,
// at least it's pre-translation.
screenManager->push(new InstallZipScreen(path));
break;
default:
// Let the EmuScreen take care of it.
screenManager->switchScreen(new EmuScreen(path));
break;
}
}
static bool IsTempPath(const std::string &str) {
std::string item = str;
@@ -1155,7 +1179,7 @@ void MainScreen::sendMessage(const char *message, const char *value) {
if (screenManager()->topScreen() == this) {
if (!strcmp(message, "boot")) {
screenManager()->switchScreen(new EmuScreen(value));
LaunchFile(screenManager(), std::string(value));
}
if (!strcmp(message, "browse_folderSelect")) {
int tab = tabHolder_->GetCurrentTab();
@@ -1304,8 +1328,7 @@ UI::EventReturn MainScreen::OnGameSelectedInstant(UI::EventParams &e) {
#else
std::string path = e.s;
#endif
// Go directly into the game.
screenManager()->switchScreen(new EmuScreen(path));
LaunchFile(screenManager(), path);
return UI::EVENT_DONE;
}