more settings porting

This commit is contained in:
georgemoralis
2025-11-27 15:25:21 +02:00
parent 761306188d
commit f54367734d
4 changed files with 11 additions and 36 deletions

View File

@@ -130,12 +130,10 @@ public:
// General
static ConfigEntry<int> volumeSlider(100);
static ConfigEntry<double> trophyNotificationDuration(6.0);
static ConfigEntry<string> logFilter("");
static ConfigEntry<string> logType("sync");
static ConfigEntry<string> userName("shadPS4");
static ConfigEntry<bool> isShowSplash(false);
static ConfigEntry<string> isSideTrophy("right");
static ConfigEntry<bool> isConnectedToNetwork(false);
static bool enableDiscordRPC = false;
static std::filesystem::path sys_modules_path = {};
@@ -328,10 +326,6 @@ std::string getPadSpkOutputDevice() {
return padSpkOutputDevice.get();
}
double getTrophyNotificationDuration() {
return trophyNotificationDuration.get();
}
u32 getWindowWidth() {
return windowWidth.get();
}
@@ -388,10 +382,6 @@ bool showSplash() {
return isShowSplash.get();
}
string sideTrophy() {
return isSideTrophy.get();
}
bool nullGpu() {
return isNullGpu.get();
}
@@ -523,10 +513,6 @@ void setShowSplash(bool enable, bool is_game_specific) {
isShowSplash.set(enable, is_game_specific);
}
void setSideTrophy(string side, bool is_game_specific) {
isSideTrophy.set(side, is_game_specific);
}
void setNullGpu(bool enable, bool is_game_specific) {
isNullGpu.set(enable, is_game_specific);
}
@@ -616,10 +602,6 @@ void setPadSpkOutputDevice(std::string device, bool is_game_specific) {
padSpkOutputDevice.set(device, is_game_specific);
}
void setTrophyNotificationDuration(double newTrophyNotificationDuration, bool is_game_specific) {
trophyNotificationDuration.set(newTrophyNotificationDuration, is_game_specific);
}
void setLanguage(u32 language, bool is_game_specific) {
m_language.set(language, is_game_specific);
}
@@ -806,14 +788,12 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
const toml::value& general = data.at("General");
volumeSlider.setFromToml(general, "volumeSlider", is_game_specific);
trophyNotificationDuration.setFromToml(general, "trophyNotificationDuration",
is_game_specific);
enableDiscordRPC = toml::find_or<bool>(general, "enableDiscordRPC", enableDiscordRPC);
logFilter.setFromToml(general, "logFilter", is_game_specific);
logType.setFromToml(general, "logType", is_game_specific);
userName.setFromToml(general, "userName", is_game_specific);
isShowSplash.setFromToml(general, "showSplash", is_game_specific);
isSideTrophy.setFromToml(general, "sideTrophy", is_game_specific);
isConnectedToNetwork.setFromToml(general, "isConnectedToNetwork", is_game_specific);
defaultControllerID.setFromToml(general, "defaultControllerID", is_game_specific);
@@ -989,13 +969,10 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
}
// Entries saved by the game-specific settings GUI
volumeSlider.setTomlValue(data, "General", "volumeSlider", is_game_specific);
trophyNotificationDuration.setTomlValue(data, "General", "trophyNotificationDuration",
is_game_specific);
logFilter.setTomlValue(data, "General", "logFilter", is_game_specific);
logType.setTomlValue(data, "General", "logType", is_game_specific);
userName.setTomlValue(data, "General", "userName", is_game_specific);
isShowSplash.setTomlValue(data, "General", "showSplash", is_game_specific);
isSideTrophy.setTomlValue(data, "General", "sideTrophy", is_game_specific);
isConnectedToNetwork.setTomlValue(data, "General", "isConnectedToNetwork", is_game_specific);
cursorState.setTomlValue(data, "Input", "cursorState", is_game_specific);
@@ -1117,12 +1094,11 @@ void setDefaultValues(bool is_game_specific) {
// Entries with game-specific settings that are in both the game-specific and global GUI
// GS - General
volumeSlider.set(100, is_game_specific);
trophyNotificationDuration.set(6.0, is_game_specific);
logFilter.set("", is_game_specific);
logType.set("sync", is_game_specific);
userName.set("shadPS4", is_game_specific);
isShowSplash.set(false, is_game_specific);
isSideTrophy.set("right", is_game_specific);
// GS - Input
cursorState.set(HideCursorState::Idle, is_game_specific);

View File

@@ -57,8 +57,6 @@ bool collectShadersForDebug();
void setCollectShaderForDebug(bool enable, bool is_game_specific = false);
bool showSplash();
void setShowSplash(bool enable, bool is_game_specific = false);
std::string sideTrophy();
void setSideTrophy(std::string side, bool is_game_specific = false);
bool nullGpu();
void setNullGpu(bool enable, bool is_game_specific = false);
bool copyGPUCmdBuffers();
@@ -97,9 +95,6 @@ std::string getLogType();
void setLogType(const std::string& type, bool is_game_specific = false);
std::string getLogFilter();
void setLogFilter(const std::string& type, bool is_game_specific = false);
double getTrophyNotificationDuration();
void setTrophyNotificationDuration(double newTrophyNotificationDuration,
bool is_game_specific = false);
int getCursorHideTimeout();
std::string getMainOutputDevice();
void setMainOutputDevice(std::string device, bool is_game_specific = false);

View File

@@ -91,7 +91,7 @@ struct GeneralSettings {
Setting<std::string> log_filter{""};
Setting<std::string> log_type{"sync"};
Setting<bool> show_splash{false};
Setting<std::string> side_trophy{"right"};
Setting<std::string> trophy_notification_side{"right"};
Setting<bool> connected_to_network{false};
Setting<bool> discord_rpc_enabled{false};
@@ -111,7 +111,8 @@ struct GeneralSettings {
make_override<GeneralSettings>("log_filter", &GeneralSettings::log_filter),
make_override<GeneralSettings>("log_type", &GeneralSettings::log_type),
make_override<GeneralSettings>("show_splash", &GeneralSettings::show_splash),
make_override<GeneralSettings>("side_trophy", &GeneralSettings::side_trophy),
make_override<GeneralSettings>("trophy_notification_side",
&GeneralSettings::trophy_notification_side),
make_override<GeneralSettings>("connected_to_network",
&GeneralSettings::connected_to_network)};
}
@@ -120,7 +121,8 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GeneralSettings, install_dirs, addon_install_
sys_modules_dir, volume_slider, neo_mode, dev_kit_mode,
extra_dmem_in_mbytes, psn_signed_in, trophy_popup_disabled,
trophy_notification_duration, log_filter, log_type, show_splash,
side_trophy, connected_to_network, discord_rpc_enabled)
trophy_notification_side, connected_to_network,
discord_rpc_enabled)
// -------------------------------
// Debug settings
@@ -322,6 +324,8 @@ public:
SETTING_FORWARD(m_general, ExtraDmemInMBytes, extra_dmem_in_mbytes)
SETTING_FORWARD_BOOL(m_general, PSNSignedIn, psn_signed_in)
SETTING_FORWARD_BOOL(m_general, TrophyPopupDisabled, trophy_popup_disabled)
SETTING_FORWARD(m_general, TrophyNotificationDuration, trophy_notification_duration)
SETTING_FORWARD(m_general, GetTrophyNotificationSide, trophy_notification_side)
SETTING_FORWARD(m_general, AddonInstallDir, addon_install_dir)
// Debug settings

View File

@@ -32,9 +32,9 @@ TrophyUI::TrophyUI(const std::filesystem::path& trophyIconPath, const std::strin
const std::string_view& rarity)
: trophy_name(trophyName), trophy_type(rarity) {
side = Config::sideTrophy();
side = EmulatorSettings::GetInstance()->GetTrophyNotificationSide();
trophy_timer = Config::getTrophyNotificationDuration();
trophy_timer = EmulatorSettings::GetInstance()->GetTrophyNotificationDuration();
if (std::filesystem::exists(trophyIconPath)) {
trophy_icon = RefCountedTexture::DecodePngFile(trophyIconPath);