mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #4461 from aldelaro5/hotkey-config-redo
Redo every input configuration dialog
This commit is contained in:
@@ -44,6 +44,11 @@ void LoadConfig()
|
||||
s_config.LoadConfig(true);
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GetGroup(int port, KeyboardGroup group)
|
||||
{
|
||||
return static_cast<GCKeyboard*>(s_config.GetController(port))->GetGroup(group);
|
||||
}
|
||||
|
||||
KeyboardStatus GetStatus(int port)
|
||||
{
|
||||
return static_cast<GCKeyboard*>(s_config.GetController(port))->GetInput();
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "InputCommon/ControllerEmu.h"
|
||||
|
||||
class InputConfig;
|
||||
enum class KeyboardGroup;
|
||||
struct KeyboardStatus;
|
||||
|
||||
namespace Keyboard
|
||||
@@ -16,6 +18,7 @@ void Initialize();
|
||||
void LoadConfig();
|
||||
|
||||
InputConfig* GetConfig();
|
||||
ControllerEmu::ControlGroup* GetGroup(int port, KeyboardGroup group);
|
||||
|
||||
KeyboardStatus GetStatus(int port);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "Core/HW/GCKeyboardEmu.h"
|
||||
#include "Common/Common.h"
|
||||
#include "InputCommon/ControllerEmu.h"
|
||||
#include "InputCommon/KeyboardStatus.h"
|
||||
|
||||
static const u16 keys0_bitmasks[] = {KEYMASK_HOME, KEYMASK_END, KEYMASK_PGUP, KEYMASK_PGDN,
|
||||
@@ -84,6 +85,29 @@ std::string GCKeyboard::GetName() const
|
||||
return std::string("GCKeyboard") + char('1' + m_index);
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GCKeyboard::GetGroup(KeyboardGroup group)
|
||||
{
|
||||
switch (group)
|
||||
{
|
||||
case KeyboardGroup::Kb0x:
|
||||
return m_keys0x;
|
||||
case KeyboardGroup::Kb1x:
|
||||
return m_keys1x;
|
||||
case KeyboardGroup::Kb2x:
|
||||
return m_keys2x;
|
||||
case KeyboardGroup::Kb3x:
|
||||
return m_keys3x;
|
||||
case KeyboardGroup::Kb4x:
|
||||
return m_keys4x;
|
||||
case KeyboardGroup::Kb5x:
|
||||
return m_keys5x;
|
||||
case KeyboardGroup::Options:
|
||||
return m_options;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
KeyboardStatus GCKeyboard::GetInput() const
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
|
||||
@@ -10,12 +10,25 @@
|
||||
|
||||
struct KeyboardStatus;
|
||||
|
||||
enum class KeyboardGroup
|
||||
{
|
||||
Kb0x,
|
||||
Kb1x,
|
||||
Kb2x,
|
||||
Kb3x,
|
||||
Kb4x,
|
||||
Kb5x,
|
||||
|
||||
Options
|
||||
};
|
||||
|
||||
class GCKeyboard : public ControllerEmu
|
||||
{
|
||||
public:
|
||||
GCKeyboard(const unsigned int index);
|
||||
KeyboardStatus GetInput() const;
|
||||
std::string GetName() const override;
|
||||
ControlGroup* GetGroup(KeyboardGroup group);
|
||||
void LoadDefaults(const ControllerInterface& ciface) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/HW/GCPad.h"
|
||||
#include "Core/HW/GCPadEmu.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
@@ -48,6 +47,11 @@ GCPadStatus GetStatus(int pad_num)
|
||||
return static_cast<GCPad*>(s_config.GetController(pad_num))->GetInput();
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GetGroup(int pad_num, PadGroup group)
|
||||
{
|
||||
return static_cast<GCPad*>(s_config.GetController(pad_num))->GetGroup(group);
|
||||
}
|
||||
|
||||
void Rumble(const int pad_num, const ControlState strength)
|
||||
{
|
||||
static_cast<GCPad*>(s_config.GetController(pad_num))->SetOutput(strength);
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "InputCommon/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerInterface/Device.h"
|
||||
|
||||
class InputConfig;
|
||||
enum class PadGroup;
|
||||
struct GCPadStatus;
|
||||
|
||||
namespace Pad
|
||||
@@ -19,6 +21,7 @@ void LoadConfig();
|
||||
InputConfig* GetConfig();
|
||||
|
||||
GCPadStatus GetStatus(int pad_num);
|
||||
ControllerEmu::ControlGroup* GetGroup(int pad_num, PadGroup group);
|
||||
void Rumble(int pad_num, ControlState strength);
|
||||
|
||||
bool GetMicButton(int pad_num);
|
||||
|
||||
@@ -79,6 +79,29 @@ std::string GCPad::GetName() const
|
||||
return std::string("GCPad") + char('1' + m_index);
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GCPad::GetGroup(PadGroup group)
|
||||
{
|
||||
switch (group)
|
||||
{
|
||||
case PadGroup::Buttons:
|
||||
return m_buttons;
|
||||
case PadGroup::MainStick:
|
||||
return m_main_stick;
|
||||
case PadGroup::CStick:
|
||||
return m_c_stick;
|
||||
case PadGroup::DPad:
|
||||
return m_dpad;
|
||||
case PadGroup::Triggers:
|
||||
return m_triggers;
|
||||
case PadGroup::Rumble:
|
||||
return m_rumble;
|
||||
case PadGroup::Options:
|
||||
return m_options;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
GCPadStatus GCPad::GetInput() const
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
|
||||
@@ -8,6 +8,19 @@
|
||||
|
||||
#include "InputCommon/ControllerEmu.h"
|
||||
|
||||
class ControlGroup;
|
||||
|
||||
enum class PadGroup
|
||||
{
|
||||
Buttons,
|
||||
MainStick,
|
||||
CStick,
|
||||
DPad,
|
||||
Triggers,
|
||||
Rumble,
|
||||
Options
|
||||
};
|
||||
|
||||
class GCPad : public ControllerEmu
|
||||
{
|
||||
public:
|
||||
@@ -19,6 +32,8 @@ public:
|
||||
|
||||
std::string GetName() const override;
|
||||
|
||||
ControlGroup* GetGroup(PadGroup group);
|
||||
|
||||
void LoadDefaults(const ControllerInterface& ciface) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -19,6 +19,37 @@ InputConfig* GetConfig()
|
||||
return &s_config;
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GetWiimoteGroup(int number, WiimoteEmu::WiimoteGroup group)
|
||||
{
|
||||
return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetWiimoteGroup(group);
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GetNunchukGroup(int number, WiimoteEmu::NunchukGroup group)
|
||||
{
|
||||
return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetNunchukGroup(group);
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GetClassicGroup(int number, WiimoteEmu::ClassicGroup group)
|
||||
{
|
||||
return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetClassicGroup(group);
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GetGuitarGroup(int number, WiimoteEmu::GuitarGroup group)
|
||||
{
|
||||
return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetGuitarGroup(group);
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GetDrumsGroup(int number, WiimoteEmu::DrumsGroup group)
|
||||
{
|
||||
return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetDrumsGroup(group);
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GetTurntableGroup(int number, WiimoteEmu::TurntableGroup group)
|
||||
{
|
||||
return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))
|
||||
->GetTurntableGroup(group);
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
s_config.ClearControllers();
|
||||
|
||||
@@ -6,9 +6,19 @@
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "InputCommon/ControllerEmu.h"
|
||||
|
||||
class InputConfig;
|
||||
class PointerWrap;
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class WiimoteGroup;
|
||||
enum class NunchukGroup;
|
||||
enum class ClassicGroup;
|
||||
enum class GuitarGroup;
|
||||
enum class DrumsGroup;
|
||||
enum class TurntableGroup;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -52,6 +62,12 @@ unsigned int GetAttached();
|
||||
void DoState(PointerWrap& p);
|
||||
void EmuStateChange(EMUSTATE_CHANGE newState);
|
||||
InputConfig* GetConfig();
|
||||
ControllerEmu::ControlGroup* GetWiimoteGroup(int number, WiimoteEmu::WiimoteGroup group);
|
||||
ControllerEmu::ControlGroup* GetNunchukGroup(int number, WiimoteEmu::NunchukGroup group);
|
||||
ControllerEmu::ControlGroup* GetClassicGroup(int number, WiimoteEmu::ClassicGroup group);
|
||||
ControllerEmu::ControlGroup* GetGuitarGroup(int number, WiimoteEmu::GuitarGroup group);
|
||||
ControllerEmu::ControlGroup* GetDrumsGroup(int number, WiimoteEmu::DrumsGroup group);
|
||||
ControllerEmu::ControlGroup* GetTurntableGroup(int number, WiimoteEmu::TurntableGroup group);
|
||||
|
||||
void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
void InterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/Common.h"
|
||||
@@ -134,4 +135,24 @@ bool Classic::IsButtonPressed() const
|
||||
m_triggers->GetState(&buttons, classic_trigger_bitmasks, trigs);
|
||||
return buttons != 0;
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* Classic::GetGroup(ClassicGroup group)
|
||||
{
|
||||
switch (group)
|
||||
{
|
||||
case ClassicGroup::Buttons:
|
||||
return m_buttons;
|
||||
case ClassicGroup::Triggers:
|
||||
return m_triggers;
|
||||
case ClassicGroup::DPad:
|
||||
return m_dpad;
|
||||
case ClassicGroup::LeftStick:
|
||||
return m_left_stick;
|
||||
case ClassicGroup::RightStick:
|
||||
return m_right_stick;
|
||||
default:
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class ClassicGroup;
|
||||
struct ExtensionReg;
|
||||
|
||||
class Classic : public Attachment
|
||||
@@ -17,6 +18,8 @@ public:
|
||||
void GetState(u8* const data) override;
|
||||
bool IsButtonPressed() const override;
|
||||
|
||||
ControlGroup* GetGroup(ClassicGroup group);
|
||||
|
||||
enum
|
||||
{
|
||||
PAD_RIGHT = 0x80,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/Common.h"
|
||||
@@ -81,4 +82,20 @@ bool Drums::IsButtonPressed() const
|
||||
m_pads->GetState(&buttons, drum_pad_bitmasks);
|
||||
return buttons != 0;
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* Drums::GetGroup(DrumsGroup group)
|
||||
{
|
||||
switch (group)
|
||||
{
|
||||
case DrumsGroup::Buttons:
|
||||
return m_buttons;
|
||||
case DrumsGroup::Pads:
|
||||
return m_pads;
|
||||
case DrumsGroup::Stick:
|
||||
return m_stick;
|
||||
default:
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class DrumsGroup;
|
||||
struct ExtensionReg;
|
||||
|
||||
class Drums : public Attachment
|
||||
@@ -17,6 +18,8 @@ public:
|
||||
void GetState(u8* const data) override;
|
||||
bool IsButtonPressed() const override;
|
||||
|
||||
ControlGroup* GetGroup(DrumsGroup group);
|
||||
|
||||
enum
|
||||
{
|
||||
BUTTON_PLUS = 0x04,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/Common.h"
|
||||
@@ -102,4 +103,24 @@ bool Guitar::IsButtonPressed() const
|
||||
m_strum->GetState(&buttons, guitar_strum_bitmasks);
|
||||
return buttons != 0;
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* Guitar::GetGroup(GuitarGroup group)
|
||||
{
|
||||
switch (group)
|
||||
{
|
||||
case GuitarGroup::Buttons:
|
||||
return m_buttons;
|
||||
case GuitarGroup::Frets:
|
||||
return m_frets;
|
||||
case GuitarGroup::Strum:
|
||||
return m_strum;
|
||||
case GuitarGroup::Whammy:
|
||||
return m_whammy;
|
||||
case GuitarGroup::Stick:
|
||||
return m_stick;
|
||||
default:
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class GuitarGroup;
|
||||
struct ExtensionReg;
|
||||
|
||||
class Guitar : public Attachment
|
||||
@@ -17,6 +18,8 @@ public:
|
||||
void GetState(u8* const data) override;
|
||||
bool IsButtonPressed() const override;
|
||||
|
||||
ControlGroup* GetGroup(GuitarGroup group);
|
||||
|
||||
enum
|
||||
{
|
||||
BUTTON_PLUS = 0x04,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/Common.h"
|
||||
@@ -114,6 +115,26 @@ bool Nunchuk::IsButtonPressed() const
|
||||
return buttons != 0;
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* Nunchuk::GetGroup(NunchukGroup group)
|
||||
{
|
||||
switch (group)
|
||||
{
|
||||
case NunchukGroup::Buttons:
|
||||
return m_buttons;
|
||||
case NunchukGroup::Stick:
|
||||
return m_stick;
|
||||
case NunchukGroup::Tilt:
|
||||
return m_tilt;
|
||||
case NunchukGroup::Swing:
|
||||
return m_swing;
|
||||
case NunchukGroup::Shake:
|
||||
return m_shake;
|
||||
default:
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Nunchuk::LoadDefaults(const ControllerInterface& ciface)
|
||||
{
|
||||
// Stick
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class NunchukGroup;
|
||||
struct ExtensionReg;
|
||||
|
||||
class Nunchuk : public Attachment
|
||||
@@ -18,6 +19,8 @@ public:
|
||||
void GetState(u8* const data) override;
|
||||
bool IsButtonPressed() const override;
|
||||
|
||||
ControlGroup* GetGroup(NunchukGroup group);
|
||||
|
||||
enum
|
||||
{
|
||||
BUTTON_C = 0x02,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/Common.h"
|
||||
@@ -131,4 +132,26 @@ bool Turntable::IsButtonPressed() const
|
||||
m_buttons->GetState(&buttons, turntable_button_bitmasks);
|
||||
return buttons != 0;
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* Turntable::GetGroup(TurntableGroup group)
|
||||
{
|
||||
switch (group)
|
||||
{
|
||||
case TurntableGroup::Buttons:
|
||||
return m_buttons;
|
||||
case TurntableGroup::Stick:
|
||||
return m_stick;
|
||||
case TurntableGroup::EffectDial:
|
||||
return m_effect_dial;
|
||||
case TurntableGroup::LeftTable:
|
||||
return m_left_table;
|
||||
case TurntableGroup::RightTable:
|
||||
return m_right_table;
|
||||
case TurntableGroup::Crossfade:
|
||||
return m_crossfade;
|
||||
default:
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
enum class TurntableGroup;
|
||||
struct ExtensionReg;
|
||||
|
||||
class Turntable : public Attachment
|
||||
@@ -17,6 +18,8 @@ public:
|
||||
void GetState(u8* const data) override;
|
||||
bool IsButtonPressed() const override;
|
||||
|
||||
ControlGroup* GetGroup(TurntableGroup group);
|
||||
|
||||
enum
|
||||
{
|
||||
BUTTON_EUPHORIA = 0x1000,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user