summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorameerj <aj662@drexel.edu>2020-08-10 18:39:42 +0200
committerameerj <aj662@drexel.edu>2020-08-10 18:46:14 +0200
commitd6672501ac74b9d0645e97f045ec2d8b9e5da289 (patch)
tree3c47b3398ec56c3d7d752449e5bc7f71b4703265
parentAdd range slider functionality for gc adapter (diff)
downloadyuzu-d6672501ac74b9d0645e97f045ec2d8b9e5da289.tar
yuzu-d6672501ac74b9d0645e97f045ec2d8b9e5da289.tar.gz
yuzu-d6672501ac74b9d0645e97f045ec2d8b9e5da289.tar.bz2
yuzu-d6672501ac74b9d0645e97f045ec2d8b9e5da289.tar.lz
yuzu-d6672501ac74b9d0645e97f045ec2d8b9e5da289.tar.xz
yuzu-d6672501ac74b9d0645e97f045ec2d8b9e5da289.tar.zst
yuzu-d6672501ac74b9d0645e97f045ec2d8b9e5da289.zip
-rw-r--r--src/input_common/gcadapter/gc_poller.cpp2
-rw-r--r--src/input_common/sdl/sdl_impl.cpp2
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp25
-rw-r--r--src/yuzu/configuration/configure_input_player.h2
-rw-r--r--src/yuzu/configuration/configure_input_player.ui60
5 files changed, 5 insertions, 86 deletions
diff --git a/src/input_common/gcadapter/gc_poller.cpp b/src/input_common/gcadapter/gc_poller.cpp
index 323b93459..b346fdf8e 100644
--- a/src/input_common/gcadapter/gc_poller.cpp
+++ b/src/input_common/gcadapter/gc_poller.cpp
@@ -233,7 +233,7 @@ std::unique_ptr<Input::AnalogDevice> GCAnalogFactory::Create(const Common::Param
const int axis_x = params.Get("axis_x", 0);
const int axis_y = params.Get("axis_y", 1);
const float deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, .99f);
- const float range = std::clamp(params.Get("range", 0.0f), 0.50f, 1.50f);
+ const float range = std::clamp(params.Get("range", 1.0f), 0.50f, 1.50f);
return std::make_unique<GCAnalog>(port, axis_x, axis_y, deadzone, adapter.get(), range);
}
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp
index 1853f535d..d76c279d3 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -461,7 +461,7 @@ public:
const int axis_x = params.Get("axis_x", 0);
const int axis_y = params.Get("axis_y", 1);
const float deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, .99f);
- const float range = std::clamp(params.Get("range", 0.0f), 0.50f, 1.50f);
+ const float range = std::clamp(params.Get("range", 1.0f), 0.50f, 1.50f);
auto joystick = state.GetSDLJoystickByGUID(guid, port);
// This is necessary so accessing GetAxis with axis_x and axis_y won't crash
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 8bc86b706..b1850bc95 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -272,10 +272,6 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
ui->sliderRStickDeadzoneAndModifier};
analog_map_deadzone_and_modifier_slider_label = {ui->labelLStickDeadzoneAndModifier,
ui->labelRStickDeadzoneAndModifier};
- ui->sliderLStickRange->setRange(50, 150);
- ui->sliderRStickRange->setRange(50, 150);
- analog_map_range_slider = {ui->sliderLStickRange, ui->sliderRStickRange};
- analog_map_range_slider_label = {ui->labelLStickRange, ui->labelRStickRange};
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
auto* const button = button_map[button_id];
@@ -368,6 +364,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
InputCommon::Polling::DeviceType::Analog);
}
});
+
connect(analog_map_deadzone_and_modifier_slider[analog_id], &QSlider::valueChanged,
[=, this] {
const float slider_value =
@@ -383,15 +380,6 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
analogs_param[analog_id].Set("modifier_scale", slider_value / 100.0f);
}
});
- connect(analog_map_range_slider[analog_id], &QSlider::valueChanged, [=, this] {
- const float slider_value = analog_map_range_slider[analog_id]->value();
- const auto engine = analogs_param[analog_id].Get("engine", "");
- if (engine == "sdl" || engine == "gcpad") {
- analog_map_range_slider_label[analog_id]->setText(
- tr("Range: %1%").arg(slider_value));
- analogs_param[analog_id].Set("range", slider_value / 100.0f);
- }
- });
}
connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); });
@@ -597,9 +585,6 @@ void ConfigureInputPlayer::UpdateButtonLabels() {
auto* const analog_stick_slider_label =
analog_map_deadzone_and_modifier_slider_label[analog_id];
- auto* const analog_stick_range = analog_map_range_slider[analog_id];
- auto* const analog_stick_range_label = analog_map_range_slider_label[analog_id];
-
if (param.Has("engine")) {
if (param.Get("engine", "") == "sdl" || param.Get("engine", "") == "gcpad") {
if (!param.Has("deadzone")) {
@@ -610,14 +595,6 @@ void ConfigureInputPlayer::UpdateButtonLabels() {
if (analog_stick_slider->value() == 0) {
analog_stick_slider_label->setText(tr("Deadzone: 0%"));
}
- if (!param.Has("range")) {
- param.Set("range", 0.50f);
- }
- // QtSlider returns values from 0.0-0.99. We want range to be from 50% to 150%
- analog_stick_range->setValue(static_cast<int>(param.Get("range", 0.1f) * 100));
- if (analog_stick_range->value() == 50) {
- analog_stick_range_label->setText(tr("Range: 50%"));
- }
} else {
if (!param.Has("modifier_scale")) {
param.Set("modifier_scale", 0.5f);
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h
index 88cc3b3b1..95afa5375 100644
--- a/src/yuzu/configuration/configure_input_player.h
+++ b/src/yuzu/configuration/configure_input_player.h
@@ -101,8 +101,6 @@ private:
analog_map_deadzone_and_modifier_slider;
std::array<QLabel*, Settings::NativeAnalog::NumAnalogs>
analog_map_deadzone_and_modifier_slider_label;
- std::array<QSlider*, Settings::NativeAnalog::NumAnalogs> analog_map_range_slider;
- std::array<QLabel*, Settings::NativeAnalog::NumAnalogs> analog_map_range_slider_label;
static const std::array<std::string, ANALOG_SUB_BUTTONS_NUM> analog_sub_buttons;
diff --git a/src/yuzu/configuration/configure_input_player.ui b/src/yuzu/configuration/configure_input_player.ui
index 91065dcde..f27a77180 100644
--- a/src/yuzu/configuration/configure_input_player.ui
+++ b/src/yuzu/configuration/configure_input_player.ui
@@ -195,35 +195,7 @@
</item>
</layout>
</item>
- <item row="5" column="0" colspan="2">
- <layout class="QVBoxLayout" name="sliderRStickRangeVerticalLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetDefaultConstraint</enum>
- </property>
- <item>
- <layout class="QHBoxLayout" name="sliderRStickRangeHorizontalLayout">
- <item>
- <widget class="QLabel" name="labelRStickRange">
- <property name="text">
- <string>Range: 0</string>
- </property>
- <property name="alignment">
- <enum>Qt::AlignHCenter</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QSlider" name="sliderRStickRange">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="6" column="0">
+ <item row="5" column="0">
<spacer name="RStick_verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -839,35 +811,7 @@
</item>
</layout>
</item>
- <item row="6" column="1" colspan="2">
- <layout class="QVBoxLayout" name="sliderLStickRangeVerticalLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetDefaultConstraint</enum>
- </property>
- <item>
- <layout class="QHBoxLayout" name="sliderLStickRangeHorizontalLayout">
- <item>
- <widget class="QLabel" name="labelLStickRange">
- <property name="text">
- <string>Range: 0</string>
- </property>
- <property name="alignment">
- <enum>Qt::AlignHCenter</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QSlider" name="sliderLStickRange">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="7" column="1">
+ <item row="6" column="1">
<spacer name="LStick_verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>