From 677693b764993de7c4a4d03575b28d70d654dd90 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 9 Jun 2016 20:39:43 -0700 Subject: [PATCH 1/2] Disable reporting when game id is missing. We can't track compatibility without a game id. That either means inventing one for homebrew (one that is consistent for all copies) or not reporting homebrew. --- UI/PauseScreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index 6be177c889..cab3c55de1 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -331,7 +331,7 @@ void GamePauseScreen::CreateViews() { // TODO, also might be nice to show overall compat rating here? // Based on their platform or even cpu/gpu/config. Would add an API for it. - if (Reporting::IsEnabled()) { + if (Reporting::IsEnabled() && gameId.size() && gameId != "_") { I18NCategory *rp = GetI18NCategory("Reporting"); rightColumnItems->Add(new Choice(rp->T("ReportButton", "Report Feedback")))->OnClick.Handle(this, &GamePauseScreen::OnReportFeedback); } From 16897bd19d98bc045daebcbce335b0e60793ee52 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 9 Jun 2016 21:07:30 -0700 Subject: [PATCH 2/2] Force "Nothing" compatibility to bad stars. Reporting "Great" speed with "Nothing" compatibility makes no sense. --- UI/ReportScreen.cpp | 54 ++++++++++++++++++++++++++++++++++++++------- UI/ReportScreen.h | 1 + 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/UI/ReportScreen.cpp b/UI/ReportScreen.cpp index b8bd189bd9..1d1675fb0c 100644 --- a/UI/ReportScreen.cpp +++ b/UI/ReportScreen.cpp @@ -30,14 +30,21 @@ class RatingChoice : public LinearLayout { public: RatingChoice(const char *captionKey, int *value, LayoutParams *layoutParams = 0); + RatingChoice *SetEnabledPtr(bool *enabled); + Event OnChoice; protected: + void Update(const InputState &input_state) override; + virtual void SetupChoices(); virtual int TotalChoices() { return 3; } void AddChoice(int i, const std::string &title); + StickyChoice *GetChoice(int i) { + return static_cast(group_->GetViewByIndex(i)); + } LinearLayout *group_; @@ -60,6 +67,28 @@ RatingChoice::RatingChoice(const char *captionKey, int *value, LayoutParams *lay SetupChoices(); } +void RatingChoice::Update(const InputState &input_state) { + LinearLayout::Update(input_state); + + for (int i = 0; i < TotalChoices(); i++) { + StickyChoice *chosen = GetChoice(i); + bool down = chosen->IsDown(); + if (down && *value_ != i) { + chosen->Release(); + } else if (!down && *value_ == i) { + chosen->Press(); + } + } +} + +RatingChoice *RatingChoice::SetEnabledPtr(bool *ptr) { + for (int i = 0; i < TotalChoices(); i++) { + GetChoice(i)->SetEnabledPtr(ptr); + } + + return this; +} + void RatingChoice::SetupChoices() { I18NCategory *rp = GetI18NCategory("Reporting"); AddChoice(0, rp->T("Bad")); @@ -70,17 +99,15 @@ void RatingChoice::SetupChoices() { void RatingChoice::AddChoice(int i, const std::string &title) { auto c = group_->Add(new StickyChoice(title, "")); c->OnClick.Handle(this, &RatingChoice::OnChoiceClick); - if (*value_ == i) - c->Press(); } EventReturn RatingChoice::OnChoiceClick(EventParams &e) { // Unstick the other choices that weren't clicked. int total = TotalChoices(); for (int i = 0; i < total; i++) { - auto v = group_->GetViewByIndex(i); + StickyChoice *v = GetChoice(i); if (v != e.v) { - static_cast(v)->Release(); + v->Release(); } else { *value_ = i; } @@ -121,10 +148,21 @@ void CompatRatingChoice::SetupChoices() { } ReportScreen::ReportScreen(const std::string &gamePath) - : UIScreenWithGameBackground(gamePath), overall_(-1), graphics_(-1), speed_(-1), gameplay_(-1) { + : UIScreenWithGameBackground(gamePath), overall_(-1), graphics_(-1), speed_(-1), gameplay_(-1), ratingEnabled_(true) { } EventReturn ReportScreen::HandleChoice(EventParams &e) { + if (overall_ == 4) { + graphics_ = 0; + speed_ = 0; + gameplay_ = 0; + ratingEnabled_ = false; + } else if (!ratingEnabled_) { + graphics_ = -1; + speed_ = -1; + gameplay_ = -1; + ratingEnabled_ = true; + } submit_->SetEnabled(overall_ >= 0 && graphics_ >= 0 && speed_ >= 0 && gameplay_ >= 0); return EVENT_DONE; } @@ -142,9 +180,9 @@ void ReportScreen::CreateViews() { // TODO: screenshot leftColumnItems->Add(new CompatRatingChoice("Overall", &overall_))->OnChoice.Handle(this, &ReportScreen::HandleChoice); - leftColumnItems->Add(new RatingChoice("Graphics", &graphics_))->OnChoice.Handle(this, &ReportScreen::HandleChoice); - leftColumnItems->Add(new RatingChoice("Speed", &speed_))->OnChoice.Handle(this, &ReportScreen::HandleChoice); - leftColumnItems->Add(new RatingChoice("Gameplay", &gameplay_))->OnChoice.Handle(this, &ReportScreen::HandleChoice); + leftColumnItems->Add(new RatingChoice("Graphics", &graphics_))->SetEnabledPtr(&ratingEnabled_)->OnChoice.Handle(this, &ReportScreen::HandleChoice); + leftColumnItems->Add(new RatingChoice("Speed", &speed_))->SetEnabledPtr(&ratingEnabled_)->OnChoice.Handle(this, &ReportScreen::HandleChoice); + leftColumnItems->Add(new RatingChoice("Gameplay", &gameplay_))->SetEnabledPtr(&ratingEnabled_)->OnChoice.Handle(this, &ReportScreen::HandleChoice); rightColumnItems->SetSpacing(0.0f); rightColumnItems->Add(new Choice(rp->T("Open Browser")))->OnClick.Handle(this, &ReportScreen::HandleBrowser); diff --git a/UI/ReportScreen.h b/UI/ReportScreen.h index affc643a40..edfbfeb8b2 100644 --- a/UI/ReportScreen.h +++ b/UI/ReportScreen.h @@ -38,4 +38,5 @@ protected: int graphics_; int speed_; int gameplay_; + bool ratingEnabled_; };