From 527f8e783c915886985ae38b580d33744435de58 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Mon, 29 May 2023 16:31:19 -0700 Subject: [PATCH] ControllerEmu: Convert Translatability to enum class --- Source/Core/Core/FreeLookManager.cpp | 30 ++++++++++--------- Source/Core/Core/HW/GBAPadEmu.cpp | 8 +++-- Source/Core/Core/HW/GCKeyboardEmu.cpp | 14 +++++---- Source/Core/Core/HW/GCPadEmu.cpp | 14 +++++---- .../Core/HW/WiimoteEmu/Extension/Classic.cpp | 10 ++++--- .../WiimoteEmu/Extension/DrawsomeTablet.cpp | 5 ++-- .../Core/HW/WiimoteEmu/Extension/Drums.cpp | 8 +++-- .../Core/HW/WiimoteEmu/Extension/Guitar.cpp | 14 +++++---- .../Core/HW/WiimoteEmu/Extension/Nunchuk.cpp | 5 ++-- .../HW/WiimoteEmu/Extension/Shinkansen.cpp | 28 +++++++++-------- .../Core/HW/WiimoteEmu/Extension/TaTaCon.cpp | 6 ++-- .../HW/WiimoteEmu/Extension/Turntable.cpp | 10 ++++--- .../HW/WiimoteEmu/Extension/UDrawTablet.cpp | 8 +++-- Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp | 10 ++++--- Source/Core/Core/HotkeyManager.cpp | 2 +- .../Config/Mapping/MappingWidget.cpp | 2 +- .../ControllerEmu/Control/Control.h | 2 +- .../ControlGroup/AnalogStick.cpp | 4 +-- .../ControllerEmu/ControlGroup/Cursor.cpp | 8 ++--- .../ControllerEmu/ControlGroup/Force.cpp | 18 +++++------ .../ControlGroup/IMUAccelerometer.cpp | 12 ++++---- .../ControllerEmu/ControlGroup/IMUCursor.cpp | 2 +- .../ControlGroup/IMUGyroscope.cpp | 12 ++++---- .../ControlGroup/ModifySettingsButton.cpp | 2 +- .../ControllerEmu/ControlGroup/Slider.cpp | 4 +-- .../ControllerEmu/ControlGroup/Tilt.cpp | 10 +++---- 26 files changed, 137 insertions(+), 111 deletions(-) diff --git a/Source/Core/Core/FreeLookManager.cpp b/Source/Core/Core/FreeLookManager.cpp index 0dbc71d3d8..b52a3d2a9c 100644 --- a/Source/Core/Core/FreeLookManager.cpp +++ b/Source/Core/Core/FreeLookManager.cpp @@ -81,31 +81,33 @@ enum GyroButtons FreeLookController::FreeLookController(const unsigned int index) : m_index(index) { + using Translatability = ControllerEmu::Translatability; + groups.emplace_back(m_move_buttons = new ControllerEmu::Buttons(_trans("Move"))); - m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Up")); - m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Down")); - m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Left")); - m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Right")); - m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Forward")); - m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Backward")); + m_move_buttons->AddInput(Translatability::Translate, _trans("Up")); + m_move_buttons->AddInput(Translatability::Translate, _trans("Down")); + m_move_buttons->AddInput(Translatability::Translate, _trans("Left")); + m_move_buttons->AddInput(Translatability::Translate, _trans("Right")); + m_move_buttons->AddInput(Translatability::Translate, _trans("Forward")); + m_move_buttons->AddInput(Translatability::Translate, _trans("Backward")); groups.emplace_back(m_speed_buttons = new ControllerEmu::Buttons(_trans("Speed"))); - m_speed_buttons->AddInput(ControllerEmu::Translate, _trans("Decrease")); - m_speed_buttons->AddInput(ControllerEmu::Translate, _trans("Increase")); - m_speed_buttons->AddInput(ControllerEmu::Translate, _trans("Reset")); + m_speed_buttons->AddInput(Translatability::Translate, _trans("Decrease")); + m_speed_buttons->AddInput(Translatability::Translate, _trans("Increase")); + m_speed_buttons->AddInput(Translatability::Translate, _trans("Reset")); groups.emplace_back(m_other_buttons = new ControllerEmu::Buttons(_trans("Other"))); - m_other_buttons->AddInput(ControllerEmu::Translate, _trans("Reset View")); + m_other_buttons->AddInput(Translatability::Translate, _trans("Reset View")); groups.emplace_back(m_fov_buttons = new ControllerEmu::Buttons(_trans("Field of View"))); - m_fov_buttons->AddInput(ControllerEmu::Translate, _trans("Increase X")); - m_fov_buttons->AddInput(ControllerEmu::Translate, _trans("Decrease X")); - m_fov_buttons->AddInput(ControllerEmu::Translate, _trans("Increase Y")); - m_fov_buttons->AddInput(ControllerEmu::Translate, _trans("Decrease Y")); + m_fov_buttons->AddInput(Translatability::Translate, _trans("Increase X")); + m_fov_buttons->AddInput(Translatability::Translate, _trans("Decrease X")); + m_fov_buttons->AddInput(Translatability::Translate, _trans("Increase Y")); + m_fov_buttons->AddInput(Translatability::Translate, _trans("Decrease Y")); groups.emplace_back(m_rotation_gyro = new ControllerEmu::IMUGyroscope( _trans("Incremental Rotation"), _trans("Incremental Rotation"))); diff --git a/Source/Core/Core/HW/GBAPadEmu.cpp b/Source/Core/Core/HW/GBAPadEmu.cpp index a46177e79f..c31d35df12 100644 --- a/Source/Core/Core/HW/GBAPadEmu.cpp +++ b/Source/Core/Core/HW/GBAPadEmu.cpp @@ -17,22 +17,24 @@ static const u16 button_bitmasks[] = {PAD_BUTTON_B, PAD_BUTTON_A, PAD_TRIGGER_ GBAPad::GBAPad(const unsigned int index) : m_reset_pending(false), m_index(index) { + using Translatability = ControllerEmu::Translatability; + // Buttons groups.emplace_back(m_buttons = new ControllerEmu::Buttons(BUTTONS_GROUP)); for (const char* named_button : {B_BUTTON, A_BUTTON, L_BUTTON, R_BUTTON}) { - m_buttons->AddInput(ControllerEmu::DoNotTranslate, named_button); + m_buttons->AddInput(Translatability::DoNotTranslate, named_button); } for (const char* named_button : {SELECT_BUTTON, START_BUTTON}) { - m_buttons->AddInput(ControllerEmu::Translate, named_button); + m_buttons->AddInput(Translatability::Translate, named_button); } // DPad groups.emplace_back(m_dpad = new ControllerEmu::Buttons(DPAD_GROUP)); for (const char* named_direction : named_directions) { - m_dpad->AddInput(ControllerEmu::Translate, named_direction); + m_dpad->AddInput(Translatability::Translate, named_direction); } } diff --git a/Source/Core/Core/HW/GCKeyboardEmu.cpp b/Source/Core/Core/HW/GCKeyboardEmu.cpp index 0d91708076..9cb0767852 100644 --- a/Source/Core/Core/HW/GCKeyboardEmu.cpp +++ b/Source/Core/Core/HW/GCKeyboardEmu.cpp @@ -51,30 +51,32 @@ static const char* const named_keys5[] = {"LEFT", "DOWN", "UP", "RIGHT", "ENTER" GCKeyboard::GCKeyboard(const unsigned int index) : m_index(index) { + using Translatability = ControllerEmu::Translatability; + // buttons groups.emplace_back(m_keys0x = new ControllerEmu::Buttons(_trans("Keys"))); for (const char* key : named_keys0) - m_keys0x->AddInput(ControllerEmu::DoNotTranslate, key); + m_keys0x->AddInput(Translatability::DoNotTranslate, key); groups.emplace_back(m_keys1x = new ControllerEmu::Buttons(_trans("Keys"))); for (const char* key : named_keys1) - m_keys1x->AddInput(ControllerEmu::DoNotTranslate, key); + m_keys1x->AddInput(Translatability::DoNotTranslate, key); groups.emplace_back(m_keys2x = new ControllerEmu::Buttons(_trans("Keys"))); for (const char* key : named_keys2) - m_keys2x->AddInput(ControllerEmu::DoNotTranslate, key); + m_keys2x->AddInput(Translatability::DoNotTranslate, key); groups.emplace_back(m_keys3x = new ControllerEmu::Buttons(_trans("Keys"))); for (const char* key : named_keys3) - m_keys3x->AddInput(ControllerEmu::DoNotTranslate, key); + m_keys3x->AddInput(Translatability::DoNotTranslate, key); groups.emplace_back(m_keys4x = new ControllerEmu::Buttons(_trans("Keys"))); for (const char* key : named_keys4) - m_keys4x->AddInput(ControllerEmu::DoNotTranslate, key); + m_keys4x->AddInput(Translatability::DoNotTranslate, key); groups.emplace_back(m_keys5x = new ControllerEmu::Buttons(_trans("Keys"))); for (const char* key : named_keys5) - m_keys5x->AddInput(ControllerEmu::DoNotTranslate, key); + m_keys5x->AddInput(Translatability::DoNotTranslate, key); } std::string GCKeyboard::GetName() const diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp index efcab4fa7a..6dd0a8b37c 100644 --- a/Source/Core/Core/HW/GCPadEmu.cpp +++ b/Source/Core/Core/HW/GCPadEmu.cpp @@ -38,14 +38,16 @@ static const u16 dpad_bitmasks[] = {PAD_BUTTON_UP, PAD_BUTTON_DOWN, PAD_BUTTON_L GCPad::GCPad(const unsigned int index) : m_index(index) { + using Translatability = ControllerEmu::Translatability; + // buttons groups.emplace_back(m_buttons = new ControllerEmu::Buttons(BUTTONS_GROUP)); for (const char* named_button : {A_BUTTON, B_BUTTON, X_BUTTON, Y_BUTTON, Z_BUTTON}) { - m_buttons->AddInput(ControllerEmu::DoNotTranslate, named_button); + m_buttons->AddInput(Translatability::DoNotTranslate, named_button); } // i18n: The START/PAUSE button on GameCube controllers - m_buttons->AddInput(ControllerEmu::Translate, START_BUTTON, _trans("START")); + m_buttons->AddInput(Translatability::Translate, START_BUTTON, _trans("START")); // sticks groups.emplace_back(m_main_stick = new ControllerEmu::OctagonAnalogStick( @@ -57,23 +59,23 @@ GCPad::GCPad(const unsigned int index) : m_index(index) groups.emplace_back(m_triggers = new ControllerEmu::MixedTriggers(TRIGGERS_GROUP)); for (const char* named_trigger : {L_DIGITAL, R_DIGITAL, L_ANALOG, R_ANALOG}) { - m_triggers->AddInput(ControllerEmu::Translate, named_trigger); + m_triggers->AddInput(Translatability::Translate, named_trigger); } // dpad groups.emplace_back(m_dpad = new ControllerEmu::Buttons(DPAD_GROUP)); for (const char* named_direction : named_directions) { - m_dpad->AddInput(ControllerEmu::Translate, named_direction); + m_dpad->AddInput(Translatability::Translate, named_direction); } // Microphone groups.emplace_back(m_mic = new ControllerEmu::Buttons(MIC_GROUP)); - m_mic->AddInput(ControllerEmu::Translate, _trans("Button")); + m_mic->AddInput(Translatability::Translate, _trans("Button")); // rumble groups.emplace_back(m_rumble = new ControllerEmu::ControlGroup(RUMBLE_GROUP)); - m_rumble->AddOutput(ControllerEmu::Translate, _trans("Motor")); + m_rumble->AddOutput(Translatability::Translate, _trans("Motor")); // options groups.emplace_back(m_options = new ControllerEmu::ControlGroup(OPTIONS_GROUP)); diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/Classic.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/Classic.cpp index cb0fe4b6c9..d3bdff9faa 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/Classic.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/Classic.cpp @@ -53,14 +53,16 @@ constexpr std::array classic_dpad_bitmasks{{ Classic::Classic() : Extension1stParty("Classic", _trans("Classic Controller")) { + using Translatability = ControllerEmu::Translatability; + // buttons groups.emplace_back(m_buttons = new ControllerEmu::Buttons(BUTTONS_GROUP)); for (auto& button_name : {A_BUTTON, B_BUTTON, X_BUTTON, Y_BUTTON, ZL_BUTTON, ZR_BUTTON, MINUS_BUTTON, PLUS_BUTTON}) { - m_buttons->AddInput(ControllerEmu::DoNotTranslate, button_name); + m_buttons->AddInput(Translatability::DoNotTranslate, button_name); } - m_buttons->AddInput(ControllerEmu::DoNotTranslate, HOME_BUTTON, "HOME"); + m_buttons->AddInput(Translatability::DoNotTranslate, HOME_BUTTON, "HOME"); // sticks constexpr auto gate_radius = ControlState(STICK_GATE_RADIUS) / CAL_STICK_RADIUS; @@ -73,14 +75,14 @@ Classic::Classic() : Extension1stParty("Classic", _trans("Classic Controller")) groups.emplace_back(m_triggers = new ControllerEmu::MixedTriggers(TRIGGERS_GROUP)); for (const char* trigger_name : {L_DIGITAL, R_DIGITAL, L_ANALOG, R_ANALOG}) { - m_triggers->AddInput(ControllerEmu::Translate, trigger_name); + m_triggers->AddInput(Translatability::Translate, trigger_name); } // dpad groups.emplace_back(m_dpad = new ControllerEmu::Buttons(DPAD_GROUP)); for (const char* named_direction : named_directions) { - m_dpad->AddInput(ControllerEmu::Translate, named_direction); + m_dpad->AddInput(Translatability::Translate, named_direction); } } diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/DrawsomeTablet.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/DrawsomeTablet.cpp index dbca6a27fc..b6367e1aa7 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/DrawsomeTablet.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/DrawsomeTablet.cpp @@ -30,8 +30,9 @@ DrawsomeTablet::DrawsomeTablet() : Extension3rdParty("Drawsome", _trans("Drawsom // Touch groups.emplace_back(m_touch = new ControllerEmu::Triggers(_trans("Touch"))); - m_touch->AddInput(ControllerEmu::Translate, _trans("Pressure")); - m_touch->AddInput(ControllerEmu::Translate, _trans("Lift")); + using Translatability = ControllerEmu::Translatability; + m_touch->AddInput(Translatability::Translate, _trans("Pressure")); + m_touch->AddInput(Translatability::Translate, _trans("Lift")); } void DrawsomeTablet::BuildDesiredExtensionState(DesiredExtensionState* target_state) diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.cpp index ef3f27460d..24ceda4029 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.cpp @@ -55,11 +55,13 @@ constexpr std::array drum_button_bitmasks{{ Drums::Drums() : Extension1stParty("Drums", _trans("Drum Kit")) { + using Translatability = ControllerEmu::Translatability; + // Pads. groups.emplace_back(m_pads = new ControllerEmu::Buttons(_trans("Pads"))); for (auto& drum_pad_name : drum_pad_names) { - m_pads->AddInput(ControllerEmu::Translate, drum_pad_name); + m_pads->AddInput(Translatability::Translate, drum_pad_name); } m_pads->AddSetting(&m_hit_strength_setting, @@ -71,8 +73,8 @@ Drums::Drums() : Extension1stParty("Drums", _trans("Drum Kit")) // Buttons. groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons"))); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "-"); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "+"); + m_buttons->AddInput(Translatability::DoNotTranslate, "-"); + m_buttons->AddInput(Translatability::DoNotTranslate, "+"); // Stick. groups.emplace_back(m_stick = diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/Guitar.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/Guitar.cpp index bf90901203..ebcd9b63f6 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/Guitar.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/Guitar.cpp @@ -65,22 +65,24 @@ constexpr std::array guitar_strum_bitmasks{{ Guitar::Guitar() : Extension1stParty(_trans("Guitar")) { + using Translatability = ControllerEmu::Translatability; + // frets groups.emplace_back(m_frets = new ControllerEmu::Buttons(_trans("Frets"))); for (auto& guitar_fret_name : guitar_fret_names) { - m_frets->AddInput(ControllerEmu::Translate, guitar_fret_name); + m_frets->AddInput(Translatability::Translate, guitar_fret_name); } // strum groups.emplace_back(m_strum = new ControllerEmu::Buttons(_trans("Strum"))); - m_strum->AddInput(ControllerEmu::Translate, _trans("Up")); - m_strum->AddInput(ControllerEmu::Translate, _trans("Down")); + m_strum->AddInput(Translatability::Translate, _trans("Up")); + m_strum->AddInput(Translatability::Translate, _trans("Down")); // buttons groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons"))); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "-"); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "+"); + m_buttons->AddInput(Translatability::DoNotTranslate, "-"); + m_buttons->AddInput(Translatability::DoNotTranslate, "+"); // stick constexpr auto gate_radius = ControlState(STICK_GATE_RADIUS) / STICK_RADIUS; @@ -89,7 +91,7 @@ Guitar::Guitar() : Extension1stParty(_trans("Guitar")) // whammy groups.emplace_back(m_whammy = new ControllerEmu::Triggers(_trans("Whammy"))); - m_whammy->AddInput(ControllerEmu::Translate, _trans("Bar")); + m_whammy->AddInput(Translatability::Translate, _trans("Bar")); // slider bar groups.emplace_back(m_slider_bar = new ControllerEmu::Slider(_trans("Slider Bar"))); diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/Nunchuk.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/Nunchuk.cpp index 361f4459f5..14ba12b01f 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/Nunchuk.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/Nunchuk.cpp @@ -38,8 +38,9 @@ Nunchuk::Nunchuk() : Extension1stParty(_trans("Nunchuk")) { // buttons groups.emplace_back(m_buttons = new ControllerEmu::Buttons(BUTTONS_GROUP)); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, C_BUTTON); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, Z_BUTTON); + using Translatability = ControllerEmu::Translatability; + m_buttons->AddInput(Translatability::DoNotTranslate, C_BUTTON); + m_buttons->AddInput(Translatability::DoNotTranslate, Z_BUTTON); // stick constexpr auto gate_radius = ControlState(STICK_GATE_RADIUS) / STICK_RADIUS; diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/Shinkansen.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/Shinkansen.cpp index 9ae99e81ff..5da6cdd31c 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/Shinkansen.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/Shinkansen.cpp @@ -22,6 +22,8 @@ constexpr std::array shinkansen_id{{0x00, 0x00, 0xa4, 0x20, 0x01, 0x10}}; Shinkansen::Shinkansen() : Extension3rdParty("Shinkansen", _trans("Shinkansen Controller")) { + using Translatability = ControllerEmu::Translatability; + // Button layout on the controller: // // Up Select Start D @@ -29,28 +31,28 @@ Shinkansen::Shinkansen() : Extension3rdParty("Shinkansen", _trans("Shinkansen Co // Down B // groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons"))); - m_buttons->AddInput(ControllerEmu::Translate, _trans("Up")); - m_buttons->AddInput(ControllerEmu::Translate, _trans("Down")); - m_buttons->AddInput(ControllerEmu::Translate, _trans("Left")); - m_buttons->AddInput(ControllerEmu::Translate, _trans("Right")); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "A"); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "B"); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "C"); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "D"); - m_buttons->AddInput(ControllerEmu::Translate, _trans("SELECT")); - m_buttons->AddInput(ControllerEmu::Translate, _trans("START")); + m_buttons->AddInput(Translatability::Translate, _trans("Up")); + m_buttons->AddInput(Translatability::Translate, _trans("Down")); + m_buttons->AddInput(Translatability::Translate, _trans("Left")); + m_buttons->AddInput(Translatability::Translate, _trans("Right")); + m_buttons->AddInput(Translatability::DoNotTranslate, "A"); + m_buttons->AddInput(Translatability::DoNotTranslate, "B"); + m_buttons->AddInput(Translatability::DoNotTranslate, "C"); + m_buttons->AddInput(Translatability::DoNotTranslate, "D"); + m_buttons->AddInput(Translatability::Translate, _trans("SELECT")); + m_buttons->AddInput(Translatability::Translate, _trans("START")); // For easier axis mapping the right lever is inverted in Dolphin, // so that the train coasts when no trigger is squeezed. groups.emplace_back(m_levers = new ControllerEmu::Triggers(_trans("Levers"))); - m_levers->AddInput(ControllerEmu::Translate, _trans("L")); - m_levers->AddInput(ControllerEmu::Translate, _trans("R")); + m_levers->AddInput(Translatability::Translate, _trans("L")); + m_levers->AddInput(Translatability::Translate, _trans("R")); // i18n: Noun. This is used as a label for a control group that represents lights on controllers. groups.emplace_back(m_led = new ControllerEmu::ControlGroup(_trans("Light"))); // i18n: A light on the Shinkansen controller that lights up when the train doors are locked. // Labeled ζˆΈγ˜γ‚ (in Japanese) on the actual controller. - m_led->AddOutput(ControllerEmu::Translate, _trans("Doors Locked")); + m_led->AddOutput(Translatability::Translate, _trans("Doors Locked")); } void Shinkansen::BuildDesiredExtensionState(DesiredExtensionState* target_state) diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.cpp index f81825a0ff..4405e03e5d 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.cpp @@ -39,15 +39,17 @@ constexpr std::array position_names{{ // i18n: The drum controller used in "Taiko no Tatsujin" games. Also known as a "TaTaCon". TaTaCon::TaTaCon() : Extension3rdParty("TaTaCon", _trans("Taiko Drum")) { + using Translatability = ControllerEmu::Translatability; + // i18n: Refers to the "center" of a TaTaCon drum. groups.emplace_back(m_center = new ControllerEmu::Buttons(_trans("Center"))); for (auto& name : position_names) - m_center->AddInput(ControllerEmu::Translate, name); + m_center->AddInput(Translatability::Translate, name); // i18n: Refers to the "rim" of a TaTaCon drum. groups.emplace_back(m_rim = new ControllerEmu::Buttons(_trans("Rim"))); for (auto& name : position_names) - m_rim->AddInput(ControllerEmu::Translate, name); + m_rim->AddInput(Translatability::Translate, name); } void TaTaCon::BuildDesiredExtensionState(DesiredExtensionState* target_state) diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/Turntable.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/Turntable.cpp index 7d3a06469d..09fb36563a 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/Turntable.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/Turntable.cpp @@ -48,18 +48,20 @@ constexpr std::array turntable_button_names{{ Turntable::Turntable() : Extension1stParty("Turntable", _trans("DJ Turntable")) { + using Translatability = ControllerEmu::Translatability; + // buttons groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons"))); for (auto& turntable_button_name : turntable_button_names) { - m_buttons->AddInput(ControllerEmu::Translate, turntable_button_name); + m_buttons->AddInput(Translatability::Translate, turntable_button_name); } - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "-"); - m_buttons->AddInput(ControllerEmu::DoNotTranslate, "+"); + m_buttons->AddInput(Translatability::DoNotTranslate, "-"); + m_buttons->AddInput(Translatability::DoNotTranslate, "+"); // i18n: This button name refers to a gameplay element in DJ Hero - m_buttons->AddInput(ControllerEmu::Translate, _trans("Euphoria")); + m_buttons->AddInput(Translatability::Translate, _trans("Euphoria")); // turntables // i18n: "Table" refers to a turntable diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/UDrawTablet.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/UDrawTablet.cpp index 5531030277..49ecd04180 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Extension/UDrawTablet.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Extension/UDrawTablet.cpp @@ -34,11 +34,13 @@ constexpr std::array udraw_tablet_button_names{{ UDrawTablet::UDrawTablet() : Extension3rdParty("uDraw", _trans("uDraw GameTablet")) { + using Translatability = ControllerEmu::Translatability; + // Buttons groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons"))); for (auto& button_name : udraw_tablet_button_names) { - m_buttons->AddInput(ControllerEmu::Translate, button_name); + m_buttons->AddInput(Translatability::Translate, button_name); } // Stylus @@ -47,8 +49,8 @@ UDrawTablet::UDrawTablet() : Extension3rdParty("uDraw", _trans("uDraw GameTablet // Touch groups.emplace_back(m_touch = new ControllerEmu::Triggers(_trans("Touch"))); - m_touch->AddInput(ControllerEmu::Translate, _trans("Pressure")); - m_touch->AddInput(ControllerEmu::Translate, _trans("Lift")); + m_touch->AddInput(Translatability::Translate, _trans("Pressure")); + m_touch->AddInput(Translatability::Translate, _trans("Lift")); } void UDrawTablet::BuildDesiredExtensionState(DesiredExtensionState* target_state) diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index 8a087e2098..3a63bd5781 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -206,19 +206,21 @@ void Wiimote::Reset() Wiimote::Wiimote(const unsigned int index) : m_index(index), m_bt_device_index(index) { + using Translatability = ControllerEmu::Translatability; + // Buttons groups.emplace_back(m_buttons = new ControllerEmu::Buttons(BUTTONS_GROUP)); for (auto& named_button : {A_BUTTON, B_BUTTON, ONE_BUTTON, TWO_BUTTON, MINUS_BUTTON, PLUS_BUTTON}) { - m_buttons->AddInput(ControllerEmu::DoNotTranslate, named_button); + m_buttons->AddInput(Translatability::DoNotTranslate, named_button); } - m_buttons->AddInput(ControllerEmu::DoNotTranslate, HOME_BUTTON, "HOME"); + m_buttons->AddInput(Translatability::DoNotTranslate, HOME_BUTTON, "HOME"); // 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); + m_dpad->AddInput(Translatability::Translate, named_direction); } // i18n: "Point" refers to the action of pointing a Wii Remote. @@ -279,7 +281,7 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index), m_bt_device_index(i // Rumble groups.emplace_back(m_rumble = new ControllerEmu::ControlGroup(_trans("Rumble"))); - m_rumble->AddOutput(ControllerEmu::Translate, _trans("Motor")); + m_rumble->AddOutput(Translatability::Translate, _trans("Motor")); // Options groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options"))); diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index fee883fd0f..adb6a2ea49 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -369,7 +369,7 @@ HotkeyManager::HotkeyManager() groups.emplace_back(m_hotkey_groups[group]); for (int key = s_groups_info[group].first; key <= s_groups_info[group].last; key++) { - m_keys[group]->AddInput(ControllerEmu::Translate, s_hotkey_labels[key]); + m_keys[group]->AddInput(ControllerEmu::Translatability::Translate, s_hotkey_labels[key]); } } } diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp index a7ea873e41..02d8c852b7 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp @@ -281,7 +281,7 @@ void MappingWidget::CreateControl(const ControllerEmu::Control* control, QFormLa button->setMinimumWidth(100); button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - const bool translate = control->translate == ControllerEmu::Translate; + const bool translate = control->translate == ControllerEmu::Translatability::Translate; const QString translated_name = translate ? tr(control->ui_name.c_str()) : QString::fromStdString(control->ui_name); layout->addRow(translated_name, button); diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Control.h b/Source/Core/InputCommon/ControllerEmu/Control/Control.h index 2dd17a9062..e61b0df04e 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Control.h +++ b/Source/Core/InputCommon/ControllerEmu/Control/Control.h @@ -10,7 +10,7 @@ namespace ControllerEmu { -enum Translatability +enum class Translatability { DoNotTranslate, Translate diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp index 0f30b50f63..c26f143f1c 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp @@ -27,9 +27,9 @@ AnalogStick::AnalogStick(const char* const name_, const char* const ui_name_, : ReshapableInput(name_, ui_name_, GroupType::Stick), m_stick_gate(std::move(stick_gate)) { for (auto& named_direction : named_directions) - AddInput(Translate, named_direction); + AddInput(Translatability::Translate, named_direction); - AddInput(Translate, _trans("Modifier")); + AddInput(Translatability::Translate, _trans("Modifier")); } AnalogStick::ReshapeData AnalogStick::GetReshapableState(bool adjusted) const diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp index 7359a4e66d..98784c00ae 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp @@ -25,12 +25,12 @@ Cursor::Cursor(std::string name_, std::string ui_name_) m_last_update(Clock::now()) { for (auto& named_direction : named_directions) - AddInput(Translate, named_direction); + AddInput(Translatability::Translate, named_direction); - AddInput(Translate, _trans("Hide")); - AddInput(Translate, _trans("Recenter")); + AddInput(Translatability::Translate, _trans("Hide")); + AddInput(Translatability::Translate, _trans("Recenter")); - AddInput(Translate, _trans("Relative Input Hold")); + AddInput(Translatability::Translate, _trans("Relative Input Hold")); // Default values chosen to reach screen edges in most games including the Wii Menu. diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp index fd6d99b93f..8ff82e2b33 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp @@ -17,12 +17,12 @@ namespace ControllerEmu { Force::Force(const std::string& name_) : ReshapableInput(name_, name_, GroupType::Force) { - AddInput(Translate, _trans("Up")); - AddInput(Translate, _trans("Down")); - AddInput(Translate, _trans("Left")); - AddInput(Translate, _trans("Right")); - AddInput(Translate, _trans("Forward")); - AddInput(Translate, _trans("Backward")); + AddInput(Translatability::Translate, _trans("Up")); + AddInput(Translatability::Translate, _trans("Down")); + AddInput(Translatability::Translate, _trans("Left")); + AddInput(Translatability::Translate, _trans("Right")); + AddInput(Translatability::Translate, _trans("Forward")); + AddInput(Translatability::Translate, _trans("Backward")); AddSetting(&m_distance_setting, {_trans("Distance"), @@ -126,11 +126,11 @@ Shake::Shake(const std::string& name_, ControlState default_intensity_scale) : ControlGroup(name_, name_, GroupType::Shake) { // i18n: Refers to a 3D axis (used when mapping motion controls) - AddInput(ControllerEmu::Translate, _trans("X")); + AddInput(Translatability::Translate, _trans("X")); // i18n: Refers to a 3D axis (used when mapping motion controls) - AddInput(ControllerEmu::Translate, _trans("Y")); + AddInput(Translatability::Translate, _trans("Y")); // i18n: Refers to a 3D axis (used when mapping motion controls) - AddInput(ControllerEmu::Translate, _trans("Z")); + AddInput(Translatability::Translate, _trans("Z")); AddDeadzoneSetting(&m_deadzone_setting, 50); diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp index b9f6b6dca0..dfd282d533 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp @@ -15,12 +15,12 @@ namespace ControllerEmu IMUAccelerometer::IMUAccelerometer(std::string name_, std::string ui_name_) : ControlGroup(std::move(name_), std::move(ui_name_), GroupType::IMUAccelerometer) { - AddInput(Translate, _trans("Up")); - AddInput(Translate, _trans("Down")); - AddInput(Translate, _trans("Left")); - AddInput(Translate, _trans("Right")); - AddInput(Translate, _trans("Forward")); - AddInput(Translate, _trans("Backward")); + AddInput(Translatability::Translate, _trans("Up")); + AddInput(Translatability::Translate, _trans("Down")); + AddInput(Translatability::Translate, _trans("Left")); + AddInput(Translatability::Translate, _trans("Right")); + AddInput(Translatability::Translate, _trans("Forward")); + AddInput(Translatability::Translate, _trans("Backward")); } bool IMUAccelerometer::AreInputsBound() const diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUCursor.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUCursor.cpp index d7ff228a19..713ad59cc5 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUCursor.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUCursor.cpp @@ -26,7 +26,7 @@ IMUCursor::IMUCursor(std::string name_, std::string ui_name_) ControlGroup::DefaultValue::Enabled) #endif { - AddInput(Translate, _trans("Recenter")); + AddInput(Translatability::Translate, _trans("Recenter")); // Default values chosen to reach screen edges in most games including the Wii Menu. diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp index dd5ca110d9..2e8c4bb18c 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp @@ -26,12 +26,12 @@ static constexpr auto WORST_ACCEPTABLE_CALIBRATION_UPDATE_FREQUENCY = 25; IMUGyroscope::IMUGyroscope(std::string name_, std::string ui_name_) : ControlGroup(std::move(name_), std::move(ui_name_), GroupType::IMUGyroscope) { - AddInput(Translate, _trans("Pitch Up")); - AddInput(Translate, _trans("Pitch Down")); - AddInput(Translate, _trans("Roll Left")); - AddInput(Translate, _trans("Roll Right")); - AddInput(Translate, _trans("Yaw Left")); - AddInput(Translate, _trans("Yaw Right")); + AddInput(Translatability::Translate, _trans("Pitch Up")); + AddInput(Translatability::Translate, _trans("Pitch Down")); + AddInput(Translatability::Translate, _trans("Roll Left")); + AddInput(Translatability::Translate, _trans("Roll Right")); + AddInput(Translatability::Translate, _trans("Yaw Left")); + AddInput(Translatability::Translate, _trans("Yaw Right")); AddSetting(&m_deadzone_setting, {_trans("Dead Zone"), diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp index 13d8edf216..570c5451fc 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp @@ -24,7 +24,7 @@ ModifySettingsButton::ModifySettingsButton(std::string button_name) void ModifySettingsButton::AddInput(std::string button_name, bool toggle) { - ControlGroup::AddInput(Translate, std::move(button_name)); + ControlGroup::AddInput(Translatability::Translate, std::move(button_name)); m_threshold_exceeded.emplace_back(false); m_associated_settings.emplace_back(false); m_associated_settings_toggle.emplace_back(toggle); diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp index 708831a4c3..c764b0214b 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp @@ -18,8 +18,8 @@ namespace ControllerEmu Slider::Slider(const std::string& name_, const std::string& ui_name_) : ControlGroup(name_, ui_name_, GroupType::Slider) { - AddInput(Translate, _trans("Left")); - AddInput(Translate, _trans("Right")); + AddInput(Translatability::Translate, _trans("Left")); + AddInput(Translatability::Translate, _trans("Right")); AddDeadzoneSetting(&m_deadzone_setting, 50); } diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp index 69a3038b42..a59ffb0eb9 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp @@ -17,12 +17,12 @@ namespace ControllerEmu { Tilt::Tilt(const std::string& name_) : ReshapableInput(name_, name_, GroupType::Tilt) { - AddInput(Translate, _trans("Forward")); - AddInput(Translate, _trans("Backward")); - AddInput(Translate, _trans("Left")); - AddInput(Translate, _trans("Right")); + AddInput(Translatability::Translate, _trans("Forward")); + AddInput(Translatability::Translate, _trans("Backward")); + AddInput(Translatability::Translate, _trans("Left")); + AddInput(Translatability::Translate, _trans("Right")); - AddInput(Translate, _trans("Modifier")); + AddInput(Translatability::Translate, _trans("Modifier")); AddSetting(&m_max_angle_setting, {_trans("Angle"),