More settings

This commit is contained in:
georgemoralis 2026-01-09 11:04:06 +02:00
parent 50f2ed8c34
commit e122087998
5 changed files with 26 additions and 68 deletions

View File

@ -144,8 +144,6 @@ static ConfigEntry<std::array<std::string, 4>> userNames({
});
// Input
static ConfigEntry<bool> useSpecialPad(false);
static ConfigEntry<int> specialPadClass(1);
static ConfigEntry<bool> isMotionControlsEnabled(true);
static ConfigEntry<bool> useUnifiedInputConfig(true);
@ -156,9 +154,6 @@ static ConfigEntry<bool> showFpsCounter(false);
// Settings
ConfigEntry<u32> m_language(1); // english
// USB Device
static ConfigEntry<int> usbDeviceBackend(UsbBackendType::Real);
// Keys
static string trophyKey = "";
@ -220,20 +215,10 @@ std::string getUserName(int id) {
return userNames.get()[id];
}
bool getUseSpecialPad() {
return useSpecialPad.get();
}
int getSpecialPadClass() {
return specialPadClass.get();
}
bool getIsMotionControlsEnabled() {
return isMotionControlsEnabled.get();
}
bool fpsColor() {
return isFpsColor.get();
}
@ -250,13 +235,6 @@ void setLanguage(u32 language, bool is_game_specific) {
m_language.set(language, is_game_specific);
}
void setUseSpecialPad(bool use) {
useSpecialPad.base_value = use;
}
void setSpecialPadClass(int type) {
specialPadClass.base_value = type;
}
void setIsMotionControlsEnabled(bool use, bool is_game_specific) {
isMotionControlsEnabled.set(use, is_game_specific);
@ -266,14 +244,6 @@ u32 GetLanguage() {
return m_language.get();
}
int getUsbDeviceBackend() {
return usbDeviceBackend.get();
}
void setUsbDeviceBackend(int value, bool is_game_specific) {
usbDeviceBackend.set(value, is_game_specific);
}
bool getLoadAutoPatches() {
return load_auto_patches;
}
@ -310,11 +280,8 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
if (data.contains("Input")) {
const toml::value& input = data.at("Input");
useSpecialPad.setFromToml(input, "useSpecialPad", is_game_specific);
specialPadClass.setFromToml(input, "specialPadClass", is_game_specific);
isMotionControlsEnabled.setFromToml(input, "isMotionControlsEnabled", is_game_specific);
useUnifiedInputConfig.setFromToml(input, "useUnifiedInputConfig", is_game_specific);
usbDeviceBackend.setFromToml(input, "usbDeviceBackend", is_game_specific);
}
string current_version = {};
@ -398,7 +365,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
isMotionControlsEnabled.setTomlValue(data, "Input", "isMotionControlsEnabled",
is_game_specific);
usbDeviceBackend.setTomlValue(data, "Input", "usbDeviceBackend", is_game_specific);
m_language.setTomlValue(data, "Settings", "consoleLanguage", is_game_specific);
@ -409,8 +375,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
data["Keys"]["TrophyKey"] = trophyKey;
// Do not save these entries in the game-specific dialog since they are not in the GUI
data["Input"]["useSpecialPad"] = useSpecialPad.base_value;
data["Input"]["specialPadClass"] = specialPadClass.base_value;
data["Input"]["useUnifiedInputConfig"] = useUnifiedInputConfig.base_value;
data["Debug"]["FPSColor"] = isFpsColor.base_value;
data["Debug"]["showFpsCounter"] = showFpsCounter.base_value;
@ -435,16 +399,12 @@ void setDefaultValues(bool is_game_specific) {
// GS - Input
isMotionControlsEnabled.setDefault(is_game_specific);
usbDeviceBackend.setDefault(is_game_specific);
// GS - Settings
m_language.setDefault(is_game_specific);
// All other entries
if (!is_game_specific) {
// Input
useSpecialPad.base_value = false;
specialPadClass.base_value = 1;
useUnifiedInputConfig.base_value = true;
controllerCustomColorRGB[0] = 0;
controllerCustomColorRGB[1] = 0;

View File

@ -28,10 +28,6 @@ std::string getTrophyKey();
void setTrophyKey(std::string key);
u32 GetLanguage();
void setLanguage(u32 language, bool is_game_specific = false);
void setUseSpecialPad(bool use);
bool getUseSpecialPad();
void setSpecialPadClass(int type);
int getSpecialPadClass();
bool fpsColor(); // no set
bool getShowFpsCounter();
void setShowFpsCounter(bool enable, bool is_game_specific = false);
@ -41,10 +37,6 @@ void setUserName(const std::string& name, bool is_game_specific = false);
bool getLoadAutoPatches();
void setLoadAutoPatches(bool enable);
enum UsbBackendType : int { Real, SkylandersPortal, InfinityBase, DimensionsToypad };
int getUsbDeviceBackend();
void setUsbDeviceBackend(int value, bool is_game_specific = false);
// TODO
std::string getUserName(int id);
std::array<std::string, 4> const getUserNames();

View File

@ -150,12 +150,12 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DebugSettings, separate_logging_enabled, debu
// Input settings
// -------------------------------
enum HideCursorState : int { Never, Idle, Always };
enum UsbDevice : int { Real, SkylanderPortal, InfinityBase, DimensionsToypad };
enum UsbBackendType : int { Real, SkylandersPortal, InfinityBase, DimensionsToypad };
struct InputSettings {
Setting<int> cursor_state{HideCursorState::Idle}; // specific
Setting<int> cursor_hide_timeout{5}; // specific
Setting<int> usb_device{UsbDevice::Real}; // specific
Setting<int> cursor_state{HideCursorState::Idle}; // specific
Setting<int> cursor_hide_timeout{5}; // specific
Setting<int> usb_device_backend{UsbBackendType::Real}; // specific
Setting<bool> use_special_pad{false};
Setting<int> special_pad_class{1};
Setting<bool> motion_controls_enabled{true}; // specific
@ -168,17 +168,17 @@ struct InputSettings {
make_override<InputSettings>("cursor_state", &InputSettings::cursor_state),
make_override<InputSettings>("cursor_hide_timeout",
&InputSettings::cursor_hide_timeout),
make_override<InputSettings>("usb_device", &InputSettings::usb_device),
make_override<InputSettings>("usb_device_backend", &InputSettings::usb_device_backend),
make_override<InputSettings>("motion_controls_enabled",
&InputSettings::motion_controls_enabled),
make_override<InputSettings>("background_controller_input",
&InputSettings::background_controller_input)};
}
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(InputSettings, cursor_state, cursor_hide_timeout, usb_device,
use_special_pad, special_pad_class, motion_controls_enabled,
use_unified_Input_Config, default_controller_id,
background_controller_input)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(InputSettings, cursor_state, cursor_hide_timeout,
usb_device_backend, use_special_pad, special_pad_class,
motion_controls_enabled, use_unified_Input_Config,
default_controller_id, background_controller_input)
// -------------------------------
// Audio settings
// -------------------------------
@ -446,10 +446,12 @@ public:
// Input Settings
SETTING_FORWARD(m_input, CursorState, cursor_state)
SETTING_FORWARD(m_input, CursorHideTimeout, cursor_hide_timeout)
SETTING_FORWARD(m_input, UsbDevice, usb_device)
SETTING_FORWARD(m_input, UsbDeviceBackend, usb_device_backend)
SETTING_FORWARD_BOOL(m_input, MotionControlsEnabled, motion_controls_enabled)
SETTING_FORWARD_BOOL(m_input, BackgroundControllerInput, background_controller_input)
SETTING_FORWARD(m_input, DefaultControllerId, default_controller_id)
SETTING_FORWARD_BOOL(m_input, UsingSpecialPad,use_special_pad)
SETTING_FORWARD(m_input, SpecialPadClass, special_pad_class)
// Vulkan settings
SETTING_FORWARD(m_vulkan, GpuId, gpu_id)

View File

@ -4,6 +4,7 @@
#include "common/config.h"
#include "common/logging/log.h"
#include "common/singleton.h"
#include "core/emulator_settings.h"
#include "core/libraries/libs.h"
#include "core/libraries/pad/pad_errors.h"
#include "input/controller.h"
@ -30,8 +31,9 @@ int PS4_SYSV_ABI scePadDeviceClassGetExtendedInformation(
s32 handle, OrbisPadDeviceClassExtendedInformation* pExtInfo) {
LOG_ERROR(Lib_Pad, "(STUBBED) called");
std::memset(pExtInfo, 0, sizeof(OrbisPadDeviceClassExtendedInformation));
if (Config::getUseSpecialPad()) {
pExtInfo->deviceClass = (OrbisPadDeviceClass)Config::getSpecialPadClass();
if (EmulatorSettings::GetInstance()->IsUsingSpecialPad()) {
pExtInfo->deviceClass =
(OrbisPadDeviceClass)EmulatorSettings::GetInstance()->GetSpecialPadClass();
}
return ORBIS_OK;
}
@ -115,9 +117,10 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn
pInfo->connectedCount = 1;
pInfo->connected = true;
pInfo->deviceClass = OrbisPadDeviceClass::Standard;
if (Config::getUseSpecialPad()) {
if (EmulatorSettings::GetInstance()->IsUsingSpecialPad()) {
pInfo->connectionType = ORBIS_PAD_PORT_TYPE_SPECIAL;
pInfo->deviceClass = (OrbisPadDeviceClass)Config::getSpecialPadClass();
pInfo->deviceClass =
(OrbisPadDeviceClass)EmulatorSettings::GetInstance()->GetSpecialPadClass();
}
return ORBIS_OK;
}
@ -263,7 +266,7 @@ int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenP
if (userId == -1) {
return ORBIS_PAD_ERROR_DEVICE_NO_HANDLE;
}
if (Config::getUseSpecialPad()) {
if (EmulatorSettings::GetInstance()->IsUsingSpecialPad()) {
if (type != ORBIS_PAD_PORT_TYPE_SPECIAL)
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
} else {
@ -280,7 +283,7 @@ int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenP
int PS4_SYSV_ABI scePadOpenExt(s32 userId, s32 type, s32 index,
const OrbisPadOpenExtParam* pParam) {
LOG_ERROR(Lib_Pad, "(STUBBED) called");
if (Config::getUseSpecialPad()) {
if (EmulatorSettings::GetInstance()->IsUsingSpecialPad()) {
if (type != ORBIS_PAD_PORT_TYPE_SPECIAL)
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
} else {

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/logging/log.h"
#include "core/emulator_settings.h"
#include "core/libraries/error_codes.h"
#include "core/libraries/libs.h"
#include "usbd.h"
@ -457,14 +458,14 @@ int PS4_SYSV_ABI Func_D56B43060720B1E0() {
}
void RegisterLib(Core::Loader::SymbolsResolver* sym) {
switch (Config::getUsbDeviceBackend()) {
case Config::SkylandersPortal:
switch (EmulatorSettings::GetInstance()->GetUsbDeviceBackend()) {
case UsbBackendType::SkylandersPortal:
usb_backend = std::make_shared<SkylandersPortalBackend>();
break;
case Config::InfinityBase:
case UsbBackendType::InfinityBase:
usb_backend = std::make_shared<InfinityBaseBackend>();
break;
case Config::DimensionsToypad:
case UsbBackendType::DimensionsToypad:
usb_backend = std::make_shared<DimensionsToypadBackend>();
break;
default: