From 7d13981ffbb8b54a045426ea8fca8563529975ad Mon Sep 17 00:00:00 2001 From: Lubos Date: Fri, 12 Aug 2022 10:30:57 +0200 Subject: [PATCH] OpenXR - Remove OPENXR ifdef from UI --- UI/GameSettingsScreen.cpp | 114 +++++++++++++++++++------------------- UI/MainScreen.cpp | 5 +- 2 files changed, 60 insertions(+), 59 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 1b03b46891..3a346fa48b 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -319,8 +319,10 @@ void GameSettingsScreen::CreateViews() { }); blockTransfer->SetDisabledPtr(&g_Config.bSoftwareRendering); - CheckBox *softwareGPU = graphicsSettings->Add(new CheckBox(&g_Config.bSoftwareRendering, gr->T("Software Rendering", "Software Rendering (slow)"))); - softwareGPU->SetEnabled(!PSP_IsInited()); + if (deviceType != DEVICE_TYPE_VR) { + CheckBox *softwareGPU = graphicsSettings->Add(new CheckBox(&g_Config.bSoftwareRendering, gr->T("Software Rendering", "Software Rendering (slow)"))); + softwareGPU->SetEnabled(!PSP_IsInited()); + } graphicsSettings->Add(new ItemHeader(gr->T("Frame Rate Control"))); static const char *frameSkip[] = {"Off", "1", "2", "3", "4", "5", "6", "7", "8"}; @@ -393,39 +395,39 @@ void GameSettingsScreen::CreateViews() { } } -#ifndef OPENXR - graphicsSettings->Add(new ItemHeader(gr->T("Screen layout"))); + if (deviceType != DEVICE_TYPE_VR) { + graphicsSettings->Add(new ItemHeader(gr->T("Screen layout"))); #if !defined(MOBILE_DEVICE) - graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gr->T("FullScreen", "Full Screen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange); - if (System_GetPropertyInt(SYSPROP_DISPLAY_COUNT) > 1) { - CheckBox *fullscreenMulti = new CheckBox(&g_Config.bFullScreenMulti, gr->T("Use all displays")); - fullscreenMulti->SetEnabledFunc([] { - return g_Config.UseFullScreen(); - }); - graphicsSettings->Add(fullscreenMulti)->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenMultiChange); - } + graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gr->T("FullScreen", "Full Screen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange); + if (System_GetPropertyInt(SYSPROP_DISPLAY_COUNT) > 1) { + CheckBox *fullscreenMulti = new CheckBox(&g_Config.bFullScreenMulti, gr->T("Use all displays")); + fullscreenMulti->SetEnabledFunc([] { + return g_Config.UseFullScreen(); + }); + graphicsSettings->Add(fullscreenMulti)->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenMultiChange); + } #endif - // Display Layout Editor: To avoid overlapping touch controls on large tablets, meet geeky demands for integer zoom/unstretched image etc. - displayEditor_ = graphicsSettings->Add(new Choice(gr->T("Display layout editor"))); - displayEditor_->OnClick.Handle(this, &GameSettingsScreen::OnDisplayLayoutEditor); + // Display Layout Editor: To avoid overlapping touch controls on large tablets, meet geeky demands for integer zoom/unstretched image etc. + displayEditor_ = graphicsSettings->Add(new Choice(gr->T("Display layout editor"))); + displayEditor_->OnClick.Handle(this, &GameSettingsScreen::OnDisplayLayoutEditor); #if PPSSPP_PLATFORM(ANDROID) - // Hide insets option if no insets, or OS too old. - if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 28 && - (System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_LEFT) != 0.0f || - System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_TOP) != 0.0f || - System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_RIGHT) != 0.0f || - System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_BOTTOM) != 0.0f)) { - graphicsSettings->Add(new CheckBox(&g_Config.bIgnoreScreenInsets, gr->T("Ignore camera notch when centering"))); - } + // Hide insets option if no insets, or OS too old. + if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 28 && + (System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_LEFT) != 0.0f || + System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_TOP) != 0.0f || + System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_RIGHT) != 0.0f || + System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_BOTTOM) != 0.0f)) { + graphicsSettings->Add(new CheckBox(&g_Config.bIgnoreScreenInsets, gr->T("Ignore camera notch when centering"))); + } - // Hide Immersive Mode on pre-kitkat Android - if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 19) { - // Let's reuse the Fullscreen translation string from desktop. - graphicsSettings->Add(new CheckBox(&g_Config.bImmersiveMode, gr->T("FullScreen", "Full Screen")))->OnClick.Handle(this, &GameSettingsScreen::OnImmersiveModeChange); + // Hide Immersive Mode on pre-kitkat Android + if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 19) { + // Let's reuse the Fullscreen translation string from desktop. + graphicsSettings->Add(new CheckBox(&g_Config.bImmersiveMode, gr->T("FullScreen", "Full Screen")))->OnClick.Handle(this, &GameSettingsScreen::OnImmersiveModeChange); + } +#endif } -#endif -#endif graphicsSettings->Add(new ItemHeader(gr->T("Performance"))); static const char *internalResolutions[] = { "Auto (1:1)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP", "6x PSP", "7x PSP", "8x PSP", "9x PSP", "10x PSP" }; @@ -470,8 +472,10 @@ void GameSettingsScreen::CreateViews() { inflightChoice->OnChoice.Handle(this, &GameSettingsScreen::OnInflightFramesChoice); } - CheckBox *hwTransform = graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gr->T("Hardware Transform"))); - hwTransform->SetDisabledPtr(&g_Config.bSoftwareRendering); + if (deviceType != DEVICE_TYPE_VR) { + CheckBox *hwTransform = graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gr->T("Hardware Transform"))); + hwTransform->SetDisabledPtr(&g_Config.bSoftwareRendering); + } CheckBox *swSkin = graphicsSettings->Add(new CheckBox(&g_Config.bSoftwareSkinning, gr->T("Software Skinning"))); swSkin->OnClick.Add([=](EventParams &e) { @@ -590,10 +594,8 @@ void GameSettingsScreen::CreateViews() { static const char *bufFilters[] = { "Linear", "Nearest", }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iBufFilter, gr->T("Screen Scaling Filter"), bufFilters, 1, ARRAY_SIZE(bufFilters), gr->GetName(), screenManager())); -#ifdef OPENXR - bool showCardboardSettings = false; -#elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS) - bool showCardboardSettings = true; +#ifdef PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS) + bool showCardboardSettings = deviceType != DEVICE_TYPE_VR; #else // If you enabled it through the ini, you can see this. Useful for testing. bool showCardboardSettings = g_Config.bEnableCardboardVR; @@ -721,9 +723,8 @@ void GameSettingsScreen::CreateViews() { }); } -#ifndef OPENXR // TVs don't have touch control, at least not yet. - if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_TV) { + if ((deviceType != DEVICE_TYPE_TV) && (deviceType != DEVICE_TYPE_VR)) { controlsSettings->Add(new ItemHeader(co->T("OnScreen", "On-Screen Touch Controls"))); controlsSettings->Add(new CheckBox(&g_Config.bShowTouchControls, co->T("OnScreen", "On-Screen Touch Controls"))); layoutEditorChoice_ = controlsSettings->Add(new Choice(co->T("Customize Touch Controls"))); @@ -771,29 +772,30 @@ void GameSettingsScreen::CreateViews() { gesture->SetEnabledPtr(&g_Config.bShowTouchControls); } - controlsSettings->Add(new ItemHeader(co->T("Keyboard", "Keyboard Control Settings"))); + if (deviceType != DEVICE_TYPE_VR) { + controlsSettings->Add(new ItemHeader(co->T("Keyboard", "Keyboard Control Settings"))); #if defined(USING_WIN_UI) - controlsSettings->Add(new CheckBox(&g_Config.bIgnoreWindowsKey, co->T("Ignore Windows Key"))); + controlsSettings->Add(new CheckBox(&g_Config.bIgnoreWindowsKey, co->T("Ignore Windows Key"))); #endif // #if defined(USING_WIN_UI) - auto analogLimiter = new PopupSliderChoiceFloat(&g_Config.fAnalogLimiterDeadzone, 0.0f, 1.0f, co->T("Analog Limiter"), 0.10f, screenManager(), "/ 1.0"); - controlsSettings->Add(analogLimiter); - analogLimiter->OnChange.Add([=](EventParams &e) { - settingInfo_->Show(co->T("AnalogLimiter Tip", "When the analog limiter button is pressed"), e.v); - return UI::EVENT_CONTINUE; - }); + auto analogLimiter = new PopupSliderChoiceFloat(&g_Config.fAnalogLimiterDeadzone, 0.0f, 1.0f, co->T("Analog Limiter"), 0.10f, screenManager(), "/ 1.0"); + controlsSettings->Add(analogLimiter); + analogLimiter->OnChange.Add([=](EventParams &e) { + settingInfo_->Show(co->T("AnalogLimiter Tip", "When the analog limiter button is pressed"), e.v); + return UI::EVENT_CONTINUE; + }); #if defined(USING_WIN_UI) || defined(SDL) - controlsSettings->Add(new ItemHeader(co->T("Mouse", "Mouse settings"))); - CheckBox *mouseControl = controlsSettings->Add(new CheckBox(&g_Config.bMouseControl, co->T("Use Mouse Control"))); - mouseControl->OnClick.Add([=](EventParams &e) { - if(g_Config.bMouseControl) - settingInfo_->Show(co->T("MouseControl Tip", "You can now map mouse in control mapping screen by pressing the 'M' icon."), e.v); - return UI::EVENT_CONTINUE; - }); - controlsSettings->Add(new CheckBox(&g_Config.bMouseConfine, co->T("Confine Mouse", "Trap mouse within window/display area")))->SetEnabledPtr(&g_Config.bMouseControl); - controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fMouseSensitivity, 0.01f, 1.0f, co->T("Mouse sensitivity"), 0.01f, screenManager(), "x"))->SetEnabledPtr(&g_Config.bMouseControl); - controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fMouseSmoothing, 0.0f, 0.95f, co->T("Mouse smoothing"), 0.05f, screenManager(), "x"))->SetEnabledPtr(&g_Config.bMouseControl); -#endif + controlsSettings->Add(new ItemHeader(co->T("Mouse", "Mouse settings"))); + CheckBox *mouseControl = controlsSettings->Add(new CheckBox(&g_Config.bMouseControl, co->T("Use Mouse Control"))); + mouseControl->OnClick.Add([=](EventParams &e) { + if(g_Config.bMouseControl) + settingInfo_->Show(co->T("MouseControl Tip", "You can now map mouse in control mapping screen by pressing the 'M' icon."), e.v); + return UI::EVENT_CONTINUE; + }); + controlsSettings->Add(new CheckBox(&g_Config.bMouseConfine, co->T("Confine Mouse", "Trap mouse within window/display area")))->SetEnabledPtr(&g_Config.bMouseControl); + controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fMouseSensitivity, 0.01f, 1.0f, co->T("Mouse sensitivity"), 0.01f, screenManager(), "x"))->SetEnabledPtr(&g_Config.bMouseControl); + controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fMouseSmoothing, 0.0f, 0.95f, co->T("Mouse smoothing"), 0.05f, screenManager(), "x"))->SetEnabledPtr(&g_Config.bMouseControl); #endif + } LinearLayout *networkingSettings = AddTab("GameSettingsNetworking", ms->T("Networking")); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index cb5fbf0116..3e025d06ba 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -1137,13 +1137,12 @@ void MainScreen::CreateViews() { rightColumnItems->Add(new Choice(mm->T("Game Settings", "Settings")))->OnClick.Handle(this, &MainScreen::OnGameSettings); rightColumnItems->Add(new Choice(mm->T("Credits")))->OnClick.Handle(this, &MainScreen::OnCredits); rightColumnItems->Add(new Choice(mm->T("www.ppsspp.org")))->OnClick.Handle(this, &MainScreen::OnPPSSPPOrg); -#ifndef OPENXR - if (!System_GetPropertyBool(SYSPROP_APP_GOLD)) { + + if (!System_GetPropertyBool(SYSPROP_APP_GOLD) && (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_VR)) { Choice *gold = rightColumnItems->Add(new Choice(mm->T("Buy PPSSPP Gold"))); gold->OnClick.Handle(this, &MainScreen::OnSupport); gold->SetIcon(ImageID("I_ICONGOLD"), 0.5f); } -#endif #if !PPSSPP_PLATFORM(UWP) // Having an exit button is against UWP guidelines.