From 4375cbca677ae1629c59293578bd583a3080c478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 22 Aug 2025 22:34:09 +0200 Subject: [PATCH] Add configurable login data for PSN revival FoxLovesYou in our Discord is working on sceNp and related to get certain PSN games working. These parmaeters are needed for his code branch, but it's not merged yet so I'm just throwing them in development tools for now. --- Common/Net/URL.h | 3 +-- Core/Config.cpp | 5 +++++ Core/Config.h | 5 +++++ Core/HLE/sceNp.cpp | 5 +++-- UI/DeveloperToolsScreen.cpp | 9 +++++++++ 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Common/Net/URL.h b/Common/Net/URL.h index c37162f51f..d9f42fae92 100644 --- a/Common/Net/URL.h +++ b/Common/Net/URL.h @@ -106,8 +106,7 @@ protected: // Easy to swap out for a UrlEncoder. struct MultipartFormDataEncoder : UrlEncoder { - MultipartFormDataEncoder() : UrlEncoder() - { + MultipartFormDataEncoder() : UrlEncoder() { data.reserve(8192); int r1 = rand(); int r2 = rand(); diff --git a/Core/Config.cpp b/Core/Config.cpp index 6c9c1830e1..bd9900b113 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -976,6 +976,11 @@ static const ConfigSetting networkSettings[] = { ConfigSetting("AllowSpeedControlWhileConnected", &g_Config.bAllowSpeedControlWhileConnected, false, CfgFlag::PER_GAME), ConfigSetting("DontDownloadInfraJson", &g_Config.bDontDownloadInfraJson, false, CfgFlag::DONT_SAVE), + // See comment in header + ConfigSetting("PSNNPID", &g_Config.sPSNNPID, "", CfgFlag::PER_GAME), + ConfigSetting("PSNPassword", &g_Config.sPSNPassword, "", CfgFlag::PER_GAME), + ConfigSetting("PSNToken", &g_Config.sPSNToken, "", CfgFlag::PER_GAME), + ConfigSetting("EnableNetworkChat", &g_Config.bEnableNetworkChat, false, CfgFlag::PER_GAME), ConfigSetting("ChatButtonPosition", &g_Config.iChatButtonPosition, (int)ScreenEdgePosition::BOTTOM_LEFT, CfgFlag::PER_GAME), ConfigSetting("ChatScreenPosition", &g_Config.iChatScreenPosition, (int)ScreenEdgePosition::BOTTOM_LEFT, CfgFlag::PER_GAME), diff --git a/Core/Config.h b/Core/Config.h index 1852e6c9bc..f590fdd89b 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -489,6 +489,11 @@ public: bool bAllowSavestateWhileConnected; // Developer option, ini-only. No normal users need this, it's always wrong to save/load state when online. bool bAllowSpeedControlWhileConnected; // Useful in some games but not recommended. + // PSN revival servers (actual code in development by FoxLovesYou from Discord) + std::string sPSNNPID; + std::string sPSNPassword; + std::string sPSNToken; // This will be set by a login mechanism + bool bEnableWlan; std::map mHostToAlias; // Local DNS database stored in ini file bool bEnableUPnP; diff --git a/Core/HLE/sceNp.cpp b/Core/HLE/sceNp.cpp index c66a9f1799..96cbda5ce9 100644 --- a/Core/HLE/sceNp.cpp +++ b/Core/HLE/sceNp.cpp @@ -147,8 +147,9 @@ static int sceNpInit() ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__); // We'll sanitize an extra time here, just to be safe from ini modifications. - if (g_Config.sInfrastructureUsername == SanitizeString(g_Config.sInfrastructureUsername, StringRestriction::AlphaNumDashUnderscore, 3, 16)) { - npOnlineId = g_Config.sInfrastructureUsername; + if (g_Config.sPSNNPID == SanitizeString(g_Config.sPSNNPID, StringRestriction::AlphaNumDashUnderscore, 3, 16)) { + npOnlineId = g_Config.sPSNNPID; + // There is also sPSNToken and sPSNPassword } else { npOnlineId.clear(); } diff --git a/UI/DeveloperToolsScreen.cpp b/UI/DeveloperToolsScreen.cpp index 457b9708e5..888e7bb02a 100644 --- a/UI/DeveloperToolsScreen.cpp +++ b/UI/DeveloperToolsScreen.cpp @@ -343,8 +343,17 @@ void DeveloperToolsScreen::CreateNetworkTab(UI::LinearLayout *list) { using namespace UI; auto dev = GetI18NCategory(I18NCat::DEVELOPER); auto ms = GetI18NCategory(I18NCat::MAINSETTINGS); + auto di = GetI18NCategory(I18NCat::DIALOG); list->Add(new ItemHeader(ms->T("Networking"))); list->Add(new CheckBox(&g_Config.bDontDownloadInfraJson, dev->T("Don't download infra-dns.json"))); + + // Note: Intensionally didn't use translation here, until we move these to the + // regular settings after the code is merged. + list->Add(new ItemHeader("PSN replacement")); + PopupTextInputChoice *usernameChoice = list->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sPSNNPID, di->T("Username"), "", 64, screenManager())); + usernameChoice->SetRestriction(StringRestriction::AlphaNumDashUnderscore, 3); + list->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sPSNPassword, di->T("Password"), "", 64, screenManager())); + list->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sPSNToken, "Token", "", 64, screenManager())); } void DeveloperToolsScreen::CreateGraphicsTab(UI::LinearLayout *list) {