Merge pull request #4461 from aldelaro5/hotkey-config-redo

Redo every input configuration dialog
This commit is contained in:
Mat M 2016-11-29 07:39:28 -05:00 committed by GitHub
commit eebe4ef1fd
53 changed files with 1724 additions and 331 deletions

View File

@ -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();

View File

@ -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);
}

View File

@ -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();

View File

@ -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:

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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:

View File

@ -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();

View File

@ -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);

View File

@ -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;
}
}
}

View File

@ -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,

View File

@ -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;
}
}
}

View File

@ -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,

View File

@ -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;
}
}
}

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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;
}
}
}

View File

@ -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,

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <cassert>
#include <cmath>
#include <cstring>
@ -315,6 +316,61 @@ std::string Wiimote::GetName() const
return std::string("Wiimote") + char('1' + m_index);
}
ControllerEmu::ControlGroup* Wiimote::GetWiimoteGroup(WiimoteGroup group)
{
switch (group)
{
case WiimoteGroup::Buttons:
return m_buttons;
case WiimoteGroup::DPad:
return m_dpad;
case WiimoteGroup::Shake:
return m_shake;
case WiimoteGroup::IR:
return m_ir;
case WiimoteGroup::Tilt:
return m_tilt;
case WiimoteGroup::Swing:
return m_swing;
case WiimoteGroup::Rumble:
return m_rumble;
case WiimoteGroup::Extension:
return m_extension;
case WiimoteGroup::Options:
return m_options;
case WiimoteGroup::Hotkeys:
return m_hotkeys;
default:
assert(false);
return nullptr;
}
}
ControllerEmu::ControlGroup* Wiimote::GetNunchukGroup(NunchukGroup group)
{
return static_cast<Nunchuk*>(m_extension->attachments[EXT_NUNCHUK].get())->GetGroup(group);
}
ControllerEmu::ControlGroup* Wiimote::GetClassicGroup(ClassicGroup group)
{
return static_cast<Classic*>(m_extension->attachments[EXT_CLASSIC].get())->GetGroup(group);
}
ControllerEmu::ControlGroup* Wiimote::GetGuitarGroup(GuitarGroup group)
{
return static_cast<Guitar*>(m_extension->attachments[EXT_GUITAR].get())->GetGroup(group);
}
ControllerEmu::ControlGroup* Wiimote::GetDrumsGroup(DrumsGroup group)
{
return static_cast<Drums*>(m_extension->attachments[EXT_DRUMS].get())->GetGroup(group);
}
ControllerEmu::ControlGroup* Wiimote::GetTurntableGroup(TurntableGroup group)
{
return static_cast<Turntable*>(m_extension->attachments[EXT_TURNTABLE].get())->GetGroup(group);
}
bool Wiimote::Step()
{
// TODO: change this a bit

View File

@ -26,7 +26,77 @@ class Wiimote;
}
namespace WiimoteEmu
{
enum class WiimoteGroup
{
Buttons,
DPad,
Shake,
IR,
Tilt,
Swing,
Rumble,
Extension,
Options,
Hotkeys
};
enum
{
EXT_NONE,
EXT_NUNCHUK,
EXT_CLASSIC,
EXT_GUITAR,
EXT_DRUMS,
EXT_TURNTABLE
};
enum class NunchukGroup
{
Buttons,
Stick,
Tilt,
Swing,
Shake
};
enum class ClassicGroup
{
Buttons,
Triggers,
DPad,
LeftStick,
RightStick
};
enum class GuitarGroup
{
Buttons,
Frets,
Strum,
Whammy,
Stick
};
enum class DrumsGroup
{
Buttons,
Pads,
Stick
};
enum class TurntableGroup
{
Buttons,
Stick,
EffectDial,
LeftTable,
RightTable,
Crossfade
};
#pragma pack(push, 1)
struct ReportFeatures
{
u8 core, accel, ir, ext, size;
@ -105,6 +175,12 @@ public:
Wiimote(const unsigned int index);
std::string GetName() const override;
ControlGroup* GetWiimoteGroup(WiimoteGroup group);
ControlGroup* GetNunchukGroup(NunchukGroup group);
ControllerEmu::ControlGroup* GetClassicGroup(ClassicGroup group);
ControllerEmu::ControlGroup* GetGuitarGroup(GuitarGroup group);
ControllerEmu::ControlGroup* GetDrumsGroup(DrumsGroup group);
ControllerEmu::ControlGroup* GetTurntableGroup(TurntableGroup group);
void Update();
void InterruptChannel(const u16 _channelID, const void* _pData, u32 _Size);

View File

@ -13,10 +13,21 @@ const std::string hotkey_labels[] = {
_trans("Open"),
_trans("Change Disc"),
_trans("Refresh List"),
_trans("Toggle Pause"),
_trans("Stop"),
_trans("Reset"),
_trans("Toggle Fullscreen"),
_trans("Take Screenshot"),
_trans("Exit"),
_trans("Volume Down"),
_trans("Volume Up"),
_trans("Volume Toggle Mute"),
_trans("Decrease Emulation Speed"),
_trans("Increase Emulation Speed"),
_trans("Disable Emulation Speed Limit"),
_trans("Frame Advance"),
_trans("Frame Advance Decrease Speed"),
_trans("Frame Advance Increase Speed"),
@ -27,10 +38,6 @@ const std::string hotkey_labels[] = {
_trans("Export Recording"),
_trans("Read-only mode"),
_trans("Toggle Fullscreen"),
_trans("Take Screenshot"),
_trans("Exit"),
_trans("Press Sync Button"),
_trans("Connect Wii Remote 1"),
_trans("Connect Wii Remote 2"),
@ -38,21 +45,14 @@ const std::string hotkey_labels[] = {
_trans("Connect Wii Remote 4"),
_trans("Connect Balance Board"),
_trans("Volume Down"),
_trans("Volume Up"),
_trans("Volume Toggle Mute"),
_trans("Increase IR"),
_trans("Decrease IR"),
_trans("Toggle Crop"),
_trans("Toggle Aspect Ratio"),
_trans("Toggle EFB Copies"),
_trans("Toggle Fog"),
_trans("Disable Emulation Speed Limit"),
_trans("Toggle Custom Textures"),
_trans("Decrease Emulation Speed"),
_trans("Increase Emulation Speed"),
_trans("Increase IR"),
_trans("Decrease IR"),
_trans("Freelook Decrease Speed"),
_trans("Freelook Increase Speed"),
@ -69,7 +69,6 @@ const std::string hotkey_labels[] = {
_trans("Toggle 3D Top-bottom"),
_trans("Toggle 3D Anaglyph"),
_trans("Toggle 3D Vision"),
_trans("Decrease Depth"),
_trans("Increase Depth"),
_trans("Decrease Convergence"),
@ -107,7 +106,6 @@ const std::string hotkey_labels[] = {
_trans("Select State Slot 8"),
_trans("Select State Slot 9"),
_trans("Select State Slot 10"),
_trans("Save to selected slot"),
_trans("Load from selected slot"),
@ -133,7 +131,7 @@ static_assert(NUM_HOTKEYS == sizeof(hotkey_labels) / sizeof(hotkey_labels[0]),
namespace HotkeyManagerEmu
{
static u32 s_hotkeyDown[(NUM_HOTKEYS + 31) / 32];
static u32 s_hotkeyDown[NUM_HOTKEY_GROUPS];
static HotkeyStatus s_hotkey;
static bool s_enabled;
@ -162,20 +160,21 @@ void Enable(bool enable_toggle)
s_enabled = enable_toggle;
}
bool IsPressed(int Id, bool held)
bool IsPressed(int id, bool held)
{
unsigned int set = Id / 32;
unsigned int setKey = Id % 32;
if (s_hotkey.button[set] & (1 << setKey))
unsigned int group = static_cast<HotkeyManager*>(s_config.GetController(0))->FindGroupByID(id);
unsigned int group_key =
static_cast<HotkeyManager*>(s_config.GetController(0))->GetIndexForGroup(group, id);
if (s_hotkey.button[group] & (1 << group_key))
{
bool pressed = !!(s_hotkeyDown[set] & (1 << setKey));
s_hotkeyDown[set] |= (1 << setKey);
bool pressed = !!(s_hotkeyDown[group] & (1 << group_key));
s_hotkeyDown[group] |= (1 << group_key);
if (!pressed || held)
return true;
}
else
{
s_hotkeyDown[set] &= ~(1 << setKey);
s_hotkeyDown[group] &= ~(1 << group_key);
}
return false;
@ -202,22 +201,50 @@ void LoadConfig()
s_config.LoadConfig(true);
}
ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group)
{
return static_cast<HotkeyManager*>(s_config.GetController(0))->GetHotkeyGroup(group);
}
ControllerEmu::ControlGroup* GetOptionsGroup()
{
return static_cast<HotkeyManager*>(s_config.GetController(0))->GetOptionsGroup();
}
void Shutdown()
{
s_config.ClearControllers();
}
}
const std::array<HotkeyGroupInfo, NUM_HOTKEY_GROUPS> groups_info = {
{{"General", HK_OPEN, HK_EXIT},
{"Volume", HK_VOLUME_DOWN, HK_VOLUME_TOGGLE_MUTE},
{"Emulation speed", HK_DECREASE_EMULATION_SPEED, HK_TOGGLE_THROTTLE},
{"Frame advance", HK_FRAME_ADVANCE, HK_FRAME_ADVANCE_RESET_SPEED},
{"Movie", HK_START_RECORDING, HK_READ_ONLY_MODE},
{"Wii", HK_TRIGGER_SYNC_BUTTON, HK_BALANCEBOARD_CONNECT},
{"Graphics toggles", HK_TOGGLE_CROP, HK_TOGGLE_TEXTURES},
{"Internal Resolution", HK_INCREASE_IR, HK_DECREASE_IR},
{"Freelook", HK_FREELOOK_DECREASE_SPEED, HK_FREELOOK_RESET},
{"3D", HK_TOGGLE_STEREO_SBS, HK_TOGGLE_STEREO_3DVISION},
{"3D depth", HK_DECREASE_DEPTH, HK_INCREASE_CONVERGENCE},
{"Load state", HK_LOAD_STATE_SLOT_1, HK_LOAD_STATE_SLOT_SELECTED},
{"Save state", HK_SAVE_STATE_SLOT_1, HK_SAVE_STATE_SLOT_SELECTED},
{"Select state", HK_SELECT_STATE_SLOT_1, HK_SELECT_STATE_SLOT_10},
{"Load last state", HK_LOAD_LAST_STATE_1, HK_LOAD_LAST_STATE_10},
{"Other state hotkeys", HK_SAVE_FIRST_STATE, HK_LOAD_STATE_FILE}}};
HotkeyManager::HotkeyManager()
{
for (int key = 0; key < NUM_HOTKEYS; key++)
for (int group = 0; group < NUM_HOTKEY_GROUPS; group++)
{
int set = key / 32;
if (key % 32 == 0)
groups.emplace_back(m_keys[set] = new Buttons(_trans("Keys")));
m_keys[set]->controls.emplace_back(new ControlGroup::Input(hotkey_labels[key]));
m_hotkey_groups[group] = (m_keys[group] = new Buttons("Keys", _trans(groups_info[group].name)));
groups.emplace_back(m_hotkey_groups[group]);
for (int key = groups_info[group].first; key <= groups_info[group].last; key++)
{
m_keys[group]->controls.emplace_back(new ControlGroup::Input(hotkey_labels[key]));
}
}
groups.emplace_back(m_options = new ControlGroup(_trans("Options")));
@ -239,17 +266,41 @@ std::string HotkeyManager::GetName() const
void HotkeyManager::GetInput(HotkeyStatus* const kb)
{
auto lock = ControllerEmu::GetStateLock();
for (int set = 0; set < (NUM_HOTKEYS + 31) / 32; set++)
for (int group = 0; group < NUM_HOTKEY_GROUPS; group++)
{
std::vector<u32> bitmasks;
for (int key = 0; key < std::min(32, NUM_HOTKEYS - set * 32); key++)
bitmasks.push_back(1 << key);
const int group_count = (groups_info[group].last - groups_info[group].first) + 1;
std::vector<u32> bitmasks(group_count);
for (size_t key = 0; key < bitmasks.size(); key++)
bitmasks[key] = static_cast<u32>(1 << key);
kb->button[set] = 0;
m_keys[set]->GetState(&kb->button[set], bitmasks.data());
kb->button[group] = 0;
m_keys[group]->GetState(&kb->button[group], bitmasks.data());
}
}
ControllerEmu::ControlGroup* HotkeyManager::GetHotkeyGroup(HotkeyGroup group) const
{
return m_hotkey_groups[group];
}
ControllerEmu::ControlGroup* HotkeyManager::GetOptionsGroup() const
{
return m_options;
}
int HotkeyManager::FindGroupByID(int id) const
{
const auto i = std::find_if(groups_info.begin(), groups_info.end(),
[id](const auto& entry) { return entry.last >= id; });
return static_cast<int>(std::distance(groups_info.begin(), i));
}
int HotkeyManager::GetIndexForGroup(int group, int id) const
{
return id - groups_info[group].first;
}
void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
{
ControllerEmu::LoadDefaults(ciface);
@ -267,7 +318,9 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
#endif
auto set_key_expression = [this](int index, const std::string& expression) {
m_keys[index / 32]->controls[index % 32]->control_ref->expression = expression;
m_keys[FindGroupByID(index)]
->controls[GetIndexForGroup(FindGroupByID(index), index)]
->control_ref->expression = expression;
};
// General hotkeys

View File

@ -4,7 +4,9 @@
#pragma once
#include <array>
#include <string>
#include "InputCommon/ControllerEmu.h"
#include "InputCommon/InputConfig.h"
@ -13,10 +15,21 @@ enum Hotkey
HK_OPEN,
HK_CHANGE_DISC,
HK_REFRESH_LIST,
HK_PLAY_PAUSE,
HK_STOP,
HK_RESET,
HK_FULLSCREEN,
HK_SCREENSHOT,
HK_EXIT,
HK_VOLUME_DOWN,
HK_VOLUME_UP,
HK_VOLUME_TOGGLE_MUTE,
HK_DECREASE_EMULATION_SPEED,
HK_INCREASE_EMULATION_SPEED,
HK_TOGGLE_THROTTLE,
HK_FRAME_ADVANCE,
HK_FRAME_ADVANCE_DECREASE_SPEED,
HK_FRAME_ADVANCE_INCREASE_SPEED,
@ -27,10 +40,6 @@ enum Hotkey
HK_EXPORT_RECORDING,
HK_READ_ONLY_MODE,
HK_FULLSCREEN,
HK_SCREENSHOT,
HK_EXIT,
HK_TRIGGER_SYNC_BUTTON,
HK_WIIMOTE1_CONNECT,
HK_WIIMOTE2_CONNECT,
@ -38,22 +47,14 @@ enum Hotkey
HK_WIIMOTE4_CONNECT,
HK_BALANCEBOARD_CONNECT,
HK_VOLUME_DOWN,
HK_VOLUME_UP,
HK_VOLUME_TOGGLE_MUTE,
HK_INCREASE_IR,
HK_DECREASE_IR,
HK_TOGGLE_CROP,
HK_TOGGLE_AR,
HK_TOGGLE_EFBCOPIES,
HK_TOGGLE_FOG,
HK_TOGGLE_THROTTLE,
HK_TOGGLE_TEXTURES,
HK_DECREASE_EMULATION_SPEED,
HK_INCREASE_EMULATION_SPEED,
HK_INCREASE_IR,
HK_DECREASE_IR,
HK_FREELOOK_DECREASE_SPEED,
HK_FREELOOK_INCREASE_SPEED,
@ -86,6 +87,7 @@ enum Hotkey
HK_LOAD_STATE_SLOT_8,
HK_LOAD_STATE_SLOT_9,
HK_LOAD_STATE_SLOT_10,
HK_LOAD_STATE_SLOT_SELECTED,
HK_SAVE_STATE_SLOT_1,
HK_SAVE_STATE_SLOT_2,
@ -97,6 +99,7 @@ enum Hotkey
HK_SAVE_STATE_SLOT_8,
HK_SAVE_STATE_SLOT_9,
HK_SAVE_STATE_SLOT_10,
HK_SAVE_STATE_SLOT_SELECTED,
HK_SELECT_STATE_SLOT_1,
HK_SELECT_STATE_SLOT_2,
@ -109,9 +112,6 @@ enum Hotkey
HK_SELECT_STATE_SLOT_9,
HK_SELECT_STATE_SLOT_10,
HK_SAVE_STATE_SLOT_SELECTED,
HK_LOAD_STATE_SLOT_SELECTED,
HK_LOAD_LAST_STATE_1,
HK_LOAD_LAST_STATE_2,
HK_LOAD_LAST_STATE_3,
@ -132,9 +132,38 @@ enum Hotkey
NUM_HOTKEYS,
};
enum HotkeyGroup : int
{
HKGP_GENERAL,
HKGP_VOLUME,
HKGP_SPEED,
HKGP_FRANE_ADVANCE,
HKGP_MOVIE,
HKGP_WII,
HKGP_GRAPHICS_TOGGLES,
HKGP_IR,
HKGP_FREELOOK,
HKGP_3D_TOGGLE,
HKGP_3D_DEPTH,
HKGP_LOAD_STATE,
HKGP_SAVE_STATE,
HKGP_SELECT_STATE,
HKGP_LOAD_LAST_STATE,
HKGP_STATE_MISC,
NUM_HOTKEY_GROUPS,
};
struct HotkeyGroupInfo
{
std::string name;
Hotkey first;
Hotkey last;
};
struct HotkeyStatus
{
u32 button[(NUM_HOTKEYS + 31) / 32];
u32 button[NUM_HOTKEY_GROUPS];
s8 err;
};
@ -146,10 +175,15 @@ public:
void GetInput(HotkeyStatus* const hk);
std::string GetName() const override;
ControlGroup* GetHotkeyGroup(HotkeyGroup group) const;
ControlGroup* GetOptionsGroup() const;
int FindGroupByID(int id) const;
int GetIndexForGroup(int group, int id) const;
void LoadDefaults(const ControllerInterface& ciface) override;
private:
Buttons* m_keys[(NUM_HOTKEYS + 31) / 32];
Buttons* m_keys[NUM_HOTKEY_GROUPS];
std::array<ControlGroup*, NUM_HOTKEY_GROUPS> m_hotkey_groups;
ControlGroup* m_options;
};
@ -160,6 +194,8 @@ void Shutdown();
void LoadConfig();
InputConfig* GetConfig();
ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group);
ControllerEmu::ControlGroup* GetOptionsGroup();
void GetStatus();
bool IsEnabled();
void Enable(bool enable_toggle);

View File

@ -40,6 +40,17 @@ set(GUI_SRCS
NetPlay/NetPlaySetupFrame.cpp
NetPlay/NetWindow.cpp
NetPlay/PadMapDialog.cpp
Input/InputConfigDiag.cpp
Input/InputConfigDiagBitmaps.cpp
Input/HotkeyInputConfigDiag.cpp
Input/GCPadInputConfigDiag.cpp
Input/GCKeyboardInputConfigDiag.cpp
Input/WiimoteInputConfigDiag.cpp
Input/NunchukInputConfigDiag.cpp
Input/ClassicInputConfigDiag.cpp
Input/GuitarInputConfigDiag.cpp
Input/DrumsInputConfigDiag.cpp
Input/TurntableInputConfigDiag.cpp
DolphinSlider.cpp
FifoPlayerDlg.cpp
Frame.cpp
@ -48,8 +59,6 @@ set(GUI_SRCS
GameListCtrl.cpp
ISOFile.cpp
ISOProperties.cpp
InputConfigDiag.cpp
InputConfigDiagBitmaps.cpp
LogConfigWindow.cpp
LogWindow.cpp
Main.cpp

View File

@ -24,7 +24,7 @@
#include "Core/HotkeyManager.h"
#include "DolphinWX/Config/InterfaceConfigPane.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/WxUtils.h"
#if defined(HAVE_XRANDR) && HAVE_XRANDR

View File

@ -33,7 +33,10 @@
#include "DolphinWX/Config/GCAdapterConfigDiag.h"
#include "DolphinWX/ControllerConfigDiag.h"
#include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/GCKeyboardInputConfigDiag.h"
#include "DolphinWX/Input/GCPadInputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/Input/WiimoteInputConfigDiag.h"
#include "DolphinWX/WxUtils.h"
#include "InputCommon/GCAdapter.h"
@ -447,20 +450,24 @@ void ControllerConfigDiag::OnGameCubeConfigButton(wxCommandEvent& event)
if (SConfig::GetInstance().m_SIDevice[port_num] == SIDEVICE_GC_KEYBOARD)
{
InputConfigDialog config_diag(this, *key_plugin, _("GameCube Keyboard Configuration"),
port_num);
GCKeyboardInputConfigDialog config_diag(
this, *key_plugin,
wxString::Format("GameCube Keyboard Configuration Port %i", port_num + 1), port_num);
config_diag.ShowModal();
}
else if (SConfig::GetInstance().m_SIDevice[port_num] == SIDEVICE_WIIU_ADAPTER)
{
GCAdapterConfigDiag config_diag(this, _("Wii U GameCube Controller Adapter Configuration"),
port_num);
GCAdapterConfigDiag config_diag(
this,
wxString::Format("Wii U GameCube Controller Adapter Configuration Port %i", port_num + 1),
port_num);
config_diag.ShowModal();
}
else
{
InputConfigDialog config_diag(this, *pad_plugin, _("GameCube Controller Configuration"),
port_num);
GCPadInputConfigDialog config_diag(
this, *pad_plugin,
wxString::Format("GameCube Controller Configuration Port %i", port_num + 1), port_num);
config_diag.ShowModal();
}
@ -494,9 +501,12 @@ void ControllerConfigDiag::OnWiimoteConfigButton(wxCommandEvent& ev)
HotkeyManagerEmu::Enable(false);
InputConfigDialog m_ConfigFrame(this, *wiimote_plugin,
_("Dolphin Emulated Wii Remote Configuration"),
m_wiimote_index_from_config_id[ev.GetId()]);
const int port_num = m_wiimote_index_from_config_id[ev.GetId()];
WiimoteInputConfigDialog m_ConfigFrame(
this, *wiimote_plugin,
wxString::Format("Dolphin Emulated Wii Remote Configuration Port %i", port_num + 1),
port_num);
m_ConfigFrame.ShowModal();
HotkeyManagerEmu::Enable(true);

View File

@ -100,8 +100,17 @@
<ClCompile Include="FrameAui.cpp" />
<ClCompile Include="FrameTools.cpp" />
<ClCompile Include="GameListCtrl.cpp" />
<ClCompile Include="InputConfigDiag.cpp" />
<ClCompile Include="InputConfigDiagBitmaps.cpp" />
<ClCompile Include="Input\InputConfigDiag.cpp" />
<ClCompile Include="Input\InputConfigDiagBitmaps.cpp" />
<ClCompile Include="Input\HotkeyInputConfigDiag.cpp" />
<ClCompile Include="Input\GCPadInputConfigDiag.cpp" />
<ClCompile Include="Input\GCKeyboardInputConfigDiag.cpp" />
<ClCompile Include="Input\WiimoteInputConfigDiag.cpp" />
<ClCompile Include="Input\NunchukInputConfigDiag.cpp" />
<ClCompile Include="Input\ClassicInputConfigDiag.cpp" />
<ClCompile Include="Input\GuitarInputConfigDiag.cpp" />
<ClCompile Include="Input\DrumsInputConfigDiag.cpp" />
<ClCompile Include="Input\TurntableInputConfigDiag.cpp" />
<ClCompile Include="ISOFile.cpp" />
<ClCompile Include="ISOProperties.cpp" />
<ClCompile Include="LogConfigWindow.cpp" />
@ -170,7 +179,16 @@
<ClInclude Include="Frame.h" />
<ClInclude Include="GameListCtrl.h" />
<ClInclude Include="Globals.h" />
<ClInclude Include="InputConfigDiag.h" />
<ClInclude Include="Input\InputConfigDiag.h" />
<ClInclude Include="Input\HotkeyInputConfigDiag.h" />
<ClInclude Include="Input\GCPadInputConfigDiag.h" />
<ClInclude Include="Input\GCKeyboardInputConfigDiag.h" />
<ClInclude Include="Input\WiimoteInputConfigDiag.h" />
<ClInclude Include="Input\NunchukInputConfigDiag.h" />
<ClInclude Include="Input\ClassicInputConfigDiag.h" />
<ClInclude Include="Input\GuitarInputConfigDiag.h" />
<ClInclude Include="Input\DrumsInputConfigDiag.h" />
<ClInclude Include="Input\TurntableInputConfigDiag.h" />
<ClInclude Include="ISOFile.h" />
<ClInclude Include="ISOProperties.h" />
<ClInclude Include="LogConfigWindow.h" />

View File

@ -104,10 +104,37 @@
<ClCompile Include="NetPlay\NetWindow.cpp">
<Filter>GUI\NetPlay</Filter>
</ClCompile>
<ClCompile Include="InputConfigDiag.cpp">
<ClCompile Include="Input\InputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="InputConfigDiagBitmaps.cpp">
<ClCompile Include="Input\InputConfigDiagBitmaps.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\HotkeyInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\GCPadInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\GCKeyboardInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\WiimoteInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\NunchukInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\ClassicInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\GuitarInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\DrumsInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\TurntableInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Debugger\DebuggerPanel.cpp">
@ -290,7 +317,34 @@
<ClInclude Include="NetPlay\NetWindow.h">
<Filter>GUI\NetPlay</Filter>
</ClInclude>
<ClInclude Include="InputConfigDiag.h">
<ClInclude Include="Input\InputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\HotkeyInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\GCPadInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\GCKeyboardInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\WiimoteInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\NunchukInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\ClassicInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\GuitarInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\DrumsInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\TurntableInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Debugger\DebuggerPanel.h">

View File

@ -65,7 +65,8 @@
#include "DolphinWX/GameListCtrl.h"
#include "DolphinWX/Globals.h"
#include "DolphinWX/ISOFile.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/HotkeyInputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/LogWindow.h"
#include "DolphinWX/MainMenuBar.h"
#include "DolphinWX/MainToolBar.h"
@ -997,7 +998,7 @@ void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED(event))
HotkeyManagerEmu::Enable(false);
InputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"));
HotkeyInputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"));
m_ConfigFrame.ShowModal();
// Update references in case controllers were refreshed

View File

@ -0,0 +1,50 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/ClassicInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
ClassicInputConfigDialog::ClassicInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::Buttons), this, this);
auto* const group_box_dpad = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::DPad), this, this);
auto* const group_box_left_stick = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::LeftStick), this, this);
auto* const group_box_right_stick = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::RightStick), this, this);
auto* const group_box_triggers = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::Triggers), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_buttons, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_dpad, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_left_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_right_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_triggers, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class ClassicInputConfigDialog final : public InputConfigDialog
{
public:
ClassicInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,46 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/DrumsInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
DrumsInputConfigDialog::DrumsInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetDrumsGroup(port_num, WiimoteEmu::DrumsGroup::Buttons), this, this);
auto* const group_box_pads = new ControlGroupBox(
Wiimote::GetDrumsGroup(port_num, WiimoteEmu::DrumsGroup::Pads), this, this);
auto* const buttons_pads_sizer = new wxBoxSizer(wxVERTICAL);
buttons_pads_sizer->Add(group_box_buttons);
buttons_pads_sizer->AddSpacer(space5);
buttons_pads_sizer->Add(group_box_pads);
auto* const group_box_stick = new ControlGroupBox(
Wiimote::GetDrumsGroup(port_num, WiimoteEmu::DrumsGroup::Stick), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(buttons_pads_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class DrumsInputConfigDialog final : public InputConfigDialog
{
public:
DrumsInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,83 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/GCKeyboardInputConfigDiag.h"
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCKeyboardEmu.h"
enum class KeyboardGroup;
GCKeyboardInputConfigDialog::GCKeyboardInputConfigDialog(wxWindow* const parent,
InputConfig& config, const wxString& name,
const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const device_chooser = CreateDeviceChooserGroupBox();
auto* const reset_sizer = CreaterResetGroupBox(wxHORIZONTAL);
auto* const profile_chooser = CreateProfileChooserGroupBox();
auto* const group_box_keys0x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb0x), this, this);
auto* const group_box_keys1x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb1x), this, this);
auto* const group_box_keys2x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb2x), this, this);
auto* const group_box_keys3x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb3x), this, this);
auto* const group_box_keys4x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb4x), this, this);
auto* const group_box_keys5x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb5x), this, this);
auto* const group_box_options =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Options), this, this);
auto* const key5x_options_sizer = new wxBoxSizer(wxVERTICAL);
key5x_options_sizer->Add(group_box_keys5x);
key5x_options_sizer->AddSpacer(space5);
key5x_options_sizer->Add(group_box_options);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys0x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys1x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys2x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys3x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys4x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(key5x_options_sizer, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
auto* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->AddSpacer(space5);
dio->Add(device_chooser, 3, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(reset_sizer, 1, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(profile_chooser, 3, wxEXPAND);
dio->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(dio);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateDeviceComboBox();
UpdateProfileComboBox();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class GCKeyboardInputConfigDialog final : public InputConfigDialog
{
public:
GCKeyboardInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,83 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/GCPadInputConfigDiag.h"
#include "Core/HW/GCPad.h"
#include "Core/HW/GCPadEmu.h"
GCPadInputConfigDialog::GCPadInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const device_chooser = CreateDeviceChooserGroupBox();
auto* const reset_sizer = CreaterResetGroupBox(wxHORIZONTAL);
auto* const profile_chooser = CreateProfileChooserGroupBox();
auto* const group_box_buttons =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::Buttons), this, this);
auto* const group_box_main_stick =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::MainStick), this, this);
auto* const group_box_c_stick =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::CStick), this, this);
auto* const group_box_dpad =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::DPad), this, this);
auto* const group_box_triggers =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::Triggers), this, this);
auto* const group_box_rumble =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::Rumble), this, this);
auto* const group_box_options =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::Options), this, this);
auto* const triggers_rumble_sizer = new wxBoxSizer(wxVERTICAL);
triggers_rumble_sizer->Add(group_box_triggers, 0, wxEXPAND);
triggers_rumble_sizer->AddSpacer(space5);
triggers_rumble_sizer->Add(group_box_rumble, 0, wxEXPAND);
auto* const dpad_options_sizer = new wxBoxSizer(wxVERTICAL);
dpad_options_sizer->Add(group_box_dpad, 0, wxEXPAND);
dpad_options_sizer->AddSpacer(space5);
dpad_options_sizer->Add(group_box_options, 0, wxEXPAND);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_buttons, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_main_stick, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_c_stick, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(triggers_rumble_sizer, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(dpad_options_sizer, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
auto* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->AddSpacer(space5);
dio->Add(device_chooser, 2, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(reset_sizer, 1, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(profile_chooser, 2, wxEXPAND);
dio->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(dio);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateDeviceComboBox();
UpdateProfileComboBox();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class GCPadInputConfigDialog final : public InputConfigDialog
{
public:
GCPadInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,58 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/GuitarInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
GuitarInputConfigDialog::GuitarInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Buttons), this, this);
auto* const group_left_strum = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Strum), this, this);
auto* const buttons_strum_sizer = new wxBoxSizer(wxVERTICAL);
buttons_strum_sizer->Add(group_box_buttons, 0, wxEXPAND);
buttons_strum_sizer->AddSpacer(space5);
buttons_strum_sizer->Add(group_left_strum, 0, wxEXPAND);
auto* const group_box_frets = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Frets), this, this);
ControlGroupBox* group_box_whammy = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Whammy), this, this);
auto* const frets_whammy_sizer = new wxBoxSizer(wxVERTICAL);
frets_whammy_sizer->Add(group_box_frets, 0, wxEXPAND);
frets_whammy_sizer->AddSpacer(space5);
frets_whammy_sizer->Add(group_box_whammy, 0, wxEXPAND);
auto* const group_box_stick = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Stick), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(buttons_strum_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(frets_whammy_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class GuitarInputConfigDialog final : public InputConfigDialog
{
public:
GuitarInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,204 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include "Core/HotkeyManager.h"
#include "DolphinWX/Input/HotkeyInputConfigDiag.h"
enum HotkeyGroup : int;
HotkeyInputConfigDialog::HotkeyInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const device_chooser = CreateDeviceChooserGroupBox();
auto* const reset_sizer = CreaterResetGroupBox(wxVERTICAL);
auto* const profile_chooser = CreateProfileChooserGroupBox();
auto* const notebook = new wxNotebook(this, wxID_ANY);
// General
auto* const tab_general = new wxPanel(notebook);
auto* const group_box_general =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_GENERAL), tab_general, this);
auto* const group_box_volume =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_VOLUME), tab_general, this);
auto* const group_box_speed =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_SPEED), tab_general, this);
auto* const szr_volume_speed = new wxBoxSizer(wxVERTICAL);
szr_volume_speed->AddSpacer(space5);
szr_volume_speed->Add(group_box_volume, 0, wxEXPAND);
szr_volume_speed->AddSpacer(space5);
szr_volume_speed->Add(group_box_speed, 0, wxEXPAND);
auto* const szr_general = new wxBoxSizer(wxHORIZONTAL);
szr_general->Add(group_box_general, 0, wxEXPAND | wxTOP, space5);
szr_general->AddSpacer(space5);
szr_general->Add(szr_volume_speed, 0, wxEXPAND);
tab_general->SetSizerAndFit(szr_general);
notebook->AddPage(tab_general, "General");
// TAS Tools
auto* const tab_tas = new wxPanel(notebook);
auto* const group_box_frame_advance =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_FRANE_ADVANCE), tab_tas, this);
auto* const group_box_movie =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_MOVIE), tab_tas, this);
auto* const szr_tas = new wxBoxSizer(wxHORIZONTAL);
szr_tas->AddSpacer(space5);
szr_tas->Add(group_box_frame_advance, 0, wxEXPAND | wxTOP, space5);
szr_tas->AddSpacer(space5);
szr_tas->Add(group_box_movie, 0, wxEXPAND | wxTOP, space5);
tab_tas->SetSizerAndFit(szr_tas);
notebook->AddPage(tab_tas, "TAS Tools");
// WII and Wii Remote
auto* const tab_wii = new wxPanel(notebook);
auto* const group_box_wii =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_WII), tab_wii, this);
auto* const szr_wii = new wxBoxSizer(wxHORIZONTAL);
szr_wii->AddSpacer(space5);
szr_wii->Add(group_box_wii, 0, wxEXPAND | wxTOP, space5);
szr_wii->AddSpacer(space5);
tab_wii->SetSizerAndFit(szr_wii);
notebook->AddPage(tab_wii, "Wii and Wii Remote");
// Graphics
auto* const tab_graphics = new wxPanel(notebook);
auto* const group_box_graphics_toggles = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_GRAPHICS_TOGGLES), tab_graphics, this);
auto* const group_box_ir =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_IR), tab_graphics, this);
auto* const szr_toggle_ir = new wxBoxSizer(wxVERTICAL);
szr_toggle_ir->Add(group_box_graphics_toggles, 0, wxEXPAND);
szr_toggle_ir->AddSpacer(space5);
szr_toggle_ir->Add(group_box_ir, 0, wxEXPAND);
auto* const group_box_freelook =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_FREELOOK), tab_graphics, this);
auto* const szr_graphics_toggles = new wxBoxSizer(wxHORIZONTAL);
szr_graphics_toggles->AddSpacer(space5);
szr_graphics_toggles->Add(szr_toggle_ir, 0, wxEXPAND | wxTOP, space5);
szr_graphics_toggles->AddSpacer(space5);
szr_graphics_toggles->Add(group_box_freelook, 0, wxEXPAND | wxTOP, space5);
szr_graphics_toggles->AddSpacer(space5);
tab_graphics->SetSizerAndFit(szr_graphics_toggles);
notebook->AddPage(tab_graphics, "Graphics");
// 3D
auto* const tab_3D = new wxPanel(notebook);
auto* const group_box_3D_toggles =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_3D_TOGGLE), tab_3D, this);
auto* const group_box_3D_depth =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_3D_DEPTH), tab_3D, this);
auto* const szr_3D = new wxBoxSizer(wxHORIZONTAL);
szr_3D->AddSpacer(space5);
szr_3D->Add(group_box_3D_toggles, 0, wxEXPAND | wxTOP, space5);
szr_3D->AddSpacer(space5);
szr_3D->Add(group_box_3D_depth, 0, wxEXPAND | wxTOP, space5);
szr_3D->AddSpacer(space5);
tab_3D->SetSizerAndFit(szr_3D);
notebook->AddPage(tab_3D, "3D");
// Save and Load State
auto* const tab_save_load_state = new wxPanel(notebook);
auto* const group_box_load_state = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_LOAD_STATE), tab_save_load_state, this);
auto* const group_box_save_state = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_SAVE_STATE), tab_save_load_state, this);
auto* const szr_save_load_state = new wxBoxSizer(wxHORIZONTAL);
szr_save_load_state->AddSpacer(space5);
szr_save_load_state->Add(group_box_load_state, 0, wxEXPAND | wxTOP, space5);
szr_save_load_state->AddSpacer(space5);
szr_save_load_state->Add(group_box_save_state, 0, wxEXPAND | wxTOP, space5);
szr_save_load_state->AddSpacer(space5);
tab_save_load_state->SetSizerAndFit(szr_save_load_state);
notebook->AddPage(tab_save_load_state, "Save and Load State");
// Other State Managament
auto* const tab_other_state = new wxPanel(notebook);
auto* const group_box_select_state = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_SELECT_STATE), tab_other_state, this);
auto* const group_box_load_last_state = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_LOAD_LAST_STATE), tab_other_state, this);
auto* const group_box_state_misc =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_STATE_MISC), tab_other_state, this);
auto* const szr_other_state = new wxBoxSizer(wxHORIZONTAL);
szr_other_state->AddSpacer(space5);
szr_other_state->Add(group_box_select_state, 0, wxEXPAND | wxTOP, space5);
szr_other_state->AddSpacer(space5);
szr_other_state->Add(group_box_load_last_state, 0, wxEXPAND | wxTOP, space5);
szr_other_state->AddSpacer(space5);
szr_other_state->Add(group_box_state_misc, 0, wxEXPAND | wxTOP, space5);
szr_other_state->AddSpacer(space5);
tab_other_state->SetSizerAndFit(szr_other_state);
notebook->AddPage(tab_other_state, "Other State Management");
notebook->SetSelection(0);
auto* const device_profile_sizer = new wxBoxSizer(wxVERTICAL);
device_profile_sizer->Add(device_chooser, 1, wxEXPAND);
device_profile_sizer->Add(profile_chooser, 1, wxEXPAND);
auto* const group_box_options =
new ControlGroupBox(HotkeyManagerEmu::GetOptionsGroup(), this, this);
auto* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->AddSpacer(space5);
dio->Add(device_profile_sizer, 3, wxEXPAND);
dio->Add(reset_sizer, 0, wxEXPAND);
dio->Add(group_box_options, 1, wxEXPAND);
dio->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(dio);
szr_main->AddSpacer(space5);
szr_main->Add(notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateDeviceComboBox();
UpdateProfileComboBox();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class HotkeyInputConfigDialog final : public InputConfigDialog
{
public:
HotkeyInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -42,9 +42,15 @@
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCPad.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "Core/HotkeyManager.h"
#include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/ClassicInputConfigDiag.h"
#include "DolphinWX/Input/DrumsInputConfigDiag.h"
#include "DolphinWX/Input/GuitarInputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/Input/NunchukInputConfigDiag.h"
#include "DolphinWX/Input/TurntableInputConfigDiag.h"
#include "DolphinWX/WxUtils.h"
#include "InputCommon/ControllerEmu.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h"
@ -54,32 +60,47 @@
using namespace ciface::ExpressionParser;
void GamepadPage::ConfigExtension(wxCommandEvent& event)
void InputConfigDialog::ConfigExtension(wxCommandEvent& event)
{
ControllerEmu::Extension* const ex = ((ExtensionButton*)event.GetEventObject())->extension;
int extension_type = ex->switch_extension;
// show config diag, if "none" isn't selected
if (ex->switch_extension)
switch (extension_type)
{
wxDialog dlg(this, wxID_ANY,
wxGetTranslation(StrToWxStr(ex->attachments[ex->switch_extension]->GetName())));
wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
const std::size_t orig_size = control_groups.size();
ControlGroupsSizer* const szr = new ControlGroupsSizer(
ex->attachments[ex->switch_extension].get(), &dlg, this, &control_groups);
const int space5 = FromDIP(5);
main_szr->Add(szr, 0, wxLEFT, space5);
main_szr->Add(dlg.CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
main_szr->AddSpacer(space5);
dlg.SetSizerAndFit(main_szr);
dlg.Center();
case WiimoteEmu::EXT_NUNCHUK:
{
NunchukInputConfigDialog dlg(this, m_config, _("Nunchuk Configuration"), m_port_num);
dlg.ShowModal();
// remove the new groups that were just added, now that the window closed
control_groups.resize(orig_size);
}
break;
case WiimoteEmu::EXT_CLASSIC:
{
ClassicInputConfigDialog dlg(this, m_config, _("Classic Controller Configuration"), m_port_num);
dlg.ShowModal();
}
break;
case WiimoteEmu::EXT_GUITAR:
{
GuitarInputConfigDialog dlg(this, m_config, _("Guitar Configuration"), m_port_num);
dlg.ShowModal();
}
break;
case WiimoteEmu::EXT_DRUMS:
{
DrumsInputConfigDialog dlg(this, m_config, _("Drums Configuration"), m_port_num);
dlg.ShowModal();
}
break;
case WiimoteEmu::EXT_TURNTABLE:
{
TurntableInputConfigDialog dlg(this, m_config, _("Turntable Configuration"), m_port_num);
dlg.ShowModal();
}
break;
default:
break;
}
}
@ -150,13 +171,13 @@ void PadSettingSpin::UpdateValue()
setting->SetValue(ControlState(((wxSpinCtrl*)wxcontrol)->GetValue()) / 100);
}
ControlDialog::ControlDialog(GamepadPage* const parent, InputConfig& config,
ControlDialog::ControlDialog(InputConfigDialog* const parent, InputConfig& config,
ControllerInterface::ControlReference* const ref)
: wxDialog(parent, wxID_ANY, _("Configure Control"), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
control_reference(ref), m_config(config), m_parent(parent)
{
m_devq = m_parent->controller->default_device;
m_devq = m_parent->GetController()->default_device;
const int space5 = FromDIP(5);
// GetStrings() sounds slow :/
@ -229,19 +250,13 @@ void InputConfigDialog::UpdateProfileComboBox()
strs.push_back(StrToWxStr(base));
}
for (GamepadPage* page : m_padpages)
{
page->profile_cbox->Clear();
page->profile_cbox->Append(strs);
}
profile_cbox->Clear();
profile_cbox->Append(strs);
}
void InputConfigDialog::UpdateControlReferences()
{
for (GamepadPage* page : m_padpages)
{
page->controller->UpdateReferences(g_controller_interface);
}
controller->UpdateReferences(g_controller_interface);
}
void InputConfigDialog::OnClose(wxCloseEvent& event)
@ -315,9 +330,10 @@ void ControlDialog::UpdateGUI()
}
};
void GamepadPage::UpdateGUI()
void InputConfigDialog::UpdateGUI()
{
device_cbox->SetValue(StrToWxStr(controller->default_device.ToString()));
if (device_cbox != nullptr)
device_cbox->SetValue(StrToWxStr(controller->default_device.ToString()));
for (ControlGroupBox* cgBox : control_groups)
{
@ -333,7 +349,7 @@ void GamepadPage::UpdateGUI()
}
}
void GamepadPage::ClearAll(wxCommandEvent&)
void InputConfigDialog::ClearAll(wxCommandEvent&)
{
// just load an empty ini section to clear everything :P
IniFile::Section section;
@ -347,7 +363,7 @@ void GamepadPage::ClearAll(wxCommandEvent&)
UpdateGUI();
}
void GamepadPage::LoadDefaults(wxCommandEvent&)
void InputConfigDialog::LoadDefaults(wxCommandEvent&)
{
controller->LoadDefaults(g_controller_interface);
@ -361,7 +377,8 @@ bool ControlDialog::Validate()
control_reference->expression = WxStrToStr(textctrl->GetValue());
auto lock = ControllerEmu::GetStateLock();
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
g_controller_interface.UpdateReference(control_reference,
m_parent->GetController()->default_device);
UpdateGUI();
@ -369,7 +386,7 @@ bool ControlDialog::Validate()
control_reference->parse_error == EXPRESSION_PARSE_NO_DEVICE);
}
void GamepadPage::SetDevice(wxCommandEvent&)
void InputConfigDialog::SetDevice(wxCommandEvent&)
{
controller->default_device.FromString(WxStrToStr(device_cbox->GetValue()));
@ -399,7 +416,8 @@ void ControlDialog::ClearControl(wxCommandEvent&)
control_reference->expression.clear();
auto lock = ControllerEmu::GetStateLock();
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
g_controller_interface.UpdateReference(control_reference,
m_parent->GetController()->default_device);
UpdateGUI();
}
@ -441,7 +459,7 @@ bool ControlDialog::GetExpressionForSelectedControl(wxString& expr)
return false;
wxString control_name = control_lbox->GetString(num);
GetExpressionForControl(expr, control_name, &m_devq, &m_parent->controller->default_device);
GetExpressionForControl(expr, control_name, &m_devq, &m_parent->GetController()->default_device);
return true;
}
@ -457,7 +475,8 @@ void ControlDialog::SetSelectedControl(wxCommandEvent&)
control_reference->expression = textctrl->GetValue();
auto lock = ControllerEmu::GetStateLock();
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
g_controller_interface.UpdateReference(control_reference,
m_parent->GetController()->default_device);
UpdateGUI();
}
@ -492,13 +511,14 @@ void ControlDialog::AppendControl(wxCommandEvent& event)
control_reference->expression = textctrl->GetValue();
auto lock = ControllerEmu::GetStateLock();
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
g_controller_interface.UpdateReference(control_reference,
m_parent->GetController()->default_device);
UpdateGUI();
}
void GamepadPage::EnablePadSetting(const std::string& group_name, const std::string& name,
const bool enabled)
void InputConfigDialog::EnablePadSetting(const std::string& group_name, const std::string& name,
const bool enabled)
{
const auto box_iterator =
std::find_if(control_groups.begin(), control_groups.end(), [&group_name](const auto& box) {
@ -517,8 +537,8 @@ void GamepadPage::EnablePadSetting(const std::string& group_name, const std::str
(*it)->wxcontrol->Enable(enabled);
}
void GamepadPage::EnableControlButton(const std::string& group_name, const std::string& name,
const bool enabled)
void InputConfigDialog::EnableControlButton(const std::string& group_name, const std::string& name,
const bool enabled)
{
const auto box_iterator =
std::find_if(control_groups.begin(), control_groups.end(), [&group_name](const auto& box) {
@ -553,14 +573,14 @@ void ControlDialog::OnRangeThumbtrack(wxScrollEvent& event)
m_range_spinner->SetValue(event.GetPosition());
}
void GamepadPage::AdjustSetting(wxCommandEvent& event)
void InputConfigDialog::AdjustSetting(wxCommandEvent& event)
{
const auto* const control = static_cast<wxControl*>(event.GetEventObject());
auto* const pad_setting = static_cast<PadSetting*>(control->GetClientData());
pad_setting->UpdateValue();
}
void GamepadPage::AdjustBooleanSetting(wxCommandEvent& event)
void InputConfigDialog::AdjustBooleanSetting(wxCommandEvent& event)
{
const auto* const control = static_cast<wxControl*>(event.GetEventObject());
auto* const pad_setting = static_cast<PadSettingCheckBox*>(control->GetClientData());
@ -578,7 +598,7 @@ void GamepadPage::AdjustBooleanSetting(wxCommandEvent& event)
}
}
void GamepadPage::ConfigControl(wxEvent& event)
void InputConfigDialog::ConfigControl(wxEvent& event)
{
m_control_dialog = new ControlDialog(this, m_config,
((ControlButton*)event.GetEventObject())->control_reference);
@ -589,7 +609,7 @@ void GamepadPage::ConfigControl(wxEvent& event)
UpdateGUI();
}
void GamepadPage::ClearControl(wxEvent& event)
void InputConfigDialog::ClearControl(wxEvent& event)
{
ControlButton* const btn = (ControlButton*)event.GetEventObject();
btn->control_reference->expression.clear();
@ -630,7 +650,7 @@ void ControlDialog::DetectControl(wxCommandEvent& event)
}
}
void GamepadPage::DetectControl(wxCommandEvent& event)
void InputConfigDialog::DetectControl(wxCommandEvent& event)
{
auto* btn = static_cast<ControlButton*>(event.GetEventObject());
if (DetectButton(btn) && m_iterate)
@ -649,7 +669,7 @@ void GamepadPage::DetectControl(wxCommandEvent& event)
}
}
bool GamepadPage::DetectButton(ControlButton* button)
bool InputConfigDialog::DetectButton(ControlButton* button)
{
bool success = false;
// find device :/
@ -687,7 +707,7 @@ bool GamepadPage::DetectButton(ControlButton* button)
return success;
}
wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent)
wxStaticBoxSizer* ControlDialog::CreateControlChooser(InputConfigDialog* const parent)
{
wxStaticBoxSizer* const main_szr = new wxStaticBoxSizer(
wxVERTICAL, this, control_reference->is_input ? _("Input") : _("Output"));
@ -785,7 +805,7 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent)
return main_szr;
}
void GamepadPage::GetProfilePath(std::string& path)
void InputConfigDialog::GetProfilePath(std::string& path)
{
const wxString& name = profile_cbox->GetValue();
if (!name.empty())
@ -801,10 +821,15 @@ void GamepadPage::GetProfilePath(std::string& path)
}
}
void GamepadPage::LoadProfile(wxCommandEvent&)
ControllerEmu* InputConfigDialog::GetController() const
{
return controller;
}
void InputConfigDialog::LoadProfile(wxCommandEvent&)
{
std::string fname;
GamepadPage::GetProfilePath(fname);
InputConfigDialog::GetProfilePath(fname);
if (!File::Exists(fname))
return;
@ -818,10 +843,10 @@ void GamepadPage::LoadProfile(wxCommandEvent&)
UpdateGUI();
}
void GamepadPage::SaveProfile(wxCommandEvent&)
void InputConfigDialog::SaveProfile(wxCommandEvent&)
{
std::string fname;
GamepadPage::GetProfilePath(fname);
InputConfigDialog::GetProfilePath(fname);
File::CreateFullPath(fname);
if (!fname.empty())
@ -830,7 +855,7 @@ void GamepadPage::SaveProfile(wxCommandEvent&)
controller->SaveConfig(inifile.GetOrCreateSection("Profile"));
inifile.Save(fname);
m_config_dialog->UpdateProfileComboBox();
UpdateProfileComboBox();
}
else
{
@ -838,10 +863,10 @@ void GamepadPage::SaveProfile(wxCommandEvent&)
}
}
void GamepadPage::DeleteProfile(wxCommandEvent&)
void InputConfigDialog::DeleteProfile(wxCommandEvent&)
{
std::string fname;
GamepadPage::GetProfilePath(fname);
InputConfigDialog::GetProfilePath(fname);
const char* const fnamecstr = fname.c_str();
@ -850,24 +875,21 @@ void GamepadPage::DeleteProfile(wxCommandEvent&)
{
File::Delete(fnamecstr);
m_config_dialog->UpdateProfileComboBox();
UpdateProfileComboBox();
}
}
void InputConfigDialog::UpdateDeviceComboBox()
{
for (GamepadPage* page : m_padpages)
{
page->device_cbox->Clear();
device_cbox->Clear();
for (const std::string& device_string : g_controller_interface.GetAllDeviceStrings())
page->device_cbox->Append(StrToWxStr(device_string));
for (const std::string& device_string : g_controller_interface.GetAllDeviceStrings())
device_cbox->Append(StrToWxStr(device_string));
page->device_cbox->SetValue(StrToWxStr(page->controller->default_device.ToString()));
}
device_cbox->SetValue(StrToWxStr(controller->default_device.ToString()));
}
void GamepadPage::RefreshDevices(wxCommandEvent&)
void InputConfigDialog::RefreshDevices(wxCommandEvent&)
{
bool was_unpaused = Core::PauseAndLock(true);
@ -875,10 +897,10 @@ void GamepadPage::RefreshDevices(wxCommandEvent&)
g_controller_interface.Reinitialize();
// update all control references
m_config_dialog->UpdateControlReferences();
UpdateControlReferences();
// update device cbox
m_config_dialog->UpdateDeviceComboBox();
UpdateDeviceComboBox();
Wiimote::LoadConfig();
Keyboard::LoadConfig();
@ -897,8 +919,9 @@ ControlGroupBox::~ControlGroupBox()
}
ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWindow* const parent,
GamepadPage* const eventsink)
: wxBoxSizer(wxVERTICAL), control_group(group), static_bitmap(nullptr), m_scale(1)
InputConfigDialog* eventsink)
: wxStaticBoxSizer(wxVERTICAL, parent, wxGetTranslation(StrToWxStr(group->ui_name))),
control_group(group), static_bitmap(nullptr), m_scale(1)
{
static constexpr std::array<const char* const, 2> exclude_buttons{{"Mic", "Modifier"}};
static constexpr std::array<const char* const, 7> exclude_groups{
@ -929,16 +952,16 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
{
control_button->SetToolTip(
_("Left-click to detect input.\nMiddle-click to clear.\nRight-click for more options."));
control_button->Bind(wxEVT_BUTTON, &GamepadPage::DetectControl, eventsink);
control_button->Bind(wxEVT_BUTTON, &InputConfigDialog::DetectControl, eventsink);
}
else
{
control_button->SetToolTip(_("Left/Right-click for more options.\nMiddle-click to clear."));
control_button->Bind(wxEVT_BUTTON, &GamepadPage::ConfigControl, eventsink);
control_button->Bind(wxEVT_BUTTON, &InputConfigDialog::ConfigControl, eventsink);
}
control_button->Bind(wxEVT_MIDDLE_DOWN, &GamepadPage::ClearControl, eventsink);
control_button->Bind(wxEVT_RIGHT_UP, &GamepadPage::ConfigControl, eventsink);
control_button->Bind(wxEVT_MIDDLE_DOWN, &InputConfigDialog::ClearControl, eventsink);
control_button->Bind(wxEVT_RIGHT_UP, &InputConfigDialog::ConfigControl, eventsink);
control_grid->Add(label, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
control_grid->Add(control_button, 0, wxALIGN_CENTER_VERTICAL);
@ -968,7 +991,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->numeric_settings)
{
PadSettingSpin* setting = new PadSettingSpin(parent, groupSetting.get());
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &GamepadPage::AdjustSetting, eventsink);
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &InputConfigDialog::AdjustSetting, eventsink);
options.push_back(setting);
szr->Add(
new wxStaticText(parent, wxID_ANY, wxGetTranslation(StrToWxStr(groupSetting->m_name))));
@ -977,7 +1000,8 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->boolean_settings)
{
auto* checkbox = new PadSettingCheckBox(parent, groupSetting.get());
checkbox->wxcontrol->Bind(wxEVT_CHECKBOX, &GamepadPage::AdjustBooleanSetting, eventsink);
checkbox->wxcontrol->Bind(wxEVT_CHECKBOX, &InputConfigDialog::AdjustBooleanSetting,
eventsink);
options.push_back(checkbox);
Add(checkbox->wxcontrol, 0, wxALL | wxLEFT, space3);
}
@ -1010,7 +1034,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
wxBITMAP_TYPE_BMP);
auto* const threshold_cbox = new PadSettingSpin(parent, group->numeric_settings[0].get());
threshold_cbox->wxcontrol->Bind(wxEVT_SPINCTRL, &GamepadPage::AdjustSetting, eventsink);
threshold_cbox->wxcontrol->Bind(wxEVT_SPINCTRL, &InputConfigDialog::AdjustSetting, eventsink);
threshold_cbox->wxcontrol->SetToolTip(
_("Adjust the analog control pressure required to activate buttons."));
@ -1057,7 +1081,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->numeric_settings)
{
PadSettingSpin* setting = new PadSettingSpin(parent, groupSetting.get());
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &GamepadPage::AdjustSetting, eventsink);
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &InputConfigDialog::AdjustSetting, eventsink);
options.push_back(setting);
wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL);
szr->Add(
@ -1081,8 +1105,8 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
options.push_back(attachments);
attachments->wxcontrol->Bind(wxEVT_CHOICE, &GamepadPage::AdjustSetting, eventsink);
configure_btn->Bind(wxEVT_BUTTON, &GamepadPage::ConfigExtension, eventsink);
attachments->wxcontrol->Bind(wxEVT_CHOICE, &InputConfigDialog::AdjustSetting, eventsink);
configure_btn->Bind(wxEVT_BUTTON, &InputConfigDialog::ConfigExtension, eventsink);
AddSpacer(space3);
Add(attachments->wxcontrol, 0, wxEXPAND | wxLEFT | wxRIGHT, space3);
@ -1096,7 +1120,8 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->boolean_settings)
{
PadSettingCheckBox* setting_cbox = new PadSettingCheckBox(parent, groupSetting.get());
setting_cbox->wxcontrol->Bind(wxEVT_CHECKBOX, &GamepadPage::AdjustBooleanSetting, eventsink);
setting_cbox->wxcontrol->Bind(wxEVT_CHECKBOX, &InputConfigDialog::AdjustBooleanSetting,
eventsink);
if (groupSetting->m_name == "Iterative Input")
groupSetting->SetValue(false);
options.push_back(setting_cbox);
@ -1106,7 +1131,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->numeric_settings)
{
PadSettingSpin* setting = new PadSettingSpin(parent, groupSetting.get());
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &GamepadPage::AdjustSetting, eventsink);
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &InputConfigDialog::AdjustSetting, eventsink);
options.push_back(setting);
wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL);
szr->Add(
@ -1114,70 +1139,18 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
wxALIGN_CENTER_VERTICAL, space3);
szr->Add(setting->wxcontrol, 0, wxLEFT, space3);
AddSpacer(space3);
Add(szr, 0, wxLEFT | wxRIGHT, space3);
Add(szr, 0, wxLEFT | wxRIGHT | wxALIGN_RIGHT, space3);
}
break;
}
}
AddSpacer(space3);
eventsink->control_groups.push_back(this);
}
ControlGroupsSizer::ControlGroupsSizer(ControllerEmu* const controller, wxWindow* const parent,
GamepadPage* const eventsink,
std::vector<ControlGroupBox*>* groups)
: wxBoxSizer(wxHORIZONTAL)
wxBoxSizer* InputConfigDialog::CreateDeviceChooserGroupBox()
{
const int space5 = parent->FromDIP(5);
size_t col_size = 0;
wxBoxSizer* stacked_groups = nullptr;
for (auto& group : controller->groups)
{
wxStaticBoxSizer* control_group =
new wxStaticBoxSizer(wxVERTICAL, parent, wxGetTranslation(StrToWxStr(group->ui_name)));
ControlGroupBox* control_group_box =
new ControlGroupBox(group.get(), control_group->GetStaticBox(), eventsink);
control_group->Add(control_group_box, 0, wxEXPAND);
const size_t grp_size =
group->controls.size() + group->numeric_settings.size() + group->boolean_settings.size();
col_size += grp_size;
if (col_size > 8 || nullptr == stacked_groups)
{
if (stacked_groups)
{
Add(stacked_groups, 0, wxBOTTOM, space5);
AddSpacer(space5);
}
stacked_groups = new wxBoxSizer(wxVERTICAL);
stacked_groups->Add(control_group, 0, wxEXPAND);
col_size = grp_size;
}
else
{
stacked_groups->Add(control_group, 0, wxEXPAND);
}
if (groups)
groups->push_back(control_group_box);
}
if (stacked_groups)
Add(stacked_groups, 0, wxBOTTOM, space5);
}
GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_num,
InputConfigDialog* const config_dialog)
: wxPanel(parent, wxID_ANY), controller(config.GetController(pad_num)),
m_config_dialog(config_dialog), m_config(config)
{
wxBoxSizer* control_group_sizer = new ControlGroupsSizer(controller, this, this, &control_groups);
const int space3 = FromDIP(3);
const int space5 = FromDIP(5);
// device chooser
wxStaticBoxSizer* const device_sbox = new wxStaticBoxSizer(wxVERTICAL, this, _("Device"));
device_cbox = new wxComboBox(device_sbox->GetStaticBox(), wxID_ANY, "");
@ -1186,9 +1159,9 @@ GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_nu
wxButton* refresh_button = new wxButton(device_sbox->GetStaticBox(), wxID_ANY, _("Refresh"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
device_cbox->Bind(wxEVT_COMBOBOX, &GamepadPage::SetDevice, this);
device_cbox->Bind(wxEVT_TEXT_ENTER, &GamepadPage::SetDevice, this);
refresh_button->Bind(wxEVT_BUTTON, &GamepadPage::RefreshDevices, this);
device_cbox->Bind(wxEVT_COMBOBOX, &InputConfigDialog::SetDevice, this);
device_cbox->Bind(wxEVT_TEXT_ENTER, &InputConfigDialog::SetDevice, this);
refresh_button->Bind(wxEVT_BUTTON, &InputConfigDialog::RefreshDevices, this);
wxBoxSizer* const device_sbox_in = new wxBoxSizer(wxHORIZONTAL);
device_sbox_in->Add(WxUtils::GiveMinSizeDIP(device_cbox, wxSize(64, -1)), 1,
@ -1196,25 +1169,32 @@ GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_nu
device_sbox_in->Add(refresh_button, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space3);
device_sbox->Add(device_sbox_in, 1, wxEXPAND | wxLEFT | wxRIGHT, space3);
device_sbox->AddSpacer(space3);
return device_sbox;
}
// Clear / Reset buttons
wxStaticBoxSizer* const clear_sbox = new wxStaticBoxSizer(wxVERTICAL, this, _("Reset"));
wxBoxSizer* InputConfigDialog::CreaterResetGroupBox(wxOrientation orientation)
{
const int space3 = FromDIP(3);
wxStaticBoxSizer* const clear_sbox = new wxStaticBoxSizer(orientation, this, _("Reset"));
wxButton* const default_button = new wxButton(clear_sbox->GetStaticBox(), wxID_ANY, _("Default"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
wxButton* const clearall_button = new wxButton(clear_sbox->GetStaticBox(), wxID_ANY, _("Clear"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
wxBoxSizer* clear_sbox_in = new wxBoxSizer(wxHORIZONTAL);
clear_sbox_in->Add(default_button, 1, wxALIGN_CENTER_VERTICAL);
clear_sbox_in->Add(clearall_button, 1, wxALIGN_CENTER_VERTICAL);
clear_sbox->Add(clear_sbox_in, 1, wxEXPAND | wxLEFT | wxRIGHT, space3);
clear_sbox->AddSpacer(space3);
wxBoxSizer* clear_sbox_in = new wxBoxSizer(orientation);
clear_sbox_in->Add(default_button, 1, wxEXPAND);
clear_sbox_in->Add(clearall_button, 1, wxEXPAND);
clear_sbox->Add(clear_sbox_in, 1, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, space3);
clearall_button->Bind(wxEVT_BUTTON, &GamepadPage::ClearAll, this);
default_button->Bind(wxEVT_BUTTON, &GamepadPage::LoadDefaults, this);
clearall_button->Bind(wxEVT_BUTTON, &InputConfigDialog::ClearAll, this);
default_button->Bind(wxEVT_BUTTON, &InputConfigDialog::LoadDefaults, this);
return clear_sbox;
}
// Profile selector
wxBoxSizer* InputConfigDialog::CreateProfileChooserGroupBox()
{
const int space3 = FromDIP(3);
wxStaticBoxSizer* profile_sbox = new wxStaticBoxSizer(wxVERTICAL, this, _("Profile"));
profile_cbox = new wxComboBox(profile_sbox->GetStaticBox(), wxID_ANY, "");
@ -1225,9 +1205,9 @@ GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_nu
wxButton* const pdelete_btn = new wxButton(profile_sbox->GetStaticBox(), wxID_ANY, _("Delete"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
pload_btn->Bind(wxEVT_BUTTON, &GamepadPage::LoadProfile, this);
psave_btn->Bind(wxEVT_BUTTON, &GamepadPage::SaveProfile, this);
pdelete_btn->Bind(wxEVT_BUTTON, &GamepadPage::DeleteProfile, this);
pload_btn->Bind(wxEVT_BUTTON, &InputConfigDialog::LoadProfile, this);
psave_btn->Bind(wxEVT_BUTTON, &InputConfigDialog::SaveProfile, this);
pdelete_btn->Bind(wxEVT_BUTTON, &InputConfigDialog::DeleteProfile, this);
wxBoxSizer* profile_sbox_in = new wxBoxSizer(wxHORIZONTAL);
profile_sbox_in->Add(WxUtils::GiveMinSizeDIP(profile_cbox, wxSize(64, -1)), 1,
@ -1238,55 +1218,19 @@ GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_nu
profile_sbox_in->Add(pdelete_btn, 0, wxALIGN_CENTER_VERTICAL);
profile_sbox->Add(profile_sbox_in, 1, wxEXPAND | wxLEFT | wxRIGHT, space3);
profile_sbox->AddSpacer(space3);
wxBoxSizer* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->Add(device_sbox, 1, wxEXPAND);
dio->Add(clear_sbox, 0, wxEXPAND | wxLEFT, space5);
dio->Add(profile_sbox, 1, wxEXPAND | wxLEFT, space5);
wxBoxSizer* const mapping = new wxBoxSizer(wxVERTICAL);
mapping->AddSpacer(space5);
mapping->Add(dio, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
mapping->AddSpacer(space5);
mapping->Add(control_group_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
UpdateGUI();
SetSizerAndFit(mapping); // needed
Layout();
};
return profile_sbox;
}
InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int tab_num)
: wxDialog(parent, wxID_ANY, name), m_config(config)
const wxString& name, const int port_num)
: wxDialog(parent, wxID_ANY, name), controller(config.GetController(port_num)),
m_config(config), m_port_num(port_num)
{
m_pad_notebook = new wxNotebook(this, wxID_ANY);
GamepadPage* gp = new GamepadPage(m_pad_notebook, m_config, tab_num, this);
m_padpages.push_back(gp);
m_pad_notebook->AddPage(gp, wxString::Format("%s [%u]",
wxGetTranslation(StrToWxStr(m_config.GetGUIName())),
1 + tab_num));
m_pad_notebook->SetSelection(0);
UpdateDeviceComboBox();
UpdateProfileComboBox();
Bind(wxEVT_CLOSE_WINDOW, &InputConfigDialog::OnClose, this);
Bind(wxEVT_BUTTON, &InputConfigDialog::OnCloseButton, this, wxID_CLOSE);
wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL);
const int space5 = FromDIP(5);
szr->AddSpacer(space5);
szr->Add(m_pad_notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr->AddSpacer(space5);
szr->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr->AddSpacer(space5);
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER);
SetSizerAndFit(szr);
Center();
// live preview update timer
m_update_timer.SetOwner(this);

View File

@ -31,7 +31,6 @@ class DolphinSlider;
class InputConfig;
class wxComboBox;
class wxListBox;
class wxNotebook;
class wxStaticBitmap;
class wxStaticText;
class wxTextCtrl;
@ -100,12 +99,12 @@ private:
bool m_block = false;
};
class GamepadPage;
class InputConfigDialog;
class ControlDialog : public wxDialog
{
public:
ControlDialog(GamepadPage* const parent, InputConfig& config,
ControlDialog(InputConfigDialog* const parent, InputConfig& config,
ControllerInterface::ControlReference* const ref);
bool Validate() override;
@ -116,7 +115,7 @@ public:
InputConfig& m_config;
private:
wxStaticBoxSizer* CreateControlChooser(GamepadPage* const parent);
wxStaticBoxSizer* CreateControlChooser(InputConfigDialog* parent);
void UpdateGUI();
void UpdateListContents();
@ -134,7 +133,7 @@ private:
bool GetExpressionForSelectedControl(wxString& expr);
GamepadPage* const m_parent;
InputConfigDialog* m_parent;
wxComboBox* device_cbox;
wxTextCtrl* textctrl;
wxListBox* control_lbox;
@ -172,11 +171,11 @@ protected:
int m_configured_width = wxDefaultCoord;
};
class ControlGroupBox : public wxBoxSizer
class ControlGroupBox : public wxStaticBoxSizer
{
public:
ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWindow* const parent,
GamepadPage* const eventsink);
InputConfigDialog* eventsink);
~ControlGroupBox();
bool HasBitmapHeading() const
@ -193,24 +192,21 @@ public:
double m_scale;
};
class ControlGroupsSizer : public wxBoxSizer
class InputConfigDialog : public wxDialog
{
public:
ControlGroupsSizer(ControllerEmu* const controller, wxWindow* const parent,
GamepadPage* const eventsink,
std::vector<ControlGroupBox*>* const groups = nullptr);
};
InputConfigDialog(wxWindow* const parent, InputConfig& config, const wxString& name,
const int port_num = 0);
virtual ~InputConfigDialog() = default;
class InputConfigDialog;
void OnClose(wxCloseEvent& event);
void OnCloseButton(wxCommandEvent& event);
class GamepadPage : public wxPanel
{
friend class InputConfigDialog;
friend class ControlDialog;
void UpdateDeviceComboBox();
void UpdateProfileComboBox();
public:
GamepadPage(wxWindow* parent, InputConfig& config, const int pad_num,
InputConfigDialog* const config_dialog);
void UpdateControlReferences();
void UpdateBitmaps(wxTimerEvent&);
void UpdateGUI();
@ -238,44 +234,29 @@ public:
void AdjustBooleanSetting(wxCommandEvent& event);
void GetProfilePath(std::string& path);
ControllerEmu* GetController() const;
wxComboBox* profile_cbox;
wxComboBox* device_cbox;
wxComboBox* profile_cbox = nullptr;
wxComboBox* device_cbox = nullptr;
std::vector<ControlGroupBox*> control_groups;
std::vector<ControlButton*> control_buttons;
protected:
wxBoxSizer* CreateDeviceChooserGroupBox();
wxBoxSizer* CreaterResetGroupBox(wxOrientation orientation);
wxBoxSizer* CreateProfileChooserGroupBox();
ControllerEmu* const controller;
wxTimer m_update_timer;
private:
ControlDialog* m_control_dialog;
InputConfigDialog* const m_config_dialog;
InputConfig& m_config;
int m_port_num;
ControlDialog* m_control_dialog;
InputEventFilter m_event_filter;
bool DetectButton(ControlButton* button);
bool m_iterate = false;
};
class InputConfigDialog : public wxDialog
{
public:
InputConfigDialog(wxWindow* const parent, InputConfig& config, const wxString& name,
const int tab_num = 0);
void OnClose(wxCloseEvent& event);
void OnCloseButton(wxCommandEvent& event);
void UpdateDeviceComboBox();
void UpdateProfileComboBox();
void UpdateControlReferences();
void UpdateBitmaps(wxTimerEvent&);
private:
wxNotebook* m_pad_notebook;
std::vector<GamepadPage*> m_padpages;
InputConfig& m_config;
wxTimer m_update_timer;
};

View File

@ -19,7 +19,7 @@
#include <wx/settings.h>
#include <wx/statbmp.h>
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/WxUtils.h"
#include "InputCommon/ControllerEmu.h"
@ -487,12 +487,9 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
g_controller_interface.UpdateInput();
GamepadPage* const current_page =
static_cast<GamepadPage*>(m_pad_notebook->GetPage(m_pad_notebook->GetSelection()));
wxMemoryDC dc;
auto lock = ControllerEmu::GetStateLock();
for (ControlGroupBox* g : current_page->control_groups)
for (ControlGroupBox* g : control_groups)
{
// Only if this control group has a bitmap
if (!g->static_bitmap)

View File

@ -0,0 +1,54 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/NunchukInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
NunchukInputConfigDialog::NunchukInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Buttons), this, this);
auto* const group_box_shake = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Shake), this, this);
auto* const buttons_shake = new wxBoxSizer(wxVERTICAL);
buttons_shake->Add(group_box_buttons, 0, wxEXPAND);
buttons_shake->AddSpacer(space5);
buttons_shake->Add(group_box_shake, 0, wxEXPAND);
auto* const group_box_stick = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Stick), this, this);
auto* const group_box_tilt = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Tilt), this, this);
auto* const group_box_swing = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Swing), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(buttons_shake, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_tilt, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_swing, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class NunchukInputConfigDialog final : public InputConfigDialog
{
public:
NunchukInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,62 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/TurntableInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
TurntableInputConfigDialog::TurntableInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_stick = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::Stick), this, this);
auto* const group_box_effect_dial = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::EffectDial), this, this);
auto* const stick_effect_sizer = new wxBoxSizer(wxVERTICAL);
stick_effect_sizer->Add(group_box_stick, 0, wxEXPAND);
stick_effect_sizer->AddSpacer(space5);
stick_effect_sizer->Add(group_box_effect_dial, 0, wxEXPAND);
auto* const group_box_left_table = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::LeftTable), this, this);
auto* const group_box_right_table = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::RightTable), this, this);
auto* const group_box_crossfade = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::Crossfade), this, this);
auto* const tables_crossfade_sizer = new wxBoxSizer(wxVERTICAL);
tables_crossfade_sizer->Add(group_box_right_table, 0, wxEXPAND);
tables_crossfade_sizer->AddSpacer(space5);
tables_crossfade_sizer->Add(group_box_left_table, 0, wxEXPAND);
tables_crossfade_sizer->AddSpacer(space5);
tables_crossfade_sizer->Add(group_box_crossfade, 0, wxEXPAND);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::Buttons), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_buttons, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(stick_effect_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(tables_crossfade_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class TurntableInputConfigDialog final : public InputConfigDialog
{
public:
TurntableInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,129 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <wx/notebook.h>
#include <wx/panel.h>
#include "DolphinWX/Input/WiimoteInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
WiimoteInputConfigDialog::WiimoteInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const device_chooser = CreateDeviceChooserGroupBox();
auto* const reset_sizer = CreaterResetGroupBox(wxVERTICAL);
auto* const profile_chooser = CreateProfileChooserGroupBox();
auto* const notebook = new wxNotebook(this, wxID_ANY);
// General and Options
auto* const tab_general = new wxPanel(notebook);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Buttons), tab_general, this);
auto* const group_box_dpad = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::DPad), tab_general, this);
auto* const group_box_rumble = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Rumble), tab_general, this);
auto* const group_box_extension = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Extension), tab_general, this);
auto* const group_box_options = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Options), tab_general, this);
auto* const group_box_hotkeys = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Hotkeys), tab_general, this);
auto* const dpad_extension_rumble_sizer = new wxBoxSizer(wxVERTICAL);
dpad_extension_rumble_sizer->Add(group_box_dpad, 0, wxEXPAND);
dpad_extension_rumble_sizer->AddSpacer(space5);
dpad_extension_rumble_sizer->Add(group_box_extension, 0, wxEXPAND);
dpad_extension_rumble_sizer->AddSpacer(space5);
dpad_extension_rumble_sizer->Add(group_box_rumble, 0, wxEXPAND);
auto* const options_hotkeys_sizer = new wxBoxSizer(wxVERTICAL);
options_hotkeys_sizer->Add(group_box_options, 0, wxEXPAND);
options_hotkeys_sizer->AddSpacer(space5);
options_hotkeys_sizer->Add(group_box_hotkeys, 0, wxEXPAND);
auto* const general_options_sizer = new wxBoxSizer(wxHORIZONTAL);
general_options_sizer->AddSpacer(space5);
general_options_sizer->Add(group_box_buttons, 0, wxEXPAND | wxTOP, space5);
general_options_sizer->AddSpacer(space5);
general_options_sizer->Add(dpad_extension_rumble_sizer, 0, wxEXPAND | wxTOP, space5);
general_options_sizer->AddSpacer(space5);
general_options_sizer->Add(options_hotkeys_sizer, 0, wxEXPAND | wxTOP, space5);
general_options_sizer->AddSpacer(space5);
tab_general->SetSizerAndFit(general_options_sizer);
notebook->AddPage(tab_general, "General and Options");
// Motion Controls and IR
auto* const tab_motion_controls_ir = new wxPanel(notebook);
auto* const group_box_shake =
new ControlGroupBox(Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Shake),
tab_motion_controls_ir, this);
auto* const group_box_ir =
new ControlGroupBox(Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::IR),
tab_motion_controls_ir, this);
auto* const group_box_tilt =
new ControlGroupBox(Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Tilt),
tab_motion_controls_ir, this);
auto* const group_box_swing =
new ControlGroupBox(Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Swing),
tab_motion_controls_ir, this);
auto* const swing_shake_sizer = new wxBoxSizer(wxVERTICAL);
swing_shake_sizer->Add(group_box_swing, 0, wxEXPAND);
swing_shake_sizer->AddSpacer(space5);
swing_shake_sizer->Add(group_box_shake, 0, wxEXPAND);
auto* const motion_controls_ir_sizer = new wxBoxSizer(wxHORIZONTAL);
motion_controls_ir_sizer->AddSpacer(space5);
motion_controls_ir_sizer->Add(group_box_ir, 0, wxEXPAND | wxTOP, space5);
motion_controls_ir_sizer->AddSpacer(space5);
motion_controls_ir_sizer->Add(group_box_tilt, 0, wxEXPAND | wxTOP, space5);
motion_controls_ir_sizer->AddSpacer(space5);
motion_controls_ir_sizer->Add(swing_shake_sizer, 0, wxEXPAND | wxTOP, space5);
motion_controls_ir_sizer->AddSpacer(space5);
tab_motion_controls_ir->SetSizerAndFit(motion_controls_ir_sizer);
notebook->AddPage(tab_motion_controls_ir, "Motion Controls and IR");
notebook->SetSelection(0);
auto* const device_profile_sizer = new wxBoxSizer(wxVERTICAL);
device_profile_sizer->Add(device_chooser, 1, wxEXPAND);
device_profile_sizer->Add(profile_chooser, 1, wxEXPAND);
auto* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->AddSpacer(space5);
dio->Add(device_profile_sizer, 5, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(reset_sizer, 1, wxEXPAND);
dio->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(dio);
szr_main->AddSpacer(space5);
szr_main->Add(notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateDeviceComboBox();
UpdateProfileComboBox();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class WiimoteInputConfigDialog final : public InputConfigDialog
{
public:
WiimoteInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -187,7 +187,14 @@ ControllerEmu::AnalogStick::AnalogStick(const char* const _name, const char* con
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
}
ControllerEmu::Buttons::Buttons(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_BUTTONS)
ControllerEmu::Buttons::Buttons(const std::string& _name)
: ControlGroup(_name, _name, GROUP_TYPE_BUTTONS)
{
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Threshold"), 0.5));
}
ControllerEmu::Buttons::Buttons(const std::string& ini_name, const std::string& group_name)
: ControlGroup(ini_name, group_name, GROUP_TYPE_BUTTONS)
{
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Threshold"), 0.5));
}

View File

@ -204,6 +204,7 @@ public:
{
public:
Buttons(const std::string& _name);
Buttons(const std::string& ini_name, const std::string& group_name);
template <typename C>
void GetState(C* const buttons, const C* bitmasks)