loader: update to reflect latest 18.0.0 changes
well, this sure is late, whoops
This commit is contained in:
@@ -25,12 +25,12 @@ namespace ams::ldr {
|
||||
}
|
||||
|
||||
/* ScopedCodeMount functionality. */
|
||||
ScopedCodeMount::ScopedCodeMount(const ncm::ProgramLocation &loc) : m_lk(g_scoped_code_mount_lock), m_has_status(false), m_mounted_ams(false), m_mounted_sd_or_code(false), m_mounted_code(false) {
|
||||
m_result = this->Initialize(loc);
|
||||
ScopedCodeMount::ScopedCodeMount(const ncm::ProgramLocation &loc, PlatformId platform) : m_lk(g_scoped_code_mount_lock), m_has_status(false), m_mounted_ams(false), m_mounted_sd_or_code(false), m_mounted_code(false) {
|
||||
m_result = this->Initialize(loc, platform);
|
||||
}
|
||||
|
||||
ScopedCodeMount::ScopedCodeMount(const ncm::ProgramLocation &loc, const cfg::OverrideStatus &o) : m_lk(g_scoped_code_mount_lock), m_override_status(o), m_has_status(true), m_mounted_ams(false), m_mounted_sd_or_code(false), m_mounted_code(false) {
|
||||
m_result = this->Initialize(loc);
|
||||
ScopedCodeMount::ScopedCodeMount(const ncm::ProgramLocation &loc, const cfg::OverrideStatus &o, PlatformId platform) : m_lk(g_scoped_code_mount_lock), m_override_status(o), m_has_status(true), m_mounted_ams(false), m_mounted_sd_or_code(false), m_mounted_code(false) {
|
||||
m_result = this->Initialize(loc, platform);
|
||||
}
|
||||
|
||||
ScopedCodeMount::~ScopedCodeMount() {
|
||||
@@ -46,25 +46,28 @@ namespace ams::ldr {
|
||||
}
|
||||
}
|
||||
|
||||
Result ScopedCodeMount::Initialize(const ncm::ProgramLocation &loc) {
|
||||
Result ScopedCodeMount::Initialize(const ncm::ProgramLocation &loc, PlatformId platform) {
|
||||
/* Capture override status, if necessary. */
|
||||
this->EnsureOverrideStatus(loc);
|
||||
AMS_ABORT_UNLESS(m_has_status);
|
||||
|
||||
/* Get the content path. */
|
||||
char content_path[fs::EntryNameLengthMax + 1];
|
||||
R_TRY(GetProgramPath(content_path, sizeof(content_path), loc));
|
||||
R_TRY(GetProgramPath(content_path, sizeof(content_path), loc, platform));
|
||||
|
||||
/* Get the content attributes. */
|
||||
const auto content_attributes = GetPlatformContentAttributes(platform);
|
||||
|
||||
/* Mount the atmosphere code file system. */
|
||||
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()));
|
||||
R_TRY(fs::MountCodeForAtmosphereWithRedirection(std::addressof(m_ams_code_verification_data), AtmosphereCodeMountName, content_path, content_attributes, 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, fs::ContentAttributes_None, loc.program_id));
|
||||
R_TRY(fs::MountCodeForAtmosphere(std::addressof(m_sd_or_base_code_verification_data), SdOrCodeMountName, content_path, content_attributes, 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, fs::ContentAttributes_None, loc.program_id))) {
|
||||
if (R_SUCCEEDED(fs::MountCode(std::addressof(m_base_code_verification_data), CodeMountName, content_path, content_attributes, loc.program_id))) {
|
||||
m_mounted_code = true;
|
||||
}
|
||||
|
||||
@@ -80,7 +83,7 @@ namespace ams::ldr {
|
||||
}
|
||||
|
||||
/* Redirection API. */
|
||||
Result GetProgramPath(char *out_path, size_t out_size, const ncm::ProgramLocation &loc) {
|
||||
Result GetProgramPath(char *out_path, size_t out_size, const ncm::ProgramLocation &loc, PlatformId platform) {
|
||||
/* Check for storage id none. */
|
||||
if (static_cast<ncm::StorageId>(loc.storage_id) == ncm::StorageId::None) {
|
||||
std::memset(out_path, 0, out_size);
|
||||
@@ -88,6 +91,10 @@ namespace ams::ldr {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
/* Get the content attributes. */
|
||||
const auto content_attributes = GetPlatformContentAttributes(platform);
|
||||
AMS_UNUSED(content_attributes);
|
||||
|
||||
lr::Path path;
|
||||
|
||||
/* Check that path registration is allowable. */
|
||||
@@ -159,4 +166,12 @@ namespace ams::ldr {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
fs::ContentAttributes GetPlatformContentAttributes(PlatformId platform) {
|
||||
switch (platform) {
|
||||
case PlatformId_Nx:
|
||||
return fs::ContentAttributes_None;
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user