Hotkeys: Fix missing hotkey strings

This commit is contained in:
degasus 2015-06-11 22:20:44 +02:00
parent 5ae1c07cd4
commit b9a9fcd26d
3 changed files with 132 additions and 142 deletions

View File

@ -9,120 +9,6 @@
#include "Common/IniFile.h"
#include "DiscIO/Volume.h"
enum Hotkey
{
HK_OPEN,
HK_CHANGE_DISC,
HK_REFRESH_LIST,
HK_PLAY_PAUSE,
HK_STOP,
HK_RESET,
HK_FRAME_ADVANCE,
HK_START_RECORDING,
HK_PLAY_RECORDING,
HK_EXPORT_RECORDING,
HK_READ_ONLY_MODE,
HK_FULLSCREEN,
HK_SCREENSHOT,
HK_EXIT,
HK_WIIMOTE1_CONNECT,
HK_WIIMOTE2_CONNECT,
HK_WIIMOTE3_CONNECT,
HK_WIIMOTE4_CONNECT,
HK_BALANCEBOARD_CONNECT,
HK_VOLUME_DOWN,
HK_VOLUME_UP,
HK_VOLUME_TOGGLE_MUTE,
HK_INCREASE_IR,
HK_DECREASE_IR,
HK_TOGGLE_IR,
HK_TOGGLE_AR,
HK_TOGGLE_EFBCOPIES,
HK_TOGGLE_FOG,
HK_TOGGLE_THROTTLE,
HK_DECREASE_FRAME_LIMIT,
HK_INCREASE_FRAME_LIMIT,
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_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,
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,
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_SAVE_STATE_SLOT_SELECTED,
HK_LOAD_STATE_SLOT_SELECTED,
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,
};
enum GPUDeterminismMode
{
GPU_DETERMINISM_AUTO,

View File

@ -109,6 +109,8 @@ const std::string hotkey_labels[] =
_trans("Load State Last 6"),
_trans("Load State Last 7"),
_trans("Load State Last 8"),
_trans("Load State Last 9"),
_trans("Load State Last 10"),
_trans("Save Oldest State"),
_trans("Undo Load State"),
@ -116,13 +118,12 @@ const std::string hotkey_labels[] =
_trans("Save State"),
_trans("Load State"),
};
const int num_hotkeys = (sizeof(hotkey_labels) / sizeof(hotkey_labels[0]));
static_assert(NUM_HOTKEYS == sizeof(hotkey_labels) / sizeof(hotkey_labels[0]), "Wrong count of hotkey_labels");
namespace HotkeyManagerEmu
{
static u32 s_hotkeyDown[3];
static u32 s_hotkeyDown[(NUM_HOTKEYS + 31) / 32];
static HotkeyStatus s_hotkey;
static bool s_enabled;
@ -182,8 +183,8 @@ void Initialize(void* const hwnd)
// load the saved controller config
s_config.LoadConfig(true);
for (unsigned int i = 0; i < 3; ++i)
s_hotkeyDown[i] = 0;
for (u32& key : s_hotkeyDown)
key = 0;
s_enabled = true;
}
@ -209,19 +210,14 @@ void Shutdown()
HotkeyManager::HotkeyManager()
{
for (int set = 0; set < 3; set++)
for (int key = 0; key < NUM_HOTKEYS; key++)
{
// buttons
if ((set * 32) < num_hotkeys)
int set = key / 32;
if (key % 32 == 0)
groups.emplace_back(m_keys[set] = new Buttons(_trans("Keys")));
for (int key = 0; key < 32; key++)
{
if ((set * 32 + key) < num_hotkeys && hotkey_labels[set * 32 + key].length() != 0)
{
m_keys[set]->controls.emplace_back(new ControlGroup::Input(hotkey_labels[set * 32 + key]));
}
}
m_keys[set]->controls.emplace_back(new ControlGroup::Input(hotkey_labels[key]));
}
groups.emplace_back(m_options = new ControlGroup(_trans("Options")));
@ -240,20 +236,14 @@ std::string HotkeyManager::GetName() const
void HotkeyManager::GetInput(HotkeyStatus* const kb)
{
for (int set = 0; set < 3; set++)
for (int set = 0; set < (NUM_HOTKEYS + 31) / 32; set++)
{
std::vector<u32> bitmasks;
for (int key = 0; key < 32; key++)
{
if ((set * 32 + key) < num_hotkeys && hotkey_labels[set * 32 + key].length() != 0)
bitmasks.push_back(1 << key);
}
for (int key = 0; key < std::min(32, NUM_HOTKEYS - set * 32); key++)
bitmasks.push_back(1 << key);
if ((set * 32) < num_hotkeys)
{
kb->button[set] = 0;
m_keys[set]->GetState(&kb->button[set], bitmasks.data());
}
kb->button[set] = 0;
m_keys[set]->GetState(&kb->button[set], bitmasks.data());
}
}

View File

@ -7,9 +7,123 @@
#include <string>
#include "InputCommon/InputConfig.h"
enum Hotkey
{
HK_OPEN,
HK_CHANGE_DISC,
HK_REFRESH_LIST,
HK_PLAY_PAUSE,
HK_STOP,
HK_RESET,
HK_FRAME_ADVANCE,
HK_START_RECORDING,
HK_PLAY_RECORDING,
HK_EXPORT_RECORDING,
HK_READ_ONLY_MODE,
HK_FULLSCREEN,
HK_SCREENSHOT,
HK_EXIT,
HK_WIIMOTE1_CONNECT,
HK_WIIMOTE2_CONNECT,
HK_WIIMOTE3_CONNECT,
HK_WIIMOTE4_CONNECT,
HK_BALANCEBOARD_CONNECT,
HK_VOLUME_DOWN,
HK_VOLUME_UP,
HK_VOLUME_TOGGLE_MUTE,
HK_INCREASE_IR,
HK_DECREASE_IR,
HK_TOGGLE_IR,
HK_TOGGLE_AR,
HK_TOGGLE_EFBCOPIES,
HK_TOGGLE_FOG,
HK_TOGGLE_THROTTLE,
HK_DECREASE_FRAME_LIMIT,
HK_INCREASE_FRAME_LIMIT,
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_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,
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,
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_SAVE_STATE_SLOT_SELECTED,
HK_LOAD_STATE_SLOT_SELECTED,
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,
};
struct HotkeyStatus
{
u32 button[6];
u32 button[(NUM_HOTKEYS + 31) / 32];
s8 err;
};
@ -24,7 +138,7 @@ public:
void LoadDefaults(const ControllerInterface& ciface);
private:
Buttons* m_keys[3];
Buttons* m_keys[(NUM_HOTKEYS + 31) / 32];
ControlGroup* m_options;
};