From ad43ba5ec78a7cf5bbc9d51ed303816a70b677a6 Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Fri, 14 Feb 2025 11:17:39 +0100 Subject: [PATCH 1/4] Fix unified config checkbox behaviour + code style changes (#2427) --- src/qt_gui/kbm_config_dialog.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/qt_gui/kbm_config_dialog.cpp b/src/qt_gui/kbm_config_dialog.cpp index 74a49034b..cfff056a0 100644 --- a/src/qt_gui/kbm_config_dialog.cpp +++ b/src/qt_gui/kbm_config_dialog.cpp @@ -10,7 +10,7 @@ #include "common/config.h" #include "common/path_util.h" #include "game_info.h" -#include "src/sdl_window.h" +#include "sdl_window.h" #include #include @@ -39,15 +39,6 @@ EditorDialog::EditorDialog(QWidget* parent) : QDialog(parent) { // Create the game selection combo box gameComboBox = new QComboBox(this); gameComboBox->addItem("default"); // Add default option - /* - gameComboBox = new QComboBox(this); - layout->addWidget(gameComboBox); // Add the combobox for selecting game configurations - - // Populate the combo box with game configurations - QStringList gameConfigs = GameInfoClass::GetGameInfo(this); - gameComboBox->addItems(gameConfigs); - gameComboBox->setCurrentText("default.ini"); // Set the default selection - */ // Load all installed games loadInstalledGames(); @@ -60,7 +51,6 @@ EditorDialog::EditorDialog(QWidget* parent) : QDialog(parent) { Config::save(Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "config.toml"); }); // Create Save, Cancel, and Help buttons - Config::SetUseUnifiedInputConfig(!Config::GetUseUnifiedInputConfig()); QPushButton* saveButton = new QPushButton("Save", this); QPushButton* cancelButton = new QPushButton("Cancel", this); QPushButton* helpButton = new QPushButton("Help", this); From 1cc9e0d37fb23946c53ce2c2a8b7333ac122e87f Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Fri, 14 Feb 2025 11:30:49 +0100 Subject: [PATCH 2/4] Initial implementation of controller color config (#2411) --- src/common/config.cpp | 22 ++++++++++++++++++ src/common/config.h | 4 ++++ src/core/libraries/pad/pad.cpp | 12 +++++++++- src/input/input_handler.cpp | 42 +++++++++++++++++++++++++++------- src/sdl_window.cpp | 3 ++- 5 files changed, 73 insertions(+), 10 deletions(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index e26a998f5..aae903da6 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -71,6 +71,8 @@ static bool rdocEnable = false; static s16 cursorState = HideCursorState::Idle; static int cursorHideTimeout = 5; // 5 seconds (default) static bool useUnifiedInputConfig = true; +static bool overrideControllerColor = false; +static int controllerCustomColorRGB[3] = {0, 0, 255}; static bool separateupdatefolder = false; static bool compatibilityData = false; static bool checkCompatibilityOnStartup = false; @@ -115,6 +117,24 @@ void SetUseUnifiedInputConfig(bool use) { useUnifiedInputConfig = use; } +bool GetOverrideControllerColor() { + return overrideControllerColor; +} + +void SetOverrideControllerColor(bool enable) { + overrideControllerColor = enable; +} + +int* GetControllerCustomColor() { + return controllerCustomColorRGB; +} + +void SetControllerCustomColor(int r, int b, int g) { + controllerCustomColorRGB[0] = r; + controllerCustomColorRGB[1] = b; + controllerCustomColorRGB[2] = g; +} + std::string getTrophyKey() { return trophyKey; } @@ -1046,6 +1066,8 @@ axis_right_y = axis_right_y # Range of deadzones: 1 (almost none) to 127 (max) analog_deadzone = leftjoystick, 2, 127 analog_deadzone = rightjoystick, 2, 127 + +override_controller_color = false, 0, 0, 255 )"; } std::filesystem::path GetFoolproofKbmConfigFile(const std::string& game_id) { diff --git a/src/common/config.h b/src/common/config.h index 3a140c0c8..dfb1d9fad 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -47,6 +47,10 @@ int getSpecialPadClass(); bool getIsMotionControlsEnabled(); bool GetUseUnifiedInputConfig(); void SetUseUnifiedInputConfig(bool use); +bool GetOverrideControllerColor(); +void SetOverrideControllerColor(bool enable); +int* GetControllerCustomColor(); +void SetControllerCustomColor(int r, int b, int g); u32 getScreenWidth(); u32 getScreenHeight(); diff --git a/src/core/libraries/pad/pad.cpp b/src/core/libraries/pad/pad.cpp index 173b78382..bcc90c49b 100644 --- a/src/core/libraries/pad/pad.cpp +++ b/src/core/libraries/pad/pad.cpp @@ -261,6 +261,7 @@ int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenP if (type != ORBIS_PAD_PORT_TYPE_STANDARD && type != ORBIS_PAD_PORT_TYPE_REMOTE_CONTROL) return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED; } + scePadResetLightBar(1); return 1; // dummy } @@ -412,7 +413,13 @@ int PS4_SYSV_ABI scePadReadStateExt() { } int PS4_SYSV_ABI scePadResetLightBar(s32 handle) { - LOG_ERROR(Lib_Pad, "(STUBBED) called"); + LOG_INFO(Lib_Pad, "(DUMMY) called"); + if (handle != 1) { + return ORBIS_PAD_ERROR_INVALID_HANDLE; + } + auto* controller = Common::Singleton::Instance(); + int* rgb = Config::GetControllerCustomColor(); + controller->SetLightBarRGB(rgb[0], rgb[1], rgb[2]); return ORBIS_OK; } @@ -472,6 +479,9 @@ int PS4_SYSV_ABI scePadSetForceIntercepted() { } int PS4_SYSV_ABI scePadSetLightBar(s32 handle, const OrbisPadLightBarParam* pParam) { + if (Config::GetOverrideControllerColor()) { + return ORBIS_OK; + } if (pParam != nullptr) { LOG_DEBUG(Lib_Pad, "called handle = {} rgb = {} {} {}", handle, pParam->r, pParam->g, pParam->b); diff --git a/src/input/input_handler.cpp b/src/input/input_handler.cpp index 38a310324..6e961043e 100644 --- a/src/input/input_handler.cpp +++ b/src/input/input_handler.cpp @@ -214,6 +214,9 @@ void ParseInputConfig(const std::string game_id = "") { lefttrigger_deadzone = {1, 127}; righttrigger_deadzone = {1, 127}; + Config::SetOverrideControllerColor(false); + Config::SetControllerCustomColor(0, 0, 255); + int lineCount = 0; std::ifstream file(config_file); @@ -254,6 +257,14 @@ void ParseInputConfig(const std::string game_id = "") { std::string input_string = line.substr(equal_pos + 1); std::size_t comma_pos = input_string.find(','); + auto parseInt = [](const std::string& s) -> std::optional { + try { + return std::stoi(s); + } catch (...) { + return std::nullopt; + } + }; + if (output_string == "mouse_to_joystick") { if (input_string == "left") { SetMouseToJoystick(1); @@ -307,14 +318,6 @@ void ParseInputConfig(const std::string game_id = "") { continue; } - auto parseInt = [](const std::string& s) -> std::optional { - try { - return std::stoi(s); - } catch (...) { - return std::nullopt; - } - }; - auto inner_deadzone = parseInt(inner_deadzone_str); auto outer_deadzone = parseInt(outer_deadzone_str); @@ -341,6 +344,29 @@ void ParseInputConfig(const std::string game_id = "") { lineCount, line); } continue; + } else if (output_string == "override_controller_color") { + std::stringstream ss(input_string); + std::string enable, r_s, g_s, b_s; + std::optional r, g, b; + if (!std::getline(ss, enable, ',') || !std::getline(ss, r_s, ',') || + !std::getline(ss, g_s, ',') || !std::getline(ss, b_s)) { + LOG_WARNING(Input, "Malformed controller color config at line {}: \"{}\"", + lineCount, line); + continue; + } + r = parseInt(r_s); + g = parseInt(g_s); + b = parseInt(b_s); + if (!r || !g || !b) { + LOG_WARNING(Input, "Invalid RGB values at line {}: \"{}\", skipping line.", + lineCount, line); + continue; + } + Config::SetOverrideControllerColor(enable == "true"); + Config::SetControllerCustomColor(*r, *g, *b); + LOG_DEBUG(Input, "Parsed color settings: {} {} {} {}", + enable == "true" ? "override" : "no override", *r, *b, *g); + continue; } // normal cases diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 6eaad62e5..ccc369c53 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -129,7 +129,8 @@ void SDLInputEngine::Init() { }; } SDL_free(gamepads); - SetLightBarRGB(0, 0, 255); + int* rgb = Config::GetControllerCustomColor(); + SetLightBarRGB(rgb[0], rgb[1], rgb[2]); } void SDLInputEngine::SetLightBarRGB(u8 r, u8 g, u8 b) { From b48975f11697e77c02d6f9ccb44ee658781d2dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=A5IGA?= <164882787+Xphalnos@users.noreply.github.com> Date: Fri, 14 Feb 2025 11:36:23 +0100 Subject: [PATCH 3/4] Qt: Resizing Font Size and Icon Grid Size (#2429) --- src/qt_gui/game_grid_frame.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qt_gui/game_grid_frame.cpp b/src/qt_gui/game_grid_frame.cpp index 2db4b7e4e..6a42fb1d6 100644 --- a/src/qt_gui/game_grid_frame.cpp +++ b/src/qt_gui/game_grid_frame.cpp @@ -117,7 +117,12 @@ void GameGridFrame::PopulateGameGrid(QVector m_games_search, bool from layout->addWidget(image_label); layout->addWidget(name_label); - name_label->setStyleSheet("color: white; font-size: 12px; font-weight: bold;"); + // Resizing of font-size. + float fontSize = (Config::getIconSizeGrid() / 5.5f); + QString styleSheet = + QString("color: white; font-weight: bold; font-size: %1px;").arg(fontSize); + name_label->setStyleSheet(styleSheet); + QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect(); shadowEffect->setBlurRadius(5); // Set the blur radius of the shadow shadowEffect->setColor(QColor(0, 0, 0, 160)); // Set the color and opacity of the shadow From bb6cca3056ef154e996eee1f6e0db24c6cb41a95 Mon Sep 17 00:00:00 2001 From: Dmugetsu <168934208+diegolix29@users.noreply.github.com> Date: Fri, 14 Feb 2025 04:48:52 -0600 Subject: [PATCH 4/4] Adding KBM icon for kbm remaps. (#2430) --- REUSE.toml | 1 + src/images/keyboard_icon.png | Bin 0 -> 4002 bytes src/qt_gui/main_window.cpp | 7 +++++++ src/qt_gui/main_window_ui.h | 5 +++++ src/shadps4.qrc | 1 + 5 files changed, 14 insertions(+) create mode 100644 src/images/keyboard_icon.png diff --git a/REUSE.toml b/REUSE.toml index dc5149e8f..3bc09e328 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -35,6 +35,7 @@ path = [ "src/images/folder_icon.png", "src/images/github.png", "src/images/grid_icon.png", + "src/images/keyboard_icon.png", "src/images/iconsize_icon.png", "src/images/ko-fi.png", "src/images/list_icon.png", diff --git a/src/images/keyboard_icon.png b/src/images/keyboard_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..696c1f9dabbaa7d8cbe9e99a3b386363c799a017 GIT binary patch literal 4002 zcmcIncU05aw*G|@kRA|_Dg?n%E+B*|QiLES6b&FqMzuXDKKuLjxBq$3)m~gg zQ3L=0aYqL@5&%HFAqWr#^Ne3q1&U_`qHP>Kgn2DN_!@~fKZ13*5)A<0Z+~@=YOJXd zZ&4w}&O63E5*33BjtT{EIGipzB0M@I7#pe^85NeldQK4lB#%47&wJc1SYgDkseJYC z`M$kPwpRbeS11{aF7rEa<}vn2N?{#eLrsm%0#mRjp!>4WjiJTsIx8azL%*em#QM-b z893EFgq^+LB|2<)A6cDqO0dj2{EZ`0L?Dg7g!Bs#csP;mY_m?cn8$53wwxT`8m;eT z&rdSgTJyWtw!alI{%}6=E4r4=cVe>#$P_^V4uUYC?7jkkd@BZ227w74XZWp8KLM%9 z(*Do45!~t9aAm<(Ra0Qc2{khmW`RUQVcbb z|IGuu13_zkF0(&KXP%TvY#0p{RV>maP1~z&%CdM@SiB%rLww(A&`}oo znR6F9Xh}uI;gu))iv(T!XhO}^PN&`U?19`}<+ZLn^b^2CE#DbOR zjsqMn-{qjWv|dR?5aJ0kO35<8HzK&y098t0@S!uGL8 zF=K$=E0mQ}w4CeB1_4r#lb}Xq8`L?^?vOu0U?&D;Ig8W(q6h~7c;^i!oA4`s9P08p zpE^ZLps;Pa^`9JPTw{$BVZ?hYEplj)lc2yfQZz^Rn)1&_00M1Kk9m_RU)g^B5o$=A zxC!~5+%AeXc;ZeVr;dQ&TSa&V*k& zJ#^r~t}XaeZc~UbY_NV$zPxOa1_vB$ArLO8{1T(;AdyMYm*e))_Ezk4ZW6@+G!Z%{ z#dKnpD<)g=E1PrD!!Lq2HJ=(H45Fh^2Zn34$tAs&>2ly64WLpG^8E^PK0NtcL2gfs z=RgxLlm#KT0Ic3xRbFs4Y<)G|Ninq?K#CfyqnRd($!%{^eYAoBhn3yN_lWOg%#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wky?ydGN*RzA>*B$tFr%(Zla993(TL zswKr(GN@b?9AM7!B&-t;RjvDseZ4TSQ9q00-cyG5aejiw?BTRaZBK%`D%!4oODZRO z%UZF3|IgLne<(G%_mV6o VU~50dpuBn-aI|xU*V+W#{}&&mKDht@ literal 0 HcmV?d00001 diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index 556dd0456..5cbce1884 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -142,6 +142,7 @@ void MainWindow::AddUiWidgets() { ui->toolBar->addWidget(ui->refreshButton); ui->toolBar->addWidget(ui->settingsButton); ui->toolBar->addWidget(ui->controllerButton); + ui->toolBar->addWidget(ui->keyboardButton); QFrame* line = new QFrame(this); line->setFrameShape(QFrame::StyledPanel); line->setFrameShadow(QFrame::Sunken); @@ -327,6 +328,11 @@ void MainWindow::CreateConnects() { configWindow->exec(); }); + connect(ui->keyboardButton, &QPushButton::clicked, this, [this]() { + auto kbmWindow = new EditorDialog(this); + kbmWindow->exec(); + }); + #ifdef ENABLE_UPDATER connect(ui->updaterAct, &QAction::triggered, this, [this]() { auto checkUpdate = new CheckUpdate(true); @@ -1106,6 +1112,7 @@ void MainWindow::SetUiIcons(bool isWhite) { ui->refreshButton->setIcon(RecolorIcon(ui->refreshButton->icon(), isWhite)); ui->settingsButton->setIcon(RecolorIcon(ui->settingsButton->icon(), isWhite)); ui->controllerButton->setIcon(RecolorIcon(ui->controllerButton->icon(), isWhite)); + ui->keyboardButton->setIcon(RecolorIcon(ui->keyboardButton->icon(), isWhite)); ui->refreshGameListAct->setIcon(RecolorIcon(ui->refreshGameListAct->icon(), isWhite)); ui->menuGame_List_Mode->setIcon(RecolorIcon(ui->menuGame_List_Mode->icon(), isWhite)); ui->pkgViewerAct->setIcon(RecolorIcon(ui->pkgViewerAct->icon(), isWhite)); diff --git a/src/qt_gui/main_window_ui.h b/src/qt_gui/main_window_ui.h index 7de166121..ee582b929 100644 --- a/src/qt_gui/main_window_ui.h +++ b/src/qt_gui/main_window_ui.h @@ -47,6 +47,7 @@ public: QPushButton* refreshButton; QPushButton* settingsButton; QPushButton* controllerButton; + QPushButton* keyboardButton; QWidget* sizeSliderContainer; QHBoxLayout* sizeSliderContainer_layout; @@ -210,6 +211,10 @@ public: controllerButton->setFlat(true); controllerButton->setIcon(QIcon(":images/controller_icon.png")); controllerButton->setIconSize(QSize(40, 40)); + keyboardButton = new QPushButton(centralWidget); + keyboardButton->setFlat(true); + keyboardButton->setIcon(QIcon(":images/keyboard_icon.png")); + keyboardButton->setIconSize(QSize(40, 40)); sizeSliderContainer = new QWidget(centralWidget); sizeSliderContainer->setObjectName("sizeSliderContainer"); diff --git a/src/shadps4.qrc b/src/shadps4.qrc index 40aeb9fb9..14b50f7a5 100644 --- a/src/shadps4.qrc +++ b/src/shadps4.qrc @@ -31,5 +31,6 @@ images/youtube.png images/website.png images/ps4_controller.png + images/keyboard_icon.png