Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Reset ZIP install errors for new ZIPs #15324

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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