diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 8 | ||||
| -rw-r--r-- | src/input_common/drivers/tas_input.cpp | 31 | ||||
| -rw-r--r-- | src/input_common/drivers/udp_client.cpp | 24 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 15 |
4 files changed, 54 insertions, 24 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 71fc05807..52a56ef1a 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -389,7 +389,8 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices( | |||
| 389 | devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { | 389 | devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { |
| 390 | return param.Get("engine", "") == param_.Get("engine", "") && | 390 | return param.Get("engine", "") == param_.Get("engine", "") && |
| 391 | param.Get("guid", "") == param_.Get("guid", "") && | 391 | param.Get("guid", "") == param_.Get("guid", "") && |
| 392 | param.Get("port", 0) == param_.Get("port", 0); | 392 | param.Get("port", 0) == param_.Get("port", 0) && |
| 393 | param.Get("pad", 0) == param_.Get("pad", 0); | ||
| 393 | }); | 394 | }); |
| 394 | if (devices_it != devices.end()) { | 395 | if (devices_it != devices.end()) { |
| 395 | continue; | 396 | continue; |
| @@ -398,6 +399,7 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices( | |||
| 398 | device.Set("engine", param.Get("engine", "")); | 399 | device.Set("engine", param.Get("engine", "")); |
| 399 | device.Set("guid", param.Get("guid", "")); | 400 | device.Set("guid", param.Get("guid", "")); |
| 400 | device.Set("port", param.Get("port", 0)); | 401 | device.Set("port", param.Get("port", 0)); |
| 402 | device.Set("pad", param.Get("pad", 0)); | ||
| 401 | devices.push_back(device); | 403 | devices.push_back(device); |
| 402 | } | 404 | } |
| 403 | 405 | ||
| @@ -412,7 +414,8 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices( | |||
| 412 | devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { | 414 | devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { |
| 413 | return param.Get("engine", "") == param_.Get("engine", "") && | 415 | return param.Get("engine", "") == param_.Get("engine", "") && |
| 414 | param.Get("guid", "") == param_.Get("guid", "") && | 416 | param.Get("guid", "") == param_.Get("guid", "") && |
| 415 | param.Get("port", 0) == param_.Get("port", 0); | 417 | param.Get("port", 0) == param_.Get("port", 0) && |
| 418 | param.Get("pad", 0) == param_.Get("pad", 0); | ||
| 416 | }); | 419 | }); |
| 417 | if (devices_it != devices.end()) { | 420 | if (devices_it != devices.end()) { |
| 418 | continue; | 421 | continue; |
| @@ -421,6 +424,7 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices( | |||
| 421 | device.Set("engine", param.Get("engine", "")); | 424 | device.Set("engine", param.Get("engine", "")); |
| 422 | device.Set("guid", param.Get("guid", "")); | 425 | device.Set("guid", param.Get("guid", "")); |
| 423 | device.Set("port", param.Get("port", 0)); | 426 | device.Set("port", param.Get("port", 0)); |
| 427 | device.Set("pad", param.Get("pad", 0)); | ||
| 424 | devices.push_back(device); | 428 | devices.push_back(device); |
| 425 | } | 429 | } |
| 426 | return devices; | 430 | return devices; |
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp index 5bdd5dac3..d78228b50 100644 --- a/src/input_common/drivers/tas_input.cpp +++ b/src/input_common/drivers/tas_input.cpp | |||
| @@ -105,10 +105,16 @@ void Tas::LoadTasFile(size_t player_index, size_t file_index) { | |||
| 105 | continue; | 105 | continue; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | const auto num_frames = std::stoi(seg_list[0]); | 108 | try { |
| 109 | while (frame_no < num_frames) { | 109 | const auto num_frames = std::stoi(seg_list[0]); |
| 110 | commands[player_index].emplace_back(); | 110 | while (frame_no < num_frames) { |
| 111 | frame_no++; | 111 | commands[player_index].emplace_back(); |
| 112 | frame_no++; | ||
| 113 | } | ||
| 114 | } catch (const std::invalid_argument&) { | ||
| 115 | LOG_ERROR(Input, "Invalid argument: '{}' at command {}", seg_list[0], frame_no); | ||
| 116 | } catch (const std::out_of_range&) { | ||
| 117 | LOG_ERROR(Input, "Out of range: '{}' at command {}", seg_list[0], frame_no); | ||
| 112 | } | 118 | } |
| 113 | 119 | ||
| 114 | TASCommand command = { | 120 | TASCommand command = { |
| @@ -233,10 +239,21 @@ TasAnalog Tas::ReadCommandAxis(const std::string& line) const { | |||
| 233 | } | 239 | } |
| 234 | } | 240 | } |
| 235 | 241 | ||
| 236 | const float x = std::stof(seg_list.at(0)) / 32767.0f; | 242 | if (seg_list.size() < 2) { |
| 237 | const float y = std::stof(seg_list.at(1)) / 32767.0f; | 243 | LOG_ERROR(Input, "Invalid axis data: '{}'", line); |
| 244 | return {}; | ||
| 245 | } | ||
| 238 | 246 | ||
| 239 | return {x, y}; | 247 | try { |
| 248 | const float x = std::stof(seg_list.at(0)) / 32767.0f; | ||
| 249 | const float y = std::stof(seg_list.at(1)) / 32767.0f; | ||
| 250 | return {x, y}; | ||
| 251 | } catch (const std::invalid_argument&) { | ||
| 252 | LOG_ERROR(Input, "Invalid argument: '{}'", line); | ||
| 253 | } catch (const std::out_of_range&) { | ||
| 254 | LOG_ERROR(Input, "Out of range: '{}'", line); | ||
| 255 | } | ||
| 256 | return {}; | ||
| 240 | } | 257 | } |
| 241 | 258 | ||
| 242 | u64 Tas::ReadCommandButtons(const std::string& line) const { | 259 | u64 Tas::ReadCommandButtons(const std::string& line) const { |
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp index a1ce4525d..c8a12c7d5 100644 --- a/src/input_common/drivers/udp_client.cpp +++ b/src/input_common/drivers/udp_client.cpp | |||
| @@ -442,14 +442,22 @@ MotionMapping UDPClient::GetMotionMappingForDevice(const Common::ParamPackage& p | |||
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | MotionMapping mapping = {}; | 444 | MotionMapping mapping = {}; |
| 445 | Common::ParamPackage motion_params; | 445 | Common::ParamPackage left_motion_params; |
| 446 | motion_params.Set("engine", GetEngineName()); | 446 | left_motion_params.Set("engine", GetEngineName()); |
| 447 | motion_params.Set("guid", params.Get("guid", "")); | 447 | left_motion_params.Set("guid", params.Get("guid", "")); |
| 448 | motion_params.Set("port", params.Get("port", 0)); | 448 | left_motion_params.Set("port", params.Get("port", 0)); |
| 449 | motion_params.Set("pad", params.Get("pad", 0)); | 449 | left_motion_params.Set("pad", params.Get("pad", 0)); |
| 450 | motion_params.Set("motion", 0); | 450 | left_motion_params.Set("motion", 0); |
| 451 | mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, std::move(motion_params)); | 451 | |
| 452 | mapping.insert_or_assign(Settings::NativeMotion::MotionRight, std::move(motion_params)); | 452 | Common::ParamPackage right_motion_params; |
| 453 | right_motion_params.Set("engine", GetEngineName()); | ||
| 454 | right_motion_params.Set("guid", params.Get("guid", "")); | ||
| 455 | right_motion_params.Set("port", params.Get("port", 0)); | ||
| 456 | right_motion_params.Set("pad", params.Get("pad", 0)); | ||
| 457 | right_motion_params.Set("motion", 0); | ||
| 458 | |||
| 459 | mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, std::move(left_motion_params)); | ||
| 460 | mapping.insert_or_assign(Settings::NativeMotion::MotionRight, std::move(right_motion_params)); | ||
| 453 | return mapping; | 461 | return mapping; |
| 454 | } | 462 | } |
| 455 | 463 | ||
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 8c6249fc2..b9342466e 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -747,15 +747,16 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() { | |||
| 747 | const auto first_engine = devices[0].Get("engine", ""); | 747 | const auto first_engine = devices[0].Get("engine", ""); |
| 748 | const auto first_guid = devices[0].Get("guid", ""); | 748 | const auto first_guid = devices[0].Get("guid", ""); |
| 749 | const auto first_port = devices[0].Get("port", 0); | 749 | const auto first_port = devices[0].Get("port", 0); |
| 750 | const auto first_pad = devices[0].Get("pad", 0); | ||
| 750 | 751 | ||
| 751 | if (devices.size() == 1) { | 752 | if (devices.size() == 1) { |
| 752 | const auto devices_it = | 753 | const auto devices_it = std::find_if( |
| 753 | std::find_if(input_devices.begin(), input_devices.end(), | 754 | input_devices.begin(), input_devices.end(), |
| 754 | [first_engine, first_guid, first_port](const Common::ParamPackage param) { | 755 | [first_engine, first_guid, first_port, first_pad](const Common::ParamPackage param) { |
| 755 | return param.Get("engine", "") == first_engine && | 756 | return param.Get("engine", "") == first_engine && |
| 756 | param.Get("guid", "") == first_guid && | 757 | param.Get("guid", "") == first_guid && param.Get("port", 0) == first_port && |
| 757 | param.Get("port", 0) == first_port; | 758 | param.Get("pad", 0) == first_pad; |
| 758 | }); | 759 | }); |
| 759 | const int device_index = | 760 | const int device_index = |
| 760 | devices_it != input_devices.end() | 761 | devices_it != input_devices.end() |
| 761 | ? static_cast<int>(std::distance(input_devices.begin(), devices_it)) | 762 | ? static_cast<int>(std::distance(input_devices.begin(), devices_it)) |