diff --git a/README.md b/README.md index 42aa32fd23..d12c217802 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ What's new in 1.20 - Controller and touch screen input - Native support for DualSense ([#20580], [#20620], [#21191]), DualShock and Switch Pro ([#20647]) controllers on Windows - including tilt controls for DualSense and Switch Pro - - Misc touch screen improvements ([#21195], [#21197], [#21258]) + - Misc touch screen and controller mapping improvements ([#21195], [#21197], [#21258], [#21325]) + - Add simple virtual keyboard for text input for platforms that don't have one ([#21306]) - Graphics - Fixed multiple graphical effects in Tales of Phantasia X @@ -397,4 +398,6 @@ See [history.md](history.md). [#20749]: https://github.com/hrydgard/ppsspp/issues/20749 "More debugger fixes" [#21081]: https://github.com/hrydgard/ppsspp/issues/21081 "Update the rcheevos library to 1.12.2." [#21148]: https://github.com/hrydgard/ppsspp/issues/21148 "Add workaround for infamous GoW crash" -[#21042]: https://github.com/hrydgard/ppsspp/issues/21042 "Setting out of game UI confirmation button to O makes both O and X into UI confirmation buttons" \ No newline at end of file +[#21042]: https://github.com/hrydgard/ppsspp/issues/21042 "Setting out of game UI confirmation button to O makes both O and X into UI confirmation buttons" +[#21325]: https://github.com/hrydgard/ppsspp/issues/21325 "Controls: Add a setting for the threshold used to map analog stick inputs to digital buttons" +[#21306]: https://github.com/hrydgard/ppsspp/issues/21306 "Server list update, add virtual keyboard to PopupTextInputChoice" \ No newline at end of file diff --git a/UI/IAPScreen.cpp b/UI/IAPScreen.cpp index 87ff640480..b52aa600f8 100644 --- a/UI/IAPScreen.cpp +++ b/UI/IAPScreen.cpp @@ -9,41 +9,26 @@ #include "UI/OnScreenDisplay.h" #include "UI/MiscViews.h" -void IAPScreen::CreateViews() { - using namespace UI; - - auto di = GetI18NCategory(I18NCat::DIALOG); +std::string_view IAPScreen::GetTitle() const { auto mm = GetI18NCategory(I18NCat::MAINMENU); + return mm->T("Buy PPSSPP Gold"); +} - const bool portrait = GetDeviceOrientation() == DeviceOrientation::Portrait; - - root_ = new LinearLayout(portrait ? ORIENT_VERTICAL : ORIENT_HORIZONTAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); - - if (portrait) { - root_->Add(new TopBar(*screenManager()->getUIContext(), TopBarFlags::Default, di->T("PPSSPP Gold"))); - root_->Add(new Spacer(20.0f)); - } +void IAPScreen::CreateContentViews(UI::ViewGroup *parent) { + using namespace UI; const bool bought = System_GetPropertyBool(SYSPROP_APP_GOLD); + auto di = GetI18NCategory(I18NCat::DIALOG); - LinearLayout *leftColumnItems; - if (portrait) { - leftColumnItems = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, UI::Margins(12, 12))); - root_->Add(leftColumnItems); - } else { - ViewGroup *leftColumnContainer = new AnchorLayout(new LinearLayoutParams(1.0f, UI::Gravity::G_HCENTER)); - leftColumnItems = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(600, WRAP_CONTENT, NONE, 105, NONE, 12)); - leftColumnContainer->Add(leftColumnItems); - root_->Add(leftColumnContainer); - } + ViewGroup *leftColumnItems = parent->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, Margins(16, 0, 16, 12)))); + leftColumnItems->Add(new Spacer(35.0f)); ViewGroup *appTitle = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); appTitle->Add(new ShinyIcon(ImageID("I_ICON_GOLD"), new LinearLayoutParams(64, 64))); appTitle->Add(new TextView("PPSSPP Gold", new LinearLayoutParams(1.0f, Gravity::G_VCENTER))); leftColumnItems->Add(appTitle); - leftColumnItems->Add(new Spacer(30.0f)); if (!bought) { - leftColumnItems->Add(new Spacer(20.0f)); + leftColumnItems->Add(new Spacer(30.0f)); leftColumnItems->Add(new TextView(di->T("GoldOverview1", "Buy PPSSPP Gold to support development!")))->SetAlign(FLAG_WRAP_TEXT); leftColumnItems->Add(new Spacer(10.0f)); leftColumnItems->Add(new TextView(di->T("GoldOverview2", "It helps sustain development!")))->SetAlign(FLAG_WRAP_TEXT); @@ -51,20 +36,21 @@ void IAPScreen::CreateViews() { leftColumnItems->Add(new TextView(di->T("GoldThankYou", "Thank you for supporting the PPSSPP project!")))->SetAlign(FLAG_WRAP_TEXT); } - leftColumnItems->Add(new Spacer(20.0f)); + leftColumnItems->Add(new Spacer(30.0f)); leftColumnItems->Add(new TextView("Henrik RydgÄrd")); leftColumnItems->Add(new TextView("(hrydgard)")); +} - float weight = 0.0f; - if (portrait) - weight = 1.0f; // hack to lift the buttons up. +void IAPScreen::CreateSettingsViews(UI::ViewGroup *rightColumnItems) { + using namespace UI; - ViewGroup *rightColumnItems = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(350, WRAP_CONTENT, weight, UI::Margins(12, 12))); - root_->Add(rightColumnItems); + auto di = GetI18NCategory(I18NCat::DIALOG); + auto mm = GetI18NCategory(I18NCat::MAINMENU); + const bool bought = System_GetPropertyBool(SYSPROP_APP_GOLD); if (!bought) { ImageID image; -#if 1 || PPSSPP_PLATFORM(ANDROID) +#if PPSSPP_PLATFORM(ANDROID) image = ImageID("I_LOGO_PLAY_STORE"); #elif PPSSPP_PLATFORM(IOS) image = ImageID("I_LOGO_APP_STORE"); @@ -75,7 +61,6 @@ void IAPScreen::CreateViews() { const int requesterToken = GetRequesterToken(); buyButton->OnClick.Add([this, requesterToken](UI::EventParams &) { INFO_LOG(Log::System, "Showing purchase UI..."); - if (useIAP_) { System_IAPMakePurchase(requesterToken, "org.ppsspp.gold", [this](const char *responseString, int intValue) { INFO_LOG(Log::System, "PPSSPP Gold purchase successful!"); @@ -89,6 +74,7 @@ void IAPScreen::CreateViews() { LaunchPlayStoreOrWebsiteGold(); } }); + rightColumnItems->Add(new Spacer(12.0f)); } Choice *moreInfo = rightColumnItems->Add(new Choice(di->T("More info"), ImageID("I_LINK_OUT"))); @@ -96,16 +82,9 @@ void IAPScreen::CreateViews() { System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/buygold_ios"); }); - if (!portrait) { - Choice *backButton = rightColumnItems->Add(new Choice(di->T("Back"), ImageID("I_NAVIGATE_BACK"))); - backButton->OnClick.Handle(this, &UIScreen::OnBack); - } - if (useIAP_) { + rightColumnItems->Add(new Spacer(12.0f)); // Put the restore purchases button in the bottom right corner in landscape. It's rarely useful, but needed. - if (!portrait) { - rightColumnItems->Add(new Spacer(new LinearLayoutParams(1.0f))); - } Choice *restorePurchases = new Choice(di->T("Restore purchase")); const int requesterToken = GetRequesterToken(); restorePurchases->OnClick.Add([this, requesterToken, restorePurchases](UI::EventParams &) { diff --git a/UI/IAPScreen.h b/UI/IAPScreen.h index 836fb7c12c..624e284fd2 100644 --- a/UI/IAPScreen.h +++ b/UI/IAPScreen.h @@ -7,10 +7,13 @@ #include "UI/BaseScreens.h" #include "UI/SimpleDialogScreen.h" -class IAPScreen : public UIBaseDialogScreen { +class IAPScreen : public UITwoPaneBaseDialogScreen { public: - IAPScreen(bool useIAP) : UIBaseDialogScreen(), useIAP_(useIAP) {} - void CreateViews() override; + IAPScreen(bool useIAP) : UITwoPaneBaseDialogScreen(Path(), TwoPaneFlags::SettingsToTheRight | TwoPaneFlags::ContentsCanScroll), useIAP_(useIAP) {} + void CreateSettingsViews(UI::ViewGroup *parent) override; + void CreateContentViews(UI::ViewGroup *parent) override; + std::string_view GetTitle() const override; + const char *tag() const override { return "IAP"; } private: // This screen can also be used to direct to Play Store purchases, for example. diff --git a/Windows/main.cpp b/Windows/main.cpp index 62bde5dbb1..e78cefb2fa 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -463,7 +463,7 @@ bool System_GetPropertyBool(SystemProperty prop) { case SYSPROP_HAS_ACCELEROMETER: return g_InputManager.AnyAccelerometer(); case SYSPROP_USE_IAP: - return false; + return false; // This should never be set to true on Windows. Only for testing/dev. case SYSPROP_USE_APP_STORE: return false; default: