From aa288d91417de2bb294455bf4e5ff51a961ebed2 Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Tue, 15 Apr 2025 15:34:09 +0200 Subject: [PATCH] Cleanup + initial code to set custom names for different players --- src/common/config.cpp | 23 ++++++----------------- src/common/config.h | 2 -- src/sdl_window.cpp | 4 ---- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index 0a0d2ba34..1c2d54327 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -42,7 +42,7 @@ static u32 screenHeight = 720; static s32 gpuId = -1; // Vulkan physical device index. Set to negative for auto select static std::string logFilter; static std::string logType = "sync"; -static std::string userName = "shadPS4"; +static std::array userNames = {"shadPS4" "shadps4-2", "shadPS4-3", "shadPS4-4"}; static std::string updateChannel; static std::string chooseHomeTab; static std::string backButtonBehavior = "left"; @@ -75,7 +75,6 @@ static double trophyNotificationDuration = 6.0; static bool useUnifiedInputConfig = true; static bool overrideControllerColor = false; static int controllerCustomColorRGB[3] = {0, 0, 255}; -static int numberOfPlayers = 1; static bool separateupdatefolder = false; static bool compatibilityData = false; static bool checkCompatibilityOnStartup = false; @@ -112,14 +111,6 @@ static bool showLabelsUnderIcons = true; // Language u32 m_language = 1; // english -void SetNumberOfPlayers(int num) { - numberOfPlayers = num; -} - -int GetNumberOfPlayers() { - return numberOfPlayers; -} - bool allowHDR() { return isHDRAllowed; } @@ -246,7 +237,7 @@ std::string getLogType() { } std::string getUserName() { - return userName; + return userNames[0]; } std::string getUpdateChannel() { @@ -496,7 +487,7 @@ void setSeparateLogFilesEnabled(bool enabled) { } void setUserName(const std::string& type) { - userName = type; + userNames[0] = type; } void setUpdateChannel(const std::string& type) { @@ -772,7 +763,7 @@ void load(const std::filesystem::path& path) { enableDiscordRPC = toml::find_or(general, "enableDiscordRPC", true); logFilter = toml::find_or(general, "logFilter", ""); logType = toml::find_or(general, "logType", "sync"); - userName = toml::find_or(general, "userName", "shadPS4"); + userNames[0] = toml::find_or(general, "userName", "shadPS4"); if (Common::g_is_release) { updateChannel = toml::find_or(general, "updateChannel", "Release"); } else { @@ -798,7 +789,6 @@ void load(const std::filesystem::path& path) { specialPadClass = toml::find_or(input, "specialPadClass", 1); isMotionControlsEnabled = toml::find_or(input, "isMotionControlsEnabled", true); useUnifiedInputConfig = toml::find_or(input, "useUnifiedInputConfig", true); - numberOfPlayers = toml::find_or(input, "numberOfPlayers", 1); } if (data.contains("GPU")) { @@ -971,7 +961,7 @@ void save(const std::filesystem::path& path) { data["General"]["enableDiscordRPC"] = enableDiscordRPC; data["General"]["logFilter"] = logFilter; data["General"]["logType"] = logType; - data["General"]["userName"] = userName; + data["General"]["userName"] = userNames[0]; data["General"]["updateChannel"] = updateChannel; data["General"]["chooseHomeTab"] = chooseHomeTab; data["General"]["showSplash"] = isShowSplash; @@ -987,7 +977,6 @@ void save(const std::filesystem::path& path) { data["Input"]["specialPadClass"] = specialPadClass; data["Input"]["isMotionControlsEnabled"] = isMotionControlsEnabled; data["Input"]["useUnifiedInputConfig"] = useUnifiedInputConfig; - data["Input"]["numberOfPlayers"] = numberOfPlayers; data["GPU"]["screenWidth"] = screenWidth; data["GPU"]["screenHeight"] = screenHeight; data["GPU"]["nullGpu"] = isNullGpu; @@ -1119,7 +1108,7 @@ void setDefaultValues() { screenHeight = 720; logFilter = ""; logType = "sync"; - userName = "shadPS4"; + userNames = {"shadPS4", "shadps4-2", "shadPS4-3", "shadPS4-4"}; if (Common::g_is_release) { updateChannel = "Release"; } else { diff --git a/src/common/config.h b/src/common/config.h index 06d45b686..aba23621c 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -20,8 +20,6 @@ void load(const std::filesystem::path& path); void save(const std::filesystem::path& path); void saveMainWindow(const std::filesystem::path& path); -void SetNumberOfPlayers(int num); -int GetNumberOfPlayers(); std::string getTrophyKey(); void setTrophyKey(std::string key); bool GetLoadGameSizeEnabled(); diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 718e5bb7e..16d8478ea 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -145,10 +145,6 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameControllers* controller Input::ParseInputConfig(std::string(Common::ElfInfo::Instance().GameSerial())); // default login using namespace Libraries::UserService; - // int player_count = Config::GetNumberOfPlayers(); - // for (int i = 0; i < player_count; i++) { - // AddUserServiceEvent({OrbisUserServiceEventType::Login, i + 1}); - // } } WindowSDL::~WindowSDL() = default;