From 2ed534f36edddfe1178955b149c4e92dbaae3552 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Sun, 10 Dec 2017 12:38:08 +0100 Subject: [PATCH] Add some options. --- Core/Config.cpp | 1 + Core/Config.h | 1 + Core/HLE/ThreadQueueList.h | 2 +- UI/GameSettingsScreen.cpp | 42 +++++++++++++++++++++++++++++++++++++- UI/GameSettingsScreen.h | 13 ++++++++++++ UI/MainScreen.cpp | 3 ++- UI/UI.vcxproj | 3 ++- Windows/MainWindowMenu.cpp | 31 ++++++++++++++++++++++++++++ Windows/resource.h | 2 ++ 9 files changed, 94 insertions(+), 4 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index f3c0634270ee..be0307f14efe 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -348,6 +348,7 @@ static ConfigSetting generalSettings[] = { ConfigSetting("CurrentDirectory", &g_Config.currentDirectory, ""), ConfigSetting("ShowDebuggerOnLoad", &g_Config.bShowDebuggerOnLoad, false), ConfigSetting("SimpleUI", &g_Config.bSimpleUI, true), + ConfigSetting("SimpleUIhide", &g_Config.bSimpleUIhide, false), ConfigSetting("CheckForNewVersion", &g_Config.bCheckForNewVersion, false), ConfigSetting("Language", &g_Config.sLanguageIni, &DefaultLangRegion), ConfigSetting("ForceLagSync", &g_Config.bForceLagSync, false, true, true), diff --git a/Core/Config.h b/Core/Config.h index 8e2a11cbe006..5b7d686af9b3 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -130,6 +130,7 @@ struct Config { bool bFastMemory; int iCpuCore; bool bSimpleUI; + bool bSimpleUIhide; bool bCheckForNewVersion; bool bForceLagSync; bool bFuncReplacements; diff --git a/Core/HLE/ThreadQueueList.h b/Core/HLE/ThreadQueueList.h index 9111fff41d6b..d88ceceb600c 100644 --- a/Core/HLE/ThreadQueueList.h +++ b/Core/HLE/ThreadQueueList.h @@ -82,7 +82,7 @@ struct ThreadQueueList { cur = cur->next; } - _dbg_assert_msg_(SCEKERNEL, false, "ThreadQueueList should not be empty."); + //_dbg_assert_msg_(SCEKERNEL, false, "ThreadQueueList should not be empty."); return 0; } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index bf539a605a05..e50e6496f5f7 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -651,6 +651,7 @@ void GameSettingsScreen::CreateViews() { if (!g_Config.bSimpleUI) { tools->Add(new Choice(dev->T("System Information")))->OnClick.Handle(this, &GameSettingsScreen::OnSysInfo); tools->Add(new Choice(sy->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools); + tools->Add(new Choice(sy->T("Other Settings")))->OnClick.Handle(this, &GameSettingsScreen::OnOtherSettings); } tools->Add(new Choice(ri->T("Remote disc streaming")))->OnClick.Handle(this, &GameSettingsScreen::OnRemoteISO); @@ -1033,7 +1034,11 @@ UI::EventReturn GameSettingsScreen::OnDumpNextFrameToLog(UI::EventParams &e) { void GameSettingsScreen::update() { UIScreen::update(); - g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0; + + if (g_Config.iForceMaxEmulatedFPS == 60 || g_Config.iForceMaxEmulatedFPS == 0) + g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0; + else + cap60FPS_ = false; g_Config.iFpsLimit = (iAlternateSpeedPercent_ * 60) / 100; @@ -1181,6 +1186,11 @@ UI::EventReturn GameSettingsScreen::OnDeveloperTools(UI::EventParams &e) { return UI::EVENT_DONE; } +UI::EventReturn GameSettingsScreen::OnOtherSettings(UI::EventParams &e) { + screenManager()->push(new OtherSettingsScreen()); + return UI::EVENT_DONE; +} + UI::EventReturn GameSettingsScreen::OnRemoteISO(UI::EventParams &e) { screenManager()->push(new RemoteISOScreen()); return UI::EVENT_DONE; @@ -1288,6 +1298,36 @@ void DeveloperToolsScreen::onFinish(DialogResult result) { g_Config.Save(); } + +void OtherSettingsScreen::CreateViews() { + using namespace UI; + root_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); + ScrollView *settingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); + settingsScroll->SetTag("OtherSettings"); + root_->Add(settingsScroll); + + I18NCategory *gr = GetI18NCategory("Graphics"); + I18NCategory *sy = GetI18NCategory("System"); + + AddStandardBack(root_); + + LinearLayout *list = settingsScroll->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); + list->SetSpacing(0); + + list->Add(new ItemHeader(sy->T("Settings that should not be changed by most users"))); + list->Add(new CheckBox(&g_Config.bEncryptSave, sy->T("Encrypt savedata"))); + list->Add(new CheckBox(&g_Config.bSavedataUpgrade, sy->T("Allow savedata with wrong encryption(unsafe workaround for outdated PSP savedata)"))); + list->Add(new CheckBox(&g_Config.bFrameSkipUnthrottle, gr->T("Frameskip unthrottle(good for CPU benchmark)"))); + list->Add(new CheckBox(&g_Config.bTrueColor, gr->T("True Color(Disable to get PSP colors)"))); + PopupSliderChoice *emulatedSpeed = list->Add(new PopupSliderChoice(&g_Config.iForceMaxEmulatedFPS, 0, 60, gr->T("Force Max Emulated FPS(affects speed in most games!)"), 1, screenManager(), gr->T("FPS, 0:Disabled"))); + emulatedSpeed->SetFormat("%i FPS"); + emulatedSpeed->SetZeroLabel(gr->T("Disabled")); +} + +void OtherSettingsScreen::onFinish(DialogResult result) { + g_Config.Save(); +} + void GameSettingsScreen::CallbackRestoreDefaults(bool yes) { if (yes) g_Config.RestoreDefaults(); diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 98799e4eacb9..a066349b1629 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -74,6 +74,7 @@ class GameSettingsScreen : public UIDialogScreenWithGameBackground { UI::EventReturn OnPostProcShader(UI::EventParams &e); UI::EventReturn OnPostProcShaderChange(UI::EventParams &e); UI::EventReturn OnDeveloperTools(UI::EventParams &e); + UI::EventReturn OnOtherSettings(UI::EventParams &e); UI::EventReturn OnRemoteISO(UI::EventParams &e); UI::EventReturn OnChangeNickname(UI::EventParams &e); UI::EventReturn OnChangeproAdhocServerAddress(UI::EventParams &e); @@ -157,6 +158,18 @@ class DeveloperToolsScreen : public UIDialogScreenWithBackground { UI::EventReturn OnJitAffectingSetting(UI::EventParams &e); }; +class OtherSettingsScreen : public UIDialogScreenWithBackground { +public: + OtherSettingsScreen() {} + void onFinish(DialogResult result) override; + +protected: + void CreateViews() override; + +private: + bool QualityDepth_; +}; + class ProAdhocServerScreen : public UIDialogScreenWithBackground { public: ProAdhocServerScreen() {} diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 3442f66dd62d..76c419488c8f 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -853,7 +853,8 @@ void MainScreen::CreateViews() { #endif 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 CheckBox(&g_Config.bSimpleUI, mm->T("SimpleUI", "Simple UI")))->OnClick.Handle(this, &MainScreen::OnRecentChange); + if (!g_Config.bSimpleUIhide) + rightColumnItems->Add(new CheckBox(&g_Config.bSimpleUI, mm->T("SimpleUI", "Simple UI")))->OnClick.Handle(this, &MainScreen::OnRecentChange); if (!g_Config.bSimpleUI) { rightColumnItems->Add(new Choice(mm->T("www.ppsspp.org")))->OnClick.Handle(this, &MainScreen::OnPPSSPPOrg); if (!System_GetPropertyBool(SYSPROP_APP_GOLD)) { diff --git a/UI/UI.vcxproj b/UI/UI.vcxproj index 06f979c86b51..929871985e84 100644 --- a/UI/UI.vcxproj +++ b/UI/UI.vcxproj @@ -84,7 +84,8 @@ {004B8D11-2BE3-4BD9-AB40-2BE04CF2096F} Win32Proj UI - + + diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 7c8b114ac540..144181e0b191 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -87,6 +87,7 @@ namespace MainWindow { MENU_DEBUG = 2, MENU_OPTIONS = 3, MENU_HELP = 4, + MENU_SIMPLEUI = 5, // File submenus SUBMENU_FILE_SAVESTATE_SLOT = 6, @@ -159,6 +160,23 @@ namespace MainWindow { AppendMenu(helpMenu, MF_STRING | MF_BYCOMMAND, ID_HELP_ABOUT, aboutPPSSPP.c_str()); } + void CreateSimpleUIMenu(HMENU menu) { + I18NCategory *des = GetI18NCategory("DesktopUI"); + + const std::wstring simpleUI = ConvertUTF8ToWString(des->T("Simple UI")); + const std::wstring enable = ConvertUTF8ToWString(des->T("Enable")); + const std::wstring hide = ConvertUTF8ToWString(des->T("Hide from main menu")); + + // Simply remove the old help menu and create a new one. + RemoveMenu(menu, MENU_SIMPLEUI, MF_BYPOSITION); + + HMENU simpleUImenu = CreatePopupMenu(); + InsertMenu(menu, MENU_SIMPLEUI, MF_POPUP | MF_STRING | MF_BYPOSITION, (UINT_PTR)simpleUImenu, simpleUI.c_str()); + + AppendMenu(simpleUImenu, MF_STRING | MF_BYCOMMAND, ID_SIMPLEUI_TOGGLE, enable.c_str()); + AppendMenu(simpleUImenu, MF_STRING | MF_BYCOMMAND, ID_SIMPLEUI_HIDE, hide.c_str()); + } + void UpdateDynamicMenuCheckmarks(HMENU menu) { int item = ID_SHADERS_BASE + 1; @@ -250,6 +268,7 @@ namespace MainWindow { TranslateMenu(menu, "Debugging", MENU_DEBUG); TranslateMenu(menu, "Game Settings", MENU_OPTIONS); TranslateMenu(menu, "Help", MENU_HELP); + TranslateMenu(menu, "Help", MENU_SIMPLEUI); // File menu TranslateMenuItem(menu, ID_FILE_LOAD); @@ -352,6 +371,7 @@ namespace MainWindow { // Help menu: it's translated in CreateHelpMenu. CreateHelpMenu(menu); + CreateSimpleUIMenu(menu); } void TranslateMenus(HWND hWnd, HMENU menu) { @@ -1034,6 +1054,15 @@ namespace MainWindow { g_Config.bDumpAudio = !g_Config.bDumpAudio; break; + case ID_SIMPLEUI_TOGGLE: + g_Config.bSimpleUI = !g_Config.bSimpleUI; + NativeMessageReceived("recreateviews", ""); + break; + case ID_SIMPLEUI_HIDE: + g_Config.bSimpleUIhide = !g_Config.bSimpleUIhide; + NativeMessageReceived("recreateviews", ""); + break; + default: { // Handle the dynamic shader switching here. @@ -1078,6 +1107,8 @@ namespace MainWindow { CHECKITEM(ID_FILE_DUMPFRAMES, g_Config.bDumpFrames); CHECKITEM(ID_FILE_USEFFV1, g_Config.bUseFFV1); CHECKITEM(ID_FILE_DUMPAUDIO, g_Config.bDumpAudio); + CHECKITEM(ID_SIMPLEUI_TOGGLE, g_Config.bSimpleUI); + CHECKITEM(ID_SIMPLEUI_HIDE, g_Config.bSimpleUIhide); static const int displayrotationitems[] = { ID_EMULATION_ROTATION_H, diff --git a/Windows/resource.h b/Windows/resource.h index 1a5fa8e24c22..d7db9b2266ae 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -334,6 +334,8 @@ #define ID_FILE_DUMPAUDIO 40167 #define ID_HELP_GITHUB 40168 #define IDC_GEDBG_RECORD 40169 +#define ID_SIMPLEUI_TOGGLE 40200 +#define ID_SIMPLEUI_HIDE 40201 // Dummy option to let the buffered rendering hotkey cycle through all the options. #define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500