Add a hidden option to not download infra-dns.json, instead use the file from assets

This commit is contained in:
Henrik Rydgård 2025-01-24 13:20:55 +01:00
parent 41b93c895c
commit 8818e440ad
4 changed files with 16 additions and 1 deletions

View File

@ -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),

View File

@ -475,7 +475,7 @@ public:
int iWlanAdhocChannel;
bool bWlanPowerSave;
bool bEnableNetworkChat;
bool bDontDownloadInfraJson;
int iChatButtonPosition;
int iChatScreenPosition;

View File

@ -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");
@ -1390,6 +1391,7 @@ int friendFinder() {
}
}
}
// Prevent retrying to Login again unless it was on demand
isAdhocctlNeedLogin = false;

View File

@ -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;