From 9d4cb685a7844d5b3496712f33fe6a713e32b5e3 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 11 Oct 2023 12:45:11 -0700 Subject: [PATCH] fs: update OpenCodeFileSystem abi for 17.0.0 --- .../fssrv/fssrv_file_system_proxy_impl.hpp | 10 ++++++++-- .../sf/fssrv_sf_i_file_system_proxy_for_loader.hpp | 5 +++-- libraries/libstratosphere/source/fs/fs_code.cpp | 2 +- .../fs/fs_remote_file_system_proxy_for_loader.hpp | 10 +++++++++- .../source/fssrv/fssrv_file_system_proxy_impl.cpp | 7 ++++++- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_file_system_proxy_impl.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_file_system_proxy_impl.hpp index 0ddba8f7c..64d43c1d2 100644 --- a/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_file_system_proxy_impl.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_file_system_proxy_impl.hpp @@ -147,7 +147,8 @@ namespace ams::fssrv { /* fsp-ldr */ Result OpenCodeFileSystemDeprecated(ams::sf::Out> out_fs, const fssrv::sf::Path &path, ncm::ProgramId program_id); Result OpenCodeFileSystemDeprecated2(ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, ncm::ProgramId program_id); - Result OpenCodeFileSystem(ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id); + Result OpenCodeFileSystemDeprecated3(ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id); + Result OpenCodeFileSystem(ams::sf::Out> out_fs, const ams::sf::OutBuffer &out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id); Result IsArchivedProgram(ams::sf::Out out, u64 process_id); }; static_assert(sf::IsIFileSystemProxy); @@ -166,7 +167,12 @@ namespace ams::fssrv { R_THROW(fs::ResultPortAcceptableCountLimited()); } - Result OpenCodeFileSystem(ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id) { + Result OpenCodeFileSystemDeprecated3(ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id) { + AMS_UNUSED(out_fs, out_verif, path, attr, program_id); + R_THROW(fs::ResultPortAcceptableCountLimited()); + } + + Result OpenCodeFileSystem(ams::sf::Out> out_fs, const ams::sf::OutBuffer &out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id) { AMS_UNUSED(out_fs, out_verif, path, attr, program_id); R_THROW(fs::ResultPortAcceptableCountLimited()); } diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_i_file_system_proxy_for_loader.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_i_file_system_proxy_for_loader.hpp index 4ba1f0a8f..fef147445 100644 --- a/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_i_file_system_proxy_for_loader.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_i_file_system_proxy_for_loader.hpp @@ -20,11 +20,12 @@ #include #include -/* ACCURATE_TO_VERSION: 13.4.0.0 */ +/* ACCURATE_TO_VERSION: 17.5.0.0 */ #define AMS_FSSRV_I_FILE_SYSTEM_PROXY_FOR_LOADER_INTERFACE_INFO(C, H) \ AMS_SF_METHOD_INFO(C, H, 0, Result, OpenCodeFileSystemDeprecated, (ams::sf::Out> out_fs, const fssrv::sf::Path &path, ncm::ProgramId program_id), (out_fs, path, program_id), hos::Version_Min, hos::Version_9_2_0) \ AMS_SF_METHOD_INFO(C, H, 0, Result, OpenCodeFileSystemDeprecated2, (ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, ncm::ProgramId program_id), (out_fs, out_verif, path, program_id), hos::Version_10_0_0, hos::Version_15_0_1) \ - AMS_SF_METHOD_INFO(C, H, 0, Result, OpenCodeFileSystem, (ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id), (out_fs, out_verif, path, attr, program_id), hos::Version_16_0_0) \ + AMS_SF_METHOD_INFO(C, H, 0, Result, OpenCodeFileSystemDeprecated3, (ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id), (out_fs, out_verif, path, attr, program_id), hos::Version_16_0_0, hos::Version_16_0_3) \ + AMS_SF_METHOD_INFO(C, H, 0, Result, OpenCodeFileSystem, (ams::sf::Out> out_fs, const ams::sf::OutBuffer &out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id), (out_fs, out_verif, path, attr, program_id), hos::Version_17_0_0) \ AMS_SF_METHOD_INFO(C, H, 1, Result, IsArchivedProgram, (ams::sf::Out out, u64 process_id), (out, process_id)) \ AMS_SF_METHOD_INFO(C, H, 2, Result, SetCurrentProcess, (const ams::sf::ClientProcessId &client_pid), (client_pid), hos::Version_4_0_0) diff --git a/libraries/libstratosphere/source/fs/fs_code.cpp b/libraries/libstratosphere/source/fs/fs_code.cpp index 23fa37a13..a8015cd6a 100644 --- a/libraries/libstratosphere/source/fs/fs_code.cpp +++ b/libraries/libstratosphere/source/fs/fs_code.cpp @@ -79,7 +79,7 @@ namespace ams::fs { R_TRY(fsp->SetCurrentProcess({})); sf::SharedPointer fs; - R_TRY(fsp->OpenCodeFileSystem(std::addressof(fs), out_verification_data, sf_path, attr, program_id)); + R_TRY(fsp->OpenCodeFileSystem(std::addressof(fs), ams::sf::OutBuffer(out_verification_data, sizeof(*out_verification_data)), sf_path, attr, program_id)); /* Allocate a new filesystem wrapper. */ auto fsa = std::make_unique(std::move(fs)); diff --git a/libraries/libstratosphere/source/fs/fs_remote_file_system_proxy_for_loader.hpp b/libraries/libstratosphere/source/fs/fs_remote_file_system_proxy_for_loader.hpp index fff9ba88c..71edaeb4f 100644 --- a/libraries/libstratosphere/source/fs/fs_remote_file_system_proxy_for_loader.hpp +++ b/libraries/libstratosphere/source/fs/fs_remote_file_system_proxy_for_loader.hpp @@ -47,7 +47,15 @@ namespace ams::fs { R_SUCCEED(); } - Result OpenCodeFileSystem(ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id) { + Result OpenCodeFileSystemDeprecated3(ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id) { + ::FsFileSystem fs; + R_TRY(fsldrOpenCodeFileSystem(reinterpret_cast<::FsCodeInfo *>(out_verif.GetPointer()), program_id.value, path.str, static_cast<::FsContentAttributes>(static_cast(attr)), std::addressof(fs))); + + out_fs.SetValue(ObjectFactory::CreateSharedEmplaced(fs)); + R_SUCCEED(); + } + + Result OpenCodeFileSystem(ams::sf::Out> out_fs, const ams::sf::OutBuffer &out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id) { ::FsFileSystem fs; R_TRY(fsldrOpenCodeFileSystem(reinterpret_cast<::FsCodeInfo *>(out_verif.GetPointer()), program_id.value, path.str, static_cast<::FsContentAttributes>(static_cast(attr)), std::addressof(fs))); diff --git a/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_impl.cpp b/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_impl.cpp index 75b7b7276..c3336bfb7 100644 --- a/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_impl.cpp +++ b/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_impl.cpp @@ -465,7 +465,12 @@ namespace ams::fssrv { AMS_UNUSED(out_fs, out_verif, path, program_id); } - Result FileSystemProxyImpl::OpenCodeFileSystem(ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id) { + Result FileSystemProxyImpl::OpenCodeFileSystemDeprecated3(ams::sf::Out> out_fs, ams::sf::Out out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id) { + AMS_ABORT("TODO"); + AMS_UNUSED(out_fs, out_verif, path, attr, program_id); + } + + Result FileSystemProxyImpl::OpenCodeFileSystem(ams::sf::Out> out_fs, const ams::sf::OutBuffer &out_verif, const fssrv::sf::Path &path, fs::ContentAttributes attr, ncm::ProgramId program_id) { AMS_ABORT("TODO"); AMS_UNUSED(out_fs, out_verif, path, attr, program_id); }