From 37de6eee0f38565e6a42b0ad1ef2d59dc58bece4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 6 Dec 2013 15:29:14 +0100 Subject: [PATCH] Improved error handling in ZIP installer --- Core/Util/GameManager.cpp | 8 ++++++-- UI/InstallZipScreen.cpp | 4 +++- UI/TouchControlLayoutScreen.cpp | 2 +- native | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index 7adb56cb84..4ca4988611 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -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; diff --git a/UI/InstallZipScreen.cpp b/UI/InstallZipScreen.cpp index 7f6b5c01f8..b01d223c81 100644 --- a/UI/InstallZipScreen.cpp +++ b/UI/InstallZipScreen.cpp @@ -71,7 +71,6 @@ UI::EventReturn InstallZipScreen::OnInstall(UI::EventParams ¶ms) { 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); diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index 183a848df4..6446c32112 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -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; } diff --git a/native b/native index 6730d2d244..af08e8f1de 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 6730d2d2447b3235b952f483c41a48414140c45f +Subproject commit af08e8f1de16bc80314fe96f45605067e0592183