mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
@@ -20,6 +20,7 @@ enum LOG_TYPE
|
||||
COMMANDPROCESSOR,
|
||||
COMMON,
|
||||
CONSOLE,
|
||||
CONTROLLERINTERFACE,
|
||||
CORE,
|
||||
DISCIO,
|
||||
DSPHLE,
|
||||
|
||||
@@ -123,6 +123,7 @@ LogManager::LogManager()
|
||||
m_log[COMMANDPROCESSOR] = {"CP", "Command Processor"};
|
||||
m_log[COMMON] = {"COMMON", "Common"};
|
||||
m_log[CONSOLE] = {"CONSOLE", "Dolphin Console"};
|
||||
m_log[CONTROLLERINTERFACE] = {"CI", "Controller Interface"};
|
||||
m_log[CORE] = {"CORE", "Core"};
|
||||
m_log[DISCIO] = {"DIO", "Disc IO"};
|
||||
m_log[DSPHLE] = {"DSPHLE", "DSP HLE"};
|
||||
|
||||
@@ -93,10 +93,15 @@ GCPad::GCPad(const unsigned int index) : m_index(index)
|
||||
|
||||
// options
|
||||
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
||||
m_options->AddSetting(&m_always_connected_setting,
|
||||
// i18n: Treat a controller as always being connected regardless of what
|
||||
// devices the user actually has plugged in
|
||||
_trans("Always Connected"), false);
|
||||
m_options->AddSetting(
|
||||
&m_always_connected_setting,
|
||||
// i18n: Treat a controller as always being connected regardless of what
|
||||
// devices the user actually has plugged in
|
||||
{_trans("Always Connected"), _trans(""),
|
||||
_trans("Always connected if checked.\n"
|
||||
"If unchecked, it will link the emulated controller connection state\n"
|
||||
"to the real default device connection state (if there is one).")},
|
||||
false);
|
||||
}
|
||||
|
||||
std::string GCPad::GetName() const
|
||||
@@ -181,17 +186,17 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
|
||||
EmulatedController::LoadDefaults(ciface);
|
||||
|
||||
// Buttons
|
||||
m_buttons->SetControlExpression(0, "X"); // A
|
||||
m_buttons->SetControlExpression(1, "Z"); // B
|
||||
m_buttons->SetControlExpression(2, "C"); // X
|
||||
m_buttons->SetControlExpression(3, "S"); // Y
|
||||
m_buttons->SetControlExpression(4, "D"); // Z
|
||||
m_buttons->SetControlExpression(0, "`X`"); // A
|
||||
m_buttons->SetControlExpression(1, "`Z`"); // B
|
||||
m_buttons->SetControlExpression(2, "`C`"); // X
|
||||
m_buttons->SetControlExpression(3, "`S`"); // Y
|
||||
m_buttons->SetControlExpression(4, "`D`"); // Z
|
||||
#ifdef _WIN32
|
||||
m_buttons->SetControlExpression(5, "RETURN"); // Start
|
||||
m_buttons->SetControlExpression(5, "`RETURN`"); // Start
|
||||
#else
|
||||
// OS X/Linux
|
||||
// Start
|
||||
m_buttons->SetControlExpression(5, "Return");
|
||||
m_buttons->SetControlExpression(5, "`Return`");
|
||||
#endif
|
||||
|
||||
// stick modifiers to 50 %
|
||||
@@ -199,46 +204,46 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
|
||||
m_c_stick->controls[4]->control_ref->range = 0.5f;
|
||||
|
||||
// D-Pad
|
||||
m_dpad->SetControlExpression(0, "T"); // Up
|
||||
m_dpad->SetControlExpression(1, "G"); // Down
|
||||
m_dpad->SetControlExpression(2, "F"); // Left
|
||||
m_dpad->SetControlExpression(3, "H"); // Right
|
||||
m_dpad->SetControlExpression(0, "`T`"); // Up
|
||||
m_dpad->SetControlExpression(1, "`G`"); // Down
|
||||
m_dpad->SetControlExpression(2, "`F`"); // Left
|
||||
m_dpad->SetControlExpression(3, "`H`"); // Right
|
||||
|
||||
// C Stick
|
||||
m_c_stick->SetControlExpression(0, "I"); // Up
|
||||
m_c_stick->SetControlExpression(1, "K"); // Down
|
||||
m_c_stick->SetControlExpression(2, "J"); // Left
|
||||
m_c_stick->SetControlExpression(3, "L"); // Right
|
||||
m_c_stick->SetControlExpression(0, "`I`"); // Up
|
||||
m_c_stick->SetControlExpression(1, "`K`"); // Down
|
||||
m_c_stick->SetControlExpression(2, "`J`"); // Left
|
||||
m_c_stick->SetControlExpression(3, "`L`"); // Right
|
||||
// Modifier
|
||||
m_c_stick->SetControlExpression(4, "Ctrl");
|
||||
m_c_stick->SetControlExpression(4, "`Ctrl`");
|
||||
|
||||
// Control Stick
|
||||
#ifdef _WIN32
|
||||
m_main_stick->SetControlExpression(0, "UP"); // Up
|
||||
m_main_stick->SetControlExpression(1, "DOWN"); // Down
|
||||
m_main_stick->SetControlExpression(2, "LEFT"); // Left
|
||||
m_main_stick->SetControlExpression(3, "RIGHT"); // Right
|
||||
m_main_stick->SetControlExpression(0, "`UP`"); // Up
|
||||
m_main_stick->SetControlExpression(1, "`DOWN`"); // Down
|
||||
m_main_stick->SetControlExpression(2, "`LEFT`"); // Left
|
||||
m_main_stick->SetControlExpression(3, "`RIGHT`"); // Right
|
||||
#elif __APPLE__
|
||||
m_main_stick->SetControlExpression(0, "`Up Arrow`"); // Up
|
||||
m_main_stick->SetControlExpression(1, "`Down Arrow`"); // Down
|
||||
m_main_stick->SetControlExpression(2, "`Left Arrow`"); // Left
|
||||
m_main_stick->SetControlExpression(3, "`Right Arrow`"); // Right
|
||||
#else
|
||||
m_main_stick->SetControlExpression(0, "Up"); // Up
|
||||
m_main_stick->SetControlExpression(1, "Down"); // Down
|
||||
m_main_stick->SetControlExpression(2, "Left"); // Left
|
||||
m_main_stick->SetControlExpression(3, "Right"); // Right
|
||||
m_main_stick->SetControlExpression(0, "`Up`"); // Up
|
||||
m_main_stick->SetControlExpression(1, "`Down`"); // Down
|
||||
m_main_stick->SetControlExpression(2, "`Left`"); // Left
|
||||
m_main_stick->SetControlExpression(3, "`Right`"); // Right
|
||||
#endif
|
||||
// Modifier
|
||||
m_main_stick->SetControlExpression(4, "Shift");
|
||||
m_main_stick->SetControlExpression(4, "`Shift`");
|
||||
|
||||
// Because our defaults use keyboard input, set calibration shapes to squares.
|
||||
m_c_stick->SetCalibrationFromGate(ControllerEmu::SquareStickGate(1.0));
|
||||
m_main_stick->SetCalibrationFromGate(ControllerEmu::SquareStickGate(1.0));
|
||||
|
||||
// Triggers
|
||||
m_triggers->SetControlExpression(0, "Q"); // L
|
||||
m_triggers->SetControlExpression(1, "W"); // R
|
||||
m_triggers->SetControlExpression(0, "`Q`"); // L
|
||||
m_triggers->SetControlExpression(1, "`W`"); // R
|
||||
}
|
||||
|
||||
bool GCPad::GetMicButton() const
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Attachments.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h"
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@ void ExtensionPort::AttachExtension(Extension* ext)
|
||||
|
||||
m_extension = ext;
|
||||
m_i2c_bus.AddSlave(m_extension);
|
||||
;
|
||||
}
|
||||
|
||||
} // namespace WiimoteEmu
|
||||
|
||||
@@ -22,6 +22,8 @@ enum ExtensionNumber : u8
|
||||
UDRAW_TABLET,
|
||||
DRAWSOME_TABLET,
|
||||
TATACON,
|
||||
|
||||
MAX
|
||||
};
|
||||
|
||||
// FYI: An extension must be attached.
|
||||
|
||||
@@ -428,7 +428,7 @@ void Wiimote::Update()
|
||||
|
||||
// Hotkey / settings modifier
|
||||
// Data is later accessed in IsSideways and IsUpright
|
||||
m_hotkeys->GetState();
|
||||
m_hotkeys->UpdateState();
|
||||
|
||||
// Update our motion simulations.
|
||||
StepDynamics();
|
||||
@@ -700,15 +700,15 @@ EncryptionKey Wiimote::GetExtensionEncryptionKey() const
|
||||
|
||||
bool Wiimote::IsSideways() const
|
||||
{
|
||||
const bool sideways_modifier_toggle = m_hotkeys->getSettingsModifier()[0];
|
||||
const bool sideways_modifier_switch = m_hotkeys->getSettingsModifier()[2];
|
||||
const bool sideways_modifier_toggle = m_hotkeys->GetSettingsModifier()[0];
|
||||
const bool sideways_modifier_switch = m_hotkeys->GetSettingsModifier()[2];
|
||||
return m_sideways_setting.GetValue() ^ sideways_modifier_toggle ^ sideways_modifier_switch;
|
||||
}
|
||||
|
||||
bool Wiimote::IsUpright() const
|
||||
{
|
||||
const bool upright_modifier_toggle = m_hotkeys->getSettingsModifier()[1];
|
||||
const bool upright_modifier_switch = m_hotkeys->getSettingsModifier()[3];
|
||||
const bool upright_modifier_toggle = m_hotkeys->GetSettingsModifier()[1];
|
||||
const bool upright_modifier_switch = m_hotkeys->GetSettingsModifier()[3];
|
||||
return m_upright_setting.GetValue() ^ upright_modifier_toggle ^ upright_modifier_switch;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@ void MappingDouble::Update()
|
||||
MappingBool::MappingBool(MappingWidget* parent, ControllerEmu::NumericSetting<bool>* setting)
|
||||
: QCheckBox(parent), m_setting(*setting)
|
||||
{
|
||||
if (const auto ui_description = m_setting.GetUIDescription())
|
||||
setToolTip(tr(ui_description));
|
||||
|
||||
connect(this, &QCheckBox::stateChanged, this, [this, parent](int value) {
|
||||
m_setting.SetValue(value != 0);
|
||||
ConfigChanged();
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "DolphinQt/Config/Graphics/BalloonTip.h"
|
||||
|
||||
constexpr int TOOLTIP_DELAY = 300;
|
||||
|
||||
template <class Derived>
|
||||
class ToolTipWidget : public Derived
|
||||
{
|
||||
@@ -25,7 +27,7 @@ private:
|
||||
{
|
||||
if (m_timer_id)
|
||||
return;
|
||||
m_timer_id = this->startTimer(300);
|
||||
m_timer_id = this->startTimer(TOOLTIP_DELAY);
|
||||
}
|
||||
|
||||
void leaveEvent(QEvent* event) override
|
||||
|
||||
@@ -247,22 +247,18 @@ ParseStatus Lexer::Tokenize(std::vector<Token>& tokens)
|
||||
class ControlExpression : public Expression
|
||||
{
|
||||
public:
|
||||
// Keep a shared_ptr to the device so the control pointer doesn't become invalid.
|
||||
std::shared_ptr<Device> m_device;
|
||||
|
||||
explicit ControlExpression(ControlQualifier qualifier_) : qualifier(qualifier_) {}
|
||||
explicit ControlExpression(ControlQualifier qualifier) : m_qualifier(qualifier) {}
|
||||
|
||||
ControlState GetValue() const override
|
||||
{
|
||||
if (s_hotkey_suppressions.IsSuppressed(input))
|
||||
if (s_hotkey_suppressions.IsSuppressed(m_input))
|
||||
return 0;
|
||||
else
|
||||
return GetValueIgnoringSuppression();
|
||||
return GetValueIgnoringSuppression();
|
||||
}
|
||||
|
||||
ControlState GetValueIgnoringSuppression() const
|
||||
{
|
||||
if (!input)
|
||||
if (!m_input)
|
||||
return 0.0;
|
||||
|
||||
// Note: Inputs may return negative values in situations where opposing directions are
|
||||
@@ -271,27 +267,29 @@ public:
|
||||
// FYI: Clamping values greater than 1.0 is purposely not done to support unbounded values in
|
||||
// the future. (e.g. raw accelerometer/gyro data)
|
||||
|
||||
return std::max(0.0, input->GetState());
|
||||
return std::max(0.0, m_input->GetState());
|
||||
}
|
||||
void SetValue(ControlState value) override
|
||||
{
|
||||
if (output)
|
||||
output->SetState(value);
|
||||
if (m_output)
|
||||
m_output->SetState(value);
|
||||
}
|
||||
int CountNumControls() const override { return (input || output) ? 1 : 0; }
|
||||
int CountNumControls() const override { return (m_input || m_output) ? 1 : 0; }
|
||||
void UpdateReferences(ControlEnvironment& env) override
|
||||
{
|
||||
m_device = env.FindDevice(qualifier);
|
||||
input = env.FindInput(qualifier);
|
||||
output = env.FindOutput(qualifier);
|
||||
m_device = env.FindDevice(m_qualifier);
|
||||
m_input = env.FindInput(m_qualifier);
|
||||
m_output = env.FindOutput(m_qualifier);
|
||||
}
|
||||
|
||||
Device::Input* GetInput() const { return input; };
|
||||
Device::Input* GetInput() const { return m_input; };
|
||||
|
||||
private:
|
||||
ControlQualifier qualifier;
|
||||
Device::Input* input = nullptr;
|
||||
Device::Output* output = nullptr;
|
||||
// Keep a shared_ptr to the device so the control pointer doesn't become invalid.
|
||||
std::shared_ptr<Device> m_device;
|
||||
ControlQualifier m_qualifier;
|
||||
Device::Input* m_input = nullptr;
|
||||
Device::Output* m_output = nullptr;
|
||||
};
|
||||
|
||||
bool HotkeySuppressions::IsSuppressedIgnoringModifiers(Device::Input* input,
|
||||
@@ -371,6 +369,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 +564,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 +947,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
virtual ~Control();
|
||||
|
||||
template <typename T = ControlState>
|
||||
T GetState()
|
||||
T GetState() const
|
||||
{
|
||||
return control_ref->GetState<T>();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ AnalogStick::AnalogStick(const char* const name_, const char* const ui_name_,
|
||||
AddInput(Translate, _trans("Modifier"));
|
||||
}
|
||||
|
||||
AnalogStick::ReshapeData AnalogStick::GetReshapableState(bool adjusted)
|
||||
AnalogStick::ReshapeData AnalogStick::GetReshapableState(bool adjusted) const
|
||||
{
|
||||
const ControlState y = controls[0]->GetState() - controls[1]->GetState();
|
||||
const ControlState x = controls[3]->GetState() - controls[2]->GetState();
|
||||
@@ -46,7 +46,7 @@ AnalogStick::ReshapeData AnalogStick::GetReshapableState(bool adjusted)
|
||||
return Reshape(x, y, modifier);
|
||||
}
|
||||
|
||||
AnalogStick::StateData AnalogStick::GetState()
|
||||
AnalogStick::StateData AnalogStick::GetState() const
|
||||
{
|
||||
return GetReshapableState(true);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ public:
|
||||
AnalogStick(const char* name, std::unique_ptr<StickGate>&& stick_gate);
|
||||
AnalogStick(const char* name, const char* ui_name, std::unique_ptr<StickGate>&& stick_gate);
|
||||
|
||||
ReshapeData GetReshapableState(bool adjusted) final override;
|
||||
ReshapeData GetReshapableState(bool adjusted) const final override;
|
||||
ControlState GetGateRadiusAtAngle(double ang) const override;
|
||||
|
||||
StateData GetState();
|
||||
StateData GetState() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<StickGate> m_stick_gate;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/HW/WiimoteEmu/ExtensionPort.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
@@ -34,7 +35,11 @@ public:
|
||||
|
||||
private:
|
||||
SettingValue<int> m_selection_value;
|
||||
NumericSetting<int> m_selection_setting = {&m_selection_value, {""}, 0, 0, 0};
|
||||
// This is here and not added to the list of numeric_settings because it's serialized differently,
|
||||
// by string (to be independent from the enum), and visualized differently in the UI.
|
||||
// For the rest, it's treated similarly to other numeric_settings in the group.
|
||||
NumericSetting<int> m_selection_setting = {
|
||||
&m_selection_value, {""}, 0, 0, WiimoteEmu::ExtensionNumber::MAX - 1};
|
||||
|
||||
std::vector<std::unique_ptr<EmulatedController>> m_attachments;
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
Buttons(const std::string& ini_name, const std::string& group_name);
|
||||
|
||||
template <typename C>
|
||||
void GetState(C* const buttons, const C* bitmasks)
|
||||
void GetState(C* const buttons, const C* bitmasks) const
|
||||
{
|
||||
for (auto& control : controls)
|
||||
*buttons |= *(bitmasks++) * control->GetState<bool>();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ Cursor::Cursor(std::string name_, std::string ui_name_)
|
||||
AddSetting(&m_autohide_setting, {_trans("Auto-Hide")}, false);
|
||||
}
|
||||
|
||||
Cursor::ReshapeData Cursor::GetReshapableState(bool adjusted)
|
||||
Cursor::ReshapeData Cursor::GetReshapableState(bool adjusted) const
|
||||
{
|
||||
const ControlState y = controls[0]->GetState() - controls[1]->GetState();
|
||||
const ControlState x = controls[3]->GetState() - controls[2]->GetState();
|
||||
|
||||
@@ -25,9 +25,10 @@ public:
|
||||
|
||||
Cursor(std::string name, std::string ui_name);
|
||||
|
||||
ReshapeData GetReshapableState(bool adjusted) final override;
|
||||
ReshapeData GetReshapableState(bool adjusted) const final override;
|
||||
ControlState GetGateRadiusAtAngle(double ang) const override;
|
||||
|
||||
// Modifies the state
|
||||
StateData GetState(bool adjusted);
|
||||
|
||||
// Yaw movement in radians.
|
||||
|
||||
@@ -65,7 +65,7 @@ Force::Force(const std::string& name_) : ReshapableInput(name_, name_, GroupType
|
||||
90, 1, 180);
|
||||
}
|
||||
|
||||
Force::ReshapeData Force::GetReshapableState(bool adjusted)
|
||||
Force::ReshapeData Force::GetReshapableState(bool adjusted) const
|
||||
{
|
||||
const ControlState y = controls[0]->GetState() - controls[1]->GetState();
|
||||
const ControlState x = controls[3]->GetState() - controls[2]->GetState();
|
||||
@@ -77,7 +77,7 @@ Force::ReshapeData Force::GetReshapableState(bool adjusted)
|
||||
return Reshape(x, y);
|
||||
}
|
||||
|
||||
Force::StateData Force::GetState(bool adjusted)
|
||||
Force::StateData Force::GetState(bool adjusted) const
|
||||
{
|
||||
const auto state = GetReshapableState(adjusted);
|
||||
ControlState z = controls[4]->GetState() - controls[5]->GetState();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user