From b1a9e8d0df583b5157fa376b4a91d4fa5979a2df Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 28 Nov 2019 22:19:39 -0800 Subject: [PATCH] compat fixes for libnx master --- stratosphere/dmnt/source/dmnt_service.hpp | 6 +++--- .../dmnt/source/dmnt_service_target_io.cpp | 8 ++++---- .../stratosphere/fs/fs_remote_filesystem.hpp | 14 +++++++------- .../include/stratosphere/fs/fs_remote_storage.hpp | 2 +- .../include/stratosphere/fs/fsa/fs_ifilesystem.hpp | 8 ++++---- .../libstratosphere/source/util/util_ini.cpp | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/stratosphere/dmnt/source/dmnt_service.hpp b/stratosphere/dmnt/source/dmnt_service.hpp index 62cc37587..187e79847 100644 --- a/stratosphere/dmnt/source/dmnt_service.hpp +++ b/stratosphere/dmnt/source/dmnt_service.hpp @@ -123,12 +123,12 @@ namespace ams::dmnt { Result TargetIO_FileOpen(sf::Out out_hnd, const sf::InBuffer &path, int open_mode, u32 create_mode); Result TargetIO_FileClose(TargetIOFileHandle hnd); - Result TargetIO_FileRead(TargetIOFileHandle hnd, const sf::OutNonSecureBuffer &out_data, sf::Out out_read, u64 offset); - Result TargetIO_FileWrite(TargetIOFileHandle hnd, const sf::InNonSecureBuffer &data, sf::Out out_written, u64 offset); + Result TargetIO_FileRead(TargetIOFileHandle hnd, const sf::OutNonSecureBuffer &out_data, sf::Out out_read, s64 offset); + Result TargetIO_FileWrite(TargetIOFileHandle hnd, const sf::InNonSecureBuffer &data, sf::Out out_written, s64 offset); Result TargetIO_FileSetAttributes(const sf::InBuffer &path, const sf::InBuffer &attributes); Result TargetIO_FileGetInformation(const sf::InBuffer &path, const sf::OutArray &out_info, sf::Out is_directory); Result TargetIO_FileSetTime(const sf::InBuffer &path, u64 create, u64 access, u64 modify); - Result TargetIO_FileSetSize(const sf::InBuffer &input, u64 size); + Result TargetIO_FileSetSize(const sf::InBuffer &input, s64 size); Result TargetIO_FileDelete(const sf::InBuffer &path); Result TargetIO_FileMove(const sf::InBuffer &src_path, const sf::InBuffer &dst_path); public: diff --git a/stratosphere/dmnt/source/dmnt_service_target_io.cpp b/stratosphere/dmnt/source/dmnt_service_target_io.cpp index 39eff9441..273a103d4 100644 --- a/stratosphere/dmnt/source/dmnt_service_target_io.cpp +++ b/stratosphere/dmnt/source/dmnt_service_target_io.cpp @@ -153,7 +153,7 @@ namespace ams::dmnt { return CloseFileByHandle(hnd); } - Result DebugMonitorService::TargetIO_FileRead(TargetIOFileHandle hnd, const sf::OutNonSecureBuffer &out_data, sf::Out out_read, u64 offset) { + Result DebugMonitorService::TargetIO_FileRead(TargetIOFileHandle hnd, const sf::OutNonSecureBuffer &out_data, sf::Out out_read, s64 offset) { FsFile f; size_t read = 0; @@ -164,7 +164,7 @@ namespace ams::dmnt { return ResultSuccess(); } - Result DebugMonitorService::TargetIO_FileWrite(TargetIOFileHandle hnd, const sf::InNonSecureBuffer &data, sf::Out out_written, u64 offset) { + Result DebugMonitorService::TargetIO_FileWrite(TargetIOFileHandle hnd, const sf::InNonSecureBuffer &data, sf::Out out_written, s64 offset) { FsFile f; R_TRY(GetFileByHandle(&f, hnd)); @@ -197,7 +197,7 @@ namespace ams::dmnt { /* N doesn't check this return code. */ if (out_info.GetSize() > 0) { - fsFileGetSize(&f, &out_info[0]); + fsFileGetSize(&f, reinterpret_cast(&out_info[0])); } /* TODO: N does not call fsFsGetFileTimestampRaw here, but we possibly could. */ @@ -216,7 +216,7 @@ namespace ams::dmnt { return ResultSuccess(); } - Result DebugMonitorService::TargetIO_FileSetSize(const sf::InBuffer &input, u64 size) { + Result DebugMonitorService::TargetIO_FileSetSize(const sf::InBuffer &input, s64 size) { /* Why does this function take in a path and not a file handle? */ R_TRY(EnsureSdInitialized()); diff --git a/stratosphere/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp b/stratosphere/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp index 8aaee50f9..d797d44a5 100644 --- a/stratosphere/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp @@ -38,7 +38,7 @@ namespace ams::fs { } virtual Result GetSizeImpl(s64 *out) override final { - return fsFileGetSize(this->base_file.get(), reinterpret_cast(out)); + return fsFileGetSize(this->base_file.get(), out); } virtual Result FlushImpl() override final { @@ -72,11 +72,11 @@ namespace ams::fs { virtual ~RemoteDirectory() { fsDirClose(this->base_dir.get()); } public: virtual Result ReadImpl(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) override final { - return fsDirRead(this->base_dir.get(), 0, reinterpret_cast(out_count), max_entries, out_entries); + return fsDirRead(this->base_dir.get(), out_count, max_entries, out_entries); } virtual Result GetEntryCountImpl(s64 *out) override final { - return fsDirGetEntryCount(this->base_dir.get(), reinterpret_cast(out)); + return fsDirGetEntryCount(this->base_dir.get(), out); } }; @@ -147,11 +147,11 @@ namespace ams::fs { virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) { - return fsFsGetFreeSpace(this->base_fs.get(), path, reinterpret_cast(out)); + return fsFsGetFreeSpace(this->base_fs.get(), path, out); } virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) { - return fsFsGetTotalSpace(this->base_fs.get(), path, reinterpret_cast(out)); + return fsFsGetTotalSpace(this->base_fs.get(), path, out); } virtual Result CleanDirectoryRecursivelyImpl(const char *path) { @@ -163,8 +163,8 @@ namespace ams::fs { return fsFsGetFileTimeStampRaw(this->base_fs.get(), path, reinterpret_cast<::FsTimeStampRaw *>(out)); } - virtual Result QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, fsa::QueryType query, const char *path) { - return fsFsQueryEntry(this->base_fs.get(), dst, dst_size, src, src_size, path, static_cast(query)); + virtual Result QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, fsa::QueryId query, const char *path) { + return fsFsQueryEntry(this->base_fs.get(), dst, dst_size, src, src_size, path, static_cast(query)); } }; diff --git a/stratosphere/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp b/stratosphere/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp index 07b08c947..2eb580f93 100644 --- a/stratosphere/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp @@ -44,7 +44,7 @@ namespace ams::fs { }; virtual Result GetSize(s64 *out_size) override { - return fsStorageGetSize(this->base_storage.get(), reinterpret_cast(out_size)); + return fsStorageGetSize(this->base_storage.get(), out_size); }; virtual Result SetSize(s64 size) override { diff --git a/stratosphere/libstratosphere/include/stratosphere/fs/fsa/fs_ifilesystem.hpp b/stratosphere/libstratosphere/include/stratosphere/fs/fsa/fs_ifilesystem.hpp index 98a7a9e4b..7d5ac04e7 100644 --- a/stratosphere/libstratosphere/include/stratosphere/fs/fsa/fs_ifilesystem.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/fs/fsa/fs_ifilesystem.hpp @@ -23,8 +23,8 @@ namespace ams::fs::fsa { class IFile; class IDirectory; - enum class QueryType { - SetArchiveBit = FsFileSystemQueryType_SetArchiveBit + enum class QueryId { + SetConcatenationFileAttribute = FsFileSystemQueryId_SetConcatenationFileAttribute }; class IFileSystem { @@ -122,7 +122,7 @@ namespace ams::fs::fsa { return this->GetFileTimeStampRawImpl(out, path); } - Result QueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, QueryType query, const char *path) { + Result QueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, QueryId query, const char *path) { R_UNLESS(path != nullptr, fs::ResultInvalidPath()); return this->QueryEntryImpl(dst, dst_size, src, src_size, query, path); } @@ -170,7 +170,7 @@ namespace ams::fs::fsa { return fs::ResultNotImplemented(); } - virtual Result QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, QueryType query, const char *path) { + virtual Result QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, QueryId query, const char *path) { return fs::ResultNotImplemented(); } diff --git a/stratosphere/libstratosphere/source/util/util_ini.cpp b/stratosphere/libstratosphere/source/util/util_ini.cpp index aac3c20b6..66f617691 100644 --- a/stratosphere/libstratosphere/source/util/util_ini.cpp +++ b/stratosphere/libstratosphere/source/util/util_ini.cpp @@ -30,7 +30,7 @@ namespace ams::util::ini { size_t num_left; explicit FsFileContext(FsFile *f) : f(f), offset(0) { - u64 size; + s64 size; R_ASSERT(fsFileGetSize(this->f, &size)); this->num_left = size_t(size); }