mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 12:19:12 +00:00
ExpressionParser: Renamed ControlFinder to ControlEnvironment. Added support for variables and assignment operator. ControlExpression objects now reference a matching input and output so the two can me mixed in any expression. (you can set rumble directly from inputs)
This commit is contained in:
parent
1efcf861ea
commit
e896835f86
7 changed files with 144 additions and 46 deletions
|
@ -38,23 +38,38 @@ std::unique_lock<std::recursive_mutex> EmulatedController::GetStateLock()
|
|||
|
||||
void EmulatedController::UpdateReferences(const ControllerInterface& devi)
|
||||
{
|
||||
const auto lock = GetStateLock();
|
||||
m_default_device_is_connected = devi.HasConnectedDevice(m_default_device);
|
||||
|
||||
ciface::ExpressionParser::ControlEnvironment env(devi, GetDefaultDevice(), m_expression_vars);
|
||||
|
||||
UpdateReferences(env);
|
||||
}
|
||||
|
||||
void EmulatedController::UpdateReferences(ciface::ExpressionParser::ControlEnvironment& env)
|
||||
{
|
||||
const auto lock = GetStateLock();
|
||||
|
||||
for (auto& ctrlGroup : groups)
|
||||
{
|
||||
for (auto& control : ctrlGroup->controls)
|
||||
control->control_ref.get()->UpdateReference(devi, GetDefaultDevice());
|
||||
control->control_ref->UpdateReference(env);
|
||||
|
||||
// Attachments:
|
||||
if (ctrlGroup->type == GroupType::Attachments)
|
||||
{
|
||||
for (auto& attachment : static_cast<Attachments*>(ctrlGroup.get())->GetAttachmentList())
|
||||
attachment->UpdateReferences(devi);
|
||||
attachment->UpdateReferences(env);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EmulatedController::UpdateSingleControlReference(const ControllerInterface& devi,
|
||||
ControlReference* ref)
|
||||
{
|
||||
ciface::ExpressionParser::ControlEnvironment env(devi, GetDefaultDevice(), m_expression_vars);
|
||||
ref->UpdateReference(env);
|
||||
}
|
||||
|
||||
bool EmulatedController::IsDefaultDeviceConnected() const
|
||||
{
|
||||
return m_default_device_is_connected;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue