mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-12 00:59:41 +01:00
Merge pull request #12601 from iota97/touch-rapid-fire
Add rapid fire to touch control
This commit is contained in:
9 files changed
+51
-3
No files matched your search
@@ -881,6 +881,7 @@ static ConfigSetting controlSettings[] = {
|
||||
ConfigSetting("fcombo4X", "fcombo4Y", "comboKeyScale4", "ShowComboKey4", &g_Config.touchCombo4, defaultTouchPosHide, true, true),
|
||||
ConfigSetting("Speed1KeyX", "Speed1KeyY", "Speed1KeyScale", "ShowSpeed1Key", &g_Config.touchSpeed1Key, defaultTouchPosHide, true, true),
|
||||
ConfigSetting("Speed2KeyX", "Speed2KeyY", "Speed2KeyScale", "ShowSpeed2Key", &g_Config.touchSpeed2Key, defaultTouchPosHide, true, true),
|
||||
ConfigSetting("RapidFireKeyX", "RapidFireKeyY", "RapidFireKeyScale", "ShowRapidFireKey", &g_Config.touchRapidFireKey, defaultTouchPosHide, true, true),
|
||||
|
||||
#ifdef _WIN32
|
||||
ConfigSetting("DInputAnalogDeadzone", &g_Config.fDInputAnalogDeadzone, 0.1f, true, true),
|
||||
@@ -1599,6 +1600,7 @@ void Config::ResetControlLayout() {
|
||||
reset(g_Config.touchCombo4);
|
||||
reset(g_Config.touchSpeed1Key);
|
||||
reset(g_Config.touchSpeed2Key);
|
||||
reset(g_Config.touchRapidFireKey);
|
||||
}
|
||||
|
||||
void Config::GetReportingInfo(UrlEncoder &data) {
|
||||
|
||||
@@ -308,6 +308,7 @@ public:
|
||||
ConfigTouchPos touchCombo4;
|
||||
ConfigTouchPos touchSpeed1Key;
|
||||
ConfigTouchPos touchSpeed2Key;
|
||||
ConfigTouchPos touchRapidFireKey;
|
||||
|
||||
// Controls Visibility
|
||||
bool bShowTouchControls;
|
||||
|
||||
@@ -200,6 +200,11 @@ void __CtrlSetRapidFire(bool state)
|
||||
emuRapidFire = state;
|
||||
}
|
||||
|
||||
bool __CtrlGetRapidFire()
|
||||
{
|
||||
return emuRapidFire;
|
||||
}
|
||||
|
||||
static int __CtrlReadSingleBuffer(PSPPointer<CtrlData> data, bool negative)
|
||||
{
|
||||
if (data.IsValid())
|
||||
|
||||
@@ -79,6 +79,7 @@ void __CtrlSetAnalogY(float value, int stick = CTRL_STICK_LEFT);
|
||||
|
||||
// Call this to enable rapid-fire. This will cause buttons other than arrows to alternate.
|
||||
void __CtrlSetRapidFire(bool state);
|
||||
bool __CtrlGetRapidFire();
|
||||
|
||||
// For use by internal UI like MsgDialog
|
||||
u32 __CtrlPeekButtons();
|
||||
|
||||
+7
-3
@@ -628,6 +628,9 @@ void EmuScreen::onVKeyDown(int virtualKeyCode) {
|
||||
osm.Show(sc->T("replaceTextures_false", "Textures no longer are being replaced"), 2.0);
|
||||
NativeMessageReceived("gpu_clearCache", "");
|
||||
break;
|
||||
case VIRTKEY_RAPID_FIRE:
|
||||
__CtrlSetRapidFire(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -677,6 +680,10 @@ void EmuScreen::onVKeyUp(int virtualKeyCode) {
|
||||
setVKeyAnalogY(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX);
|
||||
break;
|
||||
|
||||
case VIRTKEY_RAPID_FIRE:
|
||||
__CtrlSetRapidFire(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1080,9 +1087,6 @@ void EmuScreen::update() {
|
||||
if (invalid_)
|
||||
return;
|
||||
|
||||
// Virtual keys.
|
||||
__CtrlSetRapidFire(virtKeys[VIRTKEY_RAPID_FIRE - VIRTKEY_FIRST]);
|
||||
|
||||
// This is here to support the iOS on screen back button.
|
||||
if (pauseTrigger_) {
|
||||
pauseTrigger_ = false;
|
||||
|
||||
@@ -157,6 +157,19 @@ void FPSLimitButton::Touch(const TouchInput &input) {
|
||||
}
|
||||
}
|
||||
|
||||
void RapidFireButton::Touch(const TouchInput &input) {
|
||||
bool lastDown = pointerDownMask_ != 0;
|
||||
MultiTouchButton::Touch(input);
|
||||
bool down = pointerDownMask_ != 0;
|
||||
if (down && !lastDown) {
|
||||
__CtrlSetRapidFire(!__CtrlGetRapidFire());
|
||||
}
|
||||
}
|
||||
|
||||
bool RapidFireButton::IsDown() {
|
||||
return __CtrlGetRapidFire();
|
||||
}
|
||||
|
||||
bool FPSLimitButton::IsDown() {
|
||||
return PSP_CoreParameter().fpsLimit == limit_;
|
||||
}
|
||||
@@ -510,6 +523,7 @@ void InitPadLayout(float xres, float yres, float globalScale) {
|
||||
|
||||
initTouchPos(g_Config.touchSpeed1Key, unthrottle_key_X, unthrottle_key_Y - 60 * scale);
|
||||
initTouchPos(g_Config.touchSpeed2Key, unthrottle_key_X + bottom_key_spacing * scale, unthrottle_key_Y - 60 * scale);
|
||||
initTouchPos(g_Config.touchRapidFireKey, unthrottle_key_X + 2*bottom_key_spacing * scale, unthrottle_key_Y - 60 * scale);
|
||||
|
||||
// L and R------------------------------------------------------------
|
||||
// Put them above the analog stick / above the buttons to the right.
|
||||
@@ -633,6 +647,11 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause) {
|
||||
});
|
||||
}
|
||||
|
||||
if (g_Config.touchRapidFireKey.show) {
|
||||
auto rapidFire = root->Add(new RapidFireButton(rectImage, I_RECT, I_ARROW, g_Config.touchRapidFireKey.scale, buttonLayoutParams(g_Config.touchRapidFireKey)));
|
||||
rapidFire->SetAngle(90.0f, 180.0f);
|
||||
}
|
||||
|
||||
FPSLimitButton *speed1 = addFPSLimitButton(FPSLimit::CUSTOM1, rectImage, I_RECT, I_ARROW, g_Config.touchSpeed1Key);
|
||||
if (speed1)
|
||||
speed1->SetAngle(170.0f, 180.0f);
|
||||
|
||||
@@ -97,6 +97,15 @@ private:
|
||||
FPSLimit limit_;
|
||||
};
|
||||
|
||||
class RapidFireButton : public MultiTouchButton {
|
||||
public:
|
||||
RapidFireButton(int bgImg, int bgDownImg, int img, float scale, UI::LayoutParams *layoutParams)
|
||||
: MultiTouchButton(bgImg, bgDownImg, img, scale, layoutParams) {
|
||||
}
|
||||
void Touch(const TouchInput &input) override;
|
||||
bool IsDown() override;
|
||||
};
|
||||
|
||||
class PSPButton : public MultiTouchButton {
|
||||
public:
|
||||
PSPButton(int pspButtonBit, int bgImg, int bgDownImg, int img, float scale, UI::LayoutParams *layoutParams)
|
||||
|
||||
@@ -453,6 +453,12 @@ void TouchControlLayoutScreen::CreateViews() {
|
||||
controls_.push_back(speed2);
|
||||
}
|
||||
|
||||
if (g_Config.touchRapidFireKey.show) {
|
||||
DragDropButton *rapidFire = new DragDropButton(g_Config.touchRapidFireKey, rectImage, I_ARROW);
|
||||
rapidFire->SetAngle(90.0f, 180.0f);
|
||||
controls_.push_back(rapidFire);
|
||||
}
|
||||
|
||||
if (g_Config.touchLKey.show) {
|
||||
controls_.push_back(new DragDropButton(g_Config.touchLKey, shoulderImage, I_L));
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ void TouchControlVisibilityScreen::CreateViews() {
|
||||
toggles_.push_back({ "Combo4", &g_Config.touchCombo4.show, I_5 });
|
||||
toggles_.push_back({ "Alt speed 1", &g_Config.touchSpeed1Key.show, -1 });
|
||||
toggles_.push_back({ "Alt speed 2", &g_Config.touchSpeed2Key.show, -1 });
|
||||
toggles_.push_back({ "Rapid Fire", &g_Config.touchRapidFireKey.show, -1 });
|
||||
|
||||
I18NCategory *mc = GetI18NCategory("MappableControls");
|
||||
|
||||
|
||||
Reference in new issue
Block a user