From 9a8a3955605c8e1b33b358f258046bc549e88d1f Mon Sep 17 00:00:00 2001 From: JosJuice Date: Mon, 18 Apr 2022 18:19:24 +0200 Subject: [PATCH] GCPadEmu/WiimoteEmu: Reorder control groups This way, Android (which will show groups in the order they're defined) will show groups in a more logical order similar to DolphinQt. The main thing that was annoying me was how early Rumble was for Wii Remotes. Some of the other changes I'm making in this commit, like the order of Shake/Tilt/Swing, are more arbitrary and were made for consistency with DolphinQt. But there are also places where I didn't go all the way with matching DolphinQt. Most notably, DolphinQt puts sticks before buttons, but I don't see any reason to do that for Android. --- Source/Core/Core/HW/GCPadEmu.cpp | 16 +++--- .../Core/HW/WiimoteEmu/Extension/Drums.cpp | 8 +-- .../Core/HW/WiimoteEmu/Extension/Nunchuk.cpp | 12 ++--- Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp | 52 +++++++++---------- 4 files changed, 43 insertions(+), 45 deletions(-) diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp index 9c21d53451..efcab4fa7a 100644 --- a/Source/Core/Core/HW/GCPadEmu.cpp +++ b/Source/Core/Core/HW/GCPadEmu.cpp @@ -60,14 +60,6 @@ GCPad::GCPad(const unsigned int index) : m_index(index) m_triggers->AddInput(ControllerEmu::Translate, named_trigger); } - // rumble - groups.emplace_back(m_rumble = new ControllerEmu::ControlGroup(RUMBLE_GROUP)); - m_rumble->AddOutput(ControllerEmu::Translate, _trans("Motor")); - - // Microphone - groups.emplace_back(m_mic = new ControllerEmu::Buttons(MIC_GROUP)); - m_mic->AddInput(ControllerEmu::Translate, _trans("Button")); - // dpad groups.emplace_back(m_dpad = new ControllerEmu::Buttons(DPAD_GROUP)); for (const char* named_direction : named_directions) @@ -75,6 +67,14 @@ GCPad::GCPad(const unsigned int index) : m_index(index) m_dpad->AddInput(ControllerEmu::Translate, named_direction); } + // Microphone + groups.emplace_back(m_mic = new ControllerEmu::Buttons(MIC_GROUP)); + m_mic->AddInput(ControllerEmu::Translate, _trans("Button")); + + // rumble + groups.emplace_back(m_rumble = new ControllerEmu::ControlGroup(RUMBLE_GROUP)); + m_rumble->AddOutput(ControllerEmu::Translate, _trans("Motor")); + // options groups.emplace_back(m_options = new ControllerEmu::ControlGroup(OPTIONS_GROUP)); m_options->AddSetting( diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.cpp index 1451acafbe..ef3f27460d 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.cpp @@ -69,14 +69,14 @@ Drums::Drums() : Extension1stParty("Drums", _trans("Drum Kit")) _trans("%")}, 50); - // Stick. - groups.emplace_back(m_stick = - new ControllerEmu::OctagonAnalogStick(_trans("Stick"), GATE_RADIUS)); - // Buttons. groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons"))); m_buttons->AddInput(ControllerEmu::DoNotTranslate, "-"); m_buttons->AddInput(ControllerEmu::DoNotTranslate, "+"); + + // Stick. + groups.emplace_back(m_stick = + new ControllerEmu::OctagonAnalogStick(_trans("Stick"), GATE_RADIUS)); } void Drums::BuildDesiredExtensionState(DesiredExtensionState* target_state) diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/Nunchuk.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/Nunchuk.cpp index daa512c2d3..361f4459f5 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/Nunchuk.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/Nunchuk.cpp @@ -45,16 +45,16 @@ Nunchuk::Nunchuk() : Extension1stParty(_trans("Nunchuk")) constexpr auto gate_radius = ControlState(STICK_GATE_RADIUS) / STICK_RADIUS; groups.emplace_back(m_stick = new ControllerEmu::OctagonAnalogStick(STICK_GROUP, gate_radius)); - // swing - groups.emplace_back(m_swing = new ControllerEmu::Force(_trans("Swing"))); + // Shake + // Inverse the default intensity so shake is opposite that of wiimote. + // This is needed by Donkey Kong Country Returns for proper shake action detection. + groups.emplace_back(m_shake = new ControllerEmu::Shake(_trans("Shake"), -1)); // tilt groups.emplace_back(m_tilt = new ControllerEmu::Tilt(_trans("Tilt"))); - // Shake - // Inverse the default intensity so shake is opposite that of wiimote. - // This is needed by DKCR for proper shake action detection. - groups.emplace_back(m_shake = new ControllerEmu::Shake(_trans("Shake"), -1)); + // swing + groups.emplace_back(m_swing = new ControllerEmu::Force(_trans("Swing"))); // accelerometer groups.emplace_back(m_imu_accelerometer = new ControllerEmu::IMUAccelerometer( diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index 0c1999c1f9..3b0018a76b 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -214,21 +214,22 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index), m_bt_device_index(i } m_buttons->AddInput(ControllerEmu::DoNotTranslate, HOME_BUTTON, "HOME"); - // Pointing (IR) + // D-Pad + groups.emplace_back(m_dpad = new ControllerEmu::Buttons(DPAD_GROUP)); + for (const char* named_direction : named_directions) + { + m_dpad->AddInput(ControllerEmu::Translate, named_direction); + } + // i18n: "Point" refers to the action of pointing a Wii Remote. groups.emplace_back(m_ir = new ControllerEmu::Cursor(IR_GROUP, _trans("Point"))); - groups.emplace_back(m_swing = new ControllerEmu::Force(_trans("Swing"))); - groups.emplace_back(m_tilt = new ControllerEmu::Tilt(_trans("Tilt"))); groups.emplace_back(m_shake = new ControllerEmu::Shake(_trans("Shake"))); - groups.emplace_back(m_imu_accelerometer = new ControllerEmu::IMUAccelerometer( - ACCELEROMETER_GROUP, _trans("Accelerometer"))); - groups.emplace_back(m_imu_gyroscope = - new ControllerEmu::IMUGyroscope(GYROSCOPE_GROUP, _trans("Gyroscope"))); - groups.emplace_back(m_imu_ir = new ControllerEmu::IMUCursor("IMUIR", _trans("Point"))); + groups.emplace_back(m_tilt = new ControllerEmu::Tilt(_trans("Tilt"))); + groups.emplace_back(m_swing = new ControllerEmu::Force(_trans("Swing"))); + groups.emplace_back(m_imu_ir = new ControllerEmu::IMUCursor("IMUIR", _trans("Point"))); const auto fov_default = Common::DVec2(CameraLogic::CAMERA_FOV_X, CameraLogic::CAMERA_FOV_Y) / MathUtil::TAU * 360; - m_imu_ir->AddSetting(&m_fov_x_setting, // i18n: FOV stands for "Field of view". {_trans("Horizontal FOV"), @@ -237,7 +238,6 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index), m_bt_device_index(i // i18n: Refers to emulated wii remote camera properties. _trans("Camera field of view (affects sensitivity of pointing).")}, fov_default.x, 0.01, 180); - m_imu_ir->AddSetting(&m_fov_y_setting, // i18n: FOV stands for "Field of view". {_trans("Vertical FOV"), @@ -247,6 +247,21 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index), m_bt_device_index(i _trans("Camera field of view (affects sensitivity of pointing).")}, fov_default.y, 0.01, 180); + groups.emplace_back(m_imu_accelerometer = new ControllerEmu::IMUAccelerometer( + ACCELEROMETER_GROUP, _trans("Accelerometer"))); + groups.emplace_back(m_imu_gyroscope = + new ControllerEmu::IMUGyroscope(GYROSCOPE_GROUP, _trans("Gyroscope"))); + + // Hotkeys + groups.emplace_back(m_hotkeys = new ControllerEmu::ModifySettingsButton(_trans("Hotkeys"))); + // hotkeys to temporarily modify the Wii Remote orientation (sideways, upright) + // this setting modifier is toggled + m_hotkeys->AddInput(_trans("Sideways Toggle"), true); + m_hotkeys->AddInput(_trans("Upright Toggle"), true); + // this setting modifier is not toggled + m_hotkeys->AddInput(_trans("Sideways Hold"), false); + m_hotkeys->AddInput(_trans("Upright Hold"), false); + // Extension groups.emplace_back(m_attachments = new ControllerEmu::Attachments(_trans("Extension"))); m_attachments->AddAttachment(std::make_unique()); @@ -266,13 +281,6 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index), m_bt_device_index(i groups.emplace_back(m_rumble = new ControllerEmu::ControlGroup(_trans("Rumble"))); m_rumble->AddOutput(ControllerEmu::Translate, _trans("Motor")); - // D-Pad - groups.emplace_back(m_dpad = new ControllerEmu::Buttons(DPAD_GROUP)); - for (const char* named_direction : named_directions) - { - m_dpad->AddInput(ControllerEmu::Translate, named_direction); - } - // Options groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options"))); @@ -297,16 +305,6 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index), m_bt_device_index(i {"Sideways Wiimote", nullptr, nullptr, _trans("Sideways Wii Remote")}, false); - // Hotkeys - groups.emplace_back(m_hotkeys = new ControllerEmu::ModifySettingsButton(_trans("Hotkeys"))); - // hotkeys to temporarily modify the Wii Remote orientation (sideways, upright) - // this setting modifier is toggled - m_hotkeys->AddInput(_trans("Sideways Toggle"), true); - m_hotkeys->AddInput(_trans("Upright Toggle"), true); - // this setting modifier is not toggled - m_hotkeys->AddInput(_trans("Sideways Hold"), false); - m_hotkeys->AddInput(_trans("Upright Hold"), false); - Reset(); m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); });