From 016bea8a3838ab0facdf46b1018b41a76c8a1e0e Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 18 Apr 2026 21:39:08 +0000 Subject: [PATCH] [core/am] ban y2k domain to make Civ7 boot web-appletless Signed-off-by: lizzie --- .../am/frontend/applet_web_browser.cpp | 25 ++++++++++--------- src/core/hle/service/sockets/sfdnsres.cpp | 9 ++++--- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/core/hle/service/am/frontend/applet_web_browser.cpp b/src/core/hle/service/am/frontend/applet_web_browser.cpp index 92782c58e2..1ddb1ec2a3 100644 --- a/src/core/hle/service/am/frontend/applet_web_browser.cpp +++ b/src/core/hle/service/am/frontend/applet_web_browser.cpp @@ -4,6 +4,7 @@ // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "applet_web_browser_types.h" #include "common/assert.h" #include "common/fs/file.h" #include "common/fs/fs.h" @@ -370,16 +371,13 @@ void WebBrowser::ExtractOfflineRomFS() { void WebBrowser::WebBrowserExit(WebExitReason exit_reason, std::string last_url) { const bool use_tlv_output = - (web_arg_header.shim_kind == ShimKind::Share && - web_applet_version >= WebAppletVersion::Version196608) || - (web_arg_header.shim_kind == ShimKind::Web && - web_applet_version >= WebAppletVersion::Version524288) || - (web_arg_header.shim_kind == ShimKind::Lhub); + (web_arg_header.shim_kind == ShimKind::Share && web_applet_version >= WebAppletVersion::Version196608) + || (web_arg_header.shim_kind == ShimKind::Web && web_applet_version >= WebAppletVersion::Version524288) + || (web_arg_header.shim_kind == ShimKind::Lhub); // https://switchbrew.org/wiki/Internet_Browser#TLVs if (use_tlv_output) { - LOG_DEBUG(Service_AM, "Using TLV output: exit_reason={}, last_url={}, last_url_size={}", - exit_reason, last_url, last_url.size()); + LOG_DEBUG(Service_AM, "Using TLV output: exit_reason={}, last_url={}, last_url_size={}", exit_reason, last_url, last_url.size()); // storage size for TLVs is 0x2000 bytes (as per switchbrew documentation) constexpr size_t TLV_STORAGE_SIZE = 0x2000; @@ -600,11 +598,14 @@ void WebBrowser::ExecuteShare() { void WebBrowser::ExecuteWeb() { LOG_INFO(Service_AM, "Opening external URL at {}", external_url); - - frontend.OpenExternalWebPage(external_url, - [this](WebExitReason exit_reason, std::string last_url) { - WebBrowserExit(exit_reason, last_url); - }); + frontend.OpenExternalWebPage(external_url, [this](WebExitReason exit_reason, std::string last_url) { + // Offline and web applets must be explicitly exited from because they respect exit state + // Unlike the other web stuffs + if (exit_reason == WebExitReason::ExitRequested || exit_reason == WebExitReason::EndButtonPressed) + exit_reason = (web_arg_header.shim_kind == ShimKind::Web || web_arg_header.shim_kind == ShimKind::Offline) + ? WebExitReason::ExitRequested : WebExitReason::EndButtonPressed; + WebBrowserExit(exit_reason, last_url); + }); } void WebBrowser::ExecuteWifi() { diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp index f9f0ee56eb..d643d931e2 100644 --- a/src/core/hle/service/sockets/sfdnsres.cpp +++ b/src/core/hle/service/sockets/sfdnsres.cpp @@ -54,13 +54,14 @@ enum class NetDbError : s32 { }; static const constexpr std::array blockedDomains = { - "srv.nintendo.net", //obvious - "phoenix-api.wbagora.com", //hogwarts legacy + "srv.nintendo.net", // Obvious + "phoenix-api.wbagora.com", // Hogwarts legacy "battle.net", - "microsoft.com", //minecraft dungeons + other games + "microsoft.com", // Minecraft dungeons + other games "mojang.com", "xboxlive.com", - "minecraftservices.com" + "minecraftservices.com", + "508223012e5a5ff19f30a391b2bdadc0.my.2k.com", // Civilization 5 }; static bool IsBlockedHost(const std::string& host) {