Skip to content

Commit

Permalink
Little fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iota97 committed Jan 17, 2020
1 parent 9ff452c commit bd2511b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
32 changes: 20 additions & 12 deletions UI/GamepadEmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,41 +434,49 @@ void PSPStick::ProcessTouch(float x, float y, bool down) {
dy = std::min(1.0f, std::max(-1.0f, dy));

if (stick_ == 2) { // Custom right analog
if (g_Config.iRightAnalogRight != 0) // 0 is none
if (g_Config.iRightAnalogRight != 0) {
if (dx > 0.5f)
__CtrlButtonDown(button[g_Config.iRightAnalogRight-1]);
else
__CtrlButtonUp(button[g_Config.iRightAnalogRight-1]);
if (g_Config.iRightAnalogLeft != 0)
}
if (g_Config.iRightAnalogLeft != 0) {
if (dx < -0.5f)
__CtrlButtonDown(button[g_Config.iRightAnalogLeft-1]);
else
__CtrlButtonUp(button[g_Config.iRightAnalogLeft-1]);
if (g_Config.iRightAnalogUp != 0)
}
if (g_Config.iRightAnalogUp != 0) {
if (dy < -0.5f)
__CtrlButtonDown(button[g_Config.iRightAnalogUp-1]);
else
__CtrlButtonUp(button[g_Config.iRightAnalogUp-1]);
if (g_Config.iRightAnalogDown != 0)
}
if (g_Config.iRightAnalogDown != 0) {
if (dy > 0.5f)
__CtrlButtonDown(button[g_Config.iRightAnalogDown-1]);
else
__CtrlButtonUp(button[g_Config.iRightAnalogDown-1]);
}
if (g_Config.iRightAnalogPress != 0)
__CtrlButtonDown(button[g_Config.iRightAnalogPress-1]);
}
if (stick_ == 2 && g_Config.iRightAnalogPress != 0) // Right analog button press
__CtrlButtonDown(button[g_Config.iRightAnalogPress-1]);

__CtrlSetAnalogX(dx, stick_);
__CtrlSetAnalogY(-dy, stick_);
} else {
if (stick_ == 2) { // Custom right analog
__CtrlButtonUp(button[g_Config.iRightAnalogUp-1]);
__CtrlButtonUp(button[g_Config.iRightAnalogDown-1]);
__CtrlButtonUp(button[g_Config.iRightAnalogLeft-1]);
__CtrlButtonUp(button[g_Config.iRightAnalogRight-1]);
if (g_Config.iRightAnalogUp != 0)
__CtrlButtonUp(button[g_Config.iRightAnalogUp-1]);
if (g_Config.iRightAnalogDown != 0)
__CtrlButtonUp(button[g_Config.iRightAnalogDown-1]);
if (g_Config.iRightAnalogLeft != 0)
__CtrlButtonUp(button[g_Config.iRightAnalogLeft-1]);
if (g_Config.iRightAnalogRight != 0)
__CtrlButtonUp(button[g_Config.iRightAnalogRight-1]);
if (g_Config.iRightAnalogPress != 0)
__CtrlButtonUp(button[g_Config.iRightAnalogPress-1]);
}
if (stick_ == 2 && g_Config.iRightAnalogPress != 0) // Right analog button press
__CtrlButtonUp(button[g_Config.iRightAnalogPress-1]);

__CtrlSetAnalogX(0.0f, stick_);
__CtrlSetAnalogY(0.0f, stick_);
Expand Down
13 changes: 6 additions & 7 deletions UI/TouchControlVisibilityScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,17 @@ void TouchControlVisibilityScreen::CreateViews() {
CheckBox *checkbox = new CheckBox(toggle.show, "", "", new LinearLayoutParams(50, WRAP_CONTENT));
row->Add(checkbox);

Choice *choice;
if (toggle.img != -1) {
choice = new CheckBoxChoice(toggle.img, checkbox, new LinearLayoutParams(1.0f));
} else {
choice = new CheckBoxChoice(mc->T(toggle.key), checkbox, new LinearLayoutParams(1.0f));
}

if (toggle.key == rightAnalogString) {
Choice *rightAnalog = new Choice(co->T(rightAnalogString), "", false, new LinearLayoutParams(1.0f));
rightAnalog->SetCentered(true);
row->Add(rightAnalog)->OnClick.Handle(this, &TouchControlVisibilityScreen::RightAnalogBindScreen);
} else {
Choice *choice;
if (toggle.img != -1) {
choice = new CheckBoxChoice(toggle.img, checkbox, new LinearLayoutParams(1.0f));
} else {
choice = new CheckBoxChoice(mc->T(toggle.key), checkbox, new LinearLayoutParams(1.0f));
}
choice->SetCentered(true);
row->Add(choice);
}
Expand Down

0 comments on commit bd2511b

Please sign in to comment.