Skip to content

Commit

Permalink
Merge pull request #19113 from hrydgard/minor-visual-updates
Browse files Browse the repository at this point in the history
Minor visual updates
  • Loading branch information
hrydgard committed May 6, 2024
2 parents 7dd2a89 + ac40fb8 commit 70394c1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 22 deletions.
23 changes: 17 additions & 6 deletions UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_));
Expand Down
14 changes: 8 additions & 6 deletions UI/RetroAchievementScreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -410,7 +412,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;
Expand All @@ -421,12 +423,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;
}
Expand Down Expand Up @@ -537,7 +539,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;

Expand Down Expand Up @@ -579,7 +581,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) {
Expand Down Expand Up @@ -622,7 +624,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) {
Expand Down
6 changes: 0 additions & 6 deletions UI/RetroAchievementScreens.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 10 additions & 4 deletions UI/Store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,20 @@ 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", "");
e.author = game.getStringOr("author", "?");
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)
Expand All @@ -483,9 +489,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<UIScreen>(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<UIScreen>(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);
Expand Down
1 change: 1 addition & 0 deletions UI/Store.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit 70394c1

Please sign in to comment.