Skip to content

Commit

Permalink
Merge pull request #19927 from hrydgard/more-network-work
Browse files Browse the repository at this point in the history
Add a hidden option to not download infra-dns.json, instead use the file from assets
  • Loading branch information
hrydgard authored Jan 28, 2025
2 parents 07ed6da + 8818e44 commit 698a98c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ static const ConfigSetting networkSettings[] = {
ConfigSetting("InfrastructureUsername", &g_Config.sInfrastructureUsername, &DefaultInfrastructureUsername, CfgFlag::PER_GAME),
ConfigSetting("InfrastructureAutoDNS", &g_Config.bInfrastructureAutoDNS, true, CfgFlag::PER_GAME),
ConfigSetting("AllowSavestateWhileConnected", &g_Config.bAllowSavestateWhileConnected, false, CfgFlag::DONT_SAVE),
ConfigSetting("DontDownloadInfraJson", &g_Config.bDontDownloadInfraJson, false, CfgFlag::DONT_SAVE),

ConfigSetting("EnableNetworkChat", &g_Config.bEnableNetworkChat, false, CfgFlag::PER_GAME),
ConfigSetting("ChatButtonPosition", &g_Config.iChatButtonPosition, (int)ScreenEdgePosition::BOTTOM_LEFT, CfgFlag::PER_GAME),
Expand Down
2 changes: 1 addition & 1 deletion Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ struct Config {
int iWlanAdhocChannel;
bool bWlanPowerSave;
bool bEnableNetworkChat;

bool bDontDownloadInfraJson;
int iChatButtonPosition;
int iChatScreenPosition;

Expand Down
2 changes: 2 additions & 0 deletions Core/HLE/proAdhoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,7 @@ int friendFinder() {
// Reconnect when disconnected while Adhocctl is still inited
if (metasocket == (int)INVALID_SOCKET && netAdhocctlInited && isAdhocctlNeedLogin) {
if (g_Config.bEnableWlan) {
// Not really initNetwork.
if (initNetwork(&product_code) == 0) {
g_adhocServerConnected = true;
INFO_LOG(Log::sceNet, "FriendFinder: Network [RE]Initialized");
Expand All @@ -1390,6 +1391,7 @@ int friendFinder() {
}
}
}

// Prevent retrying to Login again unless it was on demand
isAdhocctlNeedLogin = false;

Expand Down
12 changes: 12 additions & 0 deletions Core/HLE/sceNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,18 @@ bool PollInfraJsonDownload(std::string *jsonOutput) {
return true;
}

if (!g_Config.bDontDownloadInfraJson) {
NOTICE_LOG(Log::sceNet, "As specified by the ini setting DontDownloadInfraJson, using infra-dns.json from /assets");
size_t jsonSize = 0;
std::unique_ptr<uint8_t[]> jsonStr(g_VFS.ReadFile("infra-dns.json", &jsonSize));
if (!jsonStr) {
jsonOutput->clear();
return true; // A clear output but returning true means something vent very wrong.
}
*jsonOutput = std::string((const char *)jsonStr.get(), jsonSize);
return true;
}

if (!g_infraDL) {
INFO_LOG(Log::sceNet, "No json download going on");
return false;
Expand Down

0 comments on commit 698a98c

Please sign in to comment.