diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player_widget.cpp | 312 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player_widget.h | 8 | ||||
| -rw-r--r-- | src/yuzu/debugger/controller.cpp | 62 | ||||
| -rw-r--r-- | src/yuzu/debugger/controller.h | 28 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 |
7 files changed, 391 insertions, 29 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 6802be295..fb9967c8f 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt | |||
| @@ -117,6 +117,8 @@ add_executable(yuzu | |||
| 117 | configuration/input_profiles.h | 117 | configuration/input_profiles.h |
| 118 | debugger/console.cpp | 118 | debugger/console.cpp |
| 119 | debugger/console.h | 119 | debugger/console.h |
| 120 | debugger/controller.cpp | ||
| 121 | debugger/controller.h | ||
| 120 | debugger/profiler.cpp | 122 | debugger/profiler.cpp |
| 121 | debugger/profiler.h | 123 | debugger/profiler.h |
| 122 | debugger/wait_tree.cpp | 124 | debugger/wait_tree.cpp |
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index ac522fc68..77d7569fe 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp | |||
| @@ -37,6 +37,17 @@ 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 | } |
| 40 | void PlayerControlPreview::SetPlayerInputRaw(std::size_t index, const Settings::ButtonsRaw buttons_, | ||
| 41 | Settings::AnalogsRaw analogs_) { | ||
| 42 | player_index = index; | ||
| 43 | std::transform(buttons_.begin() + Settings::NativeButton::BUTTON_HID_BEGIN, | ||
| 44 | buttons_.begin() + Settings::NativeButton::BUTTON_NS_END, buttons.begin(), | ||
| 45 | Input::CreateDevice<Input::ButtonDevice>); | ||
| 46 | std::transform(analogs_.begin() + Settings::NativeAnalog::STICK_HID_BEGIN, | ||
| 47 | analogs_.begin() + Settings::NativeAnalog::STICK_HID_END, sticks.begin(), | ||
| 48 | Input::CreateDevice<Input::AnalogDevice>); | ||
| 49 | UpdateColors(); | ||
| 50 | } | ||
| 40 | 51 | ||
| 41 | PlayerControlPreview::LedPattern PlayerControlPreview::GetColorPattern(std::size_t index, | 52 | PlayerControlPreview::LedPattern PlayerControlPreview::GetColorPattern(std::size_t index, |
| 42 | bool player_on) { | 53 | bool player_on) { |
| @@ -210,9 +221,24 @@ void PlayerControlPreview::DrawLeftController(QPainter& p, const QPointF center) | |||
| 210 | -axis_values[Settings::NativeAnalog::LStick].value.y(), 1.15f, | 221 | -axis_values[Settings::NativeAnalog::LStick].value.y(), 1.15f, |
| 211 | button_values[LStick]); | 222 | button_values[LStick]); |
| 212 | 223 | ||
| 213 | // Left trigger | 224 | // Topview D-pad buttons |
| 214 | p.setPen(colors.outline); | 225 | p.setPen(colors.outline); |
| 215 | button_color = colors.button; | 226 | button_color = colors.button; |
| 227 | DrawRoundButton(p, center + QPoint(-163, -21), button_values[DLeft], 11, 5, Direction::Up); | ||
| 228 | DrawRoundButton(p, center + QPoint(-117, -21), button_values[DRight], 11, 5, Direction::Up); | ||
| 229 | |||
| 230 | // Topview left joystick | ||
| 231 | DrawJoystickSideview(p, center + QPointF(-140.5f, -28), | ||
| 232 | -axis_values[Settings::NativeAnalog::LStick].value.x() + 15.0f, 1.15f, | ||
| 233 | button_values[LStick]); | ||
| 234 | |||
| 235 | // Topview minus button | ||
| 236 | p.setPen(colors.outline); | ||
| 237 | button_color = colors.button; | ||
| 238 | DrawRoundButton(p, center + QPoint(-111, -22), button_values[Minus], 8, 4, Direction::Up, | ||
| 239 | 1); | ||
| 240 | |||
| 241 | // Left trigger | ||
| 216 | DrawLeftTriggers(p, center, button_values[L]); | 242 | DrawLeftTriggers(p, center, button_values[L]); |
| 217 | DrawRoundButton(p, center + QPoint(151, -146), button_values[L], 8, 4, Direction::Down); | 243 | DrawRoundButton(p, center + QPoint(151, -146), button_values[L], 8, 4, Direction::Down); |
| 218 | DrawLeftZTriggers(p, center, button_values[ZL]); | 244 | DrawLeftZTriggers(p, center, button_values[ZL]); |
| @@ -234,15 +260,19 @@ void PlayerControlPreview::DrawLeftController(QPainter& p, const QPointF center) | |||
| 234 | button_color = colors.slider_button; | 260 | button_color = colors.slider_button; |
| 235 | DrawRoundButton(p, center + QPoint(59, 52), button_values[SR], 5, 12, Direction::Left); | 261 | DrawRoundButton(p, center + QPoint(59, 52), button_values[SR], 5, 12, Direction::Left); |
| 236 | DrawRoundButton(p, center + QPoint(59, -69), button_values[SL], 5, 12, Direction::Left); | 262 | DrawRoundButton(p, center + QPoint(59, -69), button_values[SL], 5, 12, Direction::Left); |
| 237 | } | ||
| 238 | 263 | ||
| 239 | DrawLeftBody(p, center); | 264 | DrawLeftBody(p, center); |
| 265 | |||
| 266 | // Left trigger top view | ||
| 267 | DrawLeftTriggersTopView(p, center, button_values[L]); | ||
| 268 | DrawLeftZTriggersTopView(p, center, button_values[ZL]); | ||
| 269 | } | ||
| 240 | 270 | ||
| 241 | { // Draw joysticks | 271 | { // Draw joysticks |
| 242 | using namespace Settings::NativeAnalog; | 272 | using namespace Settings::NativeAnalog; |
| 243 | DrawJoystick(p, center + QPointF(9, -69) + (axis_values[LStick].value * 8), 1.8f, | 273 | DrawJoystick(p, center + QPointF(9, -69) + (axis_values[LStick].value * 8), 1.8f, |
| 244 | button_values[Settings::NativeButton::LStick]); | 274 | button_values[Settings::NativeButton::LStick]); |
| 245 | DrawRawJoystick(p, rect().bottomLeft() + QPointF(45, -45), axis_values[LStick].raw_value, | 275 | DrawRawJoystick(p, center + QPointF(-140, 100), axis_values[LStick].raw_value, |
| 246 | axis_values[LStick].properties); | 276 | axis_values[LStick].properties); |
| 247 | } | 277 | } |
| 248 | 278 | ||
| @@ -304,6 +334,24 @@ void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center | |||
| 304 | axis_values[Settings::NativeAnalog::RStick].value.y() + 10.0f, 1.15f, | 334 | axis_values[Settings::NativeAnalog::RStick].value.y() + 10.0f, 1.15f, |
| 305 | button_values[Settings::NativeButton::RStick]); | 335 | button_values[Settings::NativeButton::RStick]); |
| 306 | 336 | ||
| 337 | // Topview face buttons | ||
| 338 | p.setPen(colors.outline); | ||
| 339 | button_color = colors.button; | ||
| 340 | DrawRoundButton(p, center + QPoint(163, -21), button_values[A], 11, 5, Direction::Up); | ||
| 341 | DrawRoundButton(p, center + QPoint(117, -21), button_values[Y], 11, 5, Direction::Up); | ||
| 342 | |||
| 343 | // Topview right joystick | ||
| 344 | DrawJoystickSideview(p, center + QPointF(140, -28), | ||
| 345 | -axis_values[Settings::NativeAnalog::RStick].value.x() + 15.0f, 1.15f, | ||
| 346 | button_values[RStick]); | ||
| 347 | |||
| 348 | // Topview plus button | ||
| 349 | p.setPen(colors.outline); | ||
| 350 | button_color = colors.button; | ||
| 351 | DrawRoundButton(p, center + QPoint(111, -22), button_values[Plus], 8, 4, Direction::Up, 1); | ||
| 352 | DrawRoundButton(p, center + QPoint(111, -22), button_values[Plus], 2.66f, 4, Direction::Up, | ||
| 353 | 1); | ||
| 354 | |||
| 307 | // Right trigger | 355 | // Right trigger |
| 308 | p.setPen(colors.outline); | 356 | p.setPen(colors.outline); |
| 309 | button_color = colors.button; | 357 | button_color = colors.button; |
| @@ -328,15 +376,19 @@ void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center | |||
| 328 | button_color = colors.slider_button; | 376 | button_color = colors.slider_button; |
| 329 | DrawRoundButton(p, center + QPoint(-59, 52), button_values[SL], 5, 11, Direction::Right); | 377 | DrawRoundButton(p, center + QPoint(-59, 52), button_values[SL], 5, 11, Direction::Right); |
| 330 | DrawRoundButton(p, center + QPoint(-59, -69), button_values[SR], 5, 11, Direction::Right); | 378 | DrawRoundButton(p, center + QPoint(-59, -69), button_values[SR], 5, 11, Direction::Right); |
| 331 | } | ||
| 332 | 379 | ||
| 333 | DrawRightBody(p, center); | 380 | DrawRightBody(p, center); |
| 381 | |||
| 382 | // Right trigger top view | ||
| 383 | DrawRightTriggersTopView(p, center, button_values[R]); | ||
| 384 | DrawRightZTriggersTopView(p, center, button_values[ZR]); | ||
| 385 | } | ||
| 334 | 386 | ||
| 335 | { // Draw joysticks | 387 | { // Draw joysticks |
| 336 | using namespace Settings::NativeAnalog; | 388 | using namespace Settings::NativeAnalog; |
| 337 | DrawJoystick(p, center + QPointF(-9, 11) + (axis_values[RStick].value * 8), 1.8f, | 389 | DrawJoystick(p, center + QPointF(-9, 11) + (axis_values[RStick].value * 8), 1.8f, |
| 338 | button_values[Settings::NativeButton::RStick]); | 390 | button_values[Settings::NativeButton::RStick]); |
| 339 | DrawRawJoystick(p, rect().bottomRight() + QPointF(-45, -45), axis_values[RStick].raw_value, | 391 | DrawRawJoystick(p, center + QPointF(140, 100), axis_values[RStick].raw_value, |
| 340 | axis_values[RStick].properties); | 392 | axis_values[RStick].properties); |
| 341 | } | 393 | } |
| 342 | 394 | ||
| @@ -536,9 +588,9 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen | |||
| 536 | button_values[Settings::NativeButton::LStick]); | 588 | button_values[Settings::NativeButton::LStick]); |
| 537 | DrawJoystick(p, center + QPointF(171, 8) + (axis_values[RStick].value * 4), 1.0f, | 589 | DrawJoystick(p, center + QPointF(171, 8) + (axis_values[RStick].value * 4), 1.0f, |
| 538 | button_values[Settings::NativeButton::RStick]); | 590 | button_values[Settings::NativeButton::RStick]); |
| 539 | DrawRawJoystick(p, center + QPointF(-45, 0), axis_values[LStick].raw_value, | 591 | DrawRawJoystick(p, center + QPointF(-50, 0), axis_values[LStick].raw_value, |
| 540 | axis_values[LStick].properties); | 592 | axis_values[LStick].properties); |
| 541 | DrawRawJoystick(p, center + QPointF(45, 0), axis_values[RStick].raw_value, | 593 | DrawRawJoystick(p, center + QPointF(50, 0), axis_values[RStick].raw_value, |
| 542 | axis_values[RStick].properties); | 594 | axis_values[RStick].properties); |
| 543 | } | 595 | } |
| 544 | 596 | ||
| @@ -546,8 +598,8 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen | |||
| 546 | 598 | ||
| 547 | // Face buttons constants | 599 | // Face buttons constants |
| 548 | const QPointF face_center = center + QPoint(171, -41); | 600 | const QPointF face_center = center + QPoint(171, -41); |
| 549 | constexpr int face_distance = 12; | 601 | constexpr float face_distance = 12.8; |
| 550 | constexpr int face_radius = 6; | 602 | constexpr float face_radius = 6.4f; |
| 551 | constexpr float text_size = 0.6f; | 603 | constexpr float text_size = 0.6f; |
| 552 | 604 | ||
| 553 | // Face buttons | 605 | // Face buttons |
| @@ -568,8 +620,8 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen | |||
| 568 | 620 | ||
| 569 | // D-pad constants | 621 | // D-pad constants |
| 570 | const QPointF dpad_center = center + QPoint(-171, 8); | 622 | const QPointF dpad_center = center + QPoint(-171, 8); |
| 571 | constexpr int dpad_distance = 12; | 623 | constexpr float dpad_distance = 12.8; |
| 572 | constexpr int dpad_radius = 6; | 624 | constexpr float dpad_radius = 6.4f; |
| 573 | constexpr float dpad_arrow_size = 0.68f; | 625 | constexpr float dpad_arrow_size = 0.68f; |
| 574 | 626 | ||
| 575 | // D-pad buttons | 627 | // D-pad buttons |
| @@ -631,10 +683,10 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center) | |||
| 631 | button_values[Settings::NativeButton::LStick]); | 683 | button_values[Settings::NativeButton::LStick]); |
| 632 | DrawProJoystick(p, center + QPointF(51, 0) + (axis_values[RStick].value * 11), | 684 | DrawProJoystick(p, center + QPointF(51, 0) + (axis_values[RStick].value * 11), |
| 633 | button_values[Settings::NativeButton::RStick]); | 685 | button_values[Settings::NativeButton::RStick]); |
| 634 | DrawRawJoystick(p, QPointF(center.x(), rect().bottom()) + QPointF(-45, -45), | 686 | DrawRawJoystick(p, center + QPointF(-50, 105), axis_values[LStick].raw_value, |
| 635 | axis_values[LStick].raw_value, axis_values[LStick].properties); | 687 | axis_values[LStick].properties); |
| 636 | DrawRawJoystick(p, QPointF(center.x(), rect().bottom()) + QPointF(45, -45), | 688 | DrawRawJoystick(p, center + QPointF(50, 105), axis_values[RStick].raw_value, |
| 637 | axis_values[RStick].raw_value, axis_values[RStick].properties); | 689 | axis_values[RStick].properties); |
| 638 | } | 690 | } |
| 639 | 691 | ||
| 640 | using namespace Settings::NativeButton; | 692 | using namespace Settings::NativeButton; |
| @@ -985,6 +1037,21 @@ constexpr std::array<float, 40 * 2> handheld_bezel = { | |||
| 985 | 112.9f, -62.2f, 112.9f, 62.2f, -112.9f, 62.2f, -112.9f, -62.2f, 129.8f, -76.0f, | 1037 | 112.9f, -62.2f, 112.9f, 62.2f, -112.9f, 62.2f, -112.9f, -62.2f, 129.8f, -76.0f, |
| 986 | }; | 1038 | }; |
| 987 | 1039 | ||
| 1040 | constexpr std::array<float, 58 * 2> handheld_buttons = { | ||
| 1041 | -82.48f, -82.95f, -82.53f, -82.95f, -106.69f, -82.96f, -106.73f, -82.98f, -106.78f, -83.01f, | ||
| 1042 | -106.81f, -83.05f, -106.83f, -83.1f, -106.83f, -83.15f, -106.82f, -83.93f, -106.81f, -83.99f, | ||
| 1043 | -106.8f, -84.04f, -106.78f, -84.08f, -106.76f, -84.13f, -106.73f, -84.18f, -106.7f, -84.22f, | ||
| 1044 | -106.6f, -84.34f, -106.56f, -84.37f, -106.51f, -84.4f, -106.47f, -84.42f, -106.42f, -84.45f, | ||
| 1045 | -106.37f, -84.47f, -106.32f, -84.48f, -106.17f, -84.5f, -98.9f, -84.48f, -98.86f, -84.45f, | ||
| 1046 | -98.83f, -84.41f, -98.81f, -84.36f, -98.8f, -84.31f, -98.8f, -84.26f, -98.79f, -84.05f, | ||
| 1047 | -90.26f, -84.1f, -90.26f, -84.15f, -90.25f, -84.36f, -90.23f, -84.41f, -90.2f, -84.45f, | ||
| 1048 | -90.16f, -84.48f, -90.11f, -84.5f, -82.79f, -84.49f, -82.74f, -84.48f, -82.69f, -84.46f, | ||
| 1049 | -82.64f, -84.45f, -82.59f, -84.42f, -82.55f, -84.4f, -82.5f, -84.37f, -82.46f, -84.33f, | ||
| 1050 | -82.42f, -84.3f, -82.39f, -84.26f, -82.3f, -84.13f, -82.28f, -84.08f, -82.25f, -83.98f, | ||
| 1051 | -82.24f, -83.93f, -82.23f, -83.83f, -82.23f, -83.78f, -82.24f, -83.1f, -82.26f, -83.05f, | ||
| 1052 | -82.29f, -83.01f, -82.33f, -82.97f, -82.38f, -82.95f, | ||
| 1053 | }; | ||
| 1054 | |||
| 988 | constexpr std::array<float, 47 * 2> left_joycon_slider = { | 1055 | constexpr std::array<float, 47 * 2> left_joycon_slider = { |
| 989 | -23.7f, -118.2f, -23.7f, -117.3f, -23.7f, 96.6f, -22.8f, 96.6f, -21.5f, 97.2f, -21.5f, | 1056 | -23.7f, -118.2f, -23.7f, -117.3f, -23.7f, 96.6f, -22.8f, 96.6f, -21.5f, 97.2f, -21.5f, |
| 990 | 98.1f, -21.2f, 106.7f, -20.8f, 107.5f, -20.1f, 108.2f, -19.2f, 108.2f, -16.4f, 108.1f, | 1057 | 98.1f, -21.2f, 106.7f, -20.8f, 107.5f, -20.1f, 108.2f, -19.2f, 108.2f, -16.4f, 108.1f, |
| @@ -1025,6 +1092,28 @@ constexpr std::array<float, 40 * 2> left_joycon_body_trigger = { | |||
| 1025 | -140.5f, -116.8f, -141.4f, -118.9f, -143.3f, -123.1f, -144.6f, -124.9f, -146.2f, -126.0f, | 1092 | -140.5f, -116.8f, -141.4f, -118.9f, -143.3f, -123.1f, -144.6f, -124.9f, -146.2f, -126.0f, |
| 1026 | }; | 1093 | }; |
| 1027 | 1094 | ||
| 1095 | constexpr std::array<float, 49 * 2> left_joycon_topview = { | ||
| 1096 | -184.8, -20.8, -185.6, -21.1, -186.4, -21.5, -187.1, -22.1, -187.8, -22.6, -188.4, | ||
| 1097 | -23.2, -189.6, -24.5, -190.2, -25.2, -190.7, -25.9, -191.1, -26.7, -191.4, -27.5, | ||
| 1098 | -191.6, -28.4, -191.7, -29.2, -191.7, -30.1, -191.5, -47.7, -191.2, -48.5, -191, | ||
| 1099 | -49.4, -190.7, -50.2, -190.3, -51, -190, -51.8, -189.6, -52.6, -189.1, -53.4, | ||
| 1100 | -188.6, -54.1, -187.5, -55.4, -186.9, -56.1, -186.2, -56.7, -185.5, -57.2, -184, | ||
| 1101 | -58.1, -183.3, -58.5, -182.5, -58.9, -181.6, -59.2, -180.8, -59.5, -179.9, -59.7, | ||
| 1102 | -179.1, -59.9, -178.2, -60, -174.7, -60.1, -168.5, -60.2, -162.4, -60.3, -156.2, | ||
| 1103 | -60.4, -149.2, -60.5, -143, -60.6, -136.9, -60.7, -130.7, -60.8, -123.7, -60.9, | ||
| 1104 | -117.5, -61, -110.5, -61.1, -94.4, -60.4, -94.4, -59.5, -94.4, -20.6, | ||
| 1105 | }; | ||
| 1106 | |||
| 1107 | constexpr std::array<float, 41 * 2> left_joycon_slider_topview = { | ||
| 1108 | -95.1f, -51.5f, -95.0f, -51.5f, -91.2f, -51.6f, -91.2f, -51.7f, -91.1f, -52.4f, -91.1f, -52.6f, | ||
| 1109 | -91.0f, -54.1f, -86.3f, -54.0f, -86.0f, -53.9f, -85.9f, -53.8f, -85.6f, -53.4f, -85.5f, -53.2f, | ||
| 1110 | -85.5f, -53.1f, -85.4f, -52.9f, -85.4f, -52.8f, -85.3f, -52.4f, -85.3f, -52.3f, -85.4f, -27.2f, | ||
| 1111 | -85.4f, -27.1f, -85.5f, -27.0f, -85.5f, -26.9f, -85.6f, -26.7f, -85.6f, -26.6f, -85.7f, -26.5f, | ||
| 1112 | -85.9f, -26.4f, -86.0f, -26.3f, -86.4f, -26.0f, -86.5f, -25.9f, -86.7f, -25.8f, -87.1f, -25.7f, | ||
| 1113 | -90.4f, -25.8f, -90.7f, -25.9f, -90.8f, -26.0f, -90.9f, -26.3f, -91.0f, -26.4f, -91.0f, -26.5f, | ||
| 1114 | -91.1f, -26.7f, -91.1f, -26.9f, -91.2f, -28.9f, -95.2f, -29.1f, -95.2f, -29.2f, | ||
| 1115 | }; | ||
| 1116 | |||
| 1028 | constexpr std::array<float, 42 * 2> left_joycon_sideview_zl = { | 1117 | constexpr std::array<float, 42 * 2> left_joycon_sideview_zl = { |
| 1029 | -148.9f, -128.2f, -148.7f, -126.6f, -148.4f, -124.9f, -148.2f, -123.3f, -147.9f, -121.7f, | 1118 | -148.9f, -128.2f, -148.7f, -126.6f, -148.4f, -124.9f, -148.2f, -123.3f, -147.9f, -121.7f, |
| 1030 | -147.7f, -120.1f, -147.4f, -118.5f, -147.2f, -116.9f, -146.9f, -115.3f, -146.4f, -112.1f, | 1119 | -147.7f, -120.1f, -147.4f, -118.5f, -147.2f, -116.9f, -146.9f, -115.3f, -146.4f, -112.1f, |
| @@ -1052,11 +1141,39 @@ constexpr std::array<float, 72 * 2> left_joystick_sideview = { | |||
| 1052 | -8.0f, -9.4f, -9.6f, -8.2f, -10.9f, -6.7f, -11.9f, -4.9f, -12.8f, -3.2f, -13.5f, -3.8f, | 1141 | -8.0f, -9.4f, -9.6f, -8.2f, -10.9f, -6.7f, -11.9f, -4.9f, -12.8f, -3.2f, -13.5f, -3.8f, |
| 1053 | }; | 1142 | }; |
| 1054 | 1143 | ||
| 1144 | constexpr std::array<float, 63 * 2> left_joystick_L_topview = { | ||
| 1145 | -186.7f, -43.7f, -186.4f, -43.7f, -110.6f, -43.4f, -110.6f, -43.1f, -110.7f, -34.3f, | ||
| 1146 | -110.7f, -34.0f, -110.8f, -33.7f, -111.1f, -32.9f, -111.2f, -32.6f, -111.4f, -32.3f, | ||
| 1147 | -111.5f, -32.1f, -111.7f, -31.8f, -111.8f, -31.5f, -112.0f, -31.3f, -112.2f, -31.0f, | ||
| 1148 | -112.4f, -30.8f, -112.8f, -30.3f, -113.0f, -30.1f, -114.1f, -29.1f, -114.3f, -28.9f, | ||
| 1149 | -114.6f, -28.7f, -114.8f, -28.6f, -115.1f, -28.4f, -115.3f, -28.3f, -115.6f, -28.1f, | ||
| 1150 | -115.9f, -28.0f, -116.4f, -27.8f, -116.7f, -27.7f, -117.3f, -27.6f, -117.6f, -27.5f, | ||
| 1151 | -182.9f, -27.6f, -183.5f, -27.7f, -183.8f, -27.8f, -184.4f, -27.9f, -184.6f, -28.1f, | ||
| 1152 | -184.9f, -28.2f, -185.4f, -28.5f, -185.7f, -28.7f, -185.9f, -28.8f, -186.2f, -29.0f, | ||
| 1153 | -186.4f, -29.2f, -187.0f, -29.9f, -187.2f, -30.1f, -187.6f, -30.6f, -187.8f, -30.8f, | ||
| 1154 | -187.9f, -31.1f, -188.1f, -31.3f, -188.2f, -31.6f, -188.4f, -31.9f, -188.5f, -32.1f, | ||
| 1155 | -188.6f, -32.4f, -188.8f, -33.3f, -188.9f, -33.6f, -188.9f, -33.9f, -188.8f, -39.9f, | ||
| 1156 | -188.8f, -40.2f, -188.7f, -41.1f, -188.7f, -41.4f, -188.6f, -41.7f, -188.0f, -43.1f, | ||
| 1157 | -187.9f, -43.4f, -187.6f, -43.6f, -187.3f, -43.7f, | ||
| 1158 | }; | ||
| 1159 | |||
| 1160 | constexpr std::array<float, 44 * 2> left_joystick_ZL_topview = { | ||
| 1161 | -179.4f, -53.3f, -177.4f, -53.3f, -111.2f, -53.3f, -111.3f, -53.3f, -111.5f, -58.6f, | ||
| 1162 | -111.8f, -60.5f, -112.2f, -62.4f, -113.1f, -66.1f, -113.8f, -68.0f, -114.5f, -69.8f, | ||
| 1163 | -115.3f, -71.5f, -116.3f, -73.2f, -117.3f, -74.8f, -118.5f, -76.4f, -119.8f, -77.8f, | ||
| 1164 | -121.2f, -79.1f, -122.8f, -80.2f, -124.4f, -81.2f, -126.2f, -82.0f, -128.1f, -82.6f, | ||
| 1165 | -130.0f, -82.9f, -131.9f, -83.0f, -141.5f, -82.9f, -149.3f, -82.8f, -153.1f, -82.6f, | ||
| 1166 | -155.0f, -82.1f, -156.8f, -81.6f, -158.7f, -80.9f, -160.4f, -80.2f, -162.2f, -79.3f, | ||
| 1167 | -163.8f, -78.3f, -165.4f, -77.2f, -166.9f, -76.0f, -168.4f, -74.7f, -169.7f, -73.3f, | ||
| 1168 | -172.1f, -70.3f, -173.2f, -68.7f, -174.2f, -67.1f, -175.2f, -65.4f, -176.1f, -63.7f, | ||
| 1169 | -178.7f, -58.5f, -179.6f, -56.8f, -180.4f, -55.1f, -181.3f, -53.3f, | ||
| 1170 | }; | ||
| 1171 | |||
| 1055 | void PlayerControlPreview::DrawProBody(QPainter& p, const QPointF center) { | 1172 | void PlayerControlPreview::DrawProBody(QPainter& p, const QPointF center) { |
| 1056 | std::array<QPointF, pro_left_handle.size() / 2> qleft_handle; | 1173 | std::array<QPointF, pro_left_handle.size() / 2> qleft_handle; |
| 1057 | std::array<QPointF, pro_left_handle.size() / 2> qright_handle; | 1174 | std::array<QPointF, pro_left_handle.size() / 2> qright_handle; |
| 1058 | std::array<QPointF, pro_body.size()> qbody; | 1175 | std::array<QPointF, pro_body.size()> qbody; |
| 1059 | constexpr int radius1 = 30; | 1176 | constexpr int radius1 = 32; |
| 1060 | 1177 | ||
| 1061 | for (std::size_t point = 0; point < pro_left_handle.size() / 2; ++point) { | 1178 | for (std::size_t point = 0; point < pro_left_handle.size() / 2; ++point) { |
| 1062 | qleft_handle[point] = | 1179 | qleft_handle[point] = |
| @@ -1101,6 +1218,7 @@ void PlayerControlPreview::DrawHandheldBody(QPainter& p, const QPointF center) { | |||
| 1101 | std::array<QPointF, handheld_bezel.size() / 2> qhandheld_bezel; | 1218 | std::array<QPointF, handheld_bezel.size() / 2> qhandheld_bezel; |
| 1102 | std::array<QPointF, bezel_inline_size> qhandheld_bezel_inline; | 1219 | std::array<QPointF, bezel_inline_size> qhandheld_bezel_inline; |
| 1103 | std::array<QPointF, bezel_outline_end> qhandheld_bezel_outline; | 1220 | std::array<QPointF, bezel_outline_end> qhandheld_bezel_outline; |
| 1221 | std::array<QPointF, handheld_buttons.size() / 2> qhandheld_buttons; | ||
| 1104 | 1222 | ||
| 1105 | for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { | 1223 | for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { |
| 1106 | left_joycon[point] = | 1224 | left_joycon[point] = |
| @@ -1129,6 +1247,10 @@ void PlayerControlPreview::DrawHandheldBody(QPainter& p, const QPointF center) { | |||
| 1129 | center + QPointF(handheld_bezel[(point + bezel_inline_start) * 2], | 1247 | center + QPointF(handheld_bezel[(point + bezel_inline_start) * 2], |
| 1130 | handheld_bezel[(point + bezel_inline_start) * 2 + 1]); | 1248 | handheld_bezel[(point + bezel_inline_start) * 2 + 1]); |
| 1131 | } | 1249 | } |
| 1250 | for (std::size_t point = 0; point < handheld_buttons.size() / 2; ++point) { | ||
| 1251 | qhandheld_buttons[point] = | ||
| 1252 | center + QPointF(handheld_buttons[point * 2], handheld_buttons[point * 2 + 1]); | ||
| 1253 | } | ||
| 1132 | 1254 | ||
| 1133 | // Draw left joycon | 1255 | // Draw left joycon |
| 1134 | p.setPen(colors.outline); | 1256 | p.setPen(colors.outline); |
| @@ -1140,6 +1262,11 @@ void PlayerControlPreview::DrawHandheldBody(QPainter& p, const QPointF center) { | |||
| 1140 | p.setBrush(colors.right); | 1262 | p.setBrush(colors.right); |
| 1141 | DrawPolygon(p, right_joycon); | 1263 | DrawPolygon(p, right_joycon); |
| 1142 | 1264 | ||
| 1265 | // Draw Handheld buttons | ||
| 1266 | p.setPen(colors.outline); | ||
| 1267 | p.setBrush(colors.button); | ||
| 1268 | DrawPolygon(p, qhandheld_buttons); | ||
| 1269 | |||
| 1143 | // Draw handheld body | 1270 | // Draw handheld body |
| 1144 | p.setPen(colors.transparent); | 1271 | p.setPen(colors.transparent); |
| 1145 | p.setBrush(colors.primary); | 1272 | p.setBrush(colors.primary); |
| @@ -1196,13 +1323,13 @@ void PlayerControlPreview::DrawDualBody(QPainter& p, const QPointF center) { | |||
| 1196 | left_joycon_body_trigger[point * 2 + 1] + 2); | 1323 | left_joycon_body_trigger[point * 2 + 1] + 2); |
| 1197 | } | 1324 | } |
| 1198 | 1325 | ||
| 1199 | // right joycon boddy | 1326 | // right joycon body |
| 1200 | p.setPen(colors.outline); | 1327 | p.setPen(colors.outline); |
| 1201 | p.setBrush(colors.right); | 1328 | p.setBrush(colors.right); |
| 1202 | DrawPolygon(p, right_joycon); | 1329 | DrawPolygon(p, right_joycon); |
| 1203 | DrawPolygon(p, qright_joycon_trigger); | 1330 | DrawPolygon(p, qright_joycon_trigger); |
| 1204 | 1331 | ||
| 1205 | // Left joycon boddy | 1332 | // Left joycon body |
| 1206 | p.setPen(colors.outline); | 1333 | p.setPen(colors.outline); |
| 1207 | p.setBrush(colors.left); | 1334 | p.setBrush(colors.left); |
| 1208 | DrawPolygon(p, left_joycon); | 1335 | DrawPolygon(p, left_joycon); |
| @@ -1309,6 +1436,8 @@ void PlayerControlPreview::DrawLeftBody(QPainter& p, const QPointF center) { | |||
| 1309 | std::array<QPointF, left_joycon_sideview.size() / 2> qleft_joycon_sideview; | 1436 | std::array<QPointF, left_joycon_sideview.size() / 2> qleft_joycon_sideview; |
| 1310 | std::array<QPointF, left_joycon_body_trigger.size() / 2> qleft_joycon_trigger; | 1437 | std::array<QPointF, left_joycon_body_trigger.size() / 2> qleft_joycon_trigger; |
| 1311 | std::array<QPointF, left_joycon_slider.size() / 2> qleft_joycon_slider; | 1438 | std::array<QPointF, left_joycon_slider.size() / 2> qleft_joycon_slider; |
| 1439 | std::array<QPointF, left_joycon_slider_topview.size() / 2> qleft_joycon_slider_topview; | ||
| 1440 | std::array<QPointF, left_joycon_topview.size() / 2> qleft_joycon_topview; | ||
| 1312 | constexpr float size = 1.78f; | 1441 | constexpr float size = 1.78f; |
| 1313 | constexpr float size2 = 1.1115f; | 1442 | constexpr float size2 = 1.1115f; |
| 1314 | constexpr float offset = 312.39f; | 1443 | constexpr float offset = 312.39f; |
| @@ -1333,13 +1462,35 @@ void PlayerControlPreview::DrawLeftBody(QPainter& p, const QPointF center) { | |||
| 1333 | center + QPointF(left_joycon_body_trigger[point * 2] * size2 + offset2, | 1462 | center + QPointF(left_joycon_body_trigger[point * 2] * size2 + offset2, |
| 1334 | left_joycon_body_trigger[point * 2 + 1] * size2 + 2); | 1463 | left_joycon_body_trigger[point * 2 + 1] * size2 + 2); |
| 1335 | } | 1464 | } |
| 1465 | for (std::size_t point = 0; point < left_joycon_topview.size() / 2; ++point) { | ||
| 1466 | qleft_joycon_topview[point] = | ||
| 1467 | center + QPointF(left_joycon_topview[point * 2], left_joycon_topview[point * 2 + 1]); | ||
| 1468 | } | ||
| 1469 | for (std::size_t point = 0; point < left_joycon_slider_topview.size() / 2; ++point) { | ||
| 1470 | qleft_joycon_slider_topview[point] = | ||
| 1471 | center + QPointF(left_joycon_slider_topview[point * 2], | ||
| 1472 | left_joycon_slider_topview[point * 2 + 1]); | ||
| 1473 | } | ||
| 1336 | 1474 | ||
| 1337 | // Joycon boddy | 1475 | // Joycon body |
| 1338 | p.setPen(colors.outline); | 1476 | p.setPen(colors.outline); |
| 1339 | p.setBrush(colors.left); | 1477 | p.setBrush(colors.left); |
| 1340 | DrawPolygon(p, left_joycon); | 1478 | DrawPolygon(p, left_joycon); |
| 1341 | DrawPolygon(p, qleft_joycon_trigger); | 1479 | DrawPolygon(p, qleft_joycon_trigger); |
| 1342 | 1480 | ||
| 1481 | // Slider release button top view | ||
| 1482 | p.setBrush(colors.button); | ||
| 1483 | DrawRoundRectangle(p, center + QPoint(-107, -62), 14, 12, 2); | ||
| 1484 | |||
| 1485 | // Joycon slider top view | ||
| 1486 | p.setBrush(colors.slider); | ||
| 1487 | DrawPolygon(p, qleft_joycon_slider_topview); | ||
| 1488 | p.drawLine(center + QPointF(-91.1f, -51.7f), center + QPointF(-91.1f, -26.5f)); | ||
| 1489 | |||
| 1490 | // Joycon body top view | ||
| 1491 | p.setBrush(colors.left); | ||
| 1492 | DrawPolygon(p, qleft_joycon_topview); | ||
| 1493 | |||
| 1343 | // Slider release button | 1494 | // Slider release button |
| 1344 | p.setBrush(colors.button); | 1495 | p.setBrush(colors.button); |
| 1345 | DrawRoundRectangle(p, center + QPoint(175, -110), 12, 14, 2); | 1496 | DrawRoundRectangle(p, center + QPoint(175, -110), 12, 14, 2); |
| @@ -1381,6 +1532,8 @@ void PlayerControlPreview::DrawRightBody(QPainter& p, const QPointF center) { | |||
| 1381 | std::array<QPointF, left_joycon_sideview.size() / 2> qright_joycon_sideview; | 1532 | std::array<QPointF, left_joycon_sideview.size() / 2> qright_joycon_sideview; |
| 1382 | std::array<QPointF, left_joycon_body_trigger.size() / 2> qright_joycon_trigger; | 1533 | std::array<QPointF, left_joycon_body_trigger.size() / 2> qright_joycon_trigger; |
| 1383 | std::array<QPointF, left_joycon_slider.size() / 2> qright_joycon_slider; | 1534 | std::array<QPointF, left_joycon_slider.size() / 2> qright_joycon_slider; |
| 1535 | std::array<QPointF, left_joycon_slider_topview.size() / 2> qright_joycon_slider_topview; | ||
| 1536 | std::array<QPointF, left_joycon_topview.size() / 2> qright_joycon_topview; | ||
| 1384 | constexpr float size = 1.78f; | 1537 | constexpr float size = 1.78f; |
| 1385 | constexpr float size2 = 1.1115f; | 1538 | constexpr float size2 = 1.1115f; |
| 1386 | constexpr float offset = 312.39f; | 1539 | constexpr float offset = 312.39f; |
| @@ -1405,13 +1558,35 @@ void PlayerControlPreview::DrawRightBody(QPainter& p, const QPointF center) { | |||
| 1405 | qright_joycon_slider[point] = center + QPointF(-left_joycon_slider[point * 2] * size2 - 81, | 1558 | qright_joycon_slider[point] = center + QPointF(-left_joycon_slider[point * 2] * size2 - 81, |
| 1406 | left_joycon_slider[point * 2 + 1] * size2); | 1559 | left_joycon_slider[point * 2 + 1] * size2); |
| 1407 | } | 1560 | } |
| 1561 | for (std::size_t point = 0; point < left_joycon_topview.size() / 2; ++point) { | ||
| 1562 | qright_joycon_topview[point] = | ||
| 1563 | center + QPointF(-left_joycon_topview[point * 2], left_joycon_topview[point * 2 + 1]); | ||
| 1564 | } | ||
| 1565 | for (std::size_t point = 0; point < left_joycon_slider_topview.size() / 2; ++point) { | ||
| 1566 | qright_joycon_slider_topview[point] = | ||
| 1567 | center + QPointF(-left_joycon_slider_topview[point * 2], | ||
| 1568 | left_joycon_slider_topview[point * 2 + 1]); | ||
| 1569 | } | ||
| 1408 | 1570 | ||
| 1409 | // Joycon boddy | 1571 | // Joycon body |
| 1410 | p.setPen(colors.outline); | 1572 | p.setPen(colors.outline); |
| 1411 | p.setBrush(colors.left); | 1573 | p.setBrush(colors.left); |
| 1412 | DrawPolygon(p, right_joycon); | 1574 | DrawPolygon(p, right_joycon); |
| 1413 | DrawPolygon(p, qright_joycon_trigger); | 1575 | DrawPolygon(p, qright_joycon_trigger); |
| 1414 | 1576 | ||
| 1577 | // Slider release button top view | ||
| 1578 | p.setBrush(colors.button); | ||
| 1579 | DrawRoundRectangle(p, center + QPoint(107, -62), 14, 12, 2); | ||
| 1580 | |||
| 1581 | // Joycon slider top view | ||
| 1582 | p.setBrush(colors.slider); | ||
| 1583 | DrawPolygon(p, qright_joycon_slider_topview); | ||
| 1584 | p.drawLine(center + QPointF(91.1f, -51.7f), center + QPointF(91.1f, -26.5f)); | ||
| 1585 | |||
| 1586 | // Joycon body top view | ||
| 1587 | p.setBrush(colors.left); | ||
| 1588 | DrawPolygon(p, qright_joycon_topview); | ||
| 1589 | |||
| 1415 | // Slider release button | 1590 | // Slider release button |
| 1416 | p.setBrush(colors.button); | 1591 | p.setBrush(colors.button); |
| 1417 | DrawRoundRectangle(p, center + QPoint(-175, -110), 12, 14, 2); | 1592 | DrawRoundRectangle(p, center + QPoint(-175, -110), 12, 14, 2); |
| @@ -1591,6 +1766,48 @@ void PlayerControlPreview::DrawLeftZTriggers(QPainter& p, const QPointF center, | |||
| 1591 | 44 * 16); | 1766 | 44 * 16); |
| 1592 | } | 1767 | } |
| 1593 | 1768 | ||
| 1769 | void PlayerControlPreview::DrawLeftTriggersTopView(QPainter& p, const QPointF center, | ||
| 1770 | bool left_pressed) { | ||
| 1771 | std::array<QPointF, left_joystick_L_topview.size() / 2> qleft_trigger; | ||
| 1772 | |||
| 1773 | for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) { | ||
| 1774 | qleft_trigger[point] = center + QPointF(left_joystick_L_topview[point * 2], | ||
| 1775 | left_joystick_L_topview[point * 2 + 1]); | ||
| 1776 | } | ||
| 1777 | |||
| 1778 | p.setPen(colors.outline); | ||
| 1779 | p.setBrush(left_pressed ? colors.highlight : colors.button); | ||
| 1780 | DrawPolygon(p, qleft_trigger); | ||
| 1781 | |||
| 1782 | // Draw ZL text | ||
| 1783 | p.setPen(colors.transparent); | ||
| 1784 | p.setBrush(colors.font2); | ||
| 1785 | DrawSymbol(p, center + QPointF(-143, -36), Symbol::ZL, 1.0f); | ||
| 1786 | |||
| 1787 | // Delete Z character | ||
| 1788 | p.setBrush(left_pressed ? colors.highlight : colors.button); | ||
| 1789 | DrawRectangle(p, center + QPointF(-146, -36), 6, 10); | ||
| 1790 | } | ||
| 1791 | |||
| 1792 | void PlayerControlPreview::DrawLeftZTriggersTopView(QPainter& p, const QPointF center, | ||
| 1793 | bool left_pressed) { | ||
| 1794 | std::array<QPointF, left_joystick_ZL_topview.size() / 2> qleft_trigger; | ||
| 1795 | |||
| 1796 | for (std::size_t point = 0; point < left_joystick_ZL_topview.size() / 2; ++point) { | ||
| 1797 | qleft_trigger[point] = center + QPointF(left_joystick_ZL_topview[point * 2], | ||
| 1798 | left_joystick_ZL_topview[point * 2 + 1]); | ||
| 1799 | } | ||
| 1800 | |||
| 1801 | p.setPen(colors.outline); | ||
| 1802 | p.setBrush(left_pressed ? colors.highlight : colors.button); | ||
| 1803 | DrawPolygon(p, qleft_trigger); | ||
| 1804 | |||
| 1805 | // Draw ZL text | ||
| 1806 | p.setPen(colors.transparent); | ||
| 1807 | p.setBrush(colors.font2); | ||
| 1808 | DrawSymbol(p, center + QPointF(-140, -68), Symbol::ZL, 1.0f); | ||
| 1809 | } | ||
| 1810 | |||
| 1594 | void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center, | 1811 | void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center, |
| 1595 | bool right_pressed) { | 1812 | bool right_pressed) { |
| 1596 | std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger; | 1813 | std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger; |
| @@ -1628,6 +1845,48 @@ void PlayerControlPreview::DrawRightZTriggers(QPainter& p, const QPointF center, | |||
| 1628 | 44 * 16); | 1845 | 44 * 16); |
| 1629 | } | 1846 | } |
| 1630 | 1847 | ||
| 1848 | void PlayerControlPreview::DrawRightTriggersTopView(QPainter& p, const QPointF center, | ||
| 1849 | bool right_pressed) { | ||
| 1850 | std::array<QPointF, left_joystick_L_topview.size() / 2> qright_trigger; | ||
| 1851 | |||
| 1852 | for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) { | ||
| 1853 | qright_trigger[point] = center + QPointF(-left_joystick_L_topview[point * 2], | ||
| 1854 | left_joystick_L_topview[point * 2 + 1]); | ||
| 1855 | } | ||
| 1856 | |||
| 1857 | p.setPen(colors.outline); | ||
| 1858 | p.setBrush(right_pressed ? colors.highlight : colors.button); | ||
| 1859 | DrawPolygon(p, qright_trigger); | ||
| 1860 | |||
| 1861 | // Draw ZR text | ||
| 1862 | p.setPen(colors.transparent); | ||
| 1863 | p.setBrush(colors.font2); | ||
| 1864 | DrawSymbol(p, center + QPointF(137, -36), Symbol::ZR, 1.0f); | ||
| 1865 | |||
| 1866 | // Delete Z character | ||
| 1867 | p.setBrush(right_pressed ? colors.highlight : colors.button); | ||
| 1868 | DrawRectangle(p, center + QPointF(134, -36), 6, 10); | ||
| 1869 | } | ||
| 1870 | |||
| 1871 | void PlayerControlPreview::DrawRightZTriggersTopView(QPainter& p, const QPointF center, | ||
| 1872 | bool right_pressed) { | ||
| 1873 | std::array<QPointF, left_joystick_ZL_topview.size() / 2> qright_trigger; | ||
| 1874 | |||
| 1875 | for (std::size_t point = 0; point < left_joystick_ZL_topview.size() / 2; ++point) { | ||
| 1876 | qright_trigger[point] = center + QPointF(-left_joystick_ZL_topview[point * 2], | ||
| 1877 | left_joystick_ZL_topview[point * 2 + 1]); | ||
| 1878 | } | ||
| 1879 | |||
| 1880 | p.setPen(colors.outline); | ||
| 1881 | p.setBrush(right_pressed ? colors.highlight : colors.button); | ||
| 1882 | DrawPolygon(p, qright_trigger); | ||
| 1883 | |||
| 1884 | // Draw ZR text | ||
| 1885 | p.setPen(colors.transparent); | ||
| 1886 | p.setBrush(colors.font2); | ||
| 1887 | DrawSymbol(p, center + QPointF(140, -68), Symbol::ZR, 1.0f); | ||
| 1888 | } | ||
| 1889 | |||
| 1631 | void PlayerControlPreview::DrawJoystick(QPainter& p, const QPointF center, float size, | 1890 | void PlayerControlPreview::DrawJoystick(QPainter& p, const QPointF center, float size, |
| 1632 | bool pressed) { | 1891 | bool pressed) { |
| 1633 | const float radius1 = 13.0f * size; | 1892 | const float radius1 = 13.0f * size; |
| @@ -1688,12 +1947,9 @@ void PlayerControlPreview::DrawRawJoystick(QPainter& p, const QPointF center, co | |||
| 1688 | const float range = size * properties.range; | 1947 | const float range = size * properties.range; |
| 1689 | const float deadzone = size * properties.deadzone; | 1948 | const float deadzone = size * properties.deadzone; |
| 1690 | 1949 | ||
| 1691 | // Outer box | 1950 | // Max range zone circle |
| 1692 | p.setPen(colors.outline); | 1951 | p.setPen(colors.outline); |
| 1693 | p.setBrush(colors.transparent); | 1952 | p.setBrush(colors.transparent); |
| 1694 | p.drawRect(center.x() - size, center.y() - size, size * 2, size * 2); | ||
| 1695 | |||
| 1696 | // Max range zone circle | ||
| 1697 | QPen pen = p.pen(); | 1953 | QPen pen = p.pen(); |
| 1698 | pen.setStyle(Qt::DotLine); | 1954 | pen.setStyle(Qt::DotLine); |
| 1699 | p.setPen(pen); | 1955 | p.setPen(pen); |
| @@ -1725,7 +1981,7 @@ void PlayerControlPreview::DrawRoundButton(QPainter& p, QPointF center, bool pre | |||
| 1725 | center.setY(center.y() + 1); | 1981 | center.setY(center.y() + 1); |
| 1726 | break; | 1982 | break; |
| 1727 | case Direction::Up: | 1983 | case Direction::Up: |
| 1728 | center.setY(center.y() + 1); | 1984 | center.setY(center.y() - 1); |
| 1729 | break; | 1985 | break; |
| 1730 | case Direction::None: | 1986 | case Direction::None: |
| 1731 | break; | 1987 | break; |
| @@ -1759,7 +2015,7 @@ void PlayerControlPreview::DrawPlusButton(QPainter& p, const QPointF center, boo | |||
| 1759 | } | 2015 | } |
| 1760 | 2016 | ||
| 1761 | void PlayerControlPreview::DrawCircleButton(QPainter& p, const QPointF center, bool pressed, | 2017 | void PlayerControlPreview::DrawCircleButton(QPainter& p, const QPointF center, bool pressed, |
| 1762 | int button_size) { | 2018 | float button_size) { |
| 1763 | p.setBrush(button_color); | 2019 | p.setBrush(button_color); |
| 1764 | if (pressed) { | 2020 | if (pressed) { |
| 1765 | p.setBrush(colors.highlight); | 2021 | p.setBrush(colors.highlight); |
diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h index 785d37924..ba5e49da3 100644 --- a/src/yuzu/configuration/configure_input_player_widget.h +++ b/src/yuzu/configuration/configure_input_player_widget.h | |||
| @@ -25,6 +25,8 @@ 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_, | ||
| 29 | Settings::AnalogsRaw analogs_); | ||
| 28 | void SetConnectedStatus(bool checked); | 30 | void SetConnectedStatus(bool checked); |
| 29 | void SetControllerType(Settings::ControllerType type); | 31 | void SetControllerType(Settings::ControllerType type); |
| 30 | void BeginMappingButton(std::size_t button_id); | 32 | void BeginMappingButton(std::size_t button_id); |
| @@ -114,8 +116,12 @@ private: | |||
| 114 | void DrawDualZTriggers(QPainter& p, QPointF center, bool left_pressed, bool right_pressed); | 116 | void DrawDualZTriggers(QPainter& p, QPointF center, bool left_pressed, bool right_pressed); |
| 115 | void DrawLeftTriggers(QPainter& p, QPointF center, bool left_pressed); | 117 | void DrawLeftTriggers(QPainter& p, QPointF center, bool left_pressed); |
| 116 | void DrawLeftZTriggers(QPainter& p, QPointF center, bool left_pressed); | 118 | void DrawLeftZTriggers(QPainter& p, QPointF center, bool left_pressed); |
| 119 | void DrawLeftTriggersTopView(QPainter& p, QPointF center, bool left_pressed); | ||
| 120 | void DrawLeftZTriggersTopView(QPainter& p, QPointF center, bool left_pressed); | ||
| 117 | void DrawRightTriggers(QPainter& p, QPointF center, bool right_pressed); | 121 | void DrawRightTriggers(QPainter& p, QPointF center, bool right_pressed); |
| 118 | void DrawRightZTriggers(QPainter& p, QPointF center, bool right_pressed); | 122 | void DrawRightZTriggers(QPainter& p, QPointF center, bool right_pressed); |
| 123 | void DrawRightTriggersTopView(QPainter& p, QPointF center, bool right_pressed); | ||
| 124 | void DrawRightZTriggersTopView(QPainter& p, QPointF center, bool right_pressed); | ||
| 119 | 125 | ||
| 120 | // Draw joystick functions | 126 | // Draw joystick functions |
| 121 | void DrawJoystick(QPainter& p, QPointF center, float size, bool pressed); | 127 | void DrawJoystick(QPainter& p, QPointF center, float size, bool pressed); |
| @@ -125,7 +131,7 @@ private: | |||
| 125 | void DrawProJoystick(QPainter& p, QPointF center, bool pressed); | 131 | void DrawProJoystick(QPainter& p, QPointF center, bool pressed); |
| 126 | 132 | ||
| 127 | // Draw button functions | 133 | // Draw button functions |
| 128 | void DrawCircleButton(QPainter& p, QPointF center, bool pressed, int button_size); | 134 | void DrawCircleButton(QPainter& p, QPointF center, bool pressed, float button_size); |
| 129 | void DrawRoundButton(QPainter& p, QPointF center, bool pressed, float width, float height, | 135 | void DrawRoundButton(QPainter& p, QPointF center, bool pressed, float width, float height, |
| 130 | Direction direction = Direction::None, float radius = 2); | 136 | Direction direction = Direction::None, float radius = 2); |
| 131 | void DrawMinusButton(QPainter& p, QPointF center, bool pressed, int button_size); | 137 | void DrawMinusButton(QPainter& p, QPointF center, bool pressed, int button_size); |
diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp new file mode 100644 index 000000000..23834f063 --- /dev/null +++ b/src/yuzu/debugger/controller.cpp | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <QAction> | ||
| 6 | #include <QLayout> | ||
| 7 | #include <QString> | ||
| 8 | #include "core/settings.h" | ||
| 9 | #include "yuzu/configuration/configure_input_player_widget.h" | ||
| 10 | #include "yuzu/debugger/controller.h" | ||
| 11 | |||
| 12 | ControllerDialog::ControllerDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) { | ||
| 13 | setObjectName(QStringLiteral("Controller")); | ||
| 14 | setWindowTitle(tr("Controller P1")); | ||
| 15 | resize(500, 350); | ||
| 16 | setMinimumSize(500, 350); | ||
| 17 | // Remove the "?" button from the titlebar and enable the maximize button | ||
| 18 | setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) | | ||
| 19 | Qt::WindowMaximizeButtonHint); | ||
| 20 | |||
| 21 | PlayerControlPreview* widget = new PlayerControlPreview(this); | ||
| 22 | const auto& players = Settings::values.players.GetValue(); | ||
| 23 | constexpr std::size_t player = 0; | ||
| 24 | widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs); | ||
| 25 | widget->SetConnectedStatus(players[player].connected); | ||
| 26 | widget->SetControllerType(players[player].controller_type); | ||
| 27 | QLayout* layout = new QVBoxLayout(this); | ||
| 28 | layout->setContentsMargins(0, 0, 0, 0); | ||
| 29 | layout->addWidget(widget); | ||
| 30 | setLayout(layout); | ||
| 31 | |||
| 32 | // Configure focus so that widget is focusable and the dialog automatically forwards focus to | ||
| 33 | // it. | ||
| 34 | setFocusProxy(widget); | ||
| 35 | widget->setFocusPolicy(Qt::StrongFocus); | ||
| 36 | widget->setFocus(); | ||
| 37 | } | ||
| 38 | |||
| 39 | QAction* ControllerDialog::toggleViewAction() { | ||
| 40 | if (toggle_view_action == nullptr) { | ||
| 41 | toggle_view_action = new QAction(windowTitle(), this); | ||
| 42 | toggle_view_action->setCheckable(true); | ||
| 43 | toggle_view_action->setChecked(isVisible()); | ||
| 44 | connect(toggle_view_action, &QAction::toggled, this, &ControllerDialog::setVisible); | ||
| 45 | } | ||
| 46 | |||
| 47 | return toggle_view_action; | ||
| 48 | } | ||
| 49 | |||
| 50 | void ControllerDialog::showEvent(QShowEvent* ev) { | ||
| 51 | if (toggle_view_action) { | ||
| 52 | toggle_view_action->setChecked(isVisible()); | ||
| 53 | } | ||
| 54 | QWidget::showEvent(ev); | ||
| 55 | } | ||
| 56 | |||
| 57 | void ControllerDialog::hideEvent(QHideEvent* ev) { | ||
| 58 | if (toggle_view_action) { | ||
| 59 | toggle_view_action->setChecked(isVisible()); | ||
| 60 | } | ||
| 61 | QWidget::hideEvent(ev); | ||
| 62 | } | ||
diff --git a/src/yuzu/debugger/controller.h b/src/yuzu/debugger/controller.h new file mode 100644 index 000000000..da389b6a2 --- /dev/null +++ b/src/yuzu/debugger/controller.h | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <QWidget> | ||
| 8 | |||
| 9 | class QAction; | ||
| 10 | class QHideEvent; | ||
| 11 | class QShowEvent; | ||
| 12 | |||
| 13 | class ControllerDialog : public QWidget { | ||
| 14 | Q_OBJECT | ||
| 15 | |||
| 16 | public: | ||
| 17 | explicit ControllerDialog(QWidget* parent = nullptr); | ||
| 18 | |||
| 19 | /// Returns a QAction that can be used to toggle visibility of this dialog. | ||
| 20 | QAction* toggleViewAction(); | ||
| 21 | |||
| 22 | protected: | ||
| 23 | void showEvent(QShowEvent* ev) override; | ||
| 24 | void hideEvent(QHideEvent* ev) override; | ||
| 25 | |||
| 26 | private: | ||
| 27 | QAction* toggle_view_action = nullptr; | ||
| 28 | }; | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 886e6e9d2..f6f902fab 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -109,6 +109,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual | |||
| 109 | #include "yuzu/configuration/config.h" | 109 | #include "yuzu/configuration/config.h" |
| 110 | #include "yuzu/configuration/configure_dialog.h" | 110 | #include "yuzu/configuration/configure_dialog.h" |
| 111 | #include "yuzu/debugger/console.h" | 111 | #include "yuzu/debugger/console.h" |
| 112 | #include "yuzu/debugger/controller.h" | ||
| 112 | #include "yuzu/debugger/profiler.h" | 113 | #include "yuzu/debugger/profiler.h" |
| 113 | #include "yuzu/debugger/wait_tree.h" | 114 | #include "yuzu/debugger/wait_tree.h" |
| 114 | #include "yuzu/discord.h" | 115 | #include "yuzu/discord.h" |
| @@ -688,6 +689,11 @@ void GMainWindow::InitializeDebugWidgets() { | |||
| 688 | addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); | 689 | addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); |
| 689 | waitTreeWidget->hide(); | 690 | waitTreeWidget->hide(); |
| 690 | debug_menu->addAction(waitTreeWidget->toggleViewAction()); | 691 | debug_menu->addAction(waitTreeWidget->toggleViewAction()); |
| 692 | |||
| 693 | controllerDialog = new ControllerDialog(this); | ||
| 694 | controllerDialog->hide(); | ||
| 695 | debug_menu->addAction(controllerDialog->toggleViewAction()); | ||
| 696 | |||
| 691 | connect(this, &GMainWindow::EmulationStarting, waitTreeWidget, | 697 | connect(this, &GMainWindow::EmulationStarting, waitTreeWidget, |
| 692 | &WaitTreeWidget::OnEmulationStarting); | 698 | &WaitTreeWidget::OnEmulationStarting); |
| 693 | connect(this, &GMainWindow::EmulationStopping, waitTreeWidget, | 699 | connect(this, &GMainWindow::EmulationStopping, waitTreeWidget, |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 31788ea62..f4a71ea11 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -27,6 +27,7 @@ class GRenderWindow; | |||
| 27 | class LoadingScreen; | 27 | class LoadingScreen; |
| 28 | class MicroProfileDialog; | 28 | class MicroProfileDialog; |
| 29 | class ProfilerWidget; | 29 | class ProfilerWidget; |
| 30 | class ControllerDialog; | ||
| 30 | class QLabel; | 31 | class QLabel; |
| 31 | class QPushButton; | 32 | class QPushButton; |
| 32 | class QProgressDialog; | 33 | class QProgressDialog; |
| @@ -313,6 +314,7 @@ private: | |||
| 313 | ProfilerWidget* profilerWidget; | 314 | ProfilerWidget* profilerWidget; |
| 314 | MicroProfileDialog* microProfileDialog; | 315 | MicroProfileDialog* microProfileDialog; |
| 315 | WaitTreeWidget* waitTreeWidget; | 316 | WaitTreeWidget* waitTreeWidget; |
| 317 | ControllerDialog* controllerDialog; | ||
| 316 | 318 | ||
| 317 | QAction* actions_recent_files[max_recent_files_item]; | 319 | QAction* actions_recent_files[max_recent_files_item]; |
| 318 | 320 | ||