mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Add the ability to hide adhoc servers using a "hidden" entry in the json.
Useful when servers are temporarily down.
This commit is contained in:
@@ -131,7 +131,7 @@ bool JsonGet::getBool(const char *child_name) const {
|
||||
return get(child_name)->value.getTag() == JSON_TRUE;
|
||||
}
|
||||
|
||||
bool JsonGet::getBool(const char *child_name, bool default_value) const {
|
||||
bool JsonGet::getBoolOr(const char *child_name, bool default_value) const {
|
||||
const JsonNode *val = get(child_name);
|
||||
if (val) {
|
||||
JsonTag tag = val->value.getTag();
|
||||
|
||||
@@ -30,7 +30,7 @@ struct JsonGet {
|
||||
int getInt(const char *child_name) const;
|
||||
int getInt(const char *child_name, int default_value) const;
|
||||
bool getBool(const char *child_name) const;
|
||||
bool getBool(const char *child_name, bool default_value) const;
|
||||
bool getBoolOr(const char *child_name, bool default_value) const;
|
||||
|
||||
bool hasChild(const char *child_name, JsonTag child_type) const {
|
||||
return get(child_name, child_type) != nullptr;
|
||||
|
||||
@@ -123,7 +123,7 @@ bool GhidraClient::FetchTypes() {
|
||||
type.pathName = entry.getStringOr("pathName", "");
|
||||
type.length = entry.getInt("length", 0);
|
||||
type.alignedLength = entry.getInt("alignedLength", 0);
|
||||
type.zeroLength = entry.getBool("zeroLength", false);
|
||||
type.zeroLength = entry.getBoolOr("zeroLength", false);
|
||||
type.description = entry.getStringOr("description", "");
|
||||
type.kind = ResolveTypeKind(entry.getStringOr("kind", ""));
|
||||
|
||||
|
||||
+2
-2
@@ -228,7 +228,7 @@ bool LoadDNSForGameID(std::string_view gameID, std::string_view jsonStr, InfraDN
|
||||
dns->revivalTeamURL = revived.getStringOr("url", "");
|
||||
}
|
||||
}
|
||||
dns->connectAdHocForGrouping = def.getBool("connect_adhoc_for_grouping", false);
|
||||
dns->connectAdHocForGrouping = def.getBoolOr("connect_adhoc_for_grouping", false);
|
||||
}
|
||||
|
||||
const JsonNode *games = root.getArray("games");
|
||||
@@ -290,7 +290,7 @@ bool LoadDNSForGameID(std::string_view gameID, std::string_view jsonStr, InfraDN
|
||||
dns->gameName = game.getStringOr("name", "");
|
||||
dns->dns = game.getStringOr("dns", dns->dns.c_str());
|
||||
dns->dyn_dns = game.getStringOr("dyn_dns", "");
|
||||
dns->connectAdHocForGrouping = game.getBool("connect_adhoc_for_grouping", dns->connectAdHocForGrouping);
|
||||
dns->connectAdHocForGrouping = game.getBoolOr("connect_adhoc_for_grouping", dns->connectAdHocForGrouping);
|
||||
if (game.hasChild("domains", JSON_OBJECT)) {
|
||||
const JsonGet domains = game.getDict("domains");
|
||||
for (const auto &iter : domains.value_) {
|
||||
|
||||
@@ -142,6 +142,7 @@ static bool ParseServerListEntriesJSON(std::string_view json) {
|
||||
for (const JsonNode *iter : servers->value) {
|
||||
JsonGet server = iter->value;
|
||||
AdhocServerListEntry entry;
|
||||
entry.hidden = server.getBoolOr("hidden", false);
|
||||
entry.name = server.getStringOr("name", "");
|
||||
entry.discord = server.getStringOr("discord", "");
|
||||
entry.host = server.getStringOr("host", "");
|
||||
|
||||
@@ -114,6 +114,7 @@ struct AdhocServerListEntry {
|
||||
std::string dataJsonUrl;
|
||||
std::string statusXmlUrl;
|
||||
std::string statusWebUrl;
|
||||
bool hidden = false;
|
||||
AdhocDataMode mode = AdhocDataMode::P2P;
|
||||
};
|
||||
|
||||
|
||||
@@ -726,6 +726,8 @@ void AdhocServerScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
|
||||
CollapsibleSection *publicSection = innerView->Add(new CollapsibleSection(n->T("Public server list"), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||
for (const auto &entry : entries) {
|
||||
if (entry.hidden)
|
||||
continue;
|
||||
AddButtonFromEntry(publicSection, entry, false);
|
||||
}
|
||||
|
||||
|
||||
+33
-1
@@ -1177,10 +1177,34 @@
|
||||
<None Include="..\android\jni\Application.mk" />
|
||||
<None Include="..\android\jni\Locals.mk" />
|
||||
<None Include="..\appveyor.yml" />
|
||||
<None Include="..\assets\adhoc-servers.json">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</None>
|
||||
<None Include="..\assets\compat.ini" />
|
||||
<None Include="..\assets\compatvr.ini" />
|
||||
<None Include="..\assets\infra-dns.json">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</None>
|
||||
<None Include="..\assets\knownfuncs.ini" />
|
||||
<None Include="..\assets\langregion.ini" />
|
||||
<None Include="..\assets\redump.csv">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</None>
|
||||
<None Include="..\atlasscript.txt" />
|
||||
<None Include="..\b.sh" />
|
||||
<None Include="..\build.gradle" />
|
||||
@@ -1411,6 +1435,14 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\asciifont_atlasscript.txt" />
|
||||
<Text Include="..\assets\gamecontrollerdb.txt">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</Text>
|
||||
<Text Include="..\font_atlasscript.txt" />
|
||||
<Text Include="..\libretro\CMakeLists.txt" />
|
||||
<Text Include="..\libretro\README_WINDOWS.txt" />
|
||||
@@ -1426,4 +1458,4 @@
|
||||
<UserProperties RESOURCE_FILE="DaSh.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -68,6 +68,9 @@
|
||||
<Filter Include="Windows\Input\Hid">
|
||||
<UniqueIdentifier>{55d277d0-1afa-464d-9bde-672334ad73fe}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="assets">
|
||||
<UniqueIdentifier>{a5b85611-e50f-4179-814d-426816c1e04d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Debugger\CtrlDisAsmView.cpp">
|
||||
@@ -830,6 +833,15 @@
|
||||
<None Include="..\scripts\websocket-test.py">
|
||||
<Filter>Other Platforms</Filter>
|
||||
</None>
|
||||
<None Include="..\assets\adhoc-servers.json">
|
||||
<Filter>assets</Filter>
|
||||
</None>
|
||||
<None Include="..\assets\infra-dns.json">
|
||||
<Filter>assets</Filter>
|
||||
</None>
|
||||
<None Include="..\assets\redump.csv">
|
||||
<Filter>assets</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ppsspp.rc">
|
||||
@@ -864,5 +876,8 @@
|
||||
<Text Include="..\SDL\README.TXT">
|
||||
<Filter>Other Platforms\SDL</Filter>
|
||||
</Text>
|
||||
<Text Include="..\assets\gamecontrollerdb.txt">
|
||||
<Filter>assets</Filter>
|
||||
</Text>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user