Skip to content

Commit

Permalink
Merge pull request #17743 from hrydgard/version-on-prompt-screen
Browse files Browse the repository at this point in the history
Show version on prompt screens that aren't questions
  • Loading branch information
hrydgard committed Jul 20, 2023
2 parents 16ee5a5 + caebef6 commit 5abddcc
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions Common/System/System.h
Expand Up @@ -117,6 +117,7 @@ enum SystemProperty {
SYSPROP_BOARDNAME,
SYSPROP_CLIPBOARD_TEXT,
SYSPROP_GPUDRIVER_VERSION,
SYSPROP_BUILD_VERSION,

// Separate SD cards or similar.
// Need hacky solutions to get at this.
Expand Down
3 changes: 3 additions & 0 deletions Common/UI/PopupScreens.h
Expand Up @@ -55,6 +55,9 @@ class MessagePopupScreen : public PopupScreen {
public:
MessagePopupScreen(std::string title, std::string message, std::string button1, std::string button2, std::function<void(bool)> callback)
: PopupScreen(title, button1, button2), message_(message), callback_(callback) {}

const char *tag() const override { return "MessagePopupScreen"; }

UI::Event OnChoice;

protected:
Expand Down
3 changes: 1 addition & 2 deletions Common/UI/UIScreen.cpp
@@ -1,5 +1,6 @@
#include <algorithm>
#include "Common/System/Display.h"
#include "Common/System/System.h"
#include "Common/Input/InputState.h"
#include "Common/Input/KeyCodes.h"
#include "Common/Math/curves.h"
Expand All @@ -9,7 +10,6 @@
#include "Common/UI/Root.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Render/DrawBuffer.h"

#include "Common/Log.h"

static const bool ClickDebug = false;
Expand Down Expand Up @@ -426,7 +426,6 @@ void PopupScreen::CreateViews() {

CreatePopupContents(box_);
root_->SetDefaultFocusView(box_);

if (ShowButtons() && !button1_.empty()) {
// And the two buttons at the bottom.
LinearLayout *buttonRow = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(200, WRAP_CONTENT));
Expand Down
2 changes: 2 additions & 0 deletions Qt/QtMain.cpp
Expand Up @@ -161,6 +161,8 @@ std::string System_GetProperty(SystemProperty prop) {
return result;
}
#endif
case SYSPROP_BUILD_VERSION:
return PPSSPP_GIT_VERSION;
default:
return "";
}
Expand Down
2 changes: 2 additions & 0 deletions SDL/SDLMain.cpp
Expand Up @@ -431,6 +431,8 @@ std::string System_GetProperty(SystemProperty prop) {
}
return result;
}
case SYSPROP_BUILD_VERSION:
return PPSSPP_GIT_VERSION;
default:
return "";
}
Expand Down
8 changes: 7 additions & 1 deletion UI/MiscScreens.cpp
Expand Up @@ -542,8 +542,14 @@ void PromptScreen::CreateViews() {
Choice *yesButton = rightColumnItems->Add(new Choice(yesButtonText_));
yesButton->OnClick.Handle(this, &PromptScreen::OnYes);
root_->SetDefaultFocusView(yesButton);
if (!noButtonText_.empty())
if (!noButtonText_.empty()) {
rightColumnItems->Add(new Choice(noButtonText_))->OnClick.Handle(this, &PromptScreen::OnNo);
} else {
// This is an information screen, not a question.
// Sneak in the version of PPSSPP in the corner, for debug-reporting user screenshots.
std::string version = System_GetProperty(SYSPROP_BUILD_VERSION);
root_->Add(new TextView(version, 0, true, new AnchorLayoutParams(10.0f, NONE, NONE, 10.0f)));
}
}

UI::EventReturn PromptScreen::OnYes(UI::EventParams &e) {
Expand Down
2 changes: 2 additions & 0 deletions UWP/PPSSPP_UWPMain.cpp
Expand Up @@ -347,6 +347,8 @@ std::string System_GetProperty(SystemProperty prop) {
return "";
case SYSPROP_GPUDRIVER_VERSION:
return "";
case SYSPROP_BUILD_VERSION:
return PPSSPP_GIT_VERSION;
default:
return "";
}
Expand Down
2 changes: 2 additions & 0 deletions Windows/main.cpp
Expand Up @@ -234,6 +234,8 @@ std::string System_GetProperty(SystemProperty prop) {
gpuDriverVersion = GetVideoCardDriverVersion();
}
return gpuDriverVersion;
case SYSPROP_BUILD_VERSION:
return PPSSPP_GIT_VERSION;
default:
return "";
}
Expand Down
2 changes: 2 additions & 0 deletions android/jni/app-android.cpp
Expand Up @@ -412,6 +412,8 @@ std::string System_GetProperty(SystemProperty prop) {
return mogaVersion;
case SYSPROP_BOARDNAME:
return boardName;
case SYSPROP_BUILD_VERSION:
return PPSSPP_GIT_VERSION;
default:
return "";
}
Expand Down
3 changes: 3 additions & 0 deletions ios/main.mm
Expand Up @@ -21,6 +21,7 @@
#include "Common/System/Request.h"
#include "Common/StringUtils.h"
#include "Common/Profiler/Profiler.h"
#include "Core/Config.h"
#include "UI/DarwinFileSystemServices.h"

static int (*csops)(pid_t pid, unsigned int ops, void * useraddr, size_t usersize);
Expand Down Expand Up @@ -108,6 +109,8 @@ kern_return_t catch_exception_raise(mach_port_t exception_port,
return StringFromFormat("iOS %s", version.c_str());
case SYSPROP_LANGREGION:
return [[[NSLocale currentLocale] objectForKey:NSLocaleIdentifier] UTF8String];
case SYSPROP_BUILD_VERSION:
return PPSSPP_GIT_VERSION;
default:
return "";
}
Expand Down

0 comments on commit 5abddcc

Please sign in to comment.