summaryrefslogtreecommitdiffstats
path: root/src/input_common
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/input_common/drivers/mouse.cpp17
-rw-r--r--src/input_common/drivers/mouse.h1
-rw-r--r--src/input_common/input_engine.cpp2
-rw-r--r--src/input_common/main.cpp3
4 files changed, 22 insertions, 1 deletions
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp
index 2c2432fb7..1c32b54be 100644
--- a/src/input_common/drivers/mouse.cpp
+++ b/src/input_common/drivers/mouse.cpp
@@ -121,12 +121,27 @@ void Mouse::StopPanning() {
std::vector<Common::ParamPackage> Mouse::GetInputDevices() const {
std::vector<Common::ParamPackage> devices;
devices.emplace_back(Common::ParamPackage{
- {"engine", "keyboard"},
+ {"engine", GetEngineName()},
{"display", "Keyboard/Mouse"},
});
return devices;
}
+AnalogMapping Mouse::GetAnalogMappingForDevice(
+ [[maybe_unused]] const Common::ParamPackage& params) {
+ // Only overwrite different buttons from default
+ AnalogMapping mapping = {};
+ Common::ParamPackage right_analog_params;
+ right_analog_params.Set("engine", GetEngineName());
+ right_analog_params.Set("axis_x", 0);
+ right_analog_params.Set("axis_y", 1);
+ right_analog_params.Set("threshold", 0.5f);
+ right_analog_params.Set("range", 1.0f);
+ right_analog_params.Set("deadzone", 0.0f);
+ mapping.insert_or_assign(Settings::NativeAnalog::RStick, std::move(right_analog_params));
+ return mapping;
+}
+
std::string Mouse::GetUIName(const Common::ParamPackage& params) const {
if (params.Has("button")) {
return fmt::format("Mouse {}", params.Get("button", 0));
diff --git a/src/input_common/drivers/mouse.h b/src/input_common/drivers/mouse.h
index e8355751a..d3178b1a9 100644
--- a/src/input_common/drivers/mouse.h
+++ b/src/input_common/drivers/mouse.h
@@ -55,6 +55,7 @@ public:
void ReleaseAllButtons();
std::vector<Common::ParamPackage> GetInputDevices() const override;
+ AnalogMapping GetAnalogMappingForDevice(const Common::ParamPackage& params) override;
std::string GetUIName(const Common::ParamPackage& params) const override;
private:
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp
index 1534f24b0..9cfe0f232 100644
--- a/src/input_common/input_engine.cpp
+++ b/src/input_common/input_engine.cpp
@@ -202,6 +202,8 @@ void InputEngine::TriggerOnButtonChange(const PadIdentifier& identifier, int but
if (!configuring || !mapping_callback.on_data) {
return;
}
+
+ PreSetButton(identifier, button);
if (value == GetButton(identifier, button)) {
return;
}
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index 8f7ce59b7..07d514ad7 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -143,6 +143,9 @@ struct InputSubsystem::Impl {
return {};
}
const std::string engine = params.Get("engine", "");
+ if (engine == mouse->GetEngineName()) {
+ return mouse->GetAnalogMappingForDevice(params);
+ }
if (engine == gcadapter->GetEngineName()) {
return gcadapter->GetAnalogMappingForDevice(params);
}