From 0d88a2bc054cfe969673a9d9587c96b1b5c6cbf4 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 14 Jul 2021 03:18:19 -0400 Subject: [PATCH] applets/web: Resolve Nintendo CDN URLs This fixes the hint videos in New Super Mario Bros. U Deluxe --- .../hle/service/am/applets/applet_web_browser.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp index f96f0fee3..35f194961 100644 --- a/src/core/hle/service/am/applets/applet_web_browser.cpp +++ b/src/core/hle/service/am/applets/applet_web_browser.cpp @@ -58,6 +58,16 @@ std::string GetMainURL(const std::string& url) { return url.substr(0, index); } +std::string ResolveURL(const std::string& url) { + const auto index = url.find_first_of('%'); + + if (index == std::string::npos) { + return url; + } + + return url.substr(0, index) + "lp1" + url.substr(index + 1); +} + WebArgInputTLVMap ReadWebArgs(const std::vector& web_arg, WebArgHeader& web_arg_header) { std::memcpy(&web_arg_header, web_arg.data(), sizeof(WebArgHeader)); @@ -407,6 +417,9 @@ void WebBrowser::InitializeShare() {} void WebBrowser::InitializeWeb() { external_url = ParseStringValue(GetInputTLVData(WebArgInputTLVType::InitialURL).value()); + + // Resolve Nintendo CDN URLs. + external_url = ResolveURL(external_url); } void WebBrowser::InitializeWifi() {}