From 3ab09f6bce47a2630eb874a4b647a06791bf6c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 20 Oct 2013 17:33:18 +0200 Subject: [PATCH] Make the touch visibility thing a "subdialog" of the layout editor. Reorder options a bit too. --- UI/GameSettingsScreen.cpp | 81 ++++++++++++++++----------------- UI/GameSettingsScreen.h | 1 - UI/MainScreen.cpp | 2 +- UI/MiscScreens.cpp | 11 +++-- UI/MiscScreens.h | 5 +- UI/TouchControlLayoutScreen.cpp | 39 ++++++++++------ UI/TouchControlLayoutScreen.h | 2 + 7 files changed, 77 insertions(+), 64 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 56cd34e4fa..7f4b0fd058 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -106,16 +106,23 @@ void GameSettingsScreen::CreateViews() { graphicsSettings->Add(new ItemHeader(gs->T("Frame Rate Control"))); static const char *frameSkip[] = {"Off", "Auto", "1", "2", "3", "4", "5", "6", "7", "8"}; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iFrameSkip, gs->T("Frame Skipping"), frameSkip, 0, ARRAY_SIZE(frameSkip), gs, screenManager())); - static const char *fpsChoices[] = {"None", "Speed", "FPS", "Both"}; - graphicsSettings->Add(new CheckBox(&cap60FPS_, gs->T("Force max 60 FPS (helps GoW)"))); static const char *customSpeed[] = {"Unlimited", "25%", "50%", "75%", "100%", "125%", "150%", "200%", "300%"}; graphicsSettings->Add(new PopupMultiChoice(&iAlternateSpeedPercent_, gs->T("Alternative Speed"), customSpeed, 0, ARRAY_SIZE(customSpeed), gs, screenManager())); graphicsSettings->Add(new ItemHeader(gs->T("Features"))); - graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gs->T("Hardware Transform"))); - graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache"))); - graphicsSettings->Add(new CheckBox(&g_Config.bLowQualitySplineBezier, gs->T("Low quality spline/bezier curves (speed)"))); + graphicsSettings->Add(new Choice(gs->T("Postprocessing Shader")))->OnClick.Handle(this, &GameSettingsScreen::OnPostProcShader); +#ifdef _WIN32 + graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange); +#endif + graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display"))); +#ifdef BLACKBERRY + if (pixel_xres == pixel_yres) + graphicsSettings->Add(new CheckBox(&g_Config.bPartialStretch, gs->T("Partial Vertical Stretch"))); +#endif + graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping"))); + + graphicsSettings->Add(new ItemHeader(gs->T("Performance"))); #ifndef USING_GLES2 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" }; @@ -123,28 +130,16 @@ void GameSettingsScreen::CreateViews() { static const char *internalResolutions[] = {"Auto (1:1)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" }; #endif graphicsSettings->Add(new PopupMultiChoice(&g_Config.iInternalResolution, gs->T("Rendering Resolution"), internalResolutions, 0, ARRAY_SIZE(internalResolutions), gs, screenManager()))->OnClick.Handle(this, &GameSettingsScreen::OnResolutionChange); - graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display"))); -#ifdef BLACKBERRY - if (pixel_xres == pixel_yres) - graphicsSettings->Add(new CheckBox(&g_Config.bPartialStretch, gs->T("Partial Vertical Stretch"))); -#endif - graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping"))); + graphicsSettings->Add(new CheckBox(&g_Config.bVSync, gs->T("VSync"))); + graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gs->T("Hardware Transform"))); + graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache"))); + graphicsSettings->Add(new CheckBox(&g_Config.bLowQualitySplineBezier, gs->T("LowCurves", "Low quality spline/bezier curves"))); + // This setting is not really useful for anyone atm. // graphicsSettings->Add(new CheckBox(&g_Config.bTrueColor, gs->T("True Color"))); -#ifdef _WIN32 - graphicsSettings->Add(new CheckBox(&g_Config.bVSync, gs->T("VSync"))); - graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange); -#endif - - graphicsSettings->Add(new ItemHeader(gs->T("Antialiasing and postprocessing"))); - graphicsSettings->Add(new Choice(gs->T("Postprocessing Shader")))->OnClick.Handle(this, &GameSettingsScreen::OnPostProcShader); // In case we're going to add few other antialiasing option like MSAA in the future. // graphicsSettings->Add(new CheckBox(&g_Config.bFXAA, gs->T("FXAA"))); - graphicsSettings->Add(new ItemHeader(gs->T("Overlay Information"))); - graphicsSettings->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS Counter"), fpsChoices, 0, ARRAY_SIZE(fpsChoices), gs, screenManager())); - graphicsSettings->Add(new CheckBox(&g_Config.bShowDebugStats, gs->T("Show Debug Statistics"))); - graphicsSettings->Add(new ItemHeader(gs->T("Texture Scaling"))); #ifndef USING_GLES2 static const char *texScaleLevels[] = {"Auto", "Off", "2x", "3x","4x", "5x"}; @@ -168,6 +163,11 @@ void GameSettingsScreen::CreateViews() { if (PSP_IsInited()) prescale->SetEnabled(false); + graphicsSettings->Add(new ItemHeader(gs->T("Overlay Information"))); + static const char *fpsChoices[] = {"None", "Speed", "FPS", "Both"}; + graphicsSettings->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS Counter"), fpsChoices, 0, ARRAY_SIZE(fpsChoices), gs, screenManager())); + graphicsSettings->Add(new CheckBox(&g_Config.bShowDebugStats, gs->T("Show Debug Statistics"))); + // Developer tools are not accessible ingame, so it goes here. graphicsSettings->Add(new ItemHeader(gs->T("Debugging"))); Choice *dump = graphicsSettings->Add(new Choice(gs->T("Dump next frame to log"))); @@ -214,7 +214,6 @@ void GameSettingsScreen::CreateViews() { controlsSettings->Add(new ItemHeader(c->T("OnScreen", "On-Screen Touch Controls"))); controlsSettings->Add(new CheckBox(&g_Config.bShowTouchControls, c->T("OnScreen", "On-Screen Touch Controls"))); controlsSettings->Add(new Choice(c->T("Custom layout...")))->OnClick.Handle(this, &GameSettingsScreen::OnTouchControlLayout); - controlsSettings->Add(new Choice(c->T("Control Visibility...")))->OnClick.Handle(this, &GameSettingsScreen::OnTouchControlVisibility); controlsSettings->Add(new PopupSliderChoice(&g_Config.iTouchButtonOpacity, 0, 100, c->T("Button Opacity"), screenManager())); controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fButtonScale, 0.80, 2.0, c->T("Button Scaling"), screenManager())); @@ -225,19 +224,12 @@ void GameSettingsScreen::CreateViews() { systemSettingsScroll->Add(systemSettings); tabHolder->AddTab(ms->T("System"), systemSettingsScroll); + systemSettings->Add(new ItemHeader(s->T("UI Language"))); + systemSettings->Add(new Choice(dev->T("Language", "Language")))->OnClick.Handle(this, &GameSettingsScreen::OnLanguage); + systemSettings->Add(new ItemHeader(s->T("Emulation"))); systemSettings->Add(new CheckBox(&g_Config.bFastMemory, s->T("Fast Memory", "Fast Memory (Unstable)"))); -#ifdef IOS - if (isJailed) { - systemSettings->Add(new TextView(s->T("DynarecisJailed", "Dynarec (JIT) - (Not jailbroken - JIT not available)"))); - } else { - systemSettings->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)"))); - } -#else - systemSettings->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)"))); -#endif - #ifndef __SYMBIAN32__ systemSettings->Add(new CheckBox(&g_Config.bSeparateCPUThread, s->T("Multithreaded (experimental)")))->SetEnabled(!PSP_IsInited()); systemSettings->Add(new CheckBox(&g_Config.bSeparateIOThread, s->T("I/O on thread (experimental)")))->SetEnabled(!PSP_IsInited()); @@ -247,16 +239,13 @@ void GameSettingsScreen::CreateViews() { systemSettings->Add(new CheckBox(&g_Config.bAtomicAudioLocks, s->T("Atomic Audio locks (experimental)")))->SetEnabled(!PSP_IsInited()); enableReports_ = Reporting::IsEnabled(); -//#ifndef ANDROID +//#ifndef ANDROID systemSettings->Add(new ItemHeader(s->T("Cheats", "Cheats (experimental, see forums)"))); systemSettings->Add(new CheckBox(&g_Config.bEnableCheats, s->T("Enable Cheats"))); //#endif LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); systemSettings->SetSpacing(0); - - systemSettings->Add(new ItemHeader(s->T("UI Language"))); - systemSettings->Add(new Choice(dev->T("Language", "Language")))->OnClick.Handle(this, &GameSettingsScreen::OnLanguage); - + systemSettings->Add(new ItemHeader(s->T("General"))); systemSettings->Add(new Choice(s->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools); systemSettings->Add(new Choice(s->T("Clear Recent Games List")))->OnClick.Handle(this, &GameSettingsScreen::OnClearRecents); @@ -461,11 +450,6 @@ UI::EventReturn GameSettingsScreen::OnTouchControlLayout(UI::EventParams &e) { return UI::EVENT_DONE; }; -UI::EventReturn GameSettingsScreen::OnTouchControlVisibility(UI::EventParams &e) { - screenManager()->push(new TouchControlVisibilityScreen()); - return UI::EVENT_DONE; -}; - void DeveloperToolsScreen::CreateViews() { using namespace UI; root_ = new ScrollView(ORIENT_VERTICAL); @@ -479,6 +463,17 @@ void DeveloperToolsScreen::CreateViews() { LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); list->SetSpacing(0); list->Add(new ItemHeader(s->T("General"))); + +#ifdef IOS + if (isJailed) { + list->Add(new TextView(s->T("DynarecisJailed", "Dynarec (JIT) - (Not jailbroken - JIT not available)"))); + } else { + list->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)"))); + } +#else + list->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)"))); +#endif + list->Add(new Choice(de->T("System Information")))->OnClick.Handle(this, &DeveloperToolsScreen::OnSysInfo); list->Add(new CheckBox(&g_Config.bShowDeveloperMenu, de->T("Show Developer Menu"))); diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 893a99ce96..77aa17931e 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -49,7 +49,6 @@ private: // Event handlers UI::EventReturn OnControlMapping(UI::EventParams &e); UI::EventReturn OnTouchControlLayout(UI::EventParams &e); - UI::EventReturn OnTouchControlVisibility(UI::EventParams &e); UI::EventReturn OnDumpNextFrameToLog(UI::EventParams &e); UI::EventReturn OnBack(UI::EventParams &e); UI::EventReturn OnReloadCheats(UI::EventParams &e); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 461901e318..1299a12b36 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -554,7 +554,7 @@ void MainScreen::CreateViews() { #if defined(_WIN32) || defined(USING_QT_UI) rightColumnItems->Add(new Choice(m->T("Load","Load...")))->OnClick.Handle(this, &MainScreen::OnLoadFile); #endif - rightColumnItems->Add(new Choice(m->T("Game Settings")))->OnClick.Handle(this, &MainScreen::OnGameSettings); + rightColumnItems->Add(new Choice(m->T("Game Settings", "Settings")))->OnClick.Handle(this, &MainScreen::OnGameSettings); rightColumnItems->Add(new Choice(m->T("Exit")))->OnClick.Handle(this, &MainScreen::OnExit); rightColumnItems->Add(new Choice(m->T("Credits")))->OnClick.Handle(this, &MainScreen::OnCredits); #ifndef __SYMBIAN32__ diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index b28ce03f47..36f08ebf98 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -250,10 +250,13 @@ void NewLanguageScreen::OnCompleted(DialogResult result) { } void LogoScreen::Next() { - if (bootFilename_.size()) { - screenManager()->switchScreen(new EmuScreen(bootFilename_)); - } else { - screenManager()->switchScreen(new MainScreen()); + if (!switched_) { + switched_ = true; + if (bootFilename_.size()) { + screenManager()->switchScreen(new EmuScreen(bootFilename_)); + } else { + screenManager()->switchScreen(new MainScreen()); + } } } diff --git a/UI/MiscScreens.h b/UI/MiscScreens.h index 6b1bc99e41..0fc2414a05 100644 --- a/UI/MiscScreens.h +++ b/UI/MiscScreens.h @@ -84,7 +84,7 @@ private: class LogoScreen : public UIScreen { public: LogoScreen(const std::string &bootFilename) - : bootFilename_(bootFilename), frames_(0) {} + : bootFilename_(bootFilename), frames_(0), switched_(false) {} void key(const KeyInput &key); void update(InputState &input); void render(); @@ -95,6 +95,7 @@ private: void Next(); std::string bootFilename_; int frames_; + bool switched_; }; class CreditsScreen : public UIDialogScreenWithBackground { @@ -117,4 +118,4 @@ private: // Utility functions that create various popup screens -ListPopupScreen *CreateLanguageScreen(); \ No newline at end of file +ListPopupScreen *CreateLanguageScreen(); diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index e689f97bef..7707fc58a9 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -18,6 +18,7 @@ #include #include "TouchControlLayoutScreen.h" +#include "TouchControlVisibilityScreen.h" #include "Core/Config.h" #include "Core/System.h" #include "base/colorutil.h" @@ -236,6 +237,11 @@ UI::EventReturn TouchControlLayoutScreen::OnBack(UI::EventParams &e) { return UI::EVENT_DONE; }; +UI::EventReturn TouchControlLayoutScreen::OnVisibility(UI::EventParams &e) { + screenManager()->push(new TouchControlVisibilityScreen()); + return UI::EVENT_DONE; +} + UI::EventReturn TouchControlLayoutScreen::OnReset(UI::EventParams &e) { g_Config.iActionButtonSpacing = -1; g_Config.iActionButtonCenterX = -1; @@ -260,20 +266,28 @@ UI::EventReturn TouchControlLayoutScreen::OnReset(UI::EventParams &e) { return UI::EVENT_DONE; }; +void TouchControlLayoutScreen::dialogFinished(const Screen *dialog, DialogResult result) { + RecreateViews(); +} + void TouchControlLayoutScreen::CreateViews() { // setup g_Config for button layout InitPadLayout(); using namespace UI; + I18NCategory *c = GetI18NCategory("Controls"); I18NCategory *d = GetI18NCategory("Dialog"); root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); Choice *reset = new Choice(d->T("Reset"), "", false, new AnchorLayoutParams(leftMargin, WRAP_CONTENT, 10, NONE, NONE, 84)); Choice *back = new Choice(d->T("Back"), "", false, new AnchorLayoutParams(leftMargin, WRAP_CONTENT, 10, NONE, NONE, 10)); + Choice *visibility = new Choice(c->T("Visibility"), "", false, new AnchorLayoutParams(leftMargin, WRAP_CONTENT, 10, NONE, NONE, 158)); reset->OnClick.Handle(this, &TouchControlLayoutScreen::OnReset); back->OnClick.Handle(this, &TouchControlLayoutScreen::OnBack); + visibility->OnClick.Handle(this, &TouchControlLayoutScreen::OnVisibility); + root_->Add(visibility); root_->Add(reset); root_->Add(back); @@ -287,18 +301,15 @@ void TouchControlLayoutScreen::CreateViews() { I18NCategory *ms = GetI18NCategory("MainSettings"); - I18NCategory *c = GetI18NCategory("Controls"); tabHolder->AddTab(ms->T("Controls"), controlsHolder); - - if(!g_Config.bShowTouchControls){ + if (!g_Config.bShowTouchControls){ return; } float scale = g_Config.fButtonScale; controls_.clear(); - PSPActionButtons *actionButtons = new PSPActionButtons(g_Config.iActionButtonCenterX, g_Config.iActionButtonCenterY, g_Config.iActionButtonSpacing, scale); actionButtons->setCircleVisibility(g_Config.bShowTouchCircle); actionButtons->setCrossVisibility(g_Config.bShowTouchCross); @@ -306,26 +317,29 @@ void TouchControlLayoutScreen::CreateViews() { actionButtons->setSquareVisibility(g_Config.bShowTouchSquare); controls_.push_back(actionButtons); - + if (g_Config.bShowTouchCross) { controls_.push_back(new PSPDPadButtons(g_Config.iDpadX, g_Config.iDpadY, g_Config.iDpadRadius, scale)); } - if (g_Config.bShowTouchSelect) + if (g_Config.bShowTouchSelect) { controls_.push_back(new DragDropButton(g_Config.iSelectKeyX, g_Config.iSelectKeyY, I_RECT, I_SELECT, scale)); - - if (g_Config.bShowTouchStart) + } + + if (g_Config.bShowTouchStart) { controls_.push_back(new DragDropButton(g_Config.iStartKeyX, g_Config.iStartKeyY, I_RECT, I_START, scale)); - + } + if (g_Config.bShowTouchUnthrottle) { DragDropButton *unthrottle = new DragDropButton(g_Config.iUnthrottleKeyX, g_Config.iUnthrottleKeyY, I_RECT, I_ARROW, scale); unthrottle->SetAngle(180.0f); controls_.push_back(unthrottle); } - if (g_Config.bShowTouchLTrigger) + if (g_Config.bShowTouchLTrigger) { controls_.push_back(new DragDropButton(g_Config.iLKeyX, g_Config.iLKeyY, I_SHOULDER, I_L, scale)); - + } + if (g_Config.bShowTouchRTrigger) { DragDropButton *rbutton = new DragDropButton(g_Config.iRKeyX, g_Config.iRKeyY, I_SHOULDER, I_R, scale); rbutton->FlipImageH(true); @@ -339,8 +353,7 @@ void TouchControlLayoutScreen::CreateViews() { for (size_t i = 0; i < controls_.size(); i++) { root_->Add(controls_[i]); } - -}; +} // return the control which was picked up by the touchEvent. If a control // was already picked up, then it's being dragged around, so just return that instead diff --git a/UI/TouchControlLayoutScreen.h b/UI/TouchControlLayoutScreen.h index 2f5a439b1e..a35623635e 100644 --- a/UI/TouchControlLayoutScreen.h +++ b/UI/TouchControlLayoutScreen.h @@ -30,10 +30,12 @@ public: virtual void CreateViews(); virtual void touch(const TouchInput &touch); + virtual void dialogFinished(const Screen *dialog, DialogResult result); protected: virtual UI::EventReturn OnBack(UI::EventParams &e); virtual UI::EventReturn OnReset(UI::EventParams &e); + virtual UI::EventReturn OnVisibility(UI::EventParams &e); private: DragDropButton *pickedControl_;