Skip to content

Commit

Permalink
Merge pull request #15324 from unknownbrackets/ui-zip-error
Browse files Browse the repository at this point in the history
UI: Reset ZIP install errors for new ZIPs
  • Loading branch information
hrydgard authored Jan 17, 2022
2 parents 4ea1c08 + b0dbdb4 commit 2b2c92d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
17 changes: 10 additions & 7 deletions Core/Util/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ bool GameManager::DetectTexturePackDest(struct zip *z, int iniIndex, Path &dest)

void GameManager::SetInstallError(const std::string &err) {
installProgress_ = 0.0f;
installInProgress_ = false;
installError_ = err;
InstallDone();
}
Expand Down Expand Up @@ -597,12 +596,11 @@ bool GameManager::InstallMemstickGame(struct zip *z, const Path &zipfile, const
zip_close(z);
z = nullptr;
installProgress_ = 1.0f;
installError_ = "";
if (deleteAfter) {
File::Delete(zipfile);
}
InstallDone();
installInProgress_ = false;
ResetInstallError();
return true;

bail:
Expand Down Expand Up @@ -647,9 +645,8 @@ bool GameManager::InstallZippedISO(struct zip *z, int isoFileIndex, const Path &

z = 0;
installProgress_ = 1.0f;
installError_ = "";
InstallDone();
installInProgress_ = false;
ResetInstallError();
return true;
}

Expand All @@ -670,12 +667,18 @@ bool GameManager::InstallRawISO(const Path &file, const std::string &originalNam
}
}
installProgress_ = 1.0f;
installError_ = "";
InstallDone();
installInProgress_ = false;
ResetInstallError();
return true;
}

void GameManager::ResetInstallError() {
if (!installInProgress_) {
installError_ = "";
}
}

void GameManager::InstallDone() {
installInProgress_ = false;
installDonePending_ = true;
}
1 change: 1 addition & 0 deletions Core/Util/GameManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class GameManager {
float GetCurrentInstallProgressPercentage() const {
return installProgress_;
}
void ResetInstallError();
std::string GetInstallError() const {
return installError_;
}
Expand Down
4 changes: 4 additions & 0 deletions UI/InstallZipScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "UI/InstallZipScreen.h"
#include "UI/MainScreen.h"

InstallZipScreen::InstallZipScreen(const Path &zipPath) : zipPath_(zipPath) {
g_GameManager.ResetInstallError();
}

void InstallZipScreen::CreateViews() {
using namespace UI;

Expand Down
2 changes: 1 addition & 1 deletion UI/InstallZipScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class InstallZipScreen : public UIDialogScreenWithBackground {
public:
InstallZipScreen(const Path &zipPath) : zipPath_(zipPath) {}
InstallZipScreen(const Path &zipPath);
virtual void update() override;
virtual bool key(const KeyInput &key) override;

Expand Down

0 comments on commit 2b2c92d

Please sign in to comment.