From a802adb1f677ae4b61f0d59b464adb6130d9b68e Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Mon, 4 Feb 2019 13:00:08 +0100 Subject: [PATCH] Add simple UI for JIT feature disable flags --- Core/MIPS/JitCommon/JitState.h | 2 ++ UI/DevScreens.cpp | 65 ++++++++++++++++++++++++++++++++++ UI/DevScreens.h | 10 ++++++ UI/GameSettingsScreen.cpp | 6 ++++ UI/GameSettingsScreen.h | 1 + 5 files changed, 84 insertions(+) diff --git a/Core/MIPS/JitCommon/JitState.h b/Core/MIPS/JitCommon/JitState.h index c4b31274f3..ac16bcf7da 100644 --- a/Core/MIPS/JitCommon/JitState.h +++ b/Core/MIPS/JitCommon/JitState.h @@ -198,6 +198,8 @@ namespace MIPSComp { POINTERIFY = 0x00400000, STATIC_ALLOC = 0x00800000, CACHE_POINTERS = 0x01000000, + + ALL_FLAGS = 0x01FFFFFF, }; struct JitOptions { diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 5bb95172d3..0815100336 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -37,6 +37,7 @@ #include "Core/MIPS/MIPSTables.h" #include "Core/MIPS/JitCommon/JitBlockCache.h" #include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/JitState.h" #include "GPU/GPUInterface.h" #include "GPU/GPUState.h" #include "UI/MiscScreens.h" @@ -318,6 +319,70 @@ void LogLevelScreen::OnCompleted(DialogResult result) { } } +struct JitDisableFlag { + MIPSComp::JitDisable flag; + const char *name; +}; + +// Please do not try to translate these :) +static const JitDisableFlag jitDisableFlags[] = { + { MIPSComp::JitDisable::ALU, "ALU" }, + { MIPSComp::JitDisable::ALU_IMM, "ALU_IMM" }, + { MIPSComp::JitDisable::ALU_BIT, "ALU_BIT" }, + { MIPSComp::JitDisable::MULDIV, "MULDIV" }, + { MIPSComp::JitDisable::FPU, "FPU" }, + { MIPSComp::JitDisable::FPU_COMP, "FPU_COMP" }, + { MIPSComp::JitDisable::FPU_XFER, "FPU_XFER" }, + { MIPSComp::JitDisable::VFPU_VEC, "VFPU_VEC" }, + { MIPSComp::JitDisable::VFPU_MTX, "VFPU_MTX" }, + { MIPSComp::JitDisable::VFPU_COMP, "VFPU_COMP" }, + { MIPSComp::JitDisable::VFPU_XFER, "VFPU_XFER" }, + { MIPSComp::JitDisable::LSU, "LSU" }, + { MIPSComp::JitDisable::LSU_UNALIGNED, "LSU_UNALIGNED" }, + { MIPSComp::JitDisable::LSU_FPU, "LSU_FPU" }, + { MIPSComp::JitDisable::LSU_VFPU, "LSU_VFPU" }, + { MIPSComp::JitDisable::SIMD, "SIMD" }, + { MIPSComp::JitDisable::BLOCKLINK, "Block Linking" }, + { MIPSComp::JitDisable::POINTERIFY, "Pointerify" }, + { MIPSComp::JitDisable::STATIC_ALLOC, "Static regalloc" }, + { MIPSComp::JitDisable::CACHE_POINTERS, "Cached pointers" }, +}; + +void JitDebugScreen::CreateViews() { + using namespace UI; + + I18NCategory *di = GetI18NCategory("Dialog"); + I18NCategory *dev = GetI18NCategory("Developer"); + + root_ = new ScrollView(ORIENT_VERTICAL); + + LinearLayout *vert = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); + vert->SetSpacing(0); + + LinearLayout *topbar = new LinearLayout(ORIENT_HORIZONTAL); + topbar->Add(new Choice(di->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); + topbar->Add(new Choice(di->T("Disable All")))->OnClick.Handle(this, &JitDebugScreen::OnDisableAll); + topbar->Add(new Choice(di->T("Enable All")))->OnClick.Handle(this, &JitDebugScreen::OnEnableAll); + + vert->Add(topbar); + vert->Add(new ItemHeader(dev->T("Disabled JIT functionality"))); + + for (auto flag : jitDisableFlags) { + // Do not add translation of these. + vert->Add(new BitCheckBox(&g_Config.uJitDisableFlags, (uint32_t)flag.flag, flag.name)); + } +} + +UI::EventReturn JitDebugScreen::OnEnableAll(UI::EventParams &e) { + g_Config.uJitDisableFlags &= ~(uint32_t)MIPSComp::JitDisable::ALL_FLAGS; + return UI::EVENT_DONE; +} + +UI::EventReturn JitDebugScreen::OnDisableAll(UI::EventParams &e) { + g_Config.uJitDisableFlags |= (uint32_t)MIPSComp::JitDisable::ALL_FLAGS; + return UI::EVENT_DONE; +} + const char *GetCompilerABI() { #if PPSSPP_ARCH(ARMV7) return "armeabi-v7a"; diff --git a/UI/DevScreens.h b/UI/DevScreens.h index a95ba61c27..a6c480bc66 100644 --- a/UI/DevScreens.h +++ b/UI/DevScreens.h @@ -47,6 +47,16 @@ protected: UI::EventReturn OnToggleAudioDebug(UI::EventParams &e); }; +class JitDebugScreen : public UIDialogScreenWithBackground { +public: + JitDebugScreen() {} + virtual void CreateViews() override; + +private: + UI::EventReturn OnEnableAll(UI::EventParams &e); + UI::EventReturn OnDisableAll(UI::EventParams &e); +}; + class LogConfigScreen : public UIDialogScreenWithBackground { public: LogConfigScreen() {} diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 0f34bdc50c..9f31ede54d 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1283,6 +1283,7 @@ void DeveloperToolsScreen::CreateViews() { core->HideChoice(1); } + list->Add(new Choice(dev->T("JIT debug tools")))->OnClick.Handle(this, &DeveloperToolsScreen::OnJitDebugTools); list->Add(new CheckBox(&g_Config.bShowDeveloperMenu, dev->T("Show Developer Menu"))); list->Add(new CheckBox(&g_Config.bDumpDecryptedEboot, dev->T("Dump Decrypted Eboot", "Dump Decrypted EBOOT.BIN (If Encrypted) When Booting Game"))); @@ -1388,6 +1389,11 @@ UI::EventReturn DeveloperToolsScreen::OnLogConfig(UI::EventParams &e) { return UI::EVENT_DONE; } +UI::EventReturn DeveloperToolsScreen::OnJitDebugTools(UI::EventParams &e) { + screenManager()->push(new JitDebugScreen()); + return UI::EVENT_DONE; +} + UI::EventReturn DeveloperToolsScreen::OnGPUDriverTest(UI::EventParams &e) { screenManager()->push(new GPUDriverTestScreen()); return UI::EVENT_DONE; diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 915a524a20..78619558ac 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -157,6 +157,7 @@ private: UI::EventReturn OnOpenTexturesIniFile(UI::EventParams &e); UI::EventReturn OnLogConfig(UI::EventParams &e); UI::EventReturn OnJitAffectingSetting(UI::EventParams &e); + UI::EventReturn OnJitDebugTools(UI::EventParams &e); UI::EventReturn OnRemoteDebugger(UI::EventParams &e); UI::EventReturn OnGPUDriverTest(UI::EventParams &e);