mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-13 22:37:02 +00:00
UI: Add configurable hotkeys + a new fast forward hotkey (#1519)
This commit is contained in:
parent
e68c31e5fb
commit
cdca5eaf78
15 changed files with 619 additions and 8 deletions
|
|
@ -191,6 +191,50 @@ enum class CrashDump
|
|||
ENABLE_ENUM_ITERATORS(CrashDump, CrashDump::Disabled, CrashDump::Enabled);
|
||||
#endif
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint16 key : 13; // enough bits for all keycodes
|
||||
uint16 alt : 1;
|
||||
uint16 ctrl : 1;
|
||||
uint16 shift : 1;
|
||||
};
|
||||
uint16 raw;
|
||||
} uKeyboardHotkey;
|
||||
|
||||
typedef sint16 ControllerHotkey_t;
|
||||
|
||||
struct sHotkeyCfg
|
||||
{
|
||||
static constexpr uint8 keyboardNone{WXK_NONE};
|
||||
static constexpr sint8 controllerNone{-1}; // no enums to work with, but buttons start from 0
|
||||
|
||||
uKeyboardHotkey keyboard{keyboardNone};
|
||||
ControllerHotkey_t controller{controllerNone};
|
||||
|
||||
/* for defaults */
|
||||
sHotkeyCfg(const uKeyboardHotkey& keyboard = {WXK_NONE}, const ControllerHotkey_t& controller = {-1}) :
|
||||
keyboard(keyboard), controller(controller) {};
|
||||
|
||||
/* for reading from xml */
|
||||
sHotkeyCfg(const char* xml_values)
|
||||
{
|
||||
std::istringstream iss(xml_values);
|
||||
iss >> keyboard.raw >> controller;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<sHotkeyCfg> : formatter<string_view>
|
||||
{
|
||||
template <typename FormatContext>
|
||||
auto format(const sHotkeyCfg c, FormatContext &ctx) const {
|
||||
std::string xml_values = fmt::format("{} {}", c.keyboard.raw, c.controller);
|
||||
return formatter<string_view>::format(xml_values, ctx);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<PrecompiledShaderOption> : formatter<string_view> {
|
||||
template <typename FormatContext>
|
||||
|
|
@ -499,6 +543,17 @@ struct CemuConfig
|
|||
ConfigValue<uint16> port{ 26760 };
|
||||
}dsu_client{};
|
||||
|
||||
// hotkeys
|
||||
struct
|
||||
{
|
||||
sHotkeyCfg modifiers;
|
||||
sHotkeyCfg toggleFullscreen;
|
||||
sHotkeyCfg toggleFullscreenAlt;
|
||||
sHotkeyCfg exitFullscreen;
|
||||
sHotkeyCfg takeScreenshot;
|
||||
sHotkeyCfg toggleFastForward;
|
||||
} hotkeys{};
|
||||
|
||||
// debug
|
||||
ConfigValueBounds<CrashDump> crash_dump{ CrashDump::Disabled };
|
||||
ConfigValue<uint16> gdb_port{ 1337 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue