From 6462101b6f08969ad5730f887faa9e9531adf4ff Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 21 Feb 2023 23:09:47 -0700 Subject: [PATCH] strat: fix sysmodule building, bump version so I don't forget later --- .../include/vapours/ams/ams_api_version.h | 8 +++---- .../ams_mitm/source/ns_mitm/ns_shim.c | 22 +++++++++++++++---- .../ams_mitm/source/ns_mitm/ns_shim.h | 2 +- .../source/ns_mitm/ns_web_mitm_service.cpp | 5 +++-- .../source/ns_mitm/ns_web_mitm_service.hpp | 10 ++++----- .../source/sysupdater/sysupdater_fs_utils.cpp | 5 ++++- .../source/sysupdater/sysupdater_fs_utils.hpp | 2 +- .../source/sysupdater/sysupdater_service.cpp | 4 ++-- .../loader/source/ldr_content_management.cpp | 6 ++--- 9 files changed, 41 insertions(+), 23 deletions(-) diff --git a/libraries/libvapours/include/vapours/ams/ams_api_version.h b/libraries/libvapours/include/vapours/ams/ams_api_version.h index 8fb3ab914..5d22b2308 100644 --- a/libraries/libvapours/include/vapours/ams/ams_api_version.h +++ b/libraries/libvapours/include/vapours/ams/ams_api_version.h @@ -16,11 +16,11 @@ #pragma once #define ATMOSPHERE_RELEASE_VERSION_MAJOR 1 -#define ATMOSPHERE_RELEASE_VERSION_MINOR 4 -#define ATMOSPHERE_RELEASE_VERSION_MICRO 1 +#define ATMOSPHERE_RELEASE_VERSION_MINOR 5 +#define ATMOSPHERE_RELEASE_VERSION_MICRO 0 #define ATMOSPHERE_RELEASE_VERSION ATMOSPHERE_RELEASE_VERSION_MAJOR, ATMOSPHERE_RELEASE_VERSION_MINOR, ATMOSPHERE_RELEASE_VERSION_MICRO -#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR 15 +#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR 16 #define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR 0 -#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 1 +#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 0 diff --git a/stratosphere/ams_mitm/source/ns_mitm/ns_shim.c b/stratosphere/ams_mitm/source/ns_mitm/ns_shim.c index a9df94003..4b6d1b8cd 100644 --- a/stratosphere/ams_mitm/source/ns_mitm/ns_shim.c +++ b/stratosphere/ams_mitm/source/ns_mitm/ns_shim.c @@ -26,7 +26,7 @@ Result nsGetDocumentInterfaceFwd(Service* s, NsDocumentInterface* out) { ); } -static Result _nsGetApplicationContentPath(Service *s, void* out, size_t out_size, u64 app_id, NcmContentType content_type) { +static Result _nsGetApplicationContentPathOld(Service *s, void* out, size_t out_size, u64 app_id, NcmContentType content_type) { const struct { u8 content_type; u64 app_id; @@ -37,6 +37,16 @@ static Result _nsGetApplicationContentPath(Service *s, void* out, size_t out_siz ); } +static Result _nsGetApplicationContentPath(Service *s, void* out, size_t out_size, u8 *out_attr, u64 app_id, NcmContentType content_type) { + const struct { + u8 content_type; + u64 app_id; + } in = { content_type, app_id }; + return serviceDispatchInOut(s, 21, in, *out_attr, + .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, + .buffers = { { out, out_size } }, + ); +} static Result _nsResolveApplicationContentPath(Service* s, u64 app_id, NcmContentType content_type) { const struct { @@ -55,7 +65,7 @@ static Result _nsGetRunningApplicationProgramId(Service* s, u64* out_program_id, /* Application Manager forwarders. */ Result nsamGetApplicationContentPathFwd(Service* s, void* out, size_t out_size, u64 app_id, NcmContentType content_type) { - return _nsGetApplicationContentPath(s, out, out_size, app_id, content_type); + return _nsGetApplicationContentPathOld(s, out, out_size, app_id, content_type); } Result nsamResolveApplicationContentPathFwd(Service* s, u64 app_id, NcmContentType content_type) { @@ -67,8 +77,12 @@ Result nsamGetRunningApplicationProgramIdFwd(Service* s, u64* out_program_id, u6 } /* Web forwarders */ -Result nswebGetApplicationContentPath(NsDocumentInterface* doc, void* out, size_t out_size, u64 app_id, NcmContentType content_type) { - return _nsGetApplicationContentPath(&doc->s, out, out_size, app_id, content_type); +Result nswebGetApplicationContentPath(NsDocumentInterface* doc, void* out, size_t out_size, u8 *out_attr, u64 app_id, NcmContentType content_type) { + if (hosversionAtLeast(16,0,0)) { + return _nsGetApplicationContentPath(&doc->s, out, out_size, out_attr, app_id, content_type); + } else { + return _nsGetApplicationContentPathOld(&doc->s, out, out_size, app_id, content_type); + } } Result nswebResolveApplicationContentPath(NsDocumentInterface* doc, u64 app_id, NcmContentType content_type) { diff --git a/stratosphere/ams_mitm/source/ns_mitm/ns_shim.h b/stratosphere/ams_mitm/source/ns_mitm/ns_shim.h index 7749bbf14..afb8125d3 100644 --- a/stratosphere/ams_mitm/source/ns_mitm/ns_shim.h +++ b/stratosphere/ams_mitm/source/ns_mitm/ns_shim.h @@ -22,7 +22,7 @@ Result nsamGetApplicationContentPathFwd(Service* s, void* out, size_t out_size, Result nsamResolveApplicationContentPathFwd(Service* s, u64 app_id, NcmContentType content_type); Result nsamGetRunningApplicationProgramIdFwd(Service* s, u64* out_program_id, u64 app_id); -Result nswebGetApplicationContentPath(NsDocumentInterface* doc, void* out, size_t out_size, u64 app_id, NcmContentType content_type); +Result nswebGetApplicationContentPath(NsDocumentInterface* doc, void* out, size_t out_size, u8 *out_attr, u64 app_id, NcmContentType content_type); Result nswebResolveApplicationContentPath(NsDocumentInterface* doc, u64 app_id, NcmContentType content_type); Result nswebGetRunningApplicationProgramId(NsDocumentInterface* doc, u64* out_program_id, u64 app_id); diff --git a/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.cpp b/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.cpp index 44d913d20..aa9972f65 100644 --- a/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.cpp @@ -19,8 +19,9 @@ namespace ams::mitm::ns { - Result NsDocumentService::GetApplicationContentPath(const sf::OutBuffer &out_path, ncm::ProgramId application_id, u8 content_type) { - R_RETURN(nswebGetApplicationContentPath(m_srv.get(), out_path.GetPointer(), out_path.GetSize(), static_cast(application_id), static_cast(content_type))); + Result NsDocumentService::GetApplicationContentPath(const sf::OutBuffer &out_path, sf::Out out_attr, ncm::ProgramId application_id, u8 content_type) { + static_assert(sizeof(*out_attr.GetPointer()) == sizeof(u8)); + R_RETURN(nswebGetApplicationContentPath(m_srv.get(), out_path.GetPointer(), out_path.GetSize(), reinterpret_cast(out_attr.GetPointer()), static_cast(application_id), static_cast(content_type))); } Result NsDocumentService::ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type) { diff --git a/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.hpp b/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.hpp index 2d298ac43..b08669e59 100644 --- a/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.hpp +++ b/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.hpp @@ -18,10 +18,10 @@ #include "ns_shim.h" -#define AMS_NS_DOCUMENT_MITM_INTERFACE_INFO(C, H) \ - AMS_SF_METHOD_INFO(C, H, 21, Result, GetApplicationContentPath, (const sf::OutBuffer &out_path, ncm::ProgramId application_id, u8 content_type), (out_path, application_id, content_type)) \ - AMS_SF_METHOD_INFO(C, H, 23, Result, ResolveApplicationContentPath, (ncm::ProgramId application_id, u8 content_type), (application_id, content_type)) \ - AMS_SF_METHOD_INFO(C, H, 92, Result, GetRunningApplicationProgramId, (sf::Out out, ncm::ProgramId application_id), (out, application_id), hos::Version_6_0_0) +#define AMS_NS_DOCUMENT_MITM_INTERFACE_INFO(C, H) \ + AMS_SF_METHOD_INFO(C, H, 21, Result, GetApplicationContentPath, (const sf::OutBuffer &out_path, sf::Out out_attr, ncm::ProgramId application_id, u8 content_type), (out_path, out_attr, application_id, content_type)) \ + AMS_SF_METHOD_INFO(C, H, 23, Result, ResolveApplicationContentPath, (ncm::ProgramId application_id, u8 content_type), (application_id, content_type)) \ + AMS_SF_METHOD_INFO(C, H, 92, Result, GetRunningApplicationProgramId, (sf::Out out, ncm::ProgramId application_id), (out, application_id), hos::Version_6_0_0) AMS_SF_DEFINE_INTERFACE(ams::mitm::ns::impl, IDocumentInterface, AMS_NS_DOCUMENT_MITM_INTERFACE_INFO, 0x0F9B1C00) @@ -44,7 +44,7 @@ namespace ams::mitm::ns { } public: /* Actual command API. */ - Result GetApplicationContentPath(const sf::OutBuffer &out_path, ncm::ProgramId application_id, u8 content_type); + Result GetApplicationContentPath(const sf::OutBuffer &out_path, sf::Out out_attr, ncm::ProgramId application_id, u8 content_type); Result ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type); Result GetRunningApplicationProgramId(sf::Out out, ncm::ProgramId application_id); }; diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp index 6f098087d..bb83af1be 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp @@ -230,7 +230,10 @@ namespace ams::mitm::sysupdater { return pos != util::string_view::npos ? m_path.substr(pos + 1) : m_path; } - Result MountSdCardContentMeta(const char *mount_name, const char *path) { + Result MountSdCardContentMeta(const char *mount_name, const char *path, ams::fs::ContentAttributes attr) { + /* TODO: What does attributes actually get used for? */ + AMS_UNUSED(attr); + /* Sanitize input. */ /* NOTE: This is an internal API, so we won't bother with mount name sanitization. */ R_UNLESS(path != nullptr, fs::ResultInvalidPath()); diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.hpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.hpp index b645201ee..90405a3a6 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.hpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.hpp @@ -28,6 +28,6 @@ namespace ams::mitm::sysupdater { util::string_view GetFileName() const; }; - Result MountSdCardContentMeta(const char *mount_name, const char *path); + Result MountSdCardContentMeta(const char *mount_name, const char *path, ams::fs::ContentAttributes attr); } diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp index 0e232d981..c5c652b44 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp @@ -69,7 +69,7 @@ namespace ams::mitm::sysupdater { char path[ams::fs::EntryNameLengthMax]; R_TRY(ConvertToFsCommonPath(path, sizeof(path), package_root_path, entry.name)); - R_RETURN(ncm::ReadContentMetaPathAlongWithExtendedDataAndDigest(out, path)); + R_RETURN(ncm::TryReadContentMetaPath(out, path, ncm::ReadContentMetaPathAlongWithExtendedDataAndDigest)); } Result ReadContentMetaPath(ncm::AutoBuffer *out, const char *package_root, const ncm::ContentInfo &content_info) { @@ -84,7 +84,7 @@ namespace ams::mitm::sysupdater { R_TRY(ConvertToFsCommonPath(content_path.str, sizeof(content_path.str), package_root, cnmt_nca_name)); /* Read the content meta path. */ - R_RETURN(ncm::ReadContentMetaPathAlongWithExtendedDataAndDigest(out, content_path.str)); + R_RETURN(ncm::TryReadContentMetaPath(out, content_path.str, ncm::ReadContentMetaPathAlongWithExtendedDataAndDigest)); } Result GetSystemUpdateUpdateContentInfoFromPackage(ncm::ContentInfo *out, const char *package_root) { diff --git a/stratosphere/loader/source/ldr_content_management.cpp b/stratosphere/loader/source/ldr_content_management.cpp index cd5ae8b29..75260f0b7 100644 --- a/stratosphere/loader/source/ldr_content_management.cpp +++ b/stratosphere/loader/source/ldr_content_management.cpp @@ -56,15 +56,15 @@ namespace ams::ldr { R_TRY(GetProgramPath(content_path, sizeof(content_path), loc)); /* Mount the atmosphere code file system. */ - R_TRY(fs::MountCodeForAtmosphereWithRedirection(std::addressof(m_ams_code_verification_data), AtmosphereCodeMountName, content_path, loc.program_id, m_override_status.IsHbl(), m_override_status.IsProgramSpecific())); + R_TRY(fs::MountCodeForAtmosphereWithRedirection(std::addressof(m_ams_code_verification_data), AtmosphereCodeMountName, content_path, fs::ContentAttributes_None, loc.program_id, m_override_status.IsHbl(), m_override_status.IsProgramSpecific())); m_mounted_ams = true; /* Mount the sd or base code file system. */ - R_TRY(fs::MountCodeForAtmosphere(std::addressof(m_sd_or_base_code_verification_data), SdOrCodeMountName, content_path, loc.program_id)); + R_TRY(fs::MountCodeForAtmosphere(std::addressof(m_sd_or_base_code_verification_data), SdOrCodeMountName, content_path, fs::ContentAttributes_None, loc.program_id)); m_mounted_sd_or_code = true; /* Mount the base code file system. */ - if (R_SUCCEEDED(fs::MountCode(std::addressof(m_base_code_verification_data), CodeMountName, content_path, loc.program_id))) { + if (R_SUCCEEDED(fs::MountCode(std::addressof(m_base_code_verification_data), CodeMountName, content_path, fs::ContentAttributes_None, loc.program_id))) { m_mounted_code = true; }