clang-format; address one comment
This commit is contained in:
parent
860860397b
commit
8e614c3eb0
11 changed files with 75 additions and 91 deletions
|
@ -59,13 +59,17 @@ DirectionState GetStickDirectionState(s16 circle_pad_x, s16 circle_pad_y) {
|
|||
}
|
||||
|
||||
void Module::LoadInputDevices() {
|
||||
std::transform(Settings::values.buttons.begin() + Settings::NativeButton::BUTTON_HID_BEGIN,
|
||||
Settings::values.buttons.begin() + Settings::NativeButton::BUTTON_HID_END,
|
||||
std::transform(Settings::values.current_input_profile.buttons.begin() +
|
||||
Settings::NativeButton::BUTTON_HID_BEGIN,
|
||||
Settings::values.current_input_profile.buttons.begin() +
|
||||
Settings::NativeButton::BUTTON_HID_END,
|
||||
buttons.begin(), Input::CreateDevice<Input::ButtonDevice>);
|
||||
circle_pad = Input::CreateDevice<Input::AnalogDevice>(
|
||||
Settings::values.analogs[Settings::NativeAnalog::CirclePad]);
|
||||
motion_device = Input::CreateDevice<Input::MotionDevice>(Settings::values.motion_device);
|
||||
touch_device = Input::CreateDevice<Input::TouchDevice>(Settings::values.touch_device);
|
||||
Settings::values.current_input_profile.analogs[Settings::NativeAnalog::CirclePad]);
|
||||
motion_device = Input::CreateDevice<Input::MotionDevice>(
|
||||
Settings::values.current_input_profile.motion_device);
|
||||
touch_device = Input::CreateDevice<Input::TouchDevice>(
|
||||
Settings::values.current_input_profile.touch_device);
|
||||
}
|
||||
|
||||
void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) {
|
||||
|
|
|
@ -263,11 +263,11 @@ void ExtraHID::RequestInputDevicesReload() {
|
|||
|
||||
void ExtraHID::LoadInputDevices() {
|
||||
zl = Input::CreateDevice<Input::ButtonDevice>(
|
||||
Settings::values.buttons[Settings::NativeButton::ZL]);
|
||||
Settings::values.current_input_profile.buttons[Settings::NativeButton::ZL]);
|
||||
zr = Input::CreateDevice<Input::ButtonDevice>(
|
||||
Settings::values.buttons[Settings::NativeButton::ZR]);
|
||||
Settings::values.current_input_profile.buttons[Settings::NativeButton::ZR]);
|
||||
c_stick = Input::CreateDevice<Input::AnalogDevice>(
|
||||
Settings::values.analogs[Settings::NativeAnalog::CStick]);
|
||||
Settings::values.current_input_profile.analogs[Settings::NativeAnalog::CStick]);
|
||||
}
|
||||
|
||||
} // namespace Service::IR
|
||||
|
|
|
@ -35,11 +35,11 @@ static_assert(sizeof(SharedMem) == 0x98, "SharedMem has wrong size!");
|
|||
|
||||
void IR_RST::LoadInputDevices() {
|
||||
zl_button = Input::CreateDevice<Input::ButtonDevice>(
|
||||
Settings::values.buttons[Settings::NativeButton::ZL]);
|
||||
Settings::values.current_input_profile.buttons[Settings::NativeButton::ZL]);
|
||||
zr_button = Input::CreateDevice<Input::ButtonDevice>(
|
||||
Settings::values.buttons[Settings::NativeButton::ZR]);
|
||||
Settings::values.current_input_profile.buttons[Settings::NativeButton::ZR]);
|
||||
c_stick = Input::CreateDevice<Input::AnalogDevice>(
|
||||
Settings::values.analogs[Settings::NativeAnalog::CStick]);
|
||||
Settings::values.current_input_profile.analogs[Settings::NativeAnalog::CStick]);
|
||||
}
|
||||
|
||||
void IR_RST::UnloadInputDevices() {
|
||||
|
|
|
@ -101,41 +101,20 @@ void LogSettings() {
|
|||
}
|
||||
|
||||
void LoadProfile(int index) {
|
||||
const auto& profile = values.input_profiles[index];
|
||||
values.current_input_profile = index;
|
||||
values.analogs = profile.analogs;
|
||||
values.buttons = profile.buttons;
|
||||
values.motion_device = profile.motion_device;
|
||||
values.touch_device = profile.touch_device;
|
||||
values.udp_input_address = profile.udp_input_address;
|
||||
values.udp_input_port = profile.udp_input_port;
|
||||
values.udp_pad_index = profile.udp_pad_index;
|
||||
values.current_input_profile = values.input_profiles[index];
|
||||
values.current_input_profile_index = index;
|
||||
}
|
||||
|
||||
void SaveProfile(int index) {
|
||||
auto& profile = values.input_profiles[index];
|
||||
profile.analogs = values.analogs;
|
||||
profile.buttons = values.buttons;
|
||||
profile.motion_device = values.motion_device;
|
||||
profile.touch_device = values.touch_device;
|
||||
profile.udp_input_address = values.udp_input_address;
|
||||
profile.udp_input_port = values.udp_input_port;
|
||||
profile.udp_pad_index = values.udp_pad_index;
|
||||
values.input_profiles[index] = values.current_input_profile;
|
||||
}
|
||||
|
||||
void CreateProfile(std::string name) {
|
||||
InputProfile profile;
|
||||
InputProfile profile = values.current_input_profile;
|
||||
profile.name = std::move(name);
|
||||
profile.analogs = values.analogs;
|
||||
profile.buttons = values.buttons;
|
||||
profile.motion_device = values.motion_device;
|
||||
profile.touch_device = values.touch_device;
|
||||
profile.udp_input_address = values.udp_input_address;
|
||||
profile.udp_input_port = values.udp_input_port;
|
||||
profile.udp_pad_index = values.udp_pad_index;
|
||||
values.input_profiles.push_back(std::move(profile));
|
||||
values.current_input_profile = static_cast<int>(values.input_profiles.size()) - 1;
|
||||
LoadProfile(values.current_input_profile);
|
||||
values.current_input_profile_index = static_cast<int>(values.input_profiles.size()) - 1;
|
||||
LoadProfile(values.current_input_profile_index);
|
||||
}
|
||||
|
||||
void DeleteProfile(int index) {
|
||||
|
@ -144,7 +123,7 @@ void DeleteProfile(int index) {
|
|||
}
|
||||
|
||||
void RenameCurrentProfile(std::string new_name) {
|
||||
values.input_profiles[values.current_input_profile].name = std::move(new_name);
|
||||
values.input_profiles[values.current_input_profile_index].name = std::move(new_name);
|
||||
}
|
||||
|
||||
} // namespace Settings
|
||||
|
|
|
@ -108,16 +108,9 @@ struct Values {
|
|||
// CheckNew3DS
|
||||
bool is_new_3ds;
|
||||
|
||||
// Current controls
|
||||
std::array<std::string, NativeButton::NumButtons> buttons;
|
||||
std::array<std::string, NativeAnalog::NumAnalogs> analogs;
|
||||
std::string motion_device;
|
||||
std::string touch_device;
|
||||
std::string udp_input_address;
|
||||
u16 udp_input_port;
|
||||
u8 udp_pad_index;
|
||||
|
||||
int current_input_profile; ///< The current input profile index
|
||||
// Controls
|
||||
InputProfile current_input_profile; ///< The current input profile
|
||||
int current_input_profile_index; ///< The current input profile index
|
||||
std::vector<InputProfile> input_profiles; ///< The list of input profiles
|
||||
|
||||
// Core
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue