Skip to content

Commit 4375cbc

Browse files
committed
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.
1 parent 04f84ad commit 4375cbc

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

Common/Net/URL.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ struct UrlEncoder
106106
// Easy to swap out for a UrlEncoder.
107107
struct MultipartFormDataEncoder : UrlEncoder
108108
{
109-
MultipartFormDataEncoder() : UrlEncoder()
110-
{
109+
MultipartFormDataEncoder() : UrlEncoder() {
111110
data.reserve(8192);
112111
int r1 = rand();
113112
int r2 = rand();

Core/Config.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,11 @@ static const ConfigSetting networkSettings[] = {
976976
ConfigSetting("AllowSpeedControlWhileConnected", &g_Config.bAllowSpeedControlWhileConnected, false, CfgFlag::PER_GAME),
977977
ConfigSetting("DontDownloadInfraJson", &g_Config.bDontDownloadInfraJson, false, CfgFlag::DONT_SAVE),
978978

979+
// See comment in header
980+
ConfigSetting("PSNNPID", &g_Config.sPSNNPID, "", CfgFlag::PER_GAME),
981+
ConfigSetting("PSNPassword", &g_Config.sPSNPassword, "", CfgFlag::PER_GAME),
982+
ConfigSetting("PSNToken", &g_Config.sPSNToken, "", CfgFlag::PER_GAME),
983+
979984
ConfigSetting("EnableNetworkChat", &g_Config.bEnableNetworkChat, false, CfgFlag::PER_GAME),
980985
ConfigSetting("ChatButtonPosition", &g_Config.iChatButtonPosition, (int)ScreenEdgePosition::BOTTOM_LEFT, CfgFlag::PER_GAME),
981986
ConfigSetting("ChatScreenPosition", &g_Config.iChatScreenPosition, (int)ScreenEdgePosition::BOTTOM_LEFT, CfgFlag::PER_GAME),

Core/Config.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,11 @@ struct Config {
489489
bool bAllowSavestateWhileConnected; // Developer option, ini-only. No normal users need this, it's always wrong to save/load state when online.
490490
bool bAllowSpeedControlWhileConnected; // Useful in some games but not recommended.
491491

492+
// PSN revival servers (actual code in development by FoxLovesYou from Discord)
493+
std::string sPSNNPID;
494+
std::string sPSNPassword;
495+
std::string sPSNToken; // This will be set by a login mechanism
496+
492497
bool bEnableWlan;
493498
std::map<std::string, std::string> mHostToAlias; // Local DNS database stored in ini file
494499
bool bEnableUPnP;

Core/HLE/sceNp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ static int sceNpInit()
147147
ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__);
148148

149149
// We'll sanitize an extra time here, just to be safe from ini modifications.
150-
if (g_Config.sInfrastructureUsername == SanitizeString(g_Config.sInfrastructureUsername, StringRestriction::AlphaNumDashUnderscore, 3, 16)) {
151-
npOnlineId = g_Config.sInfrastructureUsername;
150+
if (g_Config.sPSNNPID == SanitizeString(g_Config.sPSNNPID, StringRestriction::AlphaNumDashUnderscore, 3, 16)) {
151+
npOnlineId = g_Config.sPSNNPID;
152+
// There is also sPSNToken and sPSNPassword
152153
} else {
153154
npOnlineId.clear();
154155
}

UI/DeveloperToolsScreen.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,17 @@ void DeveloperToolsScreen::CreateNetworkTab(UI::LinearLayout *list) {
343343
using namespace UI;
344344
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
345345
auto ms = GetI18NCategory(I18NCat::MAINSETTINGS);
346+
auto di = GetI18NCategory(I18NCat::DIALOG);
346347
list->Add(new ItemHeader(ms->T("Networking")));
347348
list->Add(new CheckBox(&g_Config.bDontDownloadInfraJson, dev->T("Don't download infra-dns.json")));
349+
350+
// Note: Intensionally didn't use translation here, until we move these to the
351+
// regular settings after the code is merged.
352+
list->Add(new ItemHeader("PSN replacement"));
353+
PopupTextInputChoice *usernameChoice = list->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sPSNNPID, di->T("Username"), "", 64, screenManager()));
354+
usernameChoice->SetRestriction(StringRestriction::AlphaNumDashUnderscore, 3);
355+
list->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sPSNPassword, di->T("Password"), "", 64, screenManager()));
356+
list->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sPSNToken, "Token", "", 64, screenManager()));
348357
}
349358

350359
void DeveloperToolsScreen::CreateGraphicsTab(UI::LinearLayout *list) {

0 commit comments

Comments
 (0)