mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
ControllerEmu: Separate ControlGroup from ControllerEmu
ControllerEmu, the class, is essentially acting like a namespace for ControlGroup. This makes it impossible to forward declare any of the internals. It also globs a bunch of classes together which is kind of a pain to manage. This splits ControlGroup and the classes it contains into their own source files and situates them all within a namespace, which gets them out of global scope. Since this allows forward declarations for the once-internal classes, it now requires significantly less files to be rebuilt if anything is changed in the ControllerEmu portion of code. It does not split out the settings classes yet, however, as it would be preferable to make a settings base class that all settings derive from, but this would be a functional change -- this commit only intends to move around existing code. Extracting the settings class will be done in another commit.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#include "Core/Analytics.h"
|
||||
|
||||
#include <cinttypes>
|
||||
#include <mbedtls/sha1.h>
|
||||
#include <memory>
|
||||
@@ -16,12 +18,10 @@
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/Analytics.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/GCPad.h"
|
||||
#include "Core/Movie.h"
|
||||
#include "Core/NetPlayProto.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/GCAdapter.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include "Common/Analytics.h"
|
||||
|
||||
|
||||
@@ -2,12 +2,16 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/HW/GCKeyboard.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/HW/GCKeyboard.h"
|
||||
|
||||
#include "Core/HW/GCKeyboardEmu.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
#include "InputCommon/KeyboardStatus.h"
|
||||
|
||||
@@ -5,12 +5,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
|
||||
class InputConfig;
|
||||
enum class KeyboardGroup;
|
||||
struct KeyboardStatus;
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class ControlGroup;
|
||||
}
|
||||
|
||||
namespace Keyboard
|
||||
{
|
||||
void Shutdown();
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/HW/GCKeyboardEmu.h"
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/KeyboardStatus.h"
|
||||
|
||||
@@ -48,36 +53,38 @@ static const char* const named_keys5[] = {"LEFT", "DOWN", "UP", "RIGHT", "ENTER"
|
||||
GCKeyboard::GCKeyboard(const unsigned int index) : m_index(index)
|
||||
{
|
||||
// buttons
|
||||
groups.emplace_back(m_keys0x = new Buttons(_trans("Keys")));
|
||||
groups.emplace_back(m_keys0x = new ControllerEmu::Buttons(_trans("Keys")));
|
||||
for (const char* key : named_keys0)
|
||||
m_keys0x->controls.emplace_back(new ControlGroup::Input(key));
|
||||
m_keys0x->controls.emplace_back(new ControllerEmu::Input(key));
|
||||
|
||||
groups.emplace_back(m_keys1x = new Buttons(_trans("Keys")));
|
||||
groups.emplace_back(m_keys1x = new ControllerEmu::Buttons(_trans("Keys")));
|
||||
for (const char* key : named_keys1)
|
||||
m_keys1x->controls.emplace_back(new ControlGroup::Input(key));
|
||||
m_keys1x->controls.emplace_back(new ControllerEmu::Input(key));
|
||||
|
||||
groups.emplace_back(m_keys2x = new Buttons(_trans("Keys")));
|
||||
groups.emplace_back(m_keys2x = new ControllerEmu::Buttons(_trans("Keys")));
|
||||
for (const char* key : named_keys2)
|
||||
m_keys2x->controls.emplace_back(new ControlGroup::Input(key));
|
||||
m_keys2x->controls.emplace_back(new ControllerEmu::Input(key));
|
||||
|
||||
groups.emplace_back(m_keys3x = new Buttons(_trans("Keys")));
|
||||
groups.emplace_back(m_keys3x = new ControllerEmu::Buttons(_trans("Keys")));
|
||||
for (const char* key : named_keys3)
|
||||
m_keys3x->controls.emplace_back(new ControlGroup::Input(key));
|
||||
m_keys3x->controls.emplace_back(new ControllerEmu::Input(key));
|
||||
|
||||
groups.emplace_back(m_keys4x = new Buttons(_trans("Keys")));
|
||||
groups.emplace_back(m_keys4x = new ControllerEmu::Buttons(_trans("Keys")));
|
||||
for (const char* key : named_keys4)
|
||||
m_keys4x->controls.emplace_back(new ControlGroup::Input(key));
|
||||
m_keys4x->controls.emplace_back(new ControllerEmu::Input(key));
|
||||
|
||||
groups.emplace_back(m_keys5x = new Buttons(_trans("Keys")));
|
||||
groups.emplace_back(m_keys5x = new ControllerEmu::Buttons(_trans("Keys")));
|
||||
for (const char* key : named_keys5)
|
||||
m_keys5x->controls.emplace_back(new ControlGroup::Input(key));
|
||||
m_keys5x->controls.emplace_back(new ControllerEmu::Input(key));
|
||||
|
||||
// options
|
||||
groups.emplace_back(m_options = new ControlGroup(_trans("Options")));
|
||||
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControlGroup::BackgroundInputSetting>(_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(std::make_unique<ControlGroup::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControlGroup::SettingType::VIRTUAL));
|
||||
std::make_unique<ControllerEmu::ControlGroup::BackgroundInputSetting>(
|
||||
_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::ControlGroup::SettingType::VIRTUAL));
|
||||
}
|
||||
|
||||
std::string GCKeyboard::GetName() const
|
||||
@@ -110,7 +117,7 @@ ControllerEmu::ControlGroup* GCKeyboard::GetGroup(KeyboardGroup group)
|
||||
|
||||
KeyboardStatus GCKeyboard::GetInput() const
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
const auto lock = GetStateLock();
|
||||
|
||||
KeyboardStatus kb = {};
|
||||
|
||||
@@ -126,7 +133,7 @@ KeyboardStatus GCKeyboard::GetInput() const
|
||||
|
||||
void GCKeyboard::LoadDefaults(const ControllerInterface& ciface)
|
||||
{
|
||||
ControllerEmu::LoadDefaults(ciface);
|
||||
EmulatedController::LoadDefaults(ciface);
|
||||
|
||||
// Buttons
|
||||
m_keys0x->SetControlExpression(5, "A");
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
|
||||
struct KeyboardStatus;
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class ControlGroup;
|
||||
class Buttons;
|
||||
}
|
||||
|
||||
enum class KeyboardGroup
|
||||
{
|
||||
Kb0x,
|
||||
@@ -22,23 +28,23 @@ enum class KeyboardGroup
|
||||
Options
|
||||
};
|
||||
|
||||
class GCKeyboard : public ControllerEmu
|
||||
class GCKeyboard : public ControllerEmu::EmulatedController
|
||||
{
|
||||
public:
|
||||
explicit GCKeyboard(unsigned int index);
|
||||
KeyboardStatus GetInput() const;
|
||||
std::string GetName() const override;
|
||||
ControlGroup* GetGroup(KeyboardGroup group);
|
||||
ControllerEmu::ControlGroup* GetGroup(KeyboardGroup group);
|
||||
void LoadDefaults(const ControllerInterface& ciface) override;
|
||||
|
||||
private:
|
||||
Buttons* m_keys0x;
|
||||
Buttons* m_keys1x;
|
||||
Buttons* m_keys2x;
|
||||
Buttons* m_keys3x;
|
||||
Buttons* m_keys4x;
|
||||
Buttons* m_keys5x;
|
||||
ControlGroup* m_options;
|
||||
ControllerEmu::Buttons* m_keys0x;
|
||||
ControllerEmu::Buttons* m_keys1x;
|
||||
ControllerEmu::Buttons* m_keys2x;
|
||||
ControllerEmu::Buttons* m_keys3x;
|
||||
ControllerEmu::Buttons* m_keys4x;
|
||||
ControllerEmu::Buttons* m_keys5x;
|
||||
ControllerEmu::ControlGroup* m_options;
|
||||
|
||||
const unsigned int m_index;
|
||||
};
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/HW/GCPad.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Core/HW/GCPad.h"
|
||||
#include "Core/HW/GCPadEmu.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
|
||||
@@ -5,13 +5,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerInterface/Device.h"
|
||||
|
||||
class InputConfig;
|
||||
enum class PadGroup;
|
||||
struct GCPadStatus;
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class ControlGroup;
|
||||
}
|
||||
|
||||
namespace Pad
|
||||
{
|
||||
void Shutdown();
|
||||
|
||||
@@ -3,9 +3,17 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/HW/GCPadEmu.h"
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/Host.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Output.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/AnalogStick.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/MixedTriggers.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
static const u16 button_bitmasks[] = {
|
||||
PAD_BUTTON_A,
|
||||
@@ -39,40 +47,42 @@ static const char* const named_triggers[] = {
|
||||
GCPad::GCPad(const unsigned int index) : m_index(index)
|
||||
{
|
||||
// buttons
|
||||
groups.emplace_back(m_buttons = new Buttons(_trans("Buttons")));
|
||||
groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons")));
|
||||
for (unsigned int i = 0; i < sizeof(named_buttons) / sizeof(*named_buttons); ++i)
|
||||
m_buttons->controls.emplace_back(new ControlGroup::Input(named_buttons[i]));
|
||||
m_buttons->controls.emplace_back(new ControllerEmu::Input(named_buttons[i]));
|
||||
|
||||
// sticks
|
||||
groups.emplace_back(m_main_stick = new AnalogStick("Main Stick", _trans("Control Stick"),
|
||||
DEFAULT_PAD_STICK_RADIUS));
|
||||
groups.emplace_back(m_c_stick =
|
||||
new AnalogStick("C-Stick", _trans("C Stick"), DEFAULT_PAD_STICK_RADIUS));
|
||||
groups.emplace_back(m_main_stick = new ControllerEmu::AnalogStick(
|
||||
"Main Stick", _trans("Control Stick"), DEFAULT_PAD_STICK_RADIUS));
|
||||
groups.emplace_back(m_c_stick = new ControllerEmu::AnalogStick("C-Stick", _trans("C Stick"),
|
||||
DEFAULT_PAD_STICK_RADIUS));
|
||||
|
||||
// triggers
|
||||
groups.emplace_back(m_triggers = new MixedTriggers(_trans("Triggers")));
|
||||
groups.emplace_back(m_triggers = new ControllerEmu::MixedTriggers(_trans("Triggers")));
|
||||
for (auto& named_trigger : named_triggers)
|
||||
m_triggers->controls.emplace_back(new ControlGroup::Input(named_trigger));
|
||||
m_triggers->controls.emplace_back(new ControllerEmu::Input(named_trigger));
|
||||
|
||||
// rumble
|
||||
groups.emplace_back(m_rumble = new ControlGroup(_trans("Rumble")));
|
||||
m_rumble->controls.emplace_back(new ControlGroup::Output(_trans("Motor")));
|
||||
groups.emplace_back(m_rumble = new ControllerEmu::ControlGroup(_trans("Rumble")));
|
||||
m_rumble->controls.emplace_back(new ControllerEmu::Output(_trans("Motor")));
|
||||
|
||||
// Microphone
|
||||
groups.emplace_back(m_mic = new Buttons(_trans("Microphone")));
|
||||
m_mic->controls.emplace_back(new ControlGroup::Input(_trans("Button")));
|
||||
groups.emplace_back(m_mic = new ControllerEmu::Buttons(_trans("Microphone")));
|
||||
m_mic->controls.emplace_back(new ControllerEmu::Input(_trans("Button")));
|
||||
|
||||
// dpad
|
||||
groups.emplace_back(m_dpad = new Buttons(_trans("D-Pad")));
|
||||
groups.emplace_back(m_dpad = new ControllerEmu::Buttons(_trans("D-Pad")));
|
||||
for (auto& named_direction : named_directions)
|
||||
m_dpad->controls.emplace_back(new ControlGroup::Input(named_direction));
|
||||
m_dpad->controls.emplace_back(new ControllerEmu::Input(named_direction));
|
||||
|
||||
// options
|
||||
groups.emplace_back(m_options = new ControlGroup(_trans("Options")));
|
||||
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControlGroup::BackgroundInputSetting>(_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(std::make_unique<ControlGroup::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControlGroup::SettingType::VIRTUAL));
|
||||
std::make_unique<ControllerEmu::ControlGroup::BackgroundInputSetting>(
|
||||
_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::ControlGroup::SettingType::VIRTUAL));
|
||||
}
|
||||
|
||||
std::string GCPad::GetName() const
|
||||
@@ -107,7 +117,7 @@ ControllerEmu::ControlGroup* GCPad::GetGroup(PadGroup group)
|
||||
|
||||
GCPadStatus GCPad::GetInput() const
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
const auto lock = GetStateLock();
|
||||
|
||||
ControlState x, y, triggers[2];
|
||||
GCPadStatus pad = {};
|
||||
@@ -147,13 +157,13 @@ GCPadStatus GCPad::GetInput() const
|
||||
|
||||
void GCPad::SetOutput(const ControlState strength)
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
const auto lock = GetStateLock();
|
||||
m_rumble->controls[0]->control_ref->State(strength);
|
||||
}
|
||||
|
||||
void GCPad::LoadDefaults(const ControllerInterface& ciface)
|
||||
{
|
||||
ControllerEmu::LoadDefaults(ciface);
|
||||
EmulatedController::LoadDefaults(ciface);
|
||||
|
||||
// Buttons
|
||||
m_buttons->SetControlExpression(0, "X"); // A
|
||||
@@ -222,6 +232,6 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
|
||||
|
||||
bool GCPad::GetMicButton() const
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
const auto lock = GetStateLock();
|
||||
return (0.0f != m_mic->controls.back()->control_ref->State());
|
||||
}
|
||||
|
||||
@@ -8,7 +8,15 @@
|
||||
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
|
||||
struct GCPadStatus;
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class AnalogStick;
|
||||
class Buttons;
|
||||
class ControlGroup;
|
||||
class MixedTriggers;
|
||||
}
|
||||
|
||||
enum class PadGroup
|
||||
{
|
||||
@@ -22,7 +30,7 @@ enum class PadGroup
|
||||
Options
|
||||
};
|
||||
|
||||
class GCPad : public ControllerEmu
|
||||
class GCPad : public ControllerEmu::EmulatedController
|
||||
{
|
||||
public:
|
||||
explicit GCPad(unsigned int index);
|
||||
@@ -33,19 +41,19 @@ public:
|
||||
|
||||
std::string GetName() const override;
|
||||
|
||||
ControlGroup* GetGroup(PadGroup group);
|
||||
ControllerEmu::ControlGroup* GetGroup(PadGroup group);
|
||||
|
||||
void LoadDefaults(const ControllerInterface& ciface) override;
|
||||
|
||||
private:
|
||||
Buttons* m_buttons;
|
||||
AnalogStick* m_main_stick;
|
||||
AnalogStick* m_c_stick;
|
||||
Buttons* m_dpad;
|
||||
MixedTriggers* m_triggers;
|
||||
ControlGroup* m_rumble;
|
||||
Buttons* m_mic;
|
||||
ControlGroup* m_options;
|
||||
ControllerEmu::Buttons* m_buttons;
|
||||
ControllerEmu::AnalogStick* m_main_stick;
|
||||
ControllerEmu::AnalogStick* m_c_stick;
|
||||
ControllerEmu::Buttons* m_dpad;
|
||||
ControllerEmu::MixedTriggers* m_triggers;
|
||||
ControllerEmu::ControlGroup* m_rumble;
|
||||
ControllerEmu::Buttons* m_mic;
|
||||
ControllerEmu::ControlGroup* m_options;
|
||||
|
||||
const unsigned int m_index;
|
||||
|
||||
|
||||
@@ -3,10 +3,15 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/HW/Wiimote.h"
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||
#include "Core/Movie.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
|
||||
@@ -6,10 +6,15 @@
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
|
||||
class InputConfig;
|
||||
class PointerWrap;
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class ControlGroup;
|
||||
}
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class WiimoteGroup;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Extension.h"
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
@@ -53,12 +54,14 @@ void Attachment::Reset()
|
||||
}
|
||||
} // namespace WiimoteEmu
|
||||
|
||||
void ControllerEmu::Extension::GetState(u8* const data)
|
||||
namespace ControllerEmu
|
||||
{
|
||||
void Extension::GetState(u8* const data)
|
||||
{
|
||||
((WiimoteEmu::Attachment*)attachments[active_extension].get())->GetState(data);
|
||||
}
|
||||
|
||||
bool ControllerEmu::Extension::IsButtonPressed() const
|
||||
bool Extension::IsButtonPressed() const
|
||||
{
|
||||
// Extension == 0 means no Extension, > 0 means one is connected
|
||||
// Since we want to use this to know if disconnected Wiimotes want to be connected, and
|
||||
@@ -71,3 +74,4 @@ bool ControllerEmu::Extension::IsButtonPressed() const
|
||||
return ((WiimoteEmu::Attachment*)attachments[switch_extension].get())->IsButtonPressed();
|
||||
return false;
|
||||
}
|
||||
} // namespace ControllerEmu
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace WiimoteEmu
|
||||
{
|
||||
struct ExtensionReg;
|
||||
|
||||
class Attachment : public ControllerEmu
|
||||
class Attachment : public ControllerEmu::EmulatedController
|
||||
{
|
||||
public:
|
||||
Attachment(const char* const name, ExtensionReg& reg);
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/AnalogStick.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/MixedTriggers.h"
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
constexpr std::array<u8, 6> classic_id{{0x00, 0x00, 0xa4, 0x20, 0x01, 0x01}};
|
||||
@@ -49,25 +55,25 @@ constexpr std::array<u16, 4> classic_dpad_bitmasks{{
|
||||
Classic::Classic(ExtensionReg& reg) : Attachment(_trans("Classic"), reg)
|
||||
{
|
||||
// buttons
|
||||
groups.emplace_back(m_buttons = new Buttons("Buttons"));
|
||||
groups.emplace_back(m_buttons = new ControllerEmu::Buttons("Buttons"));
|
||||
for (auto& classic_button_name : classic_button_names)
|
||||
m_buttons->controls.emplace_back(new ControlGroup::Input(classic_button_name));
|
||||
m_buttons->controls.emplace_back(new ControllerEmu::Input(classic_button_name));
|
||||
|
||||
// sticks
|
||||
groups.emplace_back(m_left_stick =
|
||||
new AnalogStick(_trans("Left Stick"), DEFAULT_ATTACHMENT_STICK_RADIUS));
|
||||
groups.emplace_back(m_right_stick =
|
||||
new AnalogStick(_trans("Right Stick"), DEFAULT_ATTACHMENT_STICK_RADIUS));
|
||||
groups.emplace_back(m_left_stick = new ControllerEmu::AnalogStick(
|
||||
_trans("Left Stick"), DEFAULT_ATTACHMENT_STICK_RADIUS));
|
||||
groups.emplace_back(m_right_stick = new ControllerEmu::AnalogStick(
|
||||
_trans("Right Stick"), DEFAULT_ATTACHMENT_STICK_RADIUS));
|
||||
|
||||
// triggers
|
||||
groups.emplace_back(m_triggers = new MixedTriggers("Triggers"));
|
||||
groups.emplace_back(m_triggers = new ControllerEmu::MixedTriggers("Triggers"));
|
||||
for (auto& classic_trigger_name : classic_trigger_names)
|
||||
m_triggers->controls.emplace_back(new ControlGroup::Input(classic_trigger_name));
|
||||
m_triggers->controls.emplace_back(new ControllerEmu::Input(classic_trigger_name));
|
||||
|
||||
// dpad
|
||||
groups.emplace_back(m_dpad = new Buttons("D-Pad"));
|
||||
groups.emplace_back(m_dpad = new ControllerEmu::Buttons("D-Pad"));
|
||||
for (auto& named_direction : named_directions)
|
||||
m_dpad->controls.emplace_back(new ControlGroup::Input(named_direction));
|
||||
m_dpad->controls.emplace_back(new ControllerEmu::Input(named_direction));
|
||||
|
||||
// Set up register
|
||||
m_calibration = classic_calibration;
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
|
||||
#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class AnalogStick;
|
||||
class Buttons;
|
||||
class ControlGroup;
|
||||
class MixedTriggers;
|
||||
}
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class ClassicGroup;
|
||||
@@ -18,7 +26,7 @@ public:
|
||||
void GetState(u8* const data) override;
|
||||
bool IsButtonPressed() const override;
|
||||
|
||||
ControlGroup* GetGroup(ClassicGroup group);
|
||||
ControllerEmu::ControlGroup* GetGroup(ClassicGroup group);
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -52,10 +60,10 @@ public:
|
||||
static const u8 RIGHT_TRIGGER_RANGE = 0x1F;
|
||||
|
||||
private:
|
||||
Buttons* m_buttons;
|
||||
MixedTriggers* m_triggers;
|
||||
Buttons* m_dpad;
|
||||
AnalogStick* m_left_stick;
|
||||
AnalogStick* m_right_stick;
|
||||
ControllerEmu::Buttons* m_buttons;
|
||||
ControllerEmu::MixedTriggers* m_triggers;
|
||||
ControllerEmu::Buttons* m_dpad;
|
||||
ControllerEmu::AnalogStick* m_left_stick;
|
||||
ControllerEmu::AnalogStick* m_right_stick;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/AnalogStick.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
constexpr std::array<u8, 6> drums_id{{0x01, 0x00, 0xa4, 0x20, 0x01, 0x03}};
|
||||
@@ -32,17 +36,18 @@ constexpr std::array<u16, 2> drum_button_bitmasks{{
|
||||
Drums::Drums(ExtensionReg& reg) : Attachment(_trans("Drums"), reg)
|
||||
{
|
||||
// pads
|
||||
groups.emplace_back(m_pads = new Buttons(_trans("Pads")));
|
||||
groups.emplace_back(m_pads = new ControllerEmu::Buttons(_trans("Pads")));
|
||||
for (auto& drum_pad_name : drum_pad_names)
|
||||
m_pads->controls.emplace_back(new ControlGroup::Input(drum_pad_name));
|
||||
m_pads->controls.emplace_back(new ControllerEmu::Input(drum_pad_name));
|
||||
|
||||
// stick
|
||||
groups.emplace_back(m_stick = new AnalogStick("Stick", DEFAULT_ATTACHMENT_STICK_RADIUS));
|
||||
groups.emplace_back(m_stick =
|
||||
new ControllerEmu::AnalogStick("Stick", DEFAULT_ATTACHMENT_STICK_RADIUS));
|
||||
|
||||
// buttons
|
||||
groups.emplace_back(m_buttons = new Buttons("Buttons"));
|
||||
m_buttons->controls.emplace_back(new ControlGroup::Input("-"));
|
||||
m_buttons->controls.emplace_back(new ControlGroup::Input("+"));
|
||||
groups.emplace_back(m_buttons = new ControllerEmu::Buttons("Buttons"));
|
||||
m_buttons->controls.emplace_back(new ControllerEmu::Input("-"));
|
||||
m_buttons->controls.emplace_back(new ControllerEmu::Input("+"));
|
||||
|
||||
// set up register
|
||||
m_id = drums_id;
|
||||
|
||||
@@ -6,6 +6,13 @@
|
||||
|
||||
#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class AnalogStick;
|
||||
class Buttons;
|
||||
class ControlGroup;
|
||||
}
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class DrumsGroup;
|
||||
@@ -18,7 +25,7 @@ public:
|
||||
void GetState(u8* const data) override;
|
||||
bool IsButtonPressed() const override;
|
||||
|
||||
ControlGroup* GetGroup(DrumsGroup group);
|
||||
ControllerEmu::ControlGroup* GetGroup(DrumsGroup group);
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -34,8 +41,8 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
Buttons* m_buttons;
|
||||
Buttons* m_pads;
|
||||
AnalogStick* m_stick;
|
||||
ControllerEmu::Buttons* m_buttons;
|
||||
ControllerEmu::Buttons* m_pads;
|
||||
ControllerEmu::AnalogStick* m_stick;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/AnalogStick.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Triggers.h"
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
constexpr std::array<u8, 6> guitar_id{{0x00, 0x00, 0xa4, 0x20, 0x01, 0x03}};
|
||||
@@ -35,26 +41,27 @@ constexpr std::array<u16, 2> guitar_strum_bitmasks{{
|
||||
Guitar::Guitar(ExtensionReg& reg) : Attachment(_trans("Guitar"), reg)
|
||||
{
|
||||
// frets
|
||||
groups.emplace_back(m_frets = new Buttons(_trans("Frets")));
|
||||
groups.emplace_back(m_frets = new ControllerEmu::Buttons(_trans("Frets")));
|
||||
for (auto& guitar_fret_name : guitar_fret_names)
|
||||
m_frets->controls.emplace_back(new ControlGroup::Input(guitar_fret_name));
|
||||
m_frets->controls.emplace_back(new ControllerEmu::Input(guitar_fret_name));
|
||||
|
||||
// strum
|
||||
groups.emplace_back(m_strum = new Buttons(_trans("Strum")));
|
||||
m_strum->controls.emplace_back(new ControlGroup::Input("Up"));
|
||||
m_strum->controls.emplace_back(new ControlGroup::Input("Down"));
|
||||
groups.emplace_back(m_strum = new ControllerEmu::Buttons(_trans("Strum")));
|
||||
m_strum->controls.emplace_back(new ControllerEmu::Input("Up"));
|
||||
m_strum->controls.emplace_back(new ControllerEmu::Input("Down"));
|
||||
|
||||
// buttons
|
||||
groups.emplace_back(m_buttons = new Buttons("Buttons"));
|
||||
m_buttons->controls.emplace_back(new ControlGroup::Input("-"));
|
||||
m_buttons->controls.emplace_back(new ControlGroup::Input("+"));
|
||||
groups.emplace_back(m_buttons = new ControllerEmu::Buttons("Buttons"));
|
||||
m_buttons->controls.emplace_back(new ControllerEmu::Input("-"));
|
||||
m_buttons->controls.emplace_back(new ControllerEmu::Input("+"));
|
||||
|
||||
// stick
|
||||
groups.emplace_back(m_stick = new AnalogStick(_trans("Stick"), DEFAULT_ATTACHMENT_STICK_RADIUS));
|
||||
groups.emplace_back(
|
||||
m_stick = new ControllerEmu::AnalogStick(_trans("Stick"), DEFAULT_ATTACHMENT_STICK_RADIUS));
|
||||
|
||||
// whammy
|
||||
groups.emplace_back(m_whammy = new Triggers(_trans("Whammy")));
|
||||
m_whammy->controls.emplace_back(new ControlGroup::Input(_trans("Bar")));
|
||||
groups.emplace_back(m_whammy = new ControllerEmu::Triggers(_trans("Whammy")));
|
||||
m_whammy->controls.emplace_back(new ControllerEmu::Input(_trans("Bar")));
|
||||
|
||||
// set up register
|
||||
m_id = guitar_id;
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
|
||||
#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class AnalogStick;
|
||||
class Buttons;
|
||||
class ControlGroup;
|
||||
class Triggers;
|
||||
}
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class GuitarGroup;
|
||||
@@ -18,7 +26,7 @@ public:
|
||||
void GetState(u8* const data) override;
|
||||
bool IsButtonPressed() const override;
|
||||
|
||||
ControlGroup* GetGroup(GuitarGroup group);
|
||||
ControllerEmu::ControlGroup* GetGroup(GuitarGroup group);
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -35,10 +43,10 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
Buttons* m_buttons;
|
||||
Buttons* m_frets;
|
||||
Buttons* m_strum;
|
||||
Triggers* m_whammy;
|
||||
AnalogStick* m_stick;
|
||||
ControllerEmu::Buttons* m_buttons;
|
||||
ControllerEmu::Buttons* m_frets;
|
||||
ControllerEmu::Buttons* m_strum;
|
||||
ControllerEmu::Triggers* m_whammy;
|
||||
ControllerEmu::AnalogStick* m_stick;
|
||||
};
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user