#pragma once #include #include "config/CemuConfig.h" #include "input/api/Controller.h" class HotkeyEntry; class HotkeySettings : public wxFrame { public: static void Init(wxFrame* mainWindowFrame); static void CaptureInput(wxKeyEvent& event); static void CaptureInput(const ControllerState& currentState, const ControllerState& lastState); HotkeySettings(wxWindow* parent); ~HotkeySettings(); private: inline static wxFrame* s_mainWindow = nullptr; static const std::unordered_map> s_cfgHotkeyToFuncMap; inline static std::unordered_map> s_keyboardHotkeyToFuncMap{}; inline static std::unordered_map> s_controllerHotkeyToFuncMap{}; inline static auto& s_cfgHotkeys = GetConfig().hotkeys; wxPanel* m_panel; wxFlexGridSizer* m_sizer; wxButton* m_activeInputButton{ nullptr }; wxTimer* m_controllerTimer{ nullptr }; const wxSize m_minButtonSize{ 250, 45 }; const wxString m_disabledHotkeyText{ _("----") }; const wxString m_editModeHotkeyText{ _("") }; std::vector m_hotkeys; std::weak_ptr m_activeController{}; bool m_needToSave = false; /* helpers */ void CreateColumnHeaders(void); void CreateHotkeyRow(const wxString& label, sHotkeyCfg& cfgHotkey); wxString To_wxString(uKeyboardHotkey hotkey); wxString To_wxString(ControllerHotkey_t hotkey); bool IsValidKeycodeUp(int keycode); bool SetActiveController(void); template void FinalizeInput(wxButton* inputButton); template void RestoreInputButton(void); /* events */ void OnKeyboardHotkeyInputLeftClick(wxCommandEvent& event); void OnControllerHotkeyInputLeftClick(wxCommandEvent& event); void OnKeyboardHotkeyInputRightClick(wxMouseEvent& event); void OnControllerHotkeyInputRightClick(wxMouseEvent& event); void OnKeyUp(wxKeyEvent& event); void OnControllerTimer(wxTimerEvent& event); };