diff --git a/README.md b/README.md index 5e3bad48e..6577d312c 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2378. +This is the source code for early-access 2379. ## Legal Notice diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 6209c707e..13edb7332 100755 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -402,7 +402,8 @@ std::vector EmulatedController::GetMappedDevices( devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { return param.Get("engine", "") == param_.Get("engine", "") && param.Get("guid", "") == param_.Get("guid", "") && - param.Get("port", 0) == param_.Get("port", 0); + param.Get("port", 0) == param_.Get("port", 0) && + param.Get("pad", 0) == param_.Get("pad", 0); }); if (devices_it != devices.end()) { continue; @@ -411,6 +412,7 @@ std::vector EmulatedController::GetMappedDevices( device.Set("engine", param.Get("engine", "")); device.Set("guid", param.Get("guid", "")); device.Set("port", param.Get("port", 0)); + device.Set("pad", param.Get("pad", 0)); devices.push_back(device); } @@ -425,7 +427,8 @@ std::vector EmulatedController::GetMappedDevices( devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { return param.Get("engine", "") == param_.Get("engine", "") && param.Get("guid", "") == param_.Get("guid", "") && - param.Get("port", 0) == param_.Get("port", 0); + param.Get("port", 0) == param_.Get("port", 0) && + param.Get("pad", 0) == param_.Get("pad", 0); }); if (devices_it != devices.end()) { continue; @@ -434,6 +437,7 @@ std::vector EmulatedController::GetMappedDevices( device.Set("engine", param.Get("engine", "")); device.Set("guid", param.Get("guid", "")); device.Set("port", param.Get("port", 0)); + device.Set("pad", param.Get("pad", 0)); devices.push_back(device); } return devices; diff --git a/src/core/hid/motion_input.cpp b/src/core/hid/motion_input.cpp index a23f192d7..43152492e 100755 --- a/src/core/hid/motion_input.cpp +++ b/src/core/hid/motion_input.cpp @@ -10,6 +10,7 @@ namespace Core::HID { MotionInput::MotionInput() { // Initialize PID constants with default values SetPID(0.3f, 0.005f, 0.0f); + SetGyroThreshold(0.001f); } void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) { diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp index a1ce4525d..c8a12c7d5 100755 --- 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 } MotionMapping mapping = {}; - Common::ParamPackage motion_params; - motion_params.Set("engine", GetEngineName()); - motion_params.Set("guid", params.Get("guid", "")); - motion_params.Set("port", params.Get("port", 0)); - motion_params.Set("pad", params.Get("pad", 0)); - motion_params.Set("motion", 0); - mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, std::move(motion_params)); - mapping.insert_or_assign(Settings::NativeMotion::MotionRight, std::move(motion_params)); + Common::ParamPackage left_motion_params; + left_motion_params.Set("engine", GetEngineName()); + left_motion_params.Set("guid", params.Get("guid", "")); + left_motion_params.Set("port", params.Get("port", 0)); + left_motion_params.Set("pad", params.Get("pad", 0)); + left_motion_params.Set("motion", 0); + + Common::ParamPackage right_motion_params; + right_motion_params.Set("engine", GetEngineName()); + right_motion_params.Set("guid", params.Get("guid", "")); + right_motion_params.Set("port", params.Get("port", 0)); + right_motion_params.Set("pad", params.Get("pad", 0)); + right_motion_params.Set("motion", 0); + + mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, std::move(left_motion_params)); + mapping.insert_or_assign(Settings::NativeMotion::MotionRight, std::move(right_motion_params)); return mapping; } diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp index 9c17ca4f7..b57330e51 100755 --- a/src/input_common/input_engine.cpp +++ b/src/input_common/input_engine.cpp @@ -298,8 +298,16 @@ void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int mot if (!configuring || !mapping_callback.on_data) { return; } - if (std::abs(value.gyro_x) < 0.6f && std::abs(value.gyro_y) < 0.6f && - std::abs(value.gyro_z) < 0.6f) { + bool is_active = false; + if (std::abs(value.accel_x) > 1.5f || std::abs(value.accel_y) > 1.5f || + std::abs(value.accel_z) > 1.5f) { + is_active = true; + } + if (std::abs(value.gyro_x) > 0.6f || std::abs(value.gyro_y) > 0.6f || + std::abs(value.gyro_z) > 0.6f) { + is_active = true; + } + if (!is_active) { return; } mapping_callback.on_data(MappingData{ diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 8c6249fc2..b9342466e 100755 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -747,15 +747,16 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() { const auto first_engine = devices[0].Get("engine", ""); const auto first_guid = devices[0].Get("guid", ""); const auto first_port = devices[0].Get("port", 0); + const auto first_pad = devices[0].Get("pad", 0); if (devices.size() == 1) { - const auto devices_it = - std::find_if(input_devices.begin(), input_devices.end(), - [first_engine, first_guid, first_port](const Common::ParamPackage param) { - return param.Get("engine", "") == first_engine && - param.Get("guid", "") == first_guid && - param.Get("port", 0) == first_port; - }); + const auto devices_it = std::find_if( + input_devices.begin(), input_devices.end(), + [first_engine, first_guid, first_port, first_pad](const Common::ParamPackage param) { + return param.Get("engine", "") == first_engine && + param.Get("guid", "") == first_guid && param.Get("port", 0) == first_port && + param.Get("pad", 0) == first_pad; + }); const int device_index = devices_it != input_devices.end() ? static_cast(std::distance(input_devices.begin(), devices_it)) diff --git a/src/yuzu/hotkeys.cpp b/src/yuzu/hotkeys.cpp index 90381cd65..d96497c4e 100755 --- a/src/yuzu/hotkeys.cpp +++ b/src/yuzu/hotkeys.cpp @@ -206,7 +206,6 @@ void ControllerShortcut::ControllerUpdateEvent(Core::HID::ControllerTriggerType player_capture_buttons == button_sequence.capture.raw && player_home_buttons == button_sequence.home.raw && !active) { // Force user to press the home or capture button again - emulated_controller->ResetSystemButtons(); active = true; emit Activated(); return; diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e8314ba5f..e8a4ac918 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2825,6 +2825,11 @@ void GMainWindow::OnTasStartStop() { if (!emulation_running) { return; } + + // Disable system buttons to prevent TAS from executing a hotkey + auto* controller = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); + controller->ResetSystemButtons(); + input_subsystem->GetTas()->StartStop(); OnTasStateChanged(); } @@ -2836,6 +2841,11 @@ void GMainWindow::OnTasRecord() { if (is_tas_recording_dialog_active) { return; } + + // Disable system buttons to prevent TAS from recording a hotkey + auto* controller = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); + controller->ResetSystemButtons(); + const bool is_recording = input_subsystem->GetTas()->Record(); if (!is_recording) { is_tas_recording_dialog_active = true;