More work on the Homebrew Store.

This commit is contained in:
Henrik Rydgård 2013-11-20 14:42:48 +01:00
parent 3164f5f487
commit 5833bd45c3
2 changed files with 14 additions and 6 deletions

View File

@ -50,7 +50,6 @@ bool GameManager::DownloadAndInstall(std::string storeZipUrl) {
return false; return false;
} }
// TODO: Android-compatible temp file names
std::string filename = GetTempFilename(); std::string filename = GetTempFilename();
curDownload_ = downloader_.StartDownload(storeZipUrl, filename); curDownload_ = downloader_.StartDownload(storeZipUrl, filename);
return true; return true;
@ -152,7 +151,17 @@ void GameManager::InstallGame(std::string zipfile) {
return; return;
} }
// Now, loop through again, writing files. // Create all the directories in one pass
for (int i = 0; i < numFiles; i++) {
const char *fn = zip_get_name(z, i, 0);
std::string outFilename = pspGame + fn;
bool isDir = outFilename.back() == '/';
if (isDir) {
File::CreateFullPath(outFilename.c_str());
}
}
// Now, loop through again in a second pass, writing files.
for (int i = 0; i < numFiles; i++) { for (int i = 0; i < numFiles; i++) {
const char *fn = zip_get_name(z, i, 0); const char *fn = zip_get_name(z, i, 0);
// Note that we do NOT write files that are not in a directory, to avoid random // Note that we do NOT write files that are not in a directory, to avoid random

View File

@ -42,8 +42,7 @@ void ProductItemView::Update(const InputState &input_state) {
// This is a "details" view of a game. Let's you install it. // This is a "details" view of a game. Let's you install it.
class ProductView : public UI::LinearLayout { class ProductView : public UI::LinearLayout {
public: public:
ProductView(const StoreEntry &entry) ProductView(const StoreEntry &entry) : LinearLayout(UI::ORIENT_VERTICAL), entry_(entry), installButton_(0) {
: LinearLayout(UI::ORIENT_VERTICAL), entry_(entry), installButton_(0) {
CreateViews(); CreateViews();
} }
@ -86,13 +85,13 @@ void ProductView::CreateViews() {
void ProductView::Update(const InputState &input_state) { void ProductView::Update(const InputState &input_state) {
View::Update(input_state); View::Update(input_state);
// TODO: Update progress bar etc.
} }
UI::EventReturn ProductView::OnInstall(UI::EventParams &e) { UI::EventReturn ProductView::OnInstall(UI::EventParams &e) {
std::string zipUrl = storeBaseUrl + "files/" + entry_.file + ".zip"; std::string zipUrl = storeBaseUrl + "files/" + entry_.file + ".zip";
if (installButton_) if (installButton_) {
installButton_->SetEnabled(false); installButton_->SetEnabled(false);
}
INFO_LOG(HLE, "Triggering install of %s", zipUrl.c_str()); INFO_LOG(HLE, "Triggering install of %s", zipUrl.c_str());
g_GameManager.DownloadAndInstall(zipUrl); g_GameManager.DownloadAndInstall(zipUrl);
return UI::EVENT_DONE; return UI::EVENT_DONE;