Improved error handling in ZIP installer

This commit is contained in:
Henrik Rydgård 2013-12-06 15:29:14 +01:00
parent a376f20d54
commit 37de6eee0f
4 changed files with 11 additions and 5 deletions

View file

@ -172,6 +172,10 @@ bool GameManager::InstallGame(std::string zipfile, bool deleteAfter) {
if (!isPSP) {
ERROR_LOG(HLE, "File not a PSP game, no EBOOT.PBP found.");
installProgress_ = 0.0f;
installInProgress_ = false;
installError_ = "Not a PSP game";
InstallDone();
return false;
}
@ -191,7 +195,7 @@ bool GameManager::InstallGame(std::string zipfile, bool deleteAfter) {
File::CreateFullPath(outFilename.c_str());
createdDirs.insert(outFilename);
}
if (!isDir) {
if (!isDir && strstr(fn, "/") != 0) {
struct zip_stat zstat;
if (zip_stat_index(z, i, 0, &zstat) >= 0) {
allBytes += zstat.size;
@ -256,7 +260,7 @@ bool GameManager::InstallGame(std::string zipfile, bool deleteAfter) {
}
}
}
INFO_LOG(HLE, "Extracted %i files (%i bytes).", numFiles, (int)bytesCopied);
INFO_LOG(HLE, "Extracted %i files (%i bytes / %i).", numFiles, (int)bytesCopied, (int)allBytes);
zip_close(z);
z = 0;

View file

@ -71,7 +71,6 @@ UI::EventReturn InstallZipScreen::OnInstall(UI::EventParams &params) {
if (g_GameManager.InstallGameOnThread(zipPath_, deleteZipFile_)) {
installStarted_ = true;
installChoice_->SetEnabled(false);
MainScreen::showHomebrewTab = true;
}
return UI::EVENT_DONE;
}
@ -90,6 +89,9 @@ void InstallZipScreen::update(InputState &input) {
std::string err = g_GameManager.GetInstallError();
if (!err.empty()) {
doneView_->SetText(iz->T(err.c_str()));
} else if (installStarted_) {
doneView_->SetText(iz->T("Installed!"));
MainScreen::showHomebrewTab = true;
}
}
UIScreen::update(input);

View file

@ -186,7 +186,7 @@ public:
w = 2 * D_pad_Radius * spacing_ + image.w * scale_;
h = 2 * D_pad_Radius * spacing_ + image.h * scale_;
};
float GetSpacing() const { return spacing_; }
virtual void SetSpacing(float s) { spacing_ = s; }

2
native

@ -1 +1 @@
Subproject commit 6730d2d2447b3235b952f483c41a48414140c45f
Subproject commit af08e8f1de16bc80314fe96f45605067e0592183