diff --git a/Core/Config.cpp b/Core/Config.cpp index 6db53a4567..8ecbb5ff8b 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -25,18 +25,12 @@ Config g_Config; - #ifdef IOS extern bool isJailed; #endif -Config::Config() -{ -} - -Config::~Config() -{ -} +Config::Config() { } +Config::~Config() { } void Config::Load(const char *iniFileName) { @@ -143,6 +137,7 @@ void Config::Load(const char *iniFileName) control->Get("AccelerometerToAnalogHoriz", &bAccelerometerToAnalogHoriz, false); control->Get("ForceInputDevice", &iForceInputDevice, -1); control->Get("RightStickBind", &iRightStickBind, 0); + control->Get("TouchButtonOpacity", &iTouchButtonOpacity, 65); IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam"); pspConfig->Get("NickName", &sNickName, "shadow"); @@ -236,6 +231,7 @@ void Config::Save() control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz); control->Set("ForceInputDevice", iForceInputDevice); control->Set("RightStickBind", iRightStickBind); + control->Set("TouchButtonOpacity", iTouchButtonOpacity); IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam"); diff --git a/Core/Config.h b/Core/Config.h index 1b2347e05d..c0a991525e 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -90,7 +90,7 @@ public: // Sound bool bEnableSound; bool bEnableAtrac3plus; - + // UI bool bShowTouchControls; bool bShowDebuggerOnLoad; @@ -109,6 +109,7 @@ public: // Control std::map iMappingMap; // Can be used differently depending on systems int iForceInputDevice; + int iTouchButtonOpacity; // SystemParam std::string sNickName; diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 476b90d1a2..823683b835 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -795,7 +795,7 @@ int PSPOskDialog::Update() selectedChar = (selectedChar + (numKeyCols[currentKeyboard] * numKeyRows[currentKeyboard])) % (numKeyCols[currentKeyboard] * numKeyRows[currentKeyboard]); - if (IsButtonPressed(CTRL_CROSS) && g_Config.bButtonPreference || IsButtonPressed(CTRL_CIRCLE) && !g_Config.bButtonPreference) + if ((IsButtonPressed(CTRL_CROSS) && g_Config.bButtonPreference) || (IsButtonPressed(CTRL_CIRCLE) && !g_Config.bButtonPreference)) { inputChars = CombinationString(true); } @@ -816,7 +816,7 @@ int PSPOskDialog::Update() selectedChar = selectedRow * numKeyCols[currentKeyboard] + selectedExtra; } - else if (IsButtonPressed(CTRL_CIRCLE) && g_Config.bButtonPreference || IsButtonPressed(CTRL_CROSS) && !g_Config.bButtonPreference) + else if ((IsButtonPressed(CTRL_CIRCLE) && g_Config.bButtonPreference) || (IsButtonPressed(CTRL_CROSS) && !g_Config.bButtonPreference)) { if (inputChars.size() > 0) { diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 95221d819d..5ce338c37d 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -233,12 +233,15 @@ void EmuScreen::update(InputState &input) { __CtrlSetAnalog(rightstick_x, rightstick_x, 1); if (PSP_CoreParameter().fpsLimit != 2) { + // Don't really need to show these, it's pretty obvious what unthrottle does, + // in contrast to the three state toggle + /* if (input.pad_buttons_down & PAD_BUTTON_UNTHROTTLE) { osm.Show(s->T("unlimited", "Speed: unlimited!"), 1.0, 0x50E0FF); } if (input.pad_buttons_up & PAD_BUTTON_UNTHROTTLE) { osm.Show(s->T("standard", "Speed: standard"), 1.0); - } + }*/ } if (input.pad_buttons & PAD_BUTTON_UNTHROTTLE) { PSP_CoreParameter().unthrottle = true; @@ -249,22 +252,22 @@ void EmuScreen::update(InputState &input) { if (PSP_CoreParameter().fpsLimit != 0 && PSP_CoreParameter().fpsLimit != 1 && PSP_CoreParameter().fpsLimit != 2) { PSP_CoreParameter().fpsLimit = 0; } + //Toggle between 3 different states of fpsLimit if (input.pad_buttons_down & PAD_BUTTON_LEFT_THUMB) { if (PSP_CoreParameter().fpsLimit == 0) { PSP_CoreParameter().fpsLimit = 1; osm.Show(s->T("fixed", "Speed: fixed"), 1.0); } - else if (PSP_CoreParameter().fpsLimit == 1){ + else if (PSP_CoreParameter().fpsLimit == 1) { PSP_CoreParameter().fpsLimit = 2; osm.Show(s->T("unlimited", "Speed: unlimited!"), 1.0, 0x50E0FF); } - else if (PSP_CoreParameter().fpsLimit == 2){ + else if (PSP_CoreParameter().fpsLimit == 2) { PSP_CoreParameter().fpsLimit = 0; osm.Show(s->T("standard", "Speed: standard"), 1.0); } } - if (input.pad_buttons_down & (PAD_BUTTON_MENU | PAD_BUTTON_BACK | PAD_BUTTON_RIGHT_THUMB)) { if (g_Config.bBufferedRendering) @@ -313,8 +316,9 @@ void EmuScreen::render() { ui_draw2d.Begin(UIShader_Get(), DBMODE_NORMAL); + float touchOpacity = g_Config.iTouchButtonOpacity / 100.0f; if (g_Config.bShowTouchControls) - DrawGamepad(ui_draw2d); + DrawGamepad(ui_draw2d, touchOpacity); DrawWatermark(); diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index cdcb5a7f4e..eab63aebd5 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -16,8 +16,9 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "GamepadEmu.h" +#include "base/colorutil.h" #include "ui/virtual_input.h" -#include "../../Core/Config.h" +#include "Core/Config.h" #include "ui_atlas.h" TouchButton buttonX(&ui_atlas, I_ROUND, I_CROSS, PAD_BUTTON_A); @@ -112,10 +113,11 @@ void UpdateGamepad(InputState &input_state) leftStick.update(input_state); } -void DrawGamepad(DrawBuffer &db) +void DrawGamepad(DrawBuffer &db, float opacity) { - uint32_t color = 0xa0c0b080; - uint32_t colorOverlay = 0xa0FFFFFF; + uint32_t color = colorAlpha(0xc0b080, opacity); + uint32_t colorOverlay = colorAlpha(0xFFFFFF, opacity); + buttonO.draw(db, color, colorOverlay); buttonX.draw(db, color, colorOverlay); buttonTri.draw(db, color, colorOverlay); diff --git a/UI/GamepadEmu.h b/UI/GamepadEmu.h index 85a79b7266..3f6d8b964d 100644 --- a/UI/GamepadEmu.h +++ b/UI/GamepadEmu.h @@ -22,4 +22,4 @@ void LayoutGamepad(int w, int h); void UpdateGamepad(InputState &input_state); -void DrawGamepad(DrawBuffer &db); \ No newline at end of file +void DrawGamepad(DrawBuffer &db, float opacity); diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 729ce667c7..21bcad9412 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -658,7 +658,7 @@ void DeveloperScreen::render() { } if (UIButton(GEN_ID, vlinear, w, 0, d->T("Save language ini"), ALIGN_LEFT)) { - i18nrepo.SaveIni(g_Config.languageIni); + i18nrepo.SaveIni(g_Config.languageIni); } if (UIButton(GEN_ID, vlinear, w, 0, d->T("Run CPU tests"), ALIGN_LEFT)) { @@ -1119,7 +1119,13 @@ void ControlsScreen::render() { if (g_Config.bShowTouchControls) { UICheckBox(GEN_ID, x, y += stride, c->T("Large Controls"), ALIGN_TOPLEFT, &g_Config.bLargeControls); UICheckBox(GEN_ID, x, y += stride, c->T("Show Analog Stick"), ALIGN_TOPLEFT, &g_Config.bShowAnalogStick); - } + // This will be a slider in the new UI later + bool bTransparent = g_Config.iTouchButtonOpacity < 30; + bool prev = bTransparent; + UICheckBox(GEN_ID, x, y += stride, c->T("Transparent Buttons"), ALIGN_TOPLEFT, &bTransparent); + if (bTransparent != prev) + g_Config.iTouchButtonOpacity = bTransparent ? 15 : 65; + } UICheckBox(GEN_ID, x, y += stride, c->T("Tilt", "Tilt to Analog (horizontal)"), ALIGN_TOPLEFT, &g_Config.bAccelerometerToAnalogHoriz); UIEnd();