2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2015-01-27 01:24:47 +00:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-11-11 03:07:40 +00:00
|
|
|
#include <array>
|
2015-05-08 21:28:03 +00:00
|
|
|
#include <string>
|
2016-11-11 03:07:40 +00:00
|
|
|
|
2017-02-09 03:15:43 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2017-01-30 03:32:04 +00:00
|
|
|
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
2015-01-27 01:24:47 +00:00
|
|
|
#include "InputCommon/InputConfig.h"
|
|
|
|
|
2017-02-09 03:15:43 +00:00
|
|
|
namespace ControllerEmu
|
|
|
|
{
|
|
|
|
class ControllerEmu;
|
|
|
|
class Buttons;
|
|
|
|
}
|
|
|
|
|
2015-06-11 20:20:44 +00:00
|
|
|
enum Hotkey
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
HK_OPEN,
|
|
|
|
HK_CHANGE_DISC,
|
|
|
|
HK_REFRESH_LIST,
|
|
|
|
HK_PLAY_PAUSE,
|
|
|
|
HK_STOP,
|
|
|
|
HK_RESET,
|
2016-11-11 03:07:40 +00:00
|
|
|
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,
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
HK_FRAME_ADVANCE,
|
|
|
|
HK_FRAME_ADVANCE_DECREASE_SPEED,
|
|
|
|
HK_FRAME_ADVANCE_INCREASE_SPEED,
|
|
|
|
HK_FRAME_ADVANCE_RESET_SPEED,
|
|
|
|
|
|
|
|
HK_START_RECORDING,
|
|
|
|
HK_PLAY_RECORDING,
|
|
|
|
HK_EXPORT_RECORDING,
|
|
|
|
HK_READ_ONLY_MODE,
|
|
|
|
|
2016-12-30 20:22:59 +00:00
|
|
|
HK_STEP,
|
|
|
|
HK_STEP_OVER,
|
|
|
|
HK_STEP_OUT,
|
|
|
|
HK_SKIP,
|
|
|
|
|
|
|
|
HK_SHOW_PC,
|
|
|
|
HK_SET_PC,
|
|
|
|
|
|
|
|
HK_BP_TOGGLE,
|
|
|
|
HK_BP_ADD,
|
|
|
|
HK_MBP_ADD,
|
|
|
|
|
2016-08-23 14:19:30 +00:00
|
|
|
HK_TRIGGER_SYNC_BUTTON,
|
2016-06-24 08:43:46 +00:00
|
|
|
HK_WIIMOTE1_CONNECT,
|
|
|
|
HK_WIIMOTE2_CONNECT,
|
|
|
|
HK_WIIMOTE3_CONNECT,
|
|
|
|
HK_WIIMOTE4_CONNECT,
|
|
|
|
HK_BALANCEBOARD_CONNECT,
|
|
|
|
|
|
|
|
HK_TOGGLE_CROP,
|
|
|
|
HK_TOGGLE_AR,
|
|
|
|
HK_TOGGLE_EFBCOPIES,
|
|
|
|
HK_TOGGLE_FOG,
|
2016-12-05 16:20:45 +00:00
|
|
|
HK_TOGGLE_DUMPTEXTURES,
|
2016-08-20 04:14:56 +00:00
|
|
|
HK_TOGGLE_TEXTURES,
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-11-11 03:07:40 +00:00
|
|
|
HK_INCREASE_IR,
|
|
|
|
HK_DECREASE_IR,
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
HK_FREELOOK_DECREASE_SPEED,
|
|
|
|
HK_FREELOOK_INCREASE_SPEED,
|
|
|
|
HK_FREELOOK_RESET_SPEED,
|
|
|
|
HK_FREELOOK_UP,
|
|
|
|
HK_FREELOOK_DOWN,
|
|
|
|
HK_FREELOOK_LEFT,
|
|
|
|
HK_FREELOOK_RIGHT,
|
|
|
|
HK_FREELOOK_ZOOM_IN,
|
|
|
|
HK_FREELOOK_ZOOM_OUT,
|
|
|
|
HK_FREELOOK_RESET,
|
|
|
|
|
|
|
|
HK_TOGGLE_STEREO_SBS,
|
|
|
|
HK_TOGGLE_STEREO_TAB,
|
|
|
|
HK_TOGGLE_STEREO_ANAGLYPH,
|
|
|
|
HK_TOGGLE_STEREO_3DVISION,
|
|
|
|
|
|
|
|
HK_DECREASE_DEPTH,
|
|
|
|
HK_INCREASE_DEPTH,
|
|
|
|
HK_DECREASE_CONVERGENCE,
|
|
|
|
HK_INCREASE_CONVERGENCE,
|
|
|
|
|
|
|
|
HK_LOAD_STATE_SLOT_1,
|
|
|
|
HK_LOAD_STATE_SLOT_2,
|
|
|
|
HK_LOAD_STATE_SLOT_3,
|
|
|
|
HK_LOAD_STATE_SLOT_4,
|
|
|
|
HK_LOAD_STATE_SLOT_5,
|
|
|
|
HK_LOAD_STATE_SLOT_6,
|
|
|
|
HK_LOAD_STATE_SLOT_7,
|
|
|
|
HK_LOAD_STATE_SLOT_8,
|
|
|
|
HK_LOAD_STATE_SLOT_9,
|
|
|
|
HK_LOAD_STATE_SLOT_10,
|
2016-11-11 03:07:40 +00:00
|
|
|
HK_LOAD_STATE_SLOT_SELECTED,
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
HK_SAVE_STATE_SLOT_1,
|
|
|
|
HK_SAVE_STATE_SLOT_2,
|
|
|
|
HK_SAVE_STATE_SLOT_3,
|
|
|
|
HK_SAVE_STATE_SLOT_4,
|
|
|
|
HK_SAVE_STATE_SLOT_5,
|
|
|
|
HK_SAVE_STATE_SLOT_6,
|
|
|
|
HK_SAVE_STATE_SLOT_7,
|
|
|
|
HK_SAVE_STATE_SLOT_8,
|
|
|
|
HK_SAVE_STATE_SLOT_9,
|
|
|
|
HK_SAVE_STATE_SLOT_10,
|
2016-11-11 03:07:40 +00:00
|
|
|
HK_SAVE_STATE_SLOT_SELECTED,
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
HK_SELECT_STATE_SLOT_1,
|
|
|
|
HK_SELECT_STATE_SLOT_2,
|
|
|
|
HK_SELECT_STATE_SLOT_3,
|
|
|
|
HK_SELECT_STATE_SLOT_4,
|
|
|
|
HK_SELECT_STATE_SLOT_5,
|
|
|
|
HK_SELECT_STATE_SLOT_6,
|
|
|
|
HK_SELECT_STATE_SLOT_7,
|
|
|
|
HK_SELECT_STATE_SLOT_8,
|
|
|
|
HK_SELECT_STATE_SLOT_9,
|
|
|
|
HK_SELECT_STATE_SLOT_10,
|
|
|
|
|
|
|
|
HK_LOAD_LAST_STATE_1,
|
|
|
|
HK_LOAD_LAST_STATE_2,
|
|
|
|
HK_LOAD_LAST_STATE_3,
|
|
|
|
HK_LOAD_LAST_STATE_4,
|
|
|
|
HK_LOAD_LAST_STATE_5,
|
|
|
|
HK_LOAD_LAST_STATE_6,
|
|
|
|
HK_LOAD_LAST_STATE_7,
|
|
|
|
HK_LOAD_LAST_STATE_8,
|
|
|
|
HK_LOAD_LAST_STATE_9,
|
|
|
|
HK_LOAD_LAST_STATE_10,
|
|
|
|
|
|
|
|
HK_SAVE_FIRST_STATE,
|
|
|
|
HK_UNDO_LOAD_STATE,
|
|
|
|
HK_UNDO_SAVE_STATE,
|
|
|
|
HK_SAVE_STATE_FILE,
|
|
|
|
HK_LOAD_STATE_FILE,
|
|
|
|
|
|
|
|
NUM_HOTKEYS,
|
2015-06-11 20:20:44 +00:00
|
|
|
};
|
|
|
|
|
2016-11-11 03:07:40 +00:00
|
|
|
enum HotkeyGroup : int
|
|
|
|
{
|
|
|
|
HKGP_GENERAL,
|
|
|
|
HKGP_VOLUME,
|
|
|
|
HKGP_SPEED,
|
2016-12-24 18:26:21 +00:00
|
|
|
HKGP_FRAME_ADVANCE,
|
2016-11-11 03:07:40 +00:00
|
|
|
HKGP_MOVIE,
|
2016-12-30 20:22:59 +00:00
|
|
|
HKGP_STEPPING,
|
|
|
|
HKGP_PC,
|
|
|
|
HKGP_BREAKPOINT,
|
2016-11-11 03:07:40 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2015-01-27 01:24:47 +00:00
|
|
|
struct HotkeyStatus
|
|
|
|
{
|
2016-11-11 03:07:40 +00:00
|
|
|
u32 button[NUM_HOTKEY_GROUPS];
|
2016-06-24 08:43:46 +00:00
|
|
|
s8 err;
|
2015-01-27 01:24:47 +00:00
|
|
|
};
|
|
|
|
|
2017-02-09 03:15:43 +00:00
|
|
|
class HotkeyManager : public ControllerEmu::EmulatedController
|
2015-01-27 01:24:47 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-06-24 08:43:46 +00:00
|
|
|
HotkeyManager();
|
|
|
|
~HotkeyManager();
|
2015-01-27 01:24:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void GetInput(HotkeyStatus* const hk);
|
|
|
|
std::string GetName() const override;
|
2017-02-09 03:15:43 +00:00
|
|
|
ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group) const;
|
2016-11-11 03:07:40 +00:00
|
|
|
int FindGroupByID(int id) const;
|
|
|
|
int GetIndexForGroup(int group, int id) const;
|
2016-06-24 08:43:46 +00:00
|
|
|
void LoadDefaults(const ControllerInterface& ciface) override;
|
2015-01-27 01:24:47 +00:00
|
|
|
|
|
|
|
private:
|
2017-02-09 03:15:43 +00:00
|
|
|
ControllerEmu::Buttons* m_keys[NUM_HOTKEY_GROUPS];
|
|
|
|
std::array<ControllerEmu::ControlGroup*, NUM_HOTKEY_GROUPS> m_hotkey_groups;
|
2015-01-27 01:24:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
namespace HotkeyManagerEmu
|
|
|
|
{
|
2016-10-11 19:54:35 +00:00
|
|
|
void Initialize();
|
2016-06-24 08:43:46 +00:00
|
|
|
void Shutdown();
|
|
|
|
void LoadConfig();
|
|
|
|
|
|
|
|
InputConfig* GetConfig();
|
2016-11-11 03:07:40 +00:00
|
|
|
ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group);
|
2016-06-24 08:43:46 +00:00
|
|
|
void GetStatus();
|
|
|
|
bool IsEnabled();
|
|
|
|
void Enable(bool enable_toggle);
|
|
|
|
bool IsPressed(int Id, bool held);
|
2015-01-27 01:24:47 +00:00
|
|
|
}
|