strat: fix sysmodule building, bump version so I don't forget later

This commit is contained in:
Michael Scire 2023-02-21 23:09:47 -07:00
parent 5e82e72411
commit 2fa8a57f27
9 changed files with 41 additions and 23 deletions

View file

@ -16,11 +16,11 @@
#pragma once #pragma once
#define ATMOSPHERE_RELEASE_VERSION_MAJOR 1 #define ATMOSPHERE_RELEASE_VERSION_MAJOR 1
#define ATMOSPHERE_RELEASE_VERSION_MINOR 4 #define ATMOSPHERE_RELEASE_VERSION_MINOR 5
#define ATMOSPHERE_RELEASE_VERSION_MICRO 1 #define ATMOSPHERE_RELEASE_VERSION_MICRO 0
#define ATMOSPHERE_RELEASE_VERSION ATMOSPHERE_RELEASE_VERSION_MAJOR, ATMOSPHERE_RELEASE_VERSION_MINOR, ATMOSPHERE_RELEASE_VERSION_MICRO #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_MINOR 0
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 1 #define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 0

View file

@ -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 { const struct {
u8 content_type; u8 content_type;
u64 app_id; 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) { static Result _nsResolveApplicationContentPath(Service* s, u64 app_id, NcmContentType content_type) {
const struct { const struct {
@ -55,7 +65,7 @@ static Result _nsGetRunningApplicationProgramId(Service* s, u64* out_program_id,
/* Application Manager forwarders. */ /* Application Manager forwarders. */
Result nsamGetApplicationContentPathFwd(Service* s, void* out, size_t out_size, u64 app_id, NcmContentType content_type) { 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) { 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 */ /* Web forwarders */
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) {
return _nsGetApplicationContentPath(&doc->s, out, out_size, app_id, 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) { Result nswebResolveApplicationContentPath(NsDocumentInterface* doc, u64 app_id, NcmContentType content_type) {

View file

@ -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 nsamResolveApplicationContentPathFwd(Service* s, u64 app_id, NcmContentType content_type);
Result nsamGetRunningApplicationProgramIdFwd(Service* s, u64* out_program_id, u64 app_id); 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 nswebResolveApplicationContentPath(NsDocumentInterface* doc, u64 app_id, NcmContentType content_type);
Result nswebGetRunningApplicationProgramId(NsDocumentInterface* doc, u64* out_program_id, u64 app_id); Result nswebGetRunningApplicationProgramId(NsDocumentInterface* doc, u64* out_program_id, u64 app_id);

View file

@ -19,8 +19,9 @@
namespace ams::mitm::ns { namespace ams::mitm::ns {
Result NsDocumentService::GetApplicationContentPath(const sf::OutBuffer &out_path, ncm::ProgramId application_id, u8 content_type) { Result NsDocumentService::GetApplicationContentPath(const sf::OutBuffer &out_path, sf::Out<ams::fs::ContentAttributes> out_attr, ncm::ProgramId application_id, u8 content_type) {
R_RETURN(nswebGetApplicationContentPath(m_srv.get(), out_path.GetPointer(), out_path.GetSize(), static_cast<u64>(application_id), static_cast<NcmContentType>(content_type))); static_assert(sizeof(*out_attr.GetPointer()) == sizeof(u8));
R_RETURN(nswebGetApplicationContentPath(m_srv.get(), out_path.GetPointer(), out_path.GetSize(), reinterpret_cast<u8 *>(out_attr.GetPointer()), static_cast<u64>(application_id), static_cast<NcmContentType>(content_type)));
} }
Result NsDocumentService::ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type) { Result NsDocumentService::ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type) {

View file

@ -19,7 +19,7 @@
#include "ns_shim.h" #include "ns_shim.h"
#define AMS_NS_DOCUMENT_MITM_INTERFACE_INFO(C, 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, 21, Result, GetApplicationContentPath, (const sf::OutBuffer &out_path, sf::Out<ams::fs::ContentAttributes> 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, 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<ncm::ProgramId> out, ncm::ProgramId application_id), (out, application_id), hos::Version_6_0_0) AMS_SF_METHOD_INFO(C, H, 92, Result, GetRunningApplicationProgramId, (sf::Out<ncm::ProgramId> out, ncm::ProgramId application_id), (out, application_id), hos::Version_6_0_0)
@ -44,7 +44,7 @@ namespace ams::mitm::ns {
} }
public: public:
/* Actual command API. */ /* 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<ams::fs::ContentAttributes> out_attr, ncm::ProgramId application_id, u8 content_type);
Result ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type); Result ResolveApplicationContentPath(ncm::ProgramId application_id, u8 content_type);
Result GetRunningApplicationProgramId(sf::Out<ncm::ProgramId> out, ncm::ProgramId application_id); Result GetRunningApplicationProgramId(sf::Out<ncm::ProgramId> out, ncm::ProgramId application_id);
}; };

View file

@ -230,7 +230,10 @@ namespace ams::mitm::sysupdater {
return pos != util::string_view::npos ? m_path.substr(pos + 1) : m_path; 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. */ /* Sanitize input. */
/* NOTE: This is an internal API, so we won't bother with mount name sanitization. */ /* NOTE: This is an internal API, so we won't bother with mount name sanitization. */
R_UNLESS(path != nullptr, fs::ResultInvalidPath()); R_UNLESS(path != nullptr, fs::ResultInvalidPath());

View file

@ -28,6 +28,6 @@ namespace ams::mitm::sysupdater {
util::string_view GetFileName() const; 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);
} }

View file

@ -69,7 +69,7 @@ namespace ams::mitm::sysupdater {
char path[ams::fs::EntryNameLengthMax]; char path[ams::fs::EntryNameLengthMax];
R_TRY(ConvertToFsCommonPath(path, sizeof(path), package_root_path, entry.name)); 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) { 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)); R_TRY(ConvertToFsCommonPath(content_path.str, sizeof(content_path.str), package_root, cnmt_nca_name));
/* Read the content meta path. */ /* 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) { Result GetSystemUpdateUpdateContentInfoFromPackage(ncm::ContentInfo *out, const char *package_root) {

View file

@ -56,15 +56,15 @@ namespace ams::ldr {
R_TRY(GetProgramPath(content_path, sizeof(content_path), loc)); R_TRY(GetProgramPath(content_path, sizeof(content_path), loc));
/* Mount the atmosphere code file system. */ /* 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; m_mounted_ams = true;
/* Mount the sd or base code file system. */ /* 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; m_mounted_sd_or_code = true;
/* Mount the base code file system. */ /* 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; m_mounted_code = true;
} }