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

@@ -96,11 +96,7 @@ namespace ams::mitm::fs {
Result OpenProgramSpecificWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId program_id, FsFileSystemType filesystem_type, Service *fwd, const fssrv::sf::Path *path, bool with_id) {
/* Directory must exist. */
{
FsDir d;
R_UNLESS(R_SUCCEEDED(mitm::fs::OpenAtmosphereSdDirectory(std::addressof(d), program_id, ProgramWebContentDir, fs::OpenDirectoryMode_Directory)), sm::mitm::ResultShouldForwardToSession());
fsDirClose(std::addressof(d));
}
R_UNLESS(HasSdManualHtmlContent(program_id), sm::mitm::ResultShouldForwardToSession());
/* Open the SD card using fs.mitm's session. */
FsFileSystem sd_fs;
@@ -162,6 +158,17 @@ namespace ams::mitm::fs {
}
bool HasSdManualHtmlContent(ncm::ProgramId program_id) {
/* Directory must exist. */
FsDir d;
if (R_SUCCEEDED(OpenAtmosphereSdDirectory(std::addressof(d), program_id, ProgramWebContentDir, fs::OpenDirectoryMode_Directory))) {
::fsDirClose(std::addressof(d));
return true;
} else {
return false;
}
}
Result FsMitmService::OpenFileSystemWithPatch(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> out, ncm::ProgramId program_id, u32 _filesystem_type) {
R_RETURN(OpenWebContentFileSystem(out, m_client_info.program_id, program_id, static_cast<FsFileSystemType>(_filesystem_type), m_forward_service.get(), nullptr, false, m_client_info.override_status.IsProgramSpecific()));
}