Add a checkbox to toggle config type

This commit is contained in:
kalaposfos13 2025-01-31 17:18:22 +01:00
parent e5b0d638fd
commit 49d0a3057a
3 changed files with 19 additions and 2 deletions

View File

@ -198,8 +198,8 @@ InputBinding GetBindingFromString(std::string& line) {
}
void ParseInputConfig(const std::string game_id = "") {
std::string config_file = Config::GetUseUnifiedInputConfig() ? "default" : game_id;
const auto config_file = Config::GetFoolproofKbmConfigFile(config_file);
std::string config_type = Config::GetUseUnifiedInputConfig() ? "default" : game_id;
const auto config_file = Config::GetFoolproofKbmConfigFile(config_type);
// we reset these here so in case the user fucks up or doesn't include some of these,
// we can fall back to default

View File

@ -13,6 +13,7 @@
#include "src/sdl_window.h"
#include <QCloseEvent>
#include <QCheckBox>
#include <QComboBox>
#include <QFile>
#include <QHBoxLayout>
@ -50,7 +51,16 @@ EditorDialog::EditorDialog(QWidget* parent) : QDialog(parent) {
// Load all installed games
loadInstalledGames();
QCheckBox* unifiedInputCheckBox = new QCheckBox("Use Per-Game configs", this);
unifiedInputCheckBox->setChecked(!Config::GetUseUnifiedInputConfig());
// Connect checkbox signal
connect(unifiedInputCheckBox, &QCheckBox::toggled, this, [](bool checked) {
Config::SetUseUnifiedInputConfig(!checked);
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);
@ -58,6 +68,7 @@ EditorDialog::EditorDialog(QWidget* parent) : QDialog(parent) {
// Layout for the game selection and buttons
QHBoxLayout* topLayout = new QHBoxLayout();
topLayout->addWidget(unifiedInputCheckBox);
topLayout->addWidget(gameComboBox);
topLayout->addStretch();
topLayout->addWidget(saveButton);

View File

@ -70,6 +70,12 @@ A: The code recognises the line as wrong, and skip it, so the rest of the file w
Q: I want to bind <input> to <output>, but your code doesn't support <input>!
A: Some keys are intentionally omitted, but if you read the bindings through, and you're sure it is not there and isn't one of the intentionally disabled ones, open an issue on https://github.com/shadps4-emu/shadPS4.
Q: What does default.ini do?
A: If you're using per-game configs, it's the base from which all new games generate their config file. If you use the unified config, then this is used for every game directly instead.
Q: What does the use Per-game Config checkbox do?
A: It controls whether the config is loaded from CUSAXXXXX.ini for a game, or from default.ini. This way, if you only want to manage one set of bindings, you can do so, but if you want to use a different setup for every game, that's possible as well.
)";
}
QString syntax() {