Add the ability to get partial input group

For hotkeys, changed HotkeyManager to allow to get and make partial groups of hotkeys.

Also preserved the old configuration naming scheme for the ini, this is done to preserve compatibility with the older groups structure.

Add the ability to get GCPad control groups

Used like the HotkeyManager methods, this is used for the new GCPad configuration dialog.

Add the ability to get groups of Keyboard input

Same reasons as the previous ones.

Add ability to get groups of Wiimote input

Add the ability to get extensions group

This needed to pass to 3 classes.  Will be used for their respective dialogs.
This commit is contained in:
aldelaro5
2016-11-10 22:07:40 -05:00
parent 6c16f1be8a
commit 7e99d03b7f
26 changed files with 545 additions and 61 deletions

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