diff options
| author | Filoppi <filippotarpini@hotmail.it> | 2021-05-04 23:50:23 +0300 |
|---|---|---|
| committer | Filoppi <filippotarpini@hotmail.it> | 2021-05-12 18:27:23 +0300 |
| commit | f4fec42165f245e8ad35456a25bfada8428ba1f2 (patch) | |
| tree | b0e89930e9767368778c7a4b3cc4da56da243035 /Source/Core/InputCommon | |
| parent | e9e41b925b6efeac4d3eadf049391ef81483528f (diff) | |
Add mixed comments to input code, make some tooltip clearer
Diffstat (limited to 'Source/Core/InputCommon')
6 files changed, 15 insertions, 3 deletions
diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp index c96ea0599c..5e69cc42d9 100644 --- a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp +++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp @@ -371,6 +371,7 @@ public: } case TOK_ASSIGN: { + // Use this carefully as it's extremely powerful and can end up in unforeseen situations lhs->SetValue(rhs->GetValue()); return lhs->GetValue(); } @@ -565,6 +566,9 @@ private: // This class proxies all methods to its either left-hand child if it has bound controls, or its // right-hand child. Its intended use is for supporting old-style barewords expressions. +// Note that if you have a keyboard device as default device and the expression is a single digit +// number, this will usually resolve in a numerical key instead of a numerical value. +// Though if this expression belongs to NumericSetting, it will likely be simplifed back to a value. class CoalesceExpression : public Expression { public: @@ -945,6 +949,7 @@ static std::unique_ptr<Expression> ParseBarewordExpression(const std::string& st qualifier.control_name = str; qualifier.has_device = false; + // This control expression will only work (find the specified control) with the default device. return std::make_unique<ControlExpression>(qualifier); } diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.h b/Source/Core/InputCommon/ControlReference/ExpressionParser.h index 9789e9afe0..14670848ae 100644 --- a/Source/Core/InputCommon/ControlReference/ExpressionParser.h +++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.h @@ -63,7 +63,9 @@ public: enum class ParseStatus { Successful, + // Note that the expression could still work in this case (be valid and return a value) SyntaxError, + // Will return the default value EmptyExpression, }; @@ -107,6 +109,7 @@ class ControlQualifier public: bool has_device; Core::DeviceQualifier device_qualifier; + // Makes no distinction between input and output std::string control_name; ControlQualifier() : has_device(false) {} diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp index 84c7238e48..6dde9d3c44 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp @@ -44,7 +44,7 @@ void ControlGroup::AddDeadzoneSetting(SettingValue<double>* value, double maximu // i18n: The percent symbol. _trans("%"), // i18n: Refers to the dead-zone setting of gamepad inputs. - _trans("Input strength to ignore.")}, + _trans("Input strength to ignore and remap.")}, 0, 0, maximum_deadzone); } diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp index b5408cfe34..95c74b1896 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp @@ -40,7 +40,7 @@ IMUGyroscope::IMUGyroscope(std::string name_, std::string ui_name_) // i18n: "°/s" is the symbol for degrees (angular measurement) divided by seconds. _trans("°/s"), // i18n: Refers to the dead-zone setting of gyroscope input. - _trans("Angular velocity to ignore.")}, + _trans("Angular velocity to ignore and remap.")}, 2, 0, 180); AddSetting(&m_calibration_period_setting, diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index d1b230c373..60a3c062bd 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -128,6 +128,7 @@ std::optional<u32> SquareStickGate::GetIdealCalibrationSampleCount() const ReshapableInput::ReshapableInput(std::string name_, std::string ui_name_, GroupType type_) : ControlGroup(std::move(name_), std::move(ui_name_), type_) { + // 50 is not always enough but users can set it to more with an expression AddDeadzoneSetting(&m_deadzone_setting, 50); } @@ -285,6 +286,10 @@ ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlSta x -= m_center.x; y -= m_center.y; + // We run this even if both x and y will be zero. + // In that case, std::atan2(0, 0) returns a valid non-NaN value, but the exact value + // (which depends on the signs of x and y) does not matter here as dist is zero + // TODO: make the AtAngle functions work with negative angles: ControlState angle = std::atan2(y, x) + MathUtil::TAU; diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp index 140e66e261..3b9fb7f809 100644 --- a/Source/Core/InputCommon/InputConfig.cpp +++ b/Source/Core/InputCommon/InputConfig.cpp @@ -133,7 +133,6 @@ bool InputConfig::LoadConfig(bool isGC) } #endif controller->LoadConfig(&config); - // Update refs controller->UpdateReferences(g_controller_interface); controller_names.push_back(controller->GetName()); |
