2013-11-20 14:42:48 +01:00
|
|
|
// Copyright (c) 2013- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
|
|
|
|
|
|
// Manages the PSP/GAME directory contents.
|
|
|
|
//
|
|
|
|
// Not concerned with full ISOs.
|
|
|
|
|
|
|
|
#include "net/http_client.h"
|
|
|
|
|
|
|
|
class GameManager {
|
|
|
|
public:
|
2013-12-05 13:01:00 +01:00
|
|
|
GameManager();
|
|
|
|
|
2013-11-20 14:42:48 +01:00
|
|
|
bool IsGameInstalled(std::string name);
|
|
|
|
|
|
|
|
// This starts off a background process.
|
|
|
|
bool DownloadAndInstall(std::string storeZipUrl);
|
2013-11-20 19:48:44 +01:00
|
|
|
bool Uninstall(std::string name);
|
2013-11-20 14:42:48 +01:00
|
|
|
|
|
|
|
// Call from time to time to check on completed downloads from the
|
|
|
|
// main UI thread.
|
|
|
|
void Update();
|
|
|
|
|
2013-12-05 13:01:00 +01:00
|
|
|
// Returns false if no install is in progress.
|
|
|
|
bool IsInstallInProgress() const {
|
|
|
|
return installInProgress_;
|
|
|
|
}
|
|
|
|
float GetCurrentInstallProgress() const {
|
|
|
|
return installProgress_;
|
|
|
|
}
|
|
|
|
|
2013-12-05 14:11:35 +01:00
|
|
|
// Only returns false if there's already an installation in progress.
|
|
|
|
bool InstallGameOnThread(std::string zipFile);
|
|
|
|
|
2013-11-20 14:42:48 +01:00
|
|
|
private:
|
2013-12-05 13:01:00 +01:00
|
|
|
bool InstallGame(std::string zipfile);
|
2013-11-20 16:36:58 +01:00
|
|
|
std::string GetTempFilename() const;
|
2013-11-20 14:42:48 +01:00
|
|
|
std::shared_ptr<http::Download> curDownload_;
|
2013-12-05 13:01:00 +01:00
|
|
|
|
|
|
|
bool installInProgress_;
|
|
|
|
float installProgress_;
|
2013-11-20 14:42:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern GameManager g_GameManager;
|