mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-28 22:33:17 +00:00
Remapping: Documentation and defaults update + add option to use a unified config (#2302)
* Add a toggle to use unified or per-game configs, and add a deadzone example to the default config * Add a checkbox to toggle config type * clang
This commit is contained in:
parent
c4bfaa6031
commit
9aa6c5b951
5 changed files with 36 additions and 6 deletions
|
@ -68,6 +68,7 @@ static bool vkGuestMarkers = false;
|
||||||
static bool rdocEnable = false;
|
static bool rdocEnable = false;
|
||||||
static s16 cursorState = HideCursorState::Idle;
|
static s16 cursorState = HideCursorState::Idle;
|
||||||
static int cursorHideTimeout = 5; // 5 seconds (default)
|
static int cursorHideTimeout = 5; // 5 seconds (default)
|
||||||
|
static bool useUnifiedInputConfig = true;
|
||||||
static bool separateupdatefolder = false;
|
static bool separateupdatefolder = false;
|
||||||
static bool compatibilityData = false;
|
static bool compatibilityData = false;
|
||||||
static bool checkCompatibilityOnStartup = false;
|
static bool checkCompatibilityOnStartup = false;
|
||||||
|
@ -98,6 +99,14 @@ std::string emulator_language = "en";
|
||||||
// Language
|
// Language
|
||||||
u32 m_language = 1; // english
|
u32 m_language = 1; // english
|
||||||
|
|
||||||
|
bool GetUseUnifiedInputConfig() {
|
||||||
|
return useUnifiedInputConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetUseUnifiedInputConfig(bool use) {
|
||||||
|
useUnifiedInputConfig = use;
|
||||||
|
}
|
||||||
|
|
||||||
std::string getTrophyKey() {
|
std::string getTrophyKey() {
|
||||||
return trophyKey;
|
return trophyKey;
|
||||||
}
|
}
|
||||||
|
@ -657,6 +666,7 @@ void load(const std::filesystem::path& path) {
|
||||||
useSpecialPad = toml::find_or<bool>(input, "useSpecialPad", false);
|
useSpecialPad = toml::find_or<bool>(input, "useSpecialPad", false);
|
||||||
specialPadClass = toml::find_or<int>(input, "specialPadClass", 1);
|
specialPadClass = toml::find_or<int>(input, "specialPadClass", 1);
|
||||||
isMotionControlsEnabled = toml::find_or<bool>(input, "isMotionControlsEnabled", true);
|
isMotionControlsEnabled = toml::find_or<bool>(input, "isMotionControlsEnabled", true);
|
||||||
|
useUnifiedInputConfig = toml::find_or<bool>(input, "useUnifiedInputConfig", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.contains("GPU")) {
|
if (data.contains("GPU")) {
|
||||||
|
@ -779,6 +789,7 @@ void save(const std::filesystem::path& path) {
|
||||||
data["Input"]["useSpecialPad"] = useSpecialPad;
|
data["Input"]["useSpecialPad"] = useSpecialPad;
|
||||||
data["Input"]["specialPadClass"] = specialPadClass;
|
data["Input"]["specialPadClass"] = specialPadClass;
|
||||||
data["Input"]["isMotionControlsEnabled"] = isMotionControlsEnabled;
|
data["Input"]["isMotionControlsEnabled"] = isMotionControlsEnabled;
|
||||||
|
data["Input"]["useUnifiedInputConfig"] = useUnifiedInputConfig;
|
||||||
data["GPU"]["screenWidth"] = screenWidth;
|
data["GPU"]["screenWidth"] = screenWidth;
|
||||||
data["GPU"]["screenHeight"] = screenHeight;
|
data["GPU"]["screenHeight"] = screenHeight;
|
||||||
data["GPU"]["nullGpu"] = isNullGpu;
|
data["GPU"]["nullGpu"] = isNullGpu;
|
||||||
|
@ -969,9 +980,12 @@ touchpad = back
|
||||||
|
|
||||||
axis_left_x = axis_left_x
|
axis_left_x = axis_left_x
|
||||||
axis_left_y = axis_left_y
|
axis_left_y = axis_left_y
|
||||||
|
|
||||||
axis_right_x = axis_right_x
|
axis_right_x = axis_right_x
|
||||||
axis_right_y = axis_right_y
|
axis_right_y = axis_right_y
|
||||||
|
|
||||||
|
# Range of deadzones: 1 (almost none) to 127 (max)
|
||||||
|
analog_deadzone = leftjoystick, 2
|
||||||
|
analog_deadzone = rightjoystick, 2
|
||||||
)";
|
)";
|
||||||
}
|
}
|
||||||
std::filesystem::path GetFoolproofKbmConfigFile(const std::string& game_id) {
|
std::filesystem::path GetFoolproofKbmConfigFile(const std::string& game_id) {
|
||||||
|
|
|
@ -43,6 +43,8 @@ std::string getBackButtonBehavior();
|
||||||
bool getUseSpecialPad();
|
bool getUseSpecialPad();
|
||||||
int getSpecialPadClass();
|
int getSpecialPadClass();
|
||||||
bool getIsMotionControlsEnabled();
|
bool getIsMotionControlsEnabled();
|
||||||
|
bool GetUseUnifiedInputConfig();
|
||||||
|
void SetUseUnifiedInputConfig(bool use);
|
||||||
|
|
||||||
u32 getScreenWidth();
|
u32 getScreenWidth();
|
||||||
u32 getScreenHeight();
|
u32 getScreenHeight();
|
||||||
|
|
|
@ -198,11 +198,8 @@ InputBinding GetBindingFromString(std::string& line) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParseInputConfig(const std::string game_id = "") {
|
void ParseInputConfig(const std::string game_id = "") {
|
||||||
const auto config_file = Config::GetFoolproofKbmConfigFile(game_id);
|
std::string config_type = Config::GetUseUnifiedInputConfig() ? "default" : game_id;
|
||||||
|
const auto config_file = Config::GetFoolproofKbmConfigFile(config_type);
|
||||||
if (game_id == "") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we reset these here so in case the user fucks up or doesn't include some of these,
|
// we reset these here so in case the user fucks up or doesn't include some of these,
|
||||||
// we can fall back to default
|
// we can fall back to default
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "game_info.h"
|
#include "game_info.h"
|
||||||
#include "src/sdl_window.h"
|
#include "src/sdl_window.h"
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -50,7 +51,16 @@ EditorDialog::EditorDialog(QWidget* parent) : QDialog(parent) {
|
||||||
// Load all installed games
|
// Load all installed games
|
||||||
loadInstalledGames();
|
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
|
// Create Save, Cancel, and Help buttons
|
||||||
|
Config::SetUseUnifiedInputConfig(!Config::GetUseUnifiedInputConfig());
|
||||||
QPushButton* saveButton = new QPushButton("Save", this);
|
QPushButton* saveButton = new QPushButton("Save", this);
|
||||||
QPushButton* cancelButton = new QPushButton("Cancel", this);
|
QPushButton* cancelButton = new QPushButton("Cancel", this);
|
||||||
QPushButton* helpButton = new QPushButton("Help", this);
|
QPushButton* helpButton = new QPushButton("Help", this);
|
||||||
|
@ -58,6 +68,7 @@ EditorDialog::EditorDialog(QWidget* parent) : QDialog(parent) {
|
||||||
|
|
||||||
// Layout for the game selection and buttons
|
// Layout for the game selection and buttons
|
||||||
QHBoxLayout* topLayout = new QHBoxLayout();
|
QHBoxLayout* topLayout = new QHBoxLayout();
|
||||||
|
topLayout->addWidget(unifiedInputCheckBox);
|
||||||
topLayout->addWidget(gameComboBox);
|
topLayout->addWidget(gameComboBox);
|
||||||
topLayout->addStretch();
|
topLayout->addStretch();
|
||||||
topLayout->addWidget(saveButton);
|
topLayout->addWidget(saveButton);
|
||||||
|
|
|
@ -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>!
|
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.
|
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() {
|
QString syntax() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue