From bd15ae4f759b996efa282fd9df4df6612567a66f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 12 Jul 2021 11:09:39 +0200 Subject: [PATCH] Fix bug in homebrew store with files with "." in their names. Also, move the homebrew store button to the top bar instead of the bottom of the list. --- GPU/Vulkan/GPU_Vulkan.cpp | 1 + UI/MainScreen.cpp | 10 +++++----- UI/Store.cpp | 15 ++------------- UI/Store.h | 1 - 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 0ee43904b3..6b4c5e7d03 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -256,6 +256,7 @@ void GPU_Vulkan::CheckGPUFeatures() { features |= GPU_SUPPORTS_ANISOTROPY; } + // These are VULKAN_4444_FORMAT and friends. uint32_t fmt4444 = draw_->GetDataFormatSupport(Draw::DataFormat::B4G4R4A4_UNORM_PACK16); uint32_t fmt1555 = draw_->GetDataFormatSupport(Draw::DataFormat::A1R5G5B5_UNORM_PACK16); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 44c0bc497e..1f82b654a8 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -669,6 +669,11 @@ void GameBrowser::Refresh() { } else { topBar->Add(new Spacer(new LinearLayoutParams(FILL_PARENT, 64.0f, 1.0f))); } + + if (browseFlags_ & BrowseFlags::HOMEBREW_STORE) { + topBar->Add(new Choice(mm->T("PPSSPP Homebrew Store"), new UI::LinearLayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Handle(this, &GameBrowser::OnHomebrewStore); + } + ChoiceStrip *layoutChoice = topBar->Add(new ChoiceStrip(ORIENT_HORIZONTAL)); layoutChoice->AddChoice(ImageID("I_GRID")); layoutChoice->AddChoice(ImageID("I_LINES")); @@ -806,11 +811,6 @@ void GameBrowser::Refresh() { OnClick.Handle(this, &GameBrowser::PinToggleClick); } - if (browseFlags_ & BrowseFlags::HOMEBREW_STORE) { - Add(new Spacer()); - Add(new Choice(mm->T("DownloadFromStore", "Download from the PPSSPP Homebrew Store"), new UI::LinearLayoutParams(UI::WRAP_CONTENT, UI::WRAP_CONTENT)))->OnClick.Handle(this, &GameBrowser::OnHomebrewStore); - } - if (!lastText_.empty() && gameButtons.empty()) { Add(new Spacer()); Add(new Choice(lastText_, new UI::LinearLayoutParams(UI::WRAP_CONTENT, UI::WRAP_CONTENT)))->OnClick.Handle(this, &GameBrowser::LastClick); diff --git a/UI/Store.cpp b/UI/Store.cpp index 111b2b2731..a879c6e5f0 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -304,11 +304,8 @@ void ProductView::Update() { std::string ProductView::DownloadURL() { if (entry_.downloadURL.empty()) { - // Construct the URL, easy to predict from our server - std::string shortName = entry_.file; - if (shortName.find('.') == std::string::npos) - shortName += ".zip"; - return storeBaseUrl + "files/" + shortName; + // Construct the URL. + return storeBaseUrl + "files/" + entry_.file + ".zip"; } else { // Use the provided URL, for external hosting. return entry_.downloadURL; @@ -559,14 +556,6 @@ UI::EventReturn StoreScreen::OnRetry(UI::EventParams &e) { return UI::EVENT_DONE; } -std::string StoreScreen::GetStoreJsonURL(std::string storePath) const { - std::string path = storeBaseUrl + storePath; - if (*path.rbegin() != '/') - path += '/'; - path += "index.json"; - return path; -} - std::string StoreScreen::GetTranslatedString(const json::JsonGet json, std::string key, const char *fallback) const { json::JsonGet dict = json.getDict("en_US"); if (dict && json.hasChild(lang_.c_str(), JSON_OBJECT)) { diff --git a/UI/Store.h b/UI/Store.h index b8cc7aefd0..d2d15a809f 100644 --- a/UI/Store.h +++ b/UI/Store.h @@ -81,7 +81,6 @@ private: ProductItemView *GetSelectedItem(); std::vector FilterEntries(); - std::string GetStoreJsonURL(std::string storePath) const; std::string GetTranslatedString(const json::JsonGet json, std::string key, const char *fallback = nullptr) const; std::shared_ptr listing_;