From a5526d3b651d0a08e87d2708ca522ec6166a1600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 6 May 2024 17:33:33 +0200 Subject: [PATCH 1/4] PPSSPP Store: Increase the height of the top bar, the back button was too small --- UI/Store.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UI/Store.cpp b/UI/Store.cpp index 9dd2efc25457..1815f620182d 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -483,9 +483,9 @@ void StoreScreen::CreateViews() { auto mm = GetI18NCategory(I18NCat::MAINMENU); // Top bar - LinearLayout *topBar = root_->Add(new LinearLayout(ORIENT_HORIZONTAL)); - topBar->Add(new Button(di->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); - titleText_ = new TextView(mm->T("PPSSPP Homebrew Store")); + LinearLayout *topBar = root_->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, 64.0f))); + topBar->Add(new Choice(di->T("Back"), new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT)))->OnClick.Handle(this, &UIScreen::OnBack); + titleText_ = new TextView(mm->T("PPSSPP Homebrew Store"), ALIGN_VCENTER, false, new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT)); topBar->Add(titleText_); UI::Drawable solid(0xFFbd9939); topBar->SetBG(solid); From a75516f53eb80103c04279a91cd182219a46102e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 6 May 2024 13:50:56 +0200 Subject: [PATCH 2/4] Add support for a "content rating" field for apps in the homebrew store. This is to maximize likelihood of passing iOS review. --- UI/Store.cpp | 8 +++++++- UI/Store.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/UI/Store.cpp b/UI/Store.cpp index 1815f620182d..e558c4c9dd8c 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -456,7 +456,7 @@ void StoreScreen::ParseListing(const std::string &json) { entries_.clear(); for (const JsonNode *pgame : entries->value) { JsonGet game = pgame->value; - StoreEntry e; + StoreEntry e{}; e.type = ENTRY_PBPZIP; e.name = GetTranslatedString(game, "name"); e.description = GetTranslatedString(game, "description", ""); @@ -464,6 +464,12 @@ void StoreScreen::ParseListing(const std::string &json) { e.size = game.getInt("size"); e.downloadURL = game.getStringOr("download-url", ""); e.iconURL = game.getStringOr("icon-url", ""); + e.contentRating = game.getInt("content-rating", 0); +#if PPSSPP_PLATFORM(IOS_APP_STORE) + if (e.contentRating >= 100) { + continue; + } +#endif e.hidden = false; // NOTE: Handling of the "hidden" flag is broken in old versions of PPSSPP. Do not use. const char *file = game.getStringOr("file", nullptr); if (!file) diff --git a/UI/Store.h b/UI/Store.h index 1782037b9b1d..6b742c12e4c4 100644 --- a/UI/Store.h +++ b/UI/Store.h @@ -54,6 +54,7 @@ struct StoreEntry { std::string category; std::string downloadURL; // Only set for games that are not hosted on store.ppsspp.org bool hidden; + int contentRating; // 100 means to hide it on iOS. No other values defined yet. u64 size; }; From 508d6ebd58cb805f55208a8561c35a4c83a1e0dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 6 May 2024 22:46:54 +0200 Subject: [PATCH 3/4] Minor code cleanup --- UI/RetroAchievementScreens.cpp | 12 ++++++------ UI/RetroAchievementScreens.h | 6 ------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/UI/RetroAchievementScreens.cpp b/UI/RetroAchievementScreens.cpp index ac7162409ed3..8fc80fc8d8e5 100644 --- a/UI/RetroAchievementScreens.cpp +++ b/UI/RetroAchievementScreens.cpp @@ -410,7 +410,7 @@ void MeasureAchievement(const UIContext &dc, const rc_client_achievement_t *achi } } -void MeasureGameAchievementSummary(const UIContext &dc, float *w, float *h) { +static void MeasureGameAchievementSummary(const UIContext &dc, float *w, float *h) { std::string description = Achievements::GetGameAchievementSummary(); float tw, th; @@ -421,12 +421,12 @@ void MeasureGameAchievementSummary(const UIContext &dc, float *w, float *h) { *w += 8.0f; } -void MeasureLeaderboardSummary(const UIContext &dc, const rc_client_leaderboard_t *leaderboard, float *w, float *h) { +static void MeasureLeaderboardSummary(const UIContext &dc, const rc_client_leaderboard_t *leaderboard, float *w, float *h) { *w = 0.0f; *h = 72.0f; } -void MeasureLeaderboardEntry(const UIContext &dc, const rc_client_leaderboard_entry_t *entry, float *w, float *h) { +static void MeasureLeaderboardEntry(const UIContext &dc, const rc_client_leaderboard_entry_t *entry, float *w, float *h) { *w = 0.0f; *h = 72.0f; } @@ -537,7 +537,7 @@ void RenderAchievement(UIContext &dc, const rc_client_achievement_t *achievement dc.PopScissor(); } -void RenderGameAchievementSummary(UIContext &dc, const Bounds &bounds, float alpha) { +static void RenderGameAchievementSummary(UIContext &dc, const Bounds &bounds, float alpha) { using namespace UI; UI::Drawable background = dc.theme->itemStyle.background; @@ -579,7 +579,7 @@ void RenderGameAchievementSummary(UIContext &dc, const Bounds &bounds, float alp dc.RebindTexture(); } -void RenderLeaderboardSummary(UIContext &dc, const rc_client_leaderboard_t *leaderboard, AchievementRenderStyle style, const Bounds &bounds, float alpha, float startTime, float time_s, bool hasFocus) { +static void RenderLeaderboardSummary(UIContext &dc, const rc_client_leaderboard_t *leaderboard, AchievementRenderStyle style, const Bounds &bounds, float alpha, float startTime, float time_s, bool hasFocus) { using namespace UI; UI::Drawable background = dc.theme->itemStyle.background; if (hasFocus) { @@ -622,7 +622,7 @@ void RenderLeaderboardSummary(UIContext &dc, const rc_client_leaderboard_t *lead dc.RebindTexture(); } -void RenderLeaderboardEntry(UIContext &dc, const rc_client_leaderboard_entry_t *entry, const Bounds &bounds, float alpha, bool hasFocus, bool isCurrentUser) { +static void RenderLeaderboardEntry(UIContext &dc, const rc_client_leaderboard_entry_t *entry, const Bounds &bounds, float alpha, bool hasFocus, bool isCurrentUser) { using namespace UI; UI::Drawable background = dc.theme->itemStyle.background; if (hasFocus) { diff --git a/UI/RetroAchievementScreens.h b/UI/RetroAchievementScreens.h index b3fe0826e2ed..bfef98a86898 100644 --- a/UI/RetroAchievementScreens.h +++ b/UI/RetroAchievementScreens.h @@ -92,12 +92,6 @@ enum class AchievementRenderStyle { void MeasureAchievement(const UIContext &dc, const rc_client_achievement_t *achievement, AchievementRenderStyle style, float *w, float *h); void RenderAchievement(UIContext &dc, const rc_client_achievement_t *achievement, AchievementRenderStyle style, const Bounds &bounds, float alpha, float startTime, float time_s, bool hasFocus); -void MeasureGameAchievementSummary(const UIContext &dc, float *w, float *h); -void RenderGameAchievementSummary(UIContext &dc, const Bounds &bounds, float alpha); - -void MeasureLeaderboardEntry(const UIContext &dc, const rc_client_leaderboard_entry_t *entry, float *w, float *h); -void RenderLeaderboardEntry(UIContext &dc, const rc_client_leaderboard_entry_t *entry, const Bounds &bounds, float alpha); - class AchievementView : public UI::ClickableItem { public: AchievementView(const rc_client_achievement_t *achievement, UI::LayoutParams *layoutParams = nullptr) : UI::ClickableItem(layoutParams), achievement_(achievement) { From ac40fb83d4fa18375ebe3320c7a63c6bbe3aba3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 6 May 2024 22:49:46 +0200 Subject: [PATCH 4/4] iOS: Hide non-working RetroAchievements login, until we can fix it (still usable through ini file) --- UI/GameSettingsScreen.cpp | 23 +++++++++++++++++------ UI/RetroAchievementScreens.cpp | 2 ++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 7c8af35a3fb2..6e800652dfcc 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -970,12 +970,23 @@ void GameSettingsScreen::CreateToolsSettings(UI::ViewGroup *tools) { tools->Add(new ItemHeader(ms->T("Tools"))); - auto retro = tools->Add(new Choice(sy->T("RetroAchievements"))); - retro->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn { - screenManager()->push(new RetroAchievementsSettingsScreen(gamePath_)); - return UI::EVENT_DONE; - }); - retro->SetIcon(ImageID("I_RETROACHIEVEMENTS_LOGO")); + bool showRetroAchievements = true; +#if PPSSPP_PLATFORM(IOS_APP_STORE) + // Hide RetroAchievements login (unless the user has specified a login via the ini file). + // A non-working login won't pass App Store review. + if (g_Config.sAchievementsUserName.empty()) { + showRetroAchievements = false; + } +#endif + if (showRetroAchievements) { + auto retro = tools->Add(new Choice(sy->T("RetroAchievements"))); + retro->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn { + screenManager()->push(new RetroAchievementsSettingsScreen(gamePath_)); + return UI::EVENT_DONE; + }); + retro->SetIcon(ImageID("I_RETROACHIEVEMENTS_LOGO")); + } + // These were moved here so use the wrong translation objects, to avoid having to change all inis... This isn't a sustainable situation :P tools->Add(new Choice(sa->T("Savedata Manager")))->OnClick.Add([=](UI::EventParams &) { screenManager()->push(new SavedataScreen(gamePath_)); diff --git a/UI/RetroAchievementScreens.cpp b/UI/RetroAchievementScreens.cpp index 8fc80fc8d8e5..5a9e1ff4a70e 100644 --- a/UI/RetroAchievementScreens.cpp +++ b/UI/RetroAchievementScreens.cpp @@ -308,6 +308,8 @@ void RetroAchievementsSettingsScreen::CreateAccountTab(UI::ViewGroup *viewGroup) return UI::EVENT_DONE; }); } else { + // TODO: For text input on iOS, look into https://stackoverflow.com/questions/7253477/how-to-display-the-iphone-ipad-keyboard-over-a-full-screen-opengl-es-app + // Hack up a temporary quick login-form-ish-thing viewGroup->Add(new PopupTextInputChoice(GetRequesterToken(), &username_, di->T("Username"), "", 128, screenManager())); viewGroup->Add(new PopupTextInputChoice(GetRequesterToken(), &password_, di->T("Password"), "", 128, screenManager()))->SetPasswordDisplay();