diff options
| author | JMC47 <JMC4789@gmail.com> | 2021-05-23 22:10:12 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-23 22:10:12 -0400 |
| commit | 509b24a27f0a417c9139d46d1d5a0ebbf7d678e3 (patch) | |
| tree | 7977561633ae2ff25bf61f887c4873bc74169ce6 /Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp | |
| parent | 975f8e2a25653b3a9a4d8db42285f5b4de50b589 (diff) | |
| parent | 93e3e691f9a3a9913b56ebe71b4bd34fd21ce5c9 (diff) | |
Merge pull request #9581 from Filoppi/expose_input_expr_vars
Expose Control Expression variables to mappings UI
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp')
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp index a9c5844b48..498586a9f2 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp @@ -44,6 +44,8 @@ void EmulatedController::UpdateReferences(const ControllerInterface& devi) ciface::ExpressionParser::ControlEnvironment env(devi, GetDefaultDevice(), m_expression_vars); UpdateReferences(env); + + env.CleanUnusedVariables(); } void EmulatedController::UpdateReferences(ciface::ExpressionParser::ControlEnvironment& env) @@ -75,7 +77,27 @@ void EmulatedController::UpdateSingleControlReference(const ControllerInterface& ControlReference* ref) { ciface::ExpressionParser::ControlEnvironment env(devi, GetDefaultDevice(), m_expression_vars); + ref->UpdateReference(env); + + env.CleanUnusedVariables(); +} + +const ciface::ExpressionParser::ControlEnvironment::VariableContainer& +EmulatedController::GetExpressionVariables() const +{ + return m_expression_vars; +} + +void EmulatedController::ResetExpressionVariables() +{ + for (auto& var : m_expression_vars) + { + if (var.second) + { + *var.second = 0; + } + } } bool EmulatedController::IsDefaultDeviceConnected() const |
