diff --git a/rpcs3/Emu/Cell/lv2/sys_config.cpp b/rpcs3/Emu/Cell/lv2/sys_config.cpp index 0f8b6081b2..fd3bad4c7e 100644 --- a/rpcs3/Emu/Cell/lv2/sys_config.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_config.cpp @@ -438,6 +438,6 @@ error_code sys_config_register_io_error_listener(u32 config_hdl) error_code sys_config_unregister_io_error_listener(u32 config_hdl) { - sys_config.todo("sys_config_register_io_error_listener(config_hdl=0x%x)", config_hdl); + sys_config.todo("sys_config_unregister_io_error_listener(config_hdl=0x%x)", config_hdl); return CELL_OK; } diff --git a/rpcs3/Emu/Io/PadHandler.h b/rpcs3/Emu/Io/PadHandler.h index 14d01a5217..7a6f3f5319 100644 --- a/rpcs3/Emu/Io/PadHandler.h +++ b/rpcs3/Emu/Io/PadHandler.h @@ -170,7 +170,7 @@ private: virtual void get_extended_info(const std::shared_ptr& /*device*/, const std::shared_ptr& /*pad*/) {}; virtual void apply_pad_data(const std::shared_ptr& /*device*/, const std::shared_ptr& /*pad*/) {}; virtual std::unordered_map get_button_values(const std::shared_ptr& /*device*/) { return {}; }; - virtual pad_preview_values get_preview_values(std::unordered_map /*data*/) { return {}; }; + virtual pad_preview_values get_preview_values(const std::unordered_map& /*data*/) { return {}; }; protected: virtual std::array get_mapped_key_codes(const std::shared_ptr& /*device*/, const pad_config* profile); diff --git a/rpcs3/Input/basic_keyboard_handler.cpp b/rpcs3/Input/basic_keyboard_handler.cpp index 95bda6a40b..c35adb89aa 100644 --- a/rpcs3/Input/basic_keyboard_handler.cpp +++ b/rpcs3/Input/basic_keyboard_handler.cpp @@ -160,139 +160,141 @@ void basic_keyboard_handler::LoadSettings() return; } + std::vector& buttons = m_keyboards[0].m_buttons; + // Meta Keys - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_Control, CELL_KB_MKEY_L_CTRL); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Shift, CELL_KB_MKEY_L_SHIFT); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Alt, CELL_KB_MKEY_L_ALT); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Super_L, CELL_KB_MKEY_L_WIN); - //m_keyboards[0].m_buttons.emplace_back(, CELL_KB_MKEY_R_CTRL); - //m_keyboards[0].m_buttons.emplace_back(, CELL_KB_MKEY_R_SHIFT); - //m_keyboards[0].m_buttons.emplace_back(, CELL_KB_MKEY_R_ALT); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Super_R, CELL_KB_MKEY_R_WIN); + //buttons.emplace_back(Qt::Key_Control, CELL_KB_MKEY_L_CTRL); + buttons.emplace_back(Qt::Key_Shift, CELL_KB_MKEY_L_SHIFT); + buttons.emplace_back(Qt::Key_Alt, CELL_KB_MKEY_L_ALT); + buttons.emplace_back(Qt::Key_Super_L, CELL_KB_MKEY_L_WIN); + //buttons.emplace_back(, CELL_KB_MKEY_R_CTRL); + //buttons.emplace_back(, CELL_KB_MKEY_R_SHIFT); + //buttons.emplace_back(, CELL_KB_MKEY_R_ALT); + buttons.emplace_back(Qt::Key_Super_R, CELL_KB_MKEY_R_WIN); // CELL_KB_RAWDAT - //m_keyboards[0].m_buttons.emplace_back(, CELL_KEYC_NO_EVENT); - //m_keyboards[0].m_buttons.emplace_back(, CELL_KEYC_E_ROLLOVER); - //m_keyboards[0].m_buttons.emplace_back(, CELL_KEYC_E_POSTFAIL); - //m_keyboards[0].m_buttons.emplace_back(, CELL_KEYC_E_UNDEF); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Escape, CELL_KEYC_ESCAPE); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Kanji, CELL_KEYC_106_KANJI); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_CapsLock, CELL_KEYC_CAPS_LOCK); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F1, CELL_KEYC_F1); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F2, CELL_KEYC_F2); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F3, CELL_KEYC_F3); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F4, CELL_KEYC_F4); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F5, CELL_KEYC_F5); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F6, CELL_KEYC_F6); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F7, CELL_KEYC_F7); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F8, CELL_KEYC_F8); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F9, CELL_KEYC_F9); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F10, CELL_KEYC_F10); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F11, CELL_KEYC_F11); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F12, CELL_KEYC_F12); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Print, CELL_KEYC_PRINTSCREEN); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_ScrollLock, CELL_KEYC_SCROLL_LOCK); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Pause, CELL_KEYC_PAUSE); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Insert, CELL_KEYC_INSERT); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Home, CELL_KEYC_HOME); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_PageUp, CELL_KEYC_PAGE_UP); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Delete, CELL_KEYC_DELETE); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_End, CELL_KEYC_END); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_PageDown, CELL_KEYC_PAGE_DOWN); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Right, CELL_KEYC_RIGHT_ARROW); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Left, CELL_KEYC_LEFT_ARROW); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Down, CELL_KEYC_DOWN_ARROW); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Up, CELL_KEYC_UP_ARROW); - //m_keyboards[0].m_buttons.emplace_back(WXK_NUMLOCK, CELL_KEYC_NUM_LOCK); - //m_keyboards[0].m_buttons.emplace_back(, CELL_KEYC_APPLICATION); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Kana_Shift, CELL_KEYC_KANA); // maybe Key_Kana_Lock - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Henkan, CELL_KEYC_HENKAN); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Muhenkan, CELL_KEYC_MUHENKAN); + //buttons.emplace_back(, CELL_KEYC_NO_EVENT); + //buttons.emplace_back(, CELL_KEYC_E_ROLLOVER); + //buttons.emplace_back(, CELL_KEYC_E_POSTFAIL); + //buttons.emplace_back(, CELL_KEYC_E_UNDEF); + buttons.emplace_back(Qt::Key_Escape, CELL_KEYC_ESCAPE); + buttons.emplace_back(Qt::Key_Kanji, CELL_KEYC_106_KANJI); + //buttons.emplace_back(Qt::Key_CapsLock, CELL_KEYC_CAPS_LOCK); + buttons.emplace_back(Qt::Key_F1, CELL_KEYC_F1); + buttons.emplace_back(Qt::Key_F2, CELL_KEYC_F2); + buttons.emplace_back(Qt::Key_F3, CELL_KEYC_F3); + buttons.emplace_back(Qt::Key_F4, CELL_KEYC_F4); + buttons.emplace_back(Qt::Key_F5, CELL_KEYC_F5); + buttons.emplace_back(Qt::Key_F6, CELL_KEYC_F6); + buttons.emplace_back(Qt::Key_F7, CELL_KEYC_F7); + buttons.emplace_back(Qt::Key_F8, CELL_KEYC_F8); + buttons.emplace_back(Qt::Key_F9, CELL_KEYC_F9); + buttons.emplace_back(Qt::Key_F10, CELL_KEYC_F10); + buttons.emplace_back(Qt::Key_F11, CELL_KEYC_F11); + buttons.emplace_back(Qt::Key_F12, CELL_KEYC_F12); + buttons.emplace_back(Qt::Key_Print, CELL_KEYC_PRINTSCREEN); + buttons.emplace_back(Qt::Key_ScrollLock, CELL_KEYC_SCROLL_LOCK); + buttons.emplace_back(Qt::Key_Pause, CELL_KEYC_PAUSE); + buttons.emplace_back(Qt::Key_Insert, CELL_KEYC_INSERT); + buttons.emplace_back(Qt::Key_Home, CELL_KEYC_HOME); + buttons.emplace_back(Qt::Key_PageUp, CELL_KEYC_PAGE_UP); + buttons.emplace_back(Qt::Key_Delete, CELL_KEYC_DELETE); + buttons.emplace_back(Qt::Key_End, CELL_KEYC_END); + buttons.emplace_back(Qt::Key_PageDown, CELL_KEYC_PAGE_DOWN); + buttons.emplace_back(Qt::Key_Right, CELL_KEYC_RIGHT_ARROW); + buttons.emplace_back(Qt::Key_Left, CELL_KEYC_LEFT_ARROW); + buttons.emplace_back(Qt::Key_Down, CELL_KEYC_DOWN_ARROW); + buttons.emplace_back(Qt::Key_Up, CELL_KEYC_UP_ARROW); + //buttons.emplace_back(WXK_NUMLOCK, CELL_KEYC_NUM_LOCK); + //buttons.emplace_back(, CELL_KEYC_APPLICATION); + buttons.emplace_back(Qt::Key_Kana_Shift, CELL_KEYC_KANA); // maybe Key_Kana_Lock + buttons.emplace_back(Qt::Key_Henkan, CELL_KEYC_HENKAN); + buttons.emplace_back(Qt::Key_Muhenkan, CELL_KEYC_MUHENKAN); // CELL_KB_KEYPAD - m_keyboards[0].m_buttons.emplace_back(Qt::Key_NumLock, CELL_KEYC_KPAD_NUMLOCK); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_division, CELL_KEYC_KPAD_SLASH); // should ideally be slash but that's occupied obviously - m_keyboards[0].m_buttons.emplace_back(Qt::Key_multiply, CELL_KEYC_KPAD_ASTERISK); // should ideally be asterisk but that's occupied obviously - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_Minus, CELL_KEYC_KPAD_MINUS); // should ideally be minus but that's occupied obviously - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Plus, CELL_KEYC_KPAD_PLUS); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Enter, CELL_KEYC_KPAD_ENTER); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_1, CELL_KEYC_KPAD_1); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_2, CELL_KEYC_KPAD_2); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_3, CELL_KEYC_KPAD_3); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_4, CELL_KEYC_KPAD_4); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_5, CELL_KEYC_KPAD_5); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_6, CELL_KEYC_KPAD_6); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_7, CELL_KEYC_KPAD_7); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_8, CELL_KEYC_KPAD_8); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_9, CELL_KEYC_KPAD_9); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_0, CELL_KEYC_KPAD_0); - //m_keyboards[0].m_buttons.emplace_back(Qt::Key_Delete, CELL_KEYC_KPAD_PERIOD); + buttons.emplace_back(Qt::Key_NumLock, CELL_KEYC_KPAD_NUMLOCK); + buttons.emplace_back(Qt::Key_division, CELL_KEYC_KPAD_SLASH); // should ideally be slash but that's occupied obviously + buttons.emplace_back(Qt::Key_multiply, CELL_KEYC_KPAD_ASTERISK); // should ideally be asterisk but that's occupied obviously + //buttons.emplace_back(Qt::Key_Minus, CELL_KEYC_KPAD_MINUS); // should ideally be minus but that's occupied obviously + buttons.emplace_back(Qt::Key_Plus, CELL_KEYC_KPAD_PLUS); + buttons.emplace_back(Qt::Key_Enter, CELL_KEYC_KPAD_ENTER); + //buttons.emplace_back(Qt::Key_1, CELL_KEYC_KPAD_1); + //buttons.emplace_back(Qt::Key_2, CELL_KEYC_KPAD_2); + //buttons.emplace_back(Qt::Key_3, CELL_KEYC_KPAD_3); + //buttons.emplace_back(Qt::Key_4, CELL_KEYC_KPAD_4); + //buttons.emplace_back(Qt::Key_5, CELL_KEYC_KPAD_5); + //buttons.emplace_back(Qt::Key_6, CELL_KEYC_KPAD_6); + //buttons.emplace_back(Qt::Key_7, CELL_KEYC_KPAD_7); + //buttons.emplace_back(Qt::Key_8, CELL_KEYC_KPAD_8); + //buttons.emplace_back(Qt::Key_9, CELL_KEYC_KPAD_9); + //buttons.emplace_back(Qt::Key_0, CELL_KEYC_KPAD_0); + //buttons.emplace_back(Qt::Key_Delete, CELL_KEYC_KPAD_PERIOD); // ASCII Printable characters - m_keyboards[0].m_buttons.emplace_back(Qt::Key_A, CELL_KEYC_A); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_B, CELL_KEYC_B); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_C, CELL_KEYC_C); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_D, CELL_KEYC_D); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_E, CELL_KEYC_E); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_F, CELL_KEYC_F); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_G, CELL_KEYC_G); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_H, CELL_KEYC_H); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_I, CELL_KEYC_I); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_J, CELL_KEYC_J); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_K, CELL_KEYC_K); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_L, CELL_KEYC_L); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_M, CELL_KEYC_M); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_N, CELL_KEYC_N); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_O, CELL_KEYC_O); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_P, CELL_KEYC_P); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Q, CELL_KEYC_Q); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_R, CELL_KEYC_R); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_S, CELL_KEYC_S); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_T, CELL_KEYC_T); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_U, CELL_KEYC_U); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_V, CELL_KEYC_V); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_W, CELL_KEYC_W); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_X, CELL_KEYC_X); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Y, CELL_KEYC_Y); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Z, CELL_KEYC_Z); + buttons.emplace_back(Qt::Key_A, CELL_KEYC_A); + buttons.emplace_back(Qt::Key_B, CELL_KEYC_B); + buttons.emplace_back(Qt::Key_C, CELL_KEYC_C); + buttons.emplace_back(Qt::Key_D, CELL_KEYC_D); + buttons.emplace_back(Qt::Key_E, CELL_KEYC_E); + buttons.emplace_back(Qt::Key_F, CELL_KEYC_F); + buttons.emplace_back(Qt::Key_G, CELL_KEYC_G); + buttons.emplace_back(Qt::Key_H, CELL_KEYC_H); + buttons.emplace_back(Qt::Key_I, CELL_KEYC_I); + buttons.emplace_back(Qt::Key_J, CELL_KEYC_J); + buttons.emplace_back(Qt::Key_K, CELL_KEYC_K); + buttons.emplace_back(Qt::Key_L, CELL_KEYC_L); + buttons.emplace_back(Qt::Key_M, CELL_KEYC_M); + buttons.emplace_back(Qt::Key_N, CELL_KEYC_N); + buttons.emplace_back(Qt::Key_O, CELL_KEYC_O); + buttons.emplace_back(Qt::Key_P, CELL_KEYC_P); + buttons.emplace_back(Qt::Key_Q, CELL_KEYC_Q); + buttons.emplace_back(Qt::Key_R, CELL_KEYC_R); + buttons.emplace_back(Qt::Key_S, CELL_KEYC_S); + buttons.emplace_back(Qt::Key_T, CELL_KEYC_T); + buttons.emplace_back(Qt::Key_U, CELL_KEYC_U); + buttons.emplace_back(Qt::Key_V, CELL_KEYC_V); + buttons.emplace_back(Qt::Key_W, CELL_KEYC_W); + buttons.emplace_back(Qt::Key_X, CELL_KEYC_X); + buttons.emplace_back(Qt::Key_Y, CELL_KEYC_Y); + buttons.emplace_back(Qt::Key_Z, CELL_KEYC_Z); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_1, CELL_KEYC_1); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_2, CELL_KEYC_2); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_3, CELL_KEYC_3); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_4, CELL_KEYC_4); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_5, CELL_KEYC_5); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_6, CELL_KEYC_6); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_7, CELL_KEYC_7); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_8, CELL_KEYC_8); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_9, CELL_KEYC_9); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_0, CELL_KEYC_0); + buttons.emplace_back(Qt::Key_1, CELL_KEYC_1); + buttons.emplace_back(Qt::Key_2, CELL_KEYC_2); + buttons.emplace_back(Qt::Key_3, CELL_KEYC_3); + buttons.emplace_back(Qt::Key_4, CELL_KEYC_4); + buttons.emplace_back(Qt::Key_5, CELL_KEYC_5); + buttons.emplace_back(Qt::Key_6, CELL_KEYC_6); + buttons.emplace_back(Qt::Key_7, CELL_KEYC_7); + buttons.emplace_back(Qt::Key_8, CELL_KEYC_8); + buttons.emplace_back(Qt::Key_9, CELL_KEYC_9); + buttons.emplace_back(Qt::Key_0, CELL_KEYC_0); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Return, CELL_KEYC_ENTER); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Backspace, CELL_KEYC_BS); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Tab, CELL_KEYC_TAB); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Space, CELL_KEYC_SPACE); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Minus, CELL_KEYC_MINUS); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Equal, CELL_KEYC_EQUAL_101); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_AsciiCircum, CELL_KEYC_ACCENT_CIRCONFLEX_106); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_BracketLeft, CELL_KEYC_LEFT_BRACKET_101); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_At, CELL_KEYC_ATMARK_106); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_BracketRight, CELL_KEYC_RIGHT_BRACKET_101); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_BracketLeft, CELL_KEYC_LEFT_BRACKET_106); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Backslash, CELL_KEYC_BACKSLASH_101); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_BracketRight, CELL_KEYC_RIGHT_BRACKET_106); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Semicolon, CELL_KEYC_SEMICOLON); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Apostrophe, CELL_KEYC_QUOTATION_101); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Colon, CELL_KEYC_COLON_106); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Comma, CELL_KEYC_COMMA); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Period, CELL_KEYC_PERIOD); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Slash, CELL_KEYC_SLASH); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Backslash, CELL_KEYC_BACKSLASH_106); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_yen, CELL_KEYC_YEN_106); + buttons.emplace_back(Qt::Key_Return, CELL_KEYC_ENTER); + buttons.emplace_back(Qt::Key_Backspace, CELL_KEYC_BS); + buttons.emplace_back(Qt::Key_Tab, CELL_KEYC_TAB); + buttons.emplace_back(Qt::Key_Space, CELL_KEYC_SPACE); + buttons.emplace_back(Qt::Key_Minus, CELL_KEYC_MINUS); + buttons.emplace_back(Qt::Key_Equal, CELL_KEYC_EQUAL_101); + buttons.emplace_back(Qt::Key_AsciiCircum, CELL_KEYC_ACCENT_CIRCONFLEX_106); + buttons.emplace_back(Qt::Key_BracketLeft, CELL_KEYC_LEFT_BRACKET_101); + buttons.emplace_back(Qt::Key_At, CELL_KEYC_ATMARK_106); + buttons.emplace_back(Qt::Key_BracketRight, CELL_KEYC_RIGHT_BRACKET_101); + buttons.emplace_back(Qt::Key_BracketLeft, CELL_KEYC_LEFT_BRACKET_106); + buttons.emplace_back(Qt::Key_Backslash, CELL_KEYC_BACKSLASH_101); + buttons.emplace_back(Qt::Key_BracketRight, CELL_KEYC_RIGHT_BRACKET_106); + buttons.emplace_back(Qt::Key_Semicolon, CELL_KEYC_SEMICOLON); + buttons.emplace_back(Qt::Key_Apostrophe, CELL_KEYC_QUOTATION_101); + buttons.emplace_back(Qt::Key_Colon, CELL_KEYC_COLON_106); + buttons.emplace_back(Qt::Key_Comma, CELL_KEYC_COMMA); + buttons.emplace_back(Qt::Key_Period, CELL_KEYC_PERIOD); + buttons.emplace_back(Qt::Key_Slash, CELL_KEYC_SLASH); + buttons.emplace_back(Qt::Key_Backslash, CELL_KEYC_BACKSLASH_106); + buttons.emplace_back(Qt::Key_yen, CELL_KEYC_YEN_106); // Made up helper buttons - m_keyboards[0].m_buttons.emplace_back(Qt::Key_Less, CELL_KEYC_LESS); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_NumberSign, CELL_KEYC_HASHTAG); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_ssharp, CELL_KEYC_SSHARP); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_QuoteLeft, CELL_KEYC_BACK_QUOTE); - m_keyboards[0].m_buttons.emplace_back(Qt::Key_acute, CELL_KEYC_BACK_QUOTE); + buttons.emplace_back(Qt::Key_Less, CELL_KEYC_LESS); + buttons.emplace_back(Qt::Key_NumberSign, CELL_KEYC_HASHTAG); + buttons.emplace_back(Qt::Key_ssharp, CELL_KEYC_SSHARP); + buttons.emplace_back(Qt::Key_QuoteLeft, CELL_KEYC_BACK_QUOTE); + buttons.emplace_back(Qt::Key_acute, CELL_KEYC_BACK_QUOTE); } diff --git a/rpcs3/Input/ds3_pad_handler.cpp b/rpcs3/Input/ds3_pad_handler.cpp index 28258a8625..10b9062f38 100644 --- a/rpcs3/Input/ds3_pad_handler.cpp +++ b/rpcs3/Input/ds3_pad_handler.cpp @@ -231,11 +231,11 @@ std::shared_ptr ds3_pad_handler::get_ds3_device(con if (!Init()) return nullptr; - size_t pos = padId.find(m_name_string); + const size_t pos = padId.find(m_name_string); if (pos == umax) return nullptr; - int pad_number = std::stoi(padId.substr(pos + 9)); + const int pad_number = std::stoi(padId.substr(pos + 9)); if (pad_number > 0 && pad_number + 0u <= controllers.size()) return controllers[static_cast(pad_number) - 1]; @@ -302,9 +302,9 @@ ds3_pad_handler::DS3Status ds3_pad_handler::get_data(const std::shared_ptrreport_id; - int result = hid_get_feature_report(ds3dev->handle, dbuf, sizeof(dbuf)); + const int result = hid_get_feature_report(ds3dev->handle, dbuf, sizeof(dbuf)); #else - int result = hid_read(ds3dev->handle, dbuf, sizeof(dbuf)); + const int result = hid_read(ds3dev->handle, dbuf, sizeof(dbuf)); #endif if (result > 0) @@ -325,7 +325,7 @@ ds3_pad_handler::DS3Status ds3_pad_handler::get_data(const std::shared_ptr ds3_pad_handler::get_button_values(const std::share return key_buf; } -pad_preview_values ds3_pad_handler::get_preview_values(std::unordered_map data) +pad_preview_values ds3_pad_handler::get_preview_values(const std::unordered_map& data) { - return { data[L2], data[R2], data[LSXPos] - data[LSXNeg], data[LSYPos] - data[LSYNeg], data[RSXPos] - data[RSXNeg], data[RSYPos] - data[RSYNeg] }; + return { + data.at(L2), + data.at(R2), + data.at(LSXPos) - data.at(LSXNeg), + data.at(LSYPos) - data.at(LSYNeg), + data.at(RSXPos) - data.at(RSXNeg), + data.at(RSYPos) - data.at(RSYNeg) + }; } void ds3_pad_handler::get_extended_info(const std::shared_ptr& device, const std::shared_ptr& pad) diff --git a/rpcs3/Input/ds3_pad_handler.h b/rpcs3/Input/ds3_pad_handler.h index a82396a93c..52a10d2175 100644 --- a/rpcs3/Input/ds3_pad_handler.h +++ b/rpcs3/Input/ds3_pad_handler.h @@ -124,5 +124,5 @@ private: void get_extended_info(const std::shared_ptr& device, const std::shared_ptr& pad) override; void apply_pad_data(const std::shared_ptr& device, const std::shared_ptr& pad) override; std::unordered_map get_button_values(const std::shared_ptr& device) override; - pad_preview_values get_preview_values(std::unordered_map data) override; + pad_preview_values get_preview_values(const std::unordered_map& data) override; }; diff --git a/rpcs3/Input/ds4_pad_handler.cpp b/rpcs3/Input/ds4_pad_handler.cpp index 610ae07295..ac27f2a27d 100644 --- a/rpcs3/Input/ds4_pad_handler.cpp +++ b/rpcs3/Input/ds4_pad_handler.cpp @@ -383,9 +383,16 @@ std::unordered_map ds4_pad_handler::get_button_values(const std::share return keyBuffer; } -pad_preview_values ds4_pad_handler::get_preview_values(std::unordered_map data) +pad_preview_values ds4_pad_handler::get_preview_values(const std::unordered_map& data) { - return { data[L2], data[R2], data[LSXPos] - data[LSXNeg], data[LSYPos] - data[LSYNeg], data[RSXPos] - data[RSXNeg], data[RSYPos] - data[RSYNeg] }; + return { + data.at(L2), + data.at(R2), + data.at(LSXPos) - data.at(LSXNeg), + data.at(LSYPos) - data.at(LSYNeg), + data.at(RSXPos) - data.at(RSXNeg), + data.at(RSYPos) - data.at(RSYNeg) + }; } bool ds4_pad_handler::GetCalibrationData(const std::shared_ptr& ds4Dev) @@ -949,22 +956,23 @@ void ds4_pad_handler::apply_pad_data(const std::shared_ptr& device, c if (!ds4_dev || !pad) return; - auto profile = ds4_dev->config; + auto config = ds4_dev->config; // Attempt to send rumble no matter what - int idx_l = profile->switch_vibration_motors ? 1 : 0; - int idx_s = profile->switch_vibration_motors ? 0 : 1; + const int idx_l = config->switch_vibration_motors ? 1 : 0; + const int idx_s = config->switch_vibration_motors ? 0 : 1; - int speed_large = profile->enable_vibration_motor_large ? pad->m_vibrateMotors[idx_l].m_value : vibration_min; - int speed_small = profile->enable_vibration_motor_small ? pad->m_vibrateMotors[idx_s].m_value : vibration_min; + const int speed_large = config->enable_vibration_motor_large ? pad->m_vibrateMotors[idx_l].m_value : vibration_min; + const int speed_small = config->enable_vibration_motor_small ? pad->m_vibrateMotors[idx_s].m_value : vibration_min; + + const bool wireless = ds4_dev->cableState < 1; + const bool lowBattery = ds4_dev->batteryLevel < 2; + const bool isBlinking = ds4_dev->led_delay_on > 0 || ds4_dev->led_delay_off > 0; - bool wireless = ds4_dev->cableState < 1; - bool lowBattery = ds4_dev->batteryLevel < 2; - bool isBlinking = ds4_dev->led_delay_on > 0 || ds4_dev->led_delay_off > 0; bool newBlinkData = false; // Blink LED when battery is low - if (ds4_dev->config->led_low_battery_blink) + if (config->led_low_battery_blink) { // we are now wired or have okay battery level -> stop blinking if (isBlinking && !(wireless && lowBattery)) @@ -983,15 +991,15 @@ void ds4_pad_handler::apply_pad_data(const std::shared_ptr& device, c } // Use LEDs to indicate battery level - if (ds4_dev->config->led_battery_indicator) + if (config->led_battery_indicator) { // This makes sure that the LED color doesn't update every 1ms. DS4 only reports battery level in 10% increments if (ds4_dev->last_battery_level != ds4_dev->batteryLevel) { - const u32 combined_color = get_battery_color(ds4_dev->batteryLevel, ds4_dev->config->led_battery_indicator_brightness); - ds4_dev->config->colorR.set(combined_color >> 8); - ds4_dev->config->colorG.set(combined_color & 0xff); - ds4_dev->config->colorB.set(0); + const u32 combined_color = get_battery_color(ds4_dev->batteryLevel, config->led_battery_indicator_brightness); + config->colorR.set(combined_color >> 8); + config->colorG.set(combined_color & 0xff); + config->colorB.set(0); } } diff --git a/rpcs3/Input/ds4_pad_handler.h b/rpcs3/Input/ds4_pad_handler.h index 7f8aced4d3..f47f25d9b2 100644 --- a/rpcs3/Input/ds4_pad_handler.h +++ b/rpcs3/Input/ds4_pad_handler.h @@ -148,5 +148,5 @@ private: void get_extended_info(const std::shared_ptr& device, const std::shared_ptr& pad) override; void apply_pad_data(const std::shared_ptr& device, const std::shared_ptr& pad) override; std::unordered_map get_button_values(const std::shared_ptr& device) override; - pad_preview_values get_preview_values(std::unordered_map data) override; + pad_preview_values get_preview_values(const std::unordered_map& data) override; }; diff --git a/rpcs3/Input/dualsense_pad_handler.cpp b/rpcs3/Input/dualsense_pad_handler.cpp index cde76f77fb..155e94ec9b 100644 --- a/rpcs3/Input/dualsense_pad_handler.cpp +++ b/rpcs3/Input/dualsense_pad_handler.cpp @@ -582,9 +582,16 @@ std::unordered_map dualsense_pad_handler::get_button_values(const std: return keyBuffer; } -pad_preview_values dualsense_pad_handler::get_preview_values(std::unordered_map data) +pad_preview_values dualsense_pad_handler::get_preview_values(const std::unordered_map& data) { - return {data[L2], data[R2], data[LSXPos] - data[LSXNeg], data[LSYPos] - data[LSYNeg], data[RSXPos] - data[RSXNeg], data[RSYPos] - data[RSYNeg]}; + return { + data.at(L2), + data.at(R2), + data.at(LSXPos) - data.at(LSXNeg), + data.at(LSYPos) - data.at(LSYNeg), + data.at(RSXPos) - data.at(RSXNeg), + data.at(RSYPos) - data.at(RSYNeg) + }; } std::shared_ptr dualsense_pad_handler::GetDualSenseDevice(const std::string& padId) @@ -646,8 +653,8 @@ int dualsense_pad_handler::SendVibrateData(const std::shared_ptrconfig; - if (p_profile == nullptr) + auto config = device->config; + if (config == nullptr) return -2; // hid_write and hid_write_control return -1 on error if (device->btCon) @@ -690,14 +697,14 @@ void dualsense_pad_handler::apply_pad_data(const std::shared_ptr& dev if (!dualsense_dev || !pad) return; - auto profile = dualsense_dev->config; + auto config = dualsense_dev->config; // Attempt to send rumble no matter what - int idx_l = profile->switch_vibration_motors ? 1 : 0; - int idx_s = profile->switch_vibration_motors ? 0 : 1; + const int idx_l = config->switch_vibration_motors ? 1 : 0; + const int idx_s = config->switch_vibration_motors ? 0 : 1; - int speed_large = profile->enable_vibration_motor_large ? pad->m_vibrateMotors[idx_l].m_value : vibration_min; - int speed_small = profile->enable_vibration_motor_small ? pad->m_vibrateMotors[idx_s].m_value : vibration_min; + const int speed_large = config->enable_vibration_motor_large ? pad->m_vibrateMotors[idx_l].m_value : vibration_min; + const int speed_small = config->enable_vibration_motor_small ? pad->m_vibrateMotors[idx_s].m_value : vibration_min; dualsense_dev->newVibrateData |= dualsense_dev->largeVibrate != speed_large || dualsense_dev->smallVibrate != speed_small; diff --git a/rpcs3/Input/dualsense_pad_handler.h b/rpcs3/Input/dualsense_pad_handler.h index bb844a67e2..f254047161 100644 --- a/rpcs3/Input/dualsense_pad_handler.h +++ b/rpcs3/Input/dualsense_pad_handler.h @@ -99,6 +99,6 @@ private: bool get_is_right_stick(u64 keyCode) override; PadHandlerBase::connection update_connection(const std::shared_ptr& device) override; std::unordered_map get_button_values(const std::shared_ptr& device) override; - pad_preview_values get_preview_values(std::unordered_map data) override; + pad_preview_values get_preview_values(const std::unordered_map& data) override; void apply_pad_data(const std::shared_ptr& device, const std::shared_ptr& pad) override; }; diff --git a/rpcs3/Input/evdev_joystick_handler.cpp b/rpcs3/Input/evdev_joystick_handler.cpp index 8311f4b3f8..1f758c70e5 100644 --- a/rpcs3/Input/evdev_joystick_handler.cpp +++ b/rpcs3/Input/evdev_joystick_handler.cpp @@ -279,7 +279,7 @@ std::shared_ptr evdev_joystick_handler::get void evdev_joystick_handler::get_next_button_press(const std::string& padId, const pad_callback& callback, const pad_fail_callback& fail_callback, bool get_blacklist, const std::vector& buttons) { if (get_blacklist) - blacklist.clear(); + m_blacklist.clear(); // Get our evdev device auto device = get_evdev_device(padId); @@ -343,7 +343,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con if (padId.find("Sony") != umax && (code == BTN_TL2 || code == BTN_TR2)) continue; - if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end()) + if (!get_blacklist && std::find(m_blacklist.begin(), m_blacklist.end(), name) != m_blacklist.end()) continue; const u16 value = data[code].first; @@ -351,7 +351,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con { if (get_blacklist) { - blacklist.emplace_back(name); + m_blacklist.emplace_back(name); evdev_log.error("Evdev Calibration: Added button [ %d = %s = %s ] to blacklist. Value = %d", code, libevdev_event_code_get_name(EV_KEY, code), name, value); } else if (value > pressed_button.first) @@ -364,7 +364,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con if (data[code].second) continue; - if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end()) + if (!get_blacklist && std::find(m_blacklist.begin(), m_blacklist.end(), name) != m_blacklist.end()) continue; const u16 value = data[code].first; @@ -374,7 +374,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con { const int min = libevdev_get_abs_minimum(dev, code); const int max = libevdev_get_abs_maximum(dev, code); - blacklist.emplace_back(name); + m_blacklist.emplace_back(name); evdev_log.error("Evdev Calibration: Added axis [ %d = %s = %s ] to blacklist. [ Value = %d ] [ Min = %d ] [ Max = %d ]", code, libevdev_event_code_get_name(EV_ABS, code), name, value, min, max); } else if (value > pressed_button.first) @@ -387,7 +387,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con if (!data[code].second) continue; - if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end()) + if (!get_blacklist && std::find(m_blacklist.begin(), m_blacklist.end(), name) != m_blacklist.end()) continue; const u16 value = data[code].first; @@ -397,7 +397,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con { const int min = libevdev_get_abs_minimum(dev, code); const int max = libevdev_get_abs_maximum(dev, code); - blacklist.emplace_back(name); + m_blacklist.emplace_back(name); evdev_log.error("Evdev Calibration: Added rev axis [ %d = %s = %s ] to blacklist. [ Value = %d ] [ Min = %d ] [ Max = %d ]", code, libevdev_event_code_get_name(EV_ABS, code), name, value, min, max); } else if (value > pressed_button.first) @@ -407,7 +407,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con if (get_blacklist) { - if (blacklist.empty()) + if (m_blacklist.empty()) evdev_log.success("Evdev Calibration: Blacklist is clear. No input spam detected"); return; } @@ -618,8 +618,8 @@ std::vector evdev_joystick_handler::ListDevices() int evdev_joystick_handler::add_device(const std::string& device, const std::shared_ptr& pad, bool in_settings) { - if (in_settings && settings_added.count(device)) - return settings_added.at(device); + if (in_settings && m_settings_added.count(device)) + return m_settings_added.at(device); // Now we need to find the device with the same name, and make sure not to grab any duplicates. std::unordered_map unique_names; @@ -671,7 +671,7 @@ int evdev_joystick_handler::add_device(const std::string& device, const std::sha if (in_settings) { m_dev = std::make_shared(); - settings_added[device] = bindings.size(); + m_settings_added[device] = bindings.size(); // Let's log axis information while we are in the settings in order to identify problems more easily. for (const auto& [code, axis_name] : axis_list) diff --git a/rpcs3/Input/evdev_joystick_handler.h b/rpcs3/Input/evdev_joystick_handler.h index ab18d731e1..a772f112bb 100644 --- a/rpcs3/Input/evdev_joystick_handler.h +++ b/rpcs3/Input/evdev_joystick_handler.h @@ -379,8 +379,8 @@ private: positive_axis m_pos_axis_config; std::vector m_positive_axis; - std::vector blacklist; - std::unordered_map settings_added; + std::vector m_blacklist; + std::unordered_map m_settings_added; std::shared_ptr m_dev; bool m_is_button_or_trigger; bool m_is_negative; diff --git a/rpcs3/Input/xinput_pad_handler.cpp b/rpcs3/Input/xinput_pad_handler.cpp index 428598d6aa..b7e6594b5a 100644 --- a/rpcs3/Input/xinput_pad_handler.cpp +++ b/rpcs3/Input/xinput_pad_handler.cpp @@ -290,9 +290,16 @@ xinput_pad_handler::PadButtonValues xinput_pad_handler::get_button_values_scp(co return values; } -pad_preview_values xinput_pad_handler::get_preview_values(std::unordered_map data) +pad_preview_values xinput_pad_handler::get_preview_values(const std::unordered_map& data) { - return { data[LT], data[RT], data[LSXPos] - data[LSXNeg], data[LSYPos] - data[LSYNeg], data[RSXPos] - data[RSXNeg], data[RSYPos] - data[RSYNeg] }; + return { + data.at(LT), + data.at(RT), + data.at(LSXPos) - data.at(LSXNeg), + data.at(LSYPos) - data.at(LSYNeg), + data.at(RSXPos) - data.at(RSXNeg), + data.at(RSYPos) - data.at(RSYNeg) + }; } bool xinput_pad_handler::Init() diff --git a/rpcs3/Input/xinput_pad_handler.h b/rpcs3/Input/xinput_pad_handler.h index 5a1a14c03d..3285543b02 100644 --- a/rpcs3/Input/xinput_pad_handler.h +++ b/rpcs3/Input/xinput_pad_handler.h @@ -138,5 +138,5 @@ private: void get_extended_info(const std::shared_ptr& device, const std::shared_ptr& pad) override; void apply_pad_data(const std::shared_ptr& device, const std::shared_ptr& pad) override; std::unordered_map get_button_values(const std::shared_ptr& device) override; - pad_preview_values get_preview_values(std::unordered_map data) override; + pad_preview_values get_preview_values(const std::unordered_map& data) override; }; diff --git a/rpcs3/rpcs3qt/log_frame.cpp b/rpcs3/rpcs3qt/log_frame.cpp index c216762ee4..f4a420e104 100644 --- a/rpcs3/rpcs3qt/log_frame.cpp +++ b/rpcs3/rpcs3qt/log_frame.cpp @@ -404,10 +404,6 @@ void log_frame::LoadSettings() void log_frame::RepaintTextColors() { - // Backup old colors - QColor old_color_stack{ m_color_stack }; - QList old_color{ m_color }; - // Get text color. Do this once to prevent possible slowdown m_color.clear(); m_color.append(gui::utils::get_label_color("log_level_always"));