ns.mitm/fs.mitm: allow program specific web override for non-hbl, if present

This commit is contained in:
Michael Scire
2022-07-25 16:24:31 -07:00
parent e702eab21c
commit 7e6b369605
5 changed files with 24 additions and 14 deletions

View File

@@ -14,6 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "../amsmitm_fs_utils.hpp"
#include "ns_am_mitm_service.hpp"
#include "ns_shim.h"
@@ -24,10 +25,9 @@ namespace ams::mitm::ns {
}
Result NsAmMitmService::ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type) {
/* Always succeed for web applets asking about HBL. */
/* This enables hbl html. */
bool is_hbl;
if (R_SUCCEEDED(pm::info::IsHblProgramId(&is_hbl, application_id)) && is_hbl) {
/* Always succeed for web applets asking about HBL to enable hbl_html, and applications with manual_html to allow custom manual data. */
bool is_hbl = false;
if ((R_SUCCEEDED(pm::info::IsHblProgramId(std::addressof(is_hbl), application_id)) && is_hbl) || (static_cast<ncm::ContentType>(content_type) == ncm::ContentType::HtmlDocument && mitm::fs::HasSdManualHtmlContent(application_id))) {
nsamResolveApplicationContentPathFwd(m_forward_service.get(), static_cast<u64>(application_id), static_cast<NcmContentType>(content_type));
R_SUCCEED();
}

View File

@@ -14,6 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "../amsmitm_fs_utils.hpp"
#include "ns_web_mitm_service.hpp"
namespace ams::mitm::ns {
@@ -23,10 +24,9 @@ namespace ams::mitm::ns {
}
Result NsDocumentService::ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type) {
/* Always succeed for web applets asking about HBL. */
/* This enables hbl html. */
bool is_hbl;
if (R_SUCCEEDED(pm::info::IsHblProgramId(std::addressof(is_hbl), application_id)) && is_hbl) {
/* Always succeed for web applets asking about HBL to enable hbl_html, and applications with manual_html to allow custom manual data. */
bool is_hbl = false;
if ((R_SUCCEEDED(pm::info::IsHblProgramId(std::addressof(is_hbl), application_id)) && is_hbl) || (static_cast<ncm::ContentType>(content_type) == ncm::ContentType::HtmlDocument && mitm::fs::HasSdManualHtmlContent(application_id))) {
nswebResolveApplicationContentPath(m_srv.get(), static_cast<u64>(application_id), static_cast<NcmContentType>(content_type));
R_SUCCEED();
}