summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2021-02-10 10:55:59 -0800
committerGravatar GitHub2021-02-10 10:55:59 -0800
commit3e6e0d8f135c9d4990b168ec0885894d6694e2ef (patch)
tree602e19dd039a20a062df2e4cc18cc05b69606663 /src
parentMerge pull request #5904 from lat9nq/common-sized-dealloc (diff)
parentconfigure_input_player_widget: Reduce duplication of array accessors where ap... (diff)
downloadyuzu-3e6e0d8f135c9d4990b168ec0885894d6694e2ef.tar.gz
yuzu-3e6e0d8f135c9d4990b168ec0885894d6694e2ef.tar.xz
yuzu-3e6e0d8f135c9d4990b168ec0885894d6694e2ef.zip
Merge pull request #5893 from lioncash/input
configure_input_player_widget: Minor cleanup
Diffstat (limited to '')
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.cpp238
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.h6
2 files changed, 131 insertions, 113 deletions
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp
index 9c6674023..0e8a964d2 100644
--- a/src/yuzu/configuration/configure_input_player_widget.cpp
+++ b/src/yuzu/configuration/configure_input_player_widget.cpp
@@ -37,7 +37,8 @@ void PlayerControlPreview::SetPlayerInput(std::size_t index, const ButtonParam&
37 Input::CreateDevice<Input::AnalogDevice>); 37 Input::CreateDevice<Input::AnalogDevice>);
38 UpdateColors(); 38 UpdateColors();
39} 39}
40void PlayerControlPreview::SetPlayerInputRaw(std::size_t index, const Settings::ButtonsRaw buttons_, 40void PlayerControlPreview::SetPlayerInputRaw(std::size_t index,
41 const Settings::ButtonsRaw& buttons_,
41 Settings::AnalogsRaw analogs_) { 42 Settings::AnalogsRaw analogs_) {
42 player_index = index; 43 player_index = index;
43 std::transform(buttons_.begin() + Settings::NativeButton::BUTTON_HID_BEGIN, 44 std::transform(buttons_.begin() + Settings::NativeButton::BUTTON_HID_BEGIN,
@@ -517,14 +518,15 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center)
517 { 518 {
518 // Draw joysticks 519 // Draw joysticks
519 using namespace Settings::NativeAnalog; 520 using namespace Settings::NativeAnalog;
520 DrawJoystick(p, center + QPointF(-65, -65) + (axis_values[LStick].value * 7), 1.62f, 521 const auto& l_stick = axis_values[LStick];
521 button_values[Settings::NativeButton::LStick]); 522 const auto l_button = button_values[Settings::NativeButton::LStick];
522 DrawJoystick(p, center + QPointF(65, 12) + (axis_values[RStick].value * 7), 1.62f, 523 const auto& r_stick = axis_values[RStick];
523 button_values[Settings::NativeButton::RStick]); 524 const auto r_button = button_values[Settings::NativeButton::RStick];
524 DrawRawJoystick(p, center + QPointF(-180, 90), axis_values[LStick].raw_value, 525
525 axis_values[LStick].properties); 526 DrawJoystick(p, center + QPointF(-65, -65) + (l_stick.value * 7), 1.62f, l_button);
526 DrawRawJoystick(p, center + QPointF(180, 90), axis_values[RStick].raw_value, 527 DrawJoystick(p, center + QPointF(65, 12) + (r_stick.value * 7), 1.62f, r_button);
527 axis_values[RStick].properties); 528 DrawRawJoystick(p, center + QPointF(-180, 90), l_stick.raw_value, l_stick.properties);
529 DrawRawJoystick(p, center + QPointF(180, 90), r_stick.raw_value, r_stick.properties);
528 } 530 }
529 531
530 using namespace Settings::NativeButton; 532 using namespace Settings::NativeButton;
@@ -603,14 +605,15 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen
603 { 605 {
604 // Draw joysticks 606 // Draw joysticks
605 using namespace Settings::NativeAnalog; 607 using namespace Settings::NativeAnalog;
606 DrawJoystick(p, center + QPointF(-171, -41) + (axis_values[LStick].value * 4), 1.0f, 608 const auto& l_stick = axis_values[LStick];
607 button_values[Settings::NativeButton::LStick]); 609 const auto l_button = button_values[Settings::NativeButton::LStick];
608 DrawJoystick(p, center + QPointF(171, 8) + (axis_values[RStick].value * 4), 1.0f, 610 const auto& r_stick = axis_values[RStick];
609 button_values[Settings::NativeButton::RStick]); 611 const auto r_button = button_values[Settings::NativeButton::RStick];
610 DrawRawJoystick(p, center + QPointF(-50, 0), axis_values[LStick].raw_value, 612
611 axis_values[LStick].properties); 613 DrawJoystick(p, center + QPointF(-171, -41) + (l_stick.value * 4), 1.0f, l_button);
612 DrawRawJoystick(p, center + QPointF(50, 0), axis_values[RStick].raw_value, 614 DrawJoystick(p, center + QPointF(171, 8) + (r_stick.value * 4), 1.0f, r_button);
613 axis_values[RStick].properties); 615 DrawRawJoystick(p, center + QPointF(-50, 0), l_stick.raw_value, l_stick.properties);
616 DrawRawJoystick(p, center + QPointF(50, 0), r_stick.raw_value, r_stick.properties);
614 } 617 }
615 618
616 using namespace Settings::NativeButton; 619 using namespace Settings::NativeButton;
@@ -1451,15 +1454,18 @@ void PlayerControlPreview::DrawProBody(QPainter& p, const QPointF center) {
1451 constexpr int radius1 = 32; 1454 constexpr int radius1 = 32;
1452 1455
1453 for (std::size_t point = 0; point < pro_left_handle.size() / 2; ++point) { 1456 for (std::size_t point = 0; point < pro_left_handle.size() / 2; ++point) {
1454 qleft_handle[point] = 1457 const float left_x = pro_left_handle[point * 2 + 0];
1455 center + QPointF(pro_left_handle[point * 2], pro_left_handle[point * 2 + 1]); 1458 const float left_y = pro_left_handle[point * 2 + 1];
1456 qright_handle[point] = 1459
1457 center + QPointF(-pro_left_handle[point * 2], pro_left_handle[point * 2 + 1]); 1460 qleft_handle[point] = center + QPointF(left_x, left_y);
1461 qright_handle[point] = center + QPointF(-left_x, left_y);
1458 } 1462 }
1459 for (std::size_t point = 0; point < pro_body.size() / 2; ++point) { 1463 for (std::size_t point = 0; point < pro_body.size() / 2; ++point) {
1460 qbody[point] = center + QPointF(pro_body[point * 2], pro_body[point * 2 + 1]); 1464 const float body_x = pro_body[point * 2 + 0];
1461 qbody[pro_body.size() - 1 - point] = 1465 const float body_y = pro_body[point * 2 + 1];
1462 center + QPointF(-pro_body[point * 2], pro_body[point * 2 + 1]); 1466
1467 qbody[point] = center + QPointF(body_x, body_y);
1468 qbody[pro_body.size() - 1 - point] = center + QPointF(-body_x, body_y);
1463 } 1469 }
1464 1470
1465 // Draw left handle body 1471 // Draw left handle body
@@ -1490,21 +1496,25 @@ void PlayerControlPreview::DrawGCBody(QPainter& p, const QPointF center) {
1490 constexpr float angle = 2 * 3.1415f / 8; 1496 constexpr float angle = 2 * 3.1415f / 8;
1491 1497
1492 for (std::size_t point = 0; point < gc_left_body.size() / 2; ++point) { 1498 for (std::size_t point = 0; point < gc_left_body.size() / 2; ++point) {
1493 qleft_handle[point] = 1499 const float body_x = gc_left_body[point * 2 + 0];
1494 center + QPointF(gc_left_body[point * 2], gc_left_body[point * 2 + 1]); 1500 const float body_y = gc_left_body[point * 2 + 1];
1495 qright_handle[point] = 1501
1496 center + QPointF(-gc_left_body[point * 2], gc_left_body[point * 2 + 1]); 1502 qleft_handle[point] = center + QPointF(body_x, body_y);
1503 qright_handle[point] = center + QPointF(-body_x, body_y);
1497 } 1504 }
1498 for (std::size_t point = 0; point < gc_body.size() / 2; ++point) { 1505 for (std::size_t point = 0; point < gc_body.size() / 2; ++point) {
1499 qbody[point] = center + QPointF(gc_body[point * 2], gc_body[point * 2 + 1]); 1506 const float body_x = gc_body[point * 2 + 0];
1500 qbody[gc_body.size() - 1 - point] = 1507 const float body_y = gc_body[point * 2 + 1];
1501 center + QPointF(-gc_body[point * 2], gc_body[point * 2 + 1]); 1508
1509 qbody[point] = center + QPointF(body_x, body_y);
1510 qbody[gc_body.size() - 1 - point] = center + QPointF(-body_x, body_y);
1502 } 1511 }
1503 for (std::size_t point = 0; point < 8; ++point) { 1512 for (std::size_t point = 0; point < 8; ++point) {
1504 left_hex[point] = 1513 const float point_cos = std::cos(point * angle);
1505 center + QPointF(34 * std::cos(point * angle) - 111, 34 * std::sin(point * angle) - 44); 1514 const float point_sin = std::sin(point * angle);
1506 right_hex[point] = 1515
1507 center + QPointF(26 * std::cos(point * angle) + 61, 26 * std::sin(point * angle) + 37); 1516 left_hex[point] = center + QPointF(34 * point_cos - 111, 34 * point_sin - 44);
1517 right_hex[point] = center + QPointF(26 * point_cos + 61, 26 * point_sin + 37);
1508 } 1518 }
1509 1519
1510 // Draw body 1520 // Draw body
@@ -1625,32 +1635,36 @@ void PlayerControlPreview::DrawDualBody(QPainter& p, const QPointF center) {
1625 constexpr float offset = 209.3f; 1635 constexpr float offset = 209.3f;
1626 1636
1627 for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { 1637 for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) {
1628 left_joycon[point] = center + QPointF(left_joycon_body[point * 2] * size + offset, 1638 const float body_x = left_joycon_body[point * 2 + 0];
1629 left_joycon_body[point * 2 + 1] * size - 1); 1639 const float body_y = left_joycon_body[point * 2 + 1];
1630 right_joycon[point] = center + QPointF(-left_joycon_body[point * 2] * size - offset, 1640
1631 left_joycon_body[point * 2 + 1] * size - 1); 1641 left_joycon[point] = center + QPointF(body_x * size + offset, body_y * size - 1);
1642 right_joycon[point] = center + QPointF(-body_x * size - offset, body_y * size - 1);
1632 } 1643 }
1633 for (std::size_t point = 0; point < left_joycon_slider.size() / 2; ++point) { 1644 for (std::size_t point = 0; point < left_joycon_slider.size() / 2; ++point) {
1634 qleft_joycon_slider[point] = 1645 const float slider_x = left_joycon_slider[point * 2 + 0];
1635 center + QPointF(left_joycon_slider[point * 2], left_joycon_slider[point * 2 + 1]); 1646 const float slider_y = left_joycon_slider[point * 2 + 1];
1636 qright_joycon_slider[point] = 1647
1637 center + QPointF(-left_joycon_slider[point * 2], left_joycon_slider[point * 2 + 1]); 1648 qleft_joycon_slider[point] = center + QPointF(slider_x, slider_y);
1649 qright_joycon_slider[point] = center + QPointF(-slider_x, slider_y);
1638 } 1650 }
1639 for (std::size_t point = 0; point < left_joycon_topview.size() / 2; ++point) { 1651 for (std::size_t point = 0; point < left_joycon_topview.size() / 2; ++point) {
1652 const float top_view_x = left_joycon_topview[point * 2 + 0];
1653 const float top_view_y = left_joycon_topview[point * 2 + 1];
1654
1640 qleft_joycon_topview[point] = 1655 qleft_joycon_topview[point] =
1641 center + QPointF(left_joycon_topview[point * 2] * size2 - 52, 1656 center + QPointF(top_view_x * size2 - 52, top_view_y * size2 - 52);
1642 left_joycon_topview[point * 2 + 1] * size2 - 52);
1643 qright_joycon_topview[point] = 1657 qright_joycon_topview[point] =
1644 center + QPointF(-left_joycon_topview[point * 2] * size2 + 52, 1658 center + QPointF(-top_view_x * size2 + 52, top_view_y * size2 - 52);
1645 left_joycon_topview[point * 2 + 1] * size2 - 52);
1646 } 1659 }
1647 for (std::size_t point = 0; point < left_joycon_slider_topview.size() / 2; ++point) { 1660 for (std::size_t point = 0; point < left_joycon_slider_topview.size() / 2; ++point) {
1661 const float top_view_x = left_joycon_slider_topview[point * 2 + 0];
1662 const float top_view_y = left_joycon_slider_topview[point * 2 + 1];
1663
1648 qleft_joycon_slider_topview[point] = 1664 qleft_joycon_slider_topview[point] =
1649 center + QPointF(left_joycon_slider_topview[point * 2] * size2 - 52, 1665 center + QPointF(top_view_x * size2 - 52, top_view_y * size2 - 52);
1650 left_joycon_slider_topview[point * 2 + 1] * size2 - 52);
1651 qright_joycon_slider_topview[point] = 1666 qright_joycon_slider_topview[point] =
1652 center + QPointF(-left_joycon_slider_topview[point * 2] * size2 + 52, 1667 center + QPointF(-top_view_x * size2 + 52, top_view_y * size2 - 52);
1653 left_joycon_slider_topview[point * 2 + 1] * size2 - 52);
1654 } 1668 }
1655 1669
1656 // right joycon body 1670 // right joycon body
@@ -1899,18 +1913,19 @@ void PlayerControlPreview::DrawProTriggers(QPainter& p, const QPointF center, bo
1899 std::array<QPointF, pro_body_top.size()> qbody_top; 1913 std::array<QPointF, pro_body_top.size()> qbody_top;
1900 1914
1901 for (std::size_t point = 0; point < pro_left_trigger.size() / 2; ++point) { 1915 for (std::size_t point = 0; point < pro_left_trigger.size() / 2; ++point) {
1902 qleft_trigger[point] = 1916 const float trigger_x = pro_left_trigger[point * 2 + 0];
1903 center + QPointF(pro_left_trigger[point * 2], 1917 const float trigger_y = pro_left_trigger[point * 2 + 1];
1904 pro_left_trigger[point * 2 + 1] + (left_pressed ? 2 : 0)); 1918
1905 qright_trigger[point] = 1919 qleft_trigger[point] = center + QPointF(trigger_x, trigger_y + (left_pressed ? 2 : 0));
1906 center + QPointF(-pro_left_trigger[point * 2], 1920 qright_trigger[point] = center + QPointF(-trigger_x, trigger_y + (right_pressed ? 2 : 0));
1907 pro_left_trigger[point * 2 + 1] + (right_pressed ? 2 : 0));
1908 } 1921 }
1909 1922
1910 for (std::size_t point = 0; point < pro_body_top.size() / 2; ++point) { 1923 for (std::size_t point = 0; point < pro_body_top.size() / 2; ++point) {
1911 qbody_top[pro_body_top.size() - 1 - point] = 1924 const float top_x = pro_body_top[point * 2 + 0];
1912 center + QPointF(-pro_body_top[point * 2], pro_body_top[point * 2 + 1]); 1925 const float top_y = pro_body_top[point * 2 + 1];
1913 qbody_top[point] = center + QPointF(pro_body_top[point * 2], pro_body_top[point * 2 + 1]); 1926
1927 qbody_top[pro_body_top.size() - 1 - point] = center + QPointF(-top_x, top_y);
1928 qbody_top[point] = center + QPointF(top_x, top_y);
1914 } 1929 }
1915 1930
1916 // Pro body detail 1931 // Pro body detail
@@ -1933,12 +1948,11 @@ void PlayerControlPreview::DrawGCTriggers(QPainter& p, const QPointF center, boo
1933 std::array<QPointF, left_gc_trigger.size() / 2> qright_trigger; 1948 std::array<QPointF, left_gc_trigger.size() / 2> qright_trigger;
1934 1949
1935 for (std::size_t point = 0; point < left_gc_trigger.size() / 2; ++point) { 1950 for (std::size_t point = 0; point < left_gc_trigger.size() / 2; ++point) {
1936 qleft_trigger[point] = 1951 const float trigger_x = left_gc_trigger[point * 2 + 0];
1937 center + QPointF(left_gc_trigger[point * 2], 1952 const float trigger_y = left_gc_trigger[point * 2 + 1];
1938 left_gc_trigger[point * 2 + 1] + (left_pressed ? 10 : 0)); 1953
1939 qright_trigger[point] = 1954 qleft_trigger[point] = center + QPointF(trigger_x, trigger_y + (left_pressed ? 10 : 0));
1940 center + QPointF(-left_gc_trigger[point * 2], 1955 qright_trigger[point] = center + QPointF(-trigger_x, trigger_y + (right_pressed ? 10 : 0));
1941 left_gc_trigger[point * 2 + 1] + (right_pressed ? 10 : 0));
1942 } 1956 }
1943 1957
1944 // Left trigger 1958 // Left trigger
@@ -1967,12 +1981,13 @@ void PlayerControlPreview::DrawHandheldTriggers(QPainter& p, const QPointF cente
1967 std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger; 1981 std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger;
1968 1982
1969 for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { 1983 for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) {
1984 const float left_trigger_x = left_joycon_trigger[point * 2 + 0];
1985 const float left_trigger_y = left_joycon_trigger[point * 2 + 1];
1986
1970 qleft_trigger[point] = 1987 qleft_trigger[point] =
1971 center + QPointF(left_joycon_trigger[point * 2], 1988 center + QPointF(left_trigger_x, left_trigger_y + (left_pressed ? 0.5f : 0));
1972 left_joycon_trigger[point * 2 + 1] + (left_pressed ? 0.5f : 0));
1973 qright_trigger[point] = 1989 qright_trigger[point] =
1974 center + QPointF(-left_joycon_trigger[point * 2], 1990 center + QPointF(-left_trigger_x, left_trigger_y + (right_pressed ? 0.5f : 0));
1975 left_joycon_trigger[point * 2 + 1] + (right_pressed ? 0.5f : 0));
1976 } 1991 }
1977 1992
1978 // Left trigger 1993 // Left trigger
@@ -1992,12 +2007,14 @@ void PlayerControlPreview::DrawDualTriggers(QPainter& p, const QPointF center, b
1992 constexpr float size = 1.62f; 2007 constexpr float size = 1.62f;
1993 constexpr float offset = 210.6f; 2008 constexpr float offset = 210.6f;
1994 for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { 2009 for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) {
1995 qleft_trigger[point] = 2010 const float left_trigger_x = left_joycon_trigger[point * 2 + 0];
1996 center + QPointF(left_joycon_trigger[point * 2] * size + offset, 2011 const float left_trigger_y = left_joycon_trigger[point * 2 + 1];
1997 left_joycon_trigger[point * 2 + 1] * size + (left_pressed ? 0.5f : 0)); 2012
1998 qright_trigger[point] = center + QPointF(-left_joycon_trigger[point * 2] * size - offset, 2013 qleft_trigger[point] = center + QPointF(left_trigger_x * size + offset,
1999 left_joycon_trigger[point * 2 + 1] * size + 2014 left_trigger_y * size + (left_pressed ? 0.5f : 0));
2000 (right_pressed ? 0.5f : 0)); 2015 qright_trigger[point] =
2016 center + QPointF(-left_trigger_x * size - offset,
2017 left_trigger_y * size + (right_pressed ? 0.5f : 0));
2001 } 2018 }
2002 2019
2003 // Left trigger 2020 // Left trigger
@@ -2017,13 +2034,16 @@ void PlayerControlPreview::DrawDualTriggersTopView(QPainter& p, const QPointF ce
2017 constexpr float size = 0.9f; 2034 constexpr float size = 0.9f;
2018 2035
2019 for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) { 2036 for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) {
2020 qleft_trigger[point] = center + QPointF(left_joystick_L_topview[point * 2] * size - 50, 2037 const float top_view_x = left_joystick_L_topview[point * 2 + 0];
2021 left_joystick_L_topview[point * 2 + 1] * size - 52); 2038 const float top_view_y = left_joystick_L_topview[point * 2 + 1];
2039
2040 qleft_trigger[point] = center + QPointF(top_view_x * size - 50, top_view_y * size - 52);
2022 } 2041 }
2023 for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) { 2042 for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) {
2024 qright_trigger[point] = 2043 const float top_view_x = left_joystick_L_topview[point * 2 + 0];
2025 center + QPointF(-left_joystick_L_topview[point * 2] * size + 50, 2044 const float top_view_y = left_joystick_L_topview[point * 2 + 1];
2026 left_joystick_L_topview[point * 2 + 1] * size - 52); 2045
2046 qright_trigger[point] = center + QPointF(-top_view_x * size + 50, top_view_y * size - 52);
2027 } 2047 }
2028 2048
2029 p.setPen(colors.outline); 2049 p.setPen(colors.outline);
@@ -2317,7 +2337,7 @@ void PlayerControlPreview::DrawGCJoystick(QPainter& p, const QPointF center, boo
2317} 2337}
2318 2338
2319void PlayerControlPreview::DrawRawJoystick(QPainter& p, const QPointF center, const QPointF value, 2339void PlayerControlPreview::DrawRawJoystick(QPainter& p, const QPointF center, const QPointF value,
2320 const Input::AnalogProperties properties) { 2340 const Input::AnalogProperties& properties) {
2321 constexpr float size = 45.0f; 2341 constexpr float size = 45.0f;
2322 const float range = size * properties.range; 2342 const float range = size * properties.range;
2323 const float deadzone = size * properties.deadzone; 2343 const float deadzone = size * properties.deadzone;
@@ -2440,17 +2460,16 @@ void PlayerControlPreview::DrawArrowButtonOutline(QPainter& p, const QPointF cen
2440 std::array<QPointF, (arrow_points - 1) * 4> arrow_button_outline; 2460 std::array<QPointF, (arrow_points - 1) * 4> arrow_button_outline;
2441 2461
2442 for (std::size_t point = 0; point < arrow_points - 1; ++point) { 2462 for (std::size_t point = 0; point < arrow_points - 1; ++point) {
2443 arrow_button_outline[point] = center + QPointF(up_arrow_button[point * 2] * size, 2463 const float up_arrow_x = up_arrow_button[point * 2 + 0];
2444 up_arrow_button[point * 2 + 1] * size); 2464 const float up_arrow_y = up_arrow_button[point * 2 + 1];
2465
2466 arrow_button_outline[point] = center + QPointF(up_arrow_x * size, up_arrow_y * size);
2445 arrow_button_outline[(arrow_points - 1) * 2 - point - 1] = 2467 arrow_button_outline[(arrow_points - 1) * 2 - point - 1] =
2446 center + 2468 center + QPointF(up_arrow_y * size, up_arrow_x * size);
2447 QPointF(up_arrow_button[point * 2 + 1] * size, up_arrow_button[point * 2] * size);
2448 arrow_button_outline[(arrow_points - 1) * 2 + point] = 2469 arrow_button_outline[(arrow_points - 1) * 2 + point] =
2449 center + 2470 center + QPointF(-up_arrow_x * size, -up_arrow_y * size);
2450 QPointF(-up_arrow_button[point * 2] * size, -up_arrow_button[point * 2 + 1] * size);
2451 arrow_button_outline[(arrow_points - 1) * 4 - point - 1] = 2471 arrow_button_outline[(arrow_points - 1) * 4 - point - 1] =
2452 center + 2472 center + QPointF(-up_arrow_y * size, -up_arrow_x * size);
2453 QPointF(-up_arrow_button[point * 2 + 1] * size, -up_arrow_button[point * 2] * size);
2454 } 2473 }
2455 // Draw arrow button outline 2474 // Draw arrow button outline
2456 p.setPen(colors.outline); 2475 p.setPen(colors.outline);
@@ -2464,22 +2483,21 @@ void PlayerControlPreview::DrawArrowButton(QPainter& p, const QPointF center,
2464 QPoint offset; 2483 QPoint offset;
2465 2484
2466 for (std::size_t point = 0; point < up_arrow_button.size() / 2; ++point) { 2485 for (std::size_t point = 0; point < up_arrow_button.size() / 2; ++point) {
2486 const float up_arrow_x = up_arrow_button[point * 2 + 0];
2487 const float up_arrow_y = up_arrow_button[point * 2 + 1];
2488
2467 switch (direction) { 2489 switch (direction) {
2468 case Direction::Up: 2490 case Direction::Up:
2469 arrow_button[point] = center + QPointF(up_arrow_button[point * 2] * size, 2491 arrow_button[point] = center + QPointF(up_arrow_x * size, up_arrow_y * size);
2470 up_arrow_button[point * 2 + 1] * size);
2471 break; 2492 break;
2472 case Direction::Left: 2493 case Direction::Left:
2473 arrow_button[point] = center + QPointF(up_arrow_button[point * 2 + 1] * size, 2494 arrow_button[point] = center + QPointF(up_arrow_y * size, up_arrow_x * size);
2474 up_arrow_button[point * 2] * size);
2475 break; 2495 break;
2476 case Direction::Right: 2496 case Direction::Right:
2477 arrow_button[point] = center + QPointF(-up_arrow_button[point * 2 + 1] * size, 2497 arrow_button[point] = center + QPointF(-up_arrow_y * size, up_arrow_x * size);
2478 up_arrow_button[point * 2] * size);
2479 break; 2498 break;
2480 case Direction::Down: 2499 case Direction::Down:
2481 arrow_button[point] = center + QPointF(up_arrow_button[point * 2] * size, 2500 arrow_button[point] = center + QPointF(up_arrow_x * size, -up_arrow_y * size);
2482 -up_arrow_button[point * 2 + 1] * size);
2483 break; 2501 break;
2484 case Direction::None: 2502 case Direction::None:
2485 break; 2503 break;
@@ -2520,14 +2538,15 @@ void PlayerControlPreview::DrawTriggerButton(QPainter& p, const QPointF center,
2520 std::array<QPointF, trigger_button.size() / 2> qtrigger_button; 2538 std::array<QPointF, trigger_button.size() / 2> qtrigger_button;
2521 2539
2522 for (std::size_t point = 0; point < trigger_button.size() / 2; ++point) { 2540 for (std::size_t point = 0; point < trigger_button.size() / 2; ++point) {
2541 const float trigger_button_x = trigger_button[point * 2 + 0];
2542 const float trigger_button_y = trigger_button[point * 2 + 1];
2543
2523 switch (direction) { 2544 switch (direction) {
2524 case Direction::Left: 2545 case Direction::Left:
2525 qtrigger_button[point] = 2546 qtrigger_button[point] = center + QPointF(-trigger_button_x, trigger_button_y);
2526 center + QPointF(-trigger_button[point * 2], trigger_button[point * 2 + 1]);
2527 break; 2547 break;
2528 case Direction::Right: 2548 case Direction::Right:
2529 qtrigger_button[point] = 2549 qtrigger_button[point] = center + QPointF(trigger_button_x, trigger_button_y);
2530 center + QPointF(trigger_button[point * 2], trigger_button[point * 2 + 1]);
2531 break; 2550 break;
2532 case Direction::Up: 2551 case Direction::Up:
2533 case Direction::Down: 2552 case Direction::Down:
@@ -2650,22 +2669,21 @@ void PlayerControlPreview::DrawArrow(QPainter& p, const QPointF center, const Di
2650 std::array<QPointF, up_arrow_symbol.size() / 2> arrow_symbol; 2669 std::array<QPointF, up_arrow_symbol.size() / 2> arrow_symbol;
2651 2670
2652 for (std::size_t point = 0; point < up_arrow_symbol.size() / 2; ++point) { 2671 for (std::size_t point = 0; point < up_arrow_symbol.size() / 2; ++point) {
2672 const float up_arrow_x = up_arrow_symbol[point * 2 + 0];
2673 const float up_arrow_y = up_arrow_symbol[point * 2 + 1];
2674
2653 switch (direction) { 2675 switch (direction) {
2654 case Direction::Up: 2676 case Direction::Up:
2655 arrow_symbol[point] = center + QPointF(up_arrow_symbol[point * 2] * size, 2677 arrow_symbol[point] = center + QPointF(up_arrow_x * size, up_arrow_y * size);
2656 up_arrow_symbol[point * 2 + 1] * size);
2657 break; 2678 break;
2658 case Direction::Left: 2679 case Direction::Left:
2659 arrow_symbol[point] = center + QPointF(up_arrow_symbol[point * 2 + 1] * size, 2680 arrow_symbol[point] = center + QPointF(up_arrow_y * size, up_arrow_x * size);
2660 up_arrow_symbol[point * 2] * size);
2661 break; 2681 break;
2662 case Direction::Right: 2682 case Direction::Right:
2663 arrow_symbol[point] = center + QPointF(-up_arrow_symbol[point * 2 + 1] * size, 2683 arrow_symbol[point] = center + QPointF(-up_arrow_y * size, up_arrow_x * size);
2664 up_arrow_symbol[point * 2] * size);
2665 break; 2684 break;
2666 case Direction::Down: 2685 case Direction::Down:
2667 arrow_symbol[point] = center + QPointF(up_arrow_symbol[point * 2] * size, 2686 arrow_symbol[point] = center + QPointF(up_arrow_x * size, -up_arrow_y * size);
2668 -up_arrow_symbol[point * 2 + 1] * size);
2669 break; 2687 break;
2670 case Direction::None: 2688 case Direction::None:
2671 break; 2689 break;
diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h
index 676effbfd..91c3343f1 100644
--- a/src/yuzu/configuration/configure_input_player_widget.h
+++ b/src/yuzu/configuration/configure_input_player_widget.h
@@ -25,7 +25,7 @@ public:
25 25
26 void SetPlayerInput(std::size_t index, const ButtonParam& buttons_param, 26 void SetPlayerInput(std::size_t index, const ButtonParam& buttons_param,
27 const AnalogParam& analogs_param); 27 const AnalogParam& analogs_param);
28 void SetPlayerInputRaw(std::size_t index, const Settings::ButtonsRaw buttons_, 28 void SetPlayerInputRaw(std::size_t index, const Settings::ButtonsRaw& buttons_,
29 Settings::AnalogsRaw analogs_); 29 Settings::AnalogsRaw analogs_);
30 void SetConnectedStatus(bool checked); 30 void SetConnectedStatus(bool checked);
31 void SetControllerType(Settings::ControllerType type); 31 void SetControllerType(Settings::ControllerType type);
@@ -138,8 +138,8 @@ private:
138 // Draw joystick functions 138 // Draw joystick functions
139 void DrawJoystick(QPainter& p, QPointF center, float size, bool pressed); 139 void DrawJoystick(QPainter& p, QPointF center, float size, bool pressed);
140 void DrawJoystickSideview(QPainter& p, QPointF center, float angle, float size, bool pressed); 140 void DrawJoystickSideview(QPainter& p, QPointF center, float angle, float size, bool pressed);
141 void DrawRawJoystick(QPainter& p, QPointF center, const QPointF value, 141 void DrawRawJoystick(QPainter& p, QPointF center, QPointF value,
142 const Input::AnalogProperties properties); 142 const Input::AnalogProperties& properties);
143 void DrawProJoystick(QPainter& p, QPointF center, QPointF offset, float scalar, bool pressed); 143 void DrawProJoystick(QPainter& p, QPointF center, QPointF offset, float scalar, bool pressed);
144 void DrawGCJoystick(QPainter& p, QPointF center, bool pressed); 144 void DrawGCJoystick(QPainter& p, QPointF center, bool pressed);
145 145