mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-02 23:59:49 -04:00
libs: add ongoing work to facilitate hactool rewrite
This commit is contained in:
parent
706b8492fd
commit
13697fa921
34 changed files with 1829 additions and 216 deletions
|
@ -63,7 +63,7 @@ namespace ams::fs {
|
|||
return fsFileOperateRange(std::addressof(m_base_file), static_cast<::FsOperationId>(op_id), offset, size, reinterpret_cast<::FsRangeInfo *>(dst));
|
||||
}
|
||||
public:
|
||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override {
|
||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override final {
|
||||
return sf::cmif::DomainObjectId{serviceGetObjectId(const_cast<::Service *>(std::addressof(m_base_file.s)))};
|
||||
}
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ namespace ams::fs {
|
|||
return fsDirGetEntryCount(std::addressof(m_base_dir), out);
|
||||
}
|
||||
public:
|
||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override {
|
||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override final {
|
||||
return sf::cmif::DomainObjectId{serviceGetObjectId(const_cast<::Service *>(std::addressof(m_base_dir.s)))};
|
||||
}
|
||||
};
|
||||
|
@ -202,32 +202,32 @@ namespace ams::fs {
|
|||
return fsFsCommit(std::addressof(m_base_fs));
|
||||
}
|
||||
|
||||
virtual Result DoGetFreeSpaceSize(s64 *out, const fs::Path &path) {
|
||||
virtual Result DoGetFreeSpaceSize(s64 *out, const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsGetFreeSpace(std::addressof(m_base_fs), sf_path.str, out);
|
||||
}
|
||||
|
||||
virtual Result DoGetTotalSpaceSize(s64 *out, const fs::Path &path) {
|
||||
virtual Result DoGetTotalSpaceSize(s64 *out, const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsGetTotalSpace(std::addressof(m_base_fs), sf_path.str, out);
|
||||
}
|
||||
|
||||
virtual Result DoCleanDirectoryRecursively(const fs::Path &path) {
|
||||
virtual Result DoCleanDirectoryRecursively(const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsCleanDirectoryRecursively(std::addressof(m_base_fs), sf_path.str);
|
||||
}
|
||||
|
||||
virtual Result DoGetFileTimeStampRaw(FileTimeStampRaw *out, const fs::Path &path) {
|
||||
virtual Result DoGetFileTimeStampRaw(FileTimeStampRaw *out, const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
static_assert(sizeof(FileTimeStampRaw) == sizeof(::FsTimeStampRaw));
|
||||
return fsFsGetFileTimeStampRaw(std::addressof(m_base_fs), sf_path.str, reinterpret_cast<::FsTimeStampRaw *>(out));
|
||||
}
|
||||
|
||||
virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fsa::QueryId query, const fs::Path &path) {
|
||||
virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fsa::QueryId query, const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsQueryEntry(std::addressof(m_base_fs), dst, dst_size, src, src_size, sf_path.str, static_cast<FsFileSystemQueryId>(query));
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <stratosphere/fssrv/sf/fssrv_sf_ifile.hpp>
|
||||
#include <stratosphere/fssrv/sf/fssrv_sf_i_event_notifier.hpp>
|
||||
#include <stratosphere/fssrv/impl/fssrv_impl_program_index_map_info_manager.hpp>
|
||||
#include <stratosphere/fssrv/fssrv_access_control.hpp>
|
||||
#include <stratosphere/fssrv/impl/fssrv_access_control.hpp>
|
||||
#include <stratosphere/fssrv/fssrv_nca_crypto_configuration.hpp>
|
||||
#include <stratosphere/fssrv/fssrv_memory_resource_from_standard_allocator.hpp>
|
||||
#include <stratosphere/fssrv/fssrv_memory_resource_from_exp_heap.hpp>
|
||||
|
|
|
@ -47,6 +47,11 @@ namespace ams::fssrv::fscreator {
|
|||
virtual Result Create(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, std::shared_ptr<fssystem::NcaReader> nca_reader, s32 index) override;
|
||||
virtual Result CreateWithPatch(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, std::shared_ptr<fssystem::NcaReader> original_nca_reader, std::shared_ptr<fssystem::NcaReader> current_nca_reader, s32 index) override;
|
||||
virtual Result CreateNcaReader(std::shared_ptr<fssystem::NcaReader> *out, std::shared_ptr<fs::IStorage> storage) override;
|
||||
|
||||
#if !defined(ATMOSPHERE_BOARD_NINTENDO_NX)
|
||||
Result CreateWithContext(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, void *ctx, std::shared_ptr<fssystem::NcaReader> nca_reader, s32 index);
|
||||
Result CreateWithPatchWithContext(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, void *ctx, std::shared_ptr<fssystem::NcaReader> original_nca_reader, std::shared_ptr<fssystem::NcaReader> current_nca_reader, s32 index);
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::fssrv {
|
||||
|
||||
void SetDebugFlagEnabled(bool en);
|
||||
|
||||
}
|
|
@ -0,0 +1,251 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/ncm/ncm_ids.hpp>
|
||||
#include <stratosphere/fs/impl/fs_newable.hpp>
|
||||
#include <stratosphere/fssrv/impl/fssrv_access_control_bits.hpp>
|
||||
|
||||
namespace ams::fssrv {
|
||||
|
||||
bool IsDebugFlagEnabled();
|
||||
void SetDebugFlagEnabled(bool en);
|
||||
|
||||
}
|
||||
|
||||
namespace ams::fssrv::impl {
|
||||
|
||||
struct Accessibility {
|
||||
u8 value;
|
||||
|
||||
constexpr bool CanRead() const { return value & (1 << 0); }
|
||||
constexpr bool CanWrite() const { return value & (1 << 1); }
|
||||
|
||||
static constexpr Accessibility MakeAccessibility(bool read, bool write) {
|
||||
return { static_cast<u8>(read * (1 << 0) + write * (1 << 1)) };
|
||||
}
|
||||
};
|
||||
static_assert(std::is_trivial<Accessibility>::value);
|
||||
|
||||
class ContentOwnerInfo : public util::IntrusiveListBaseNode<ContentOwnerInfo>, public ::ams::fs::impl::Newable {
|
||||
private:
|
||||
u64 m_id;
|
||||
public:
|
||||
ContentOwnerInfo(u64 id) : m_id(id) { /* ... */ }
|
||||
|
||||
u64 GetId() const { return m_id; }
|
||||
};
|
||||
|
||||
class SaveDataOwnerInfo : public util::IntrusiveListBaseNode<SaveDataOwnerInfo>, public ::ams::fs::impl::Newable {
|
||||
private:
|
||||
u64 m_id;
|
||||
Accessibility m_accessibility;
|
||||
public:
|
||||
SaveDataOwnerInfo(u64 id, Accessibility access) : m_id(id), m_accessibility(access) { /* ... */ }
|
||||
|
||||
u64 GetId() const { return m_id; }
|
||||
Accessibility GetAccessibility() const { return m_accessibility; }
|
||||
};
|
||||
|
||||
class AccessControl {
|
||||
public:
|
||||
enum class AccessibilityType : u32 {
|
||||
MountLogo,
|
||||
MountContentMeta,
|
||||
MountContentControl,
|
||||
MountContentManual,
|
||||
MountContentData,
|
||||
MountApplicationPackage,
|
||||
MountSaveDataStorage,
|
||||
MountContentStorage,
|
||||
MountImageAndVideoStorage,
|
||||
MountCloudBackupWorkStorage,
|
||||
MountCustomStorage,
|
||||
MountBisCalibrationFile,
|
||||
MountBisSafeMode,
|
||||
MountBisUser,
|
||||
MountBisSystem,
|
||||
MountBisSystemProperEncryption,
|
||||
MountBisSystemProperPartition,
|
||||
MountSdCard,
|
||||
MountGameCard,
|
||||
MountDeviceSaveData,
|
||||
MountSystemSaveData,
|
||||
MountOthersSaveData,
|
||||
MountOthersSystemSaveData,
|
||||
OpenBisPartitionBootPartition1Root,
|
||||
OpenBisPartitionBootPartition2Root,
|
||||
OpenBisPartitionUserDataRoot,
|
||||
OpenBisPartitionBootConfigAndPackage2Part1,
|
||||
OpenBisPartitionBootConfigAndPackage2Part2,
|
||||
OpenBisPartitionBootConfigAndPackage2Part3,
|
||||
OpenBisPartitionBootConfigAndPackage2Part4,
|
||||
OpenBisPartitionBootConfigAndPackage2Part5,
|
||||
OpenBisPartitionBootConfigAndPackage2Part6,
|
||||
OpenBisPartitionCalibrationBinary,
|
||||
OpenBisPartitionCalibrationFile,
|
||||
OpenBisPartitionSafeMode,
|
||||
OpenBisPartitionUser,
|
||||
OpenBisPartitionSystem,
|
||||
OpenBisPartitionSystemProperEncryption,
|
||||
OpenBisPartitionSystemProperPartition,
|
||||
OpenSdCardStorage,
|
||||
OpenGameCardStorage,
|
||||
MountSystemDataPrivate,
|
||||
MountHost,
|
||||
MountRegisteredUpdatePartition,
|
||||
MountSaveDataInternalStorage,
|
||||
MountTemporaryDirectory,
|
||||
MountAllBaseFileSystem,
|
||||
NotMount,
|
||||
|
||||
Count,
|
||||
};
|
||||
|
||||
enum class OperationType : u32 {
|
||||
InvalidateBisCache,
|
||||
EraseMmc,
|
||||
GetGameCardDeviceCertificate,
|
||||
GetGameCardIdSet,
|
||||
FinalizeGameCardDriver,
|
||||
GetGameCardAsicInfo,
|
||||
CreateSaveData,
|
||||
DeleteSaveData,
|
||||
CreateSystemSaveData,
|
||||
CreateOthersSystemSaveData,
|
||||
DeleteSystemSaveData,
|
||||
OpenSaveDataInfoReader,
|
||||
OpenSaveDataInfoReaderForSystem,
|
||||
OpenSaveDataInfoReaderForInternal,
|
||||
OpenSaveDataMetaFile,
|
||||
SetCurrentPosixTime,
|
||||
ReadSaveDataFileSystemExtraData,
|
||||
SetGlobalAccessLogMode,
|
||||
SetSpeedEmulationMode,
|
||||
Debug,
|
||||
FillBis,
|
||||
CorruptSaveData,
|
||||
CorruptSystemSaveData,
|
||||
VerifySaveData,
|
||||
DebugSaveData,
|
||||
FormatSdCard,
|
||||
GetRightsId,
|
||||
RegisterExternalKey,
|
||||
SetEncryptionSeed,
|
||||
WriteSaveDataFileSystemExtraDataTimeStamp,
|
||||
WriteSaveDataFileSystemExtraDataFlags,
|
||||
WriteSaveDataFileSystemExtraDataCommitId,
|
||||
WriteSaveDataFileSystemExtraDataAll,
|
||||
ExtendSaveData,
|
||||
ExtendSystemSaveData,
|
||||
ExtendOthersSystemSaveData,
|
||||
RegisterUpdatePartition,
|
||||
OpenSaveDataTransferManager,
|
||||
OpenSaveDataTransferManagerVersion2,
|
||||
OpenSaveDataTransferManagerForSaveDataRepair,
|
||||
OpenSaveDataTransferManagerForSaveDataRepairTool,
|
||||
OpenSaveDataTransferProhibiter,
|
||||
OpenSaveDataMover,
|
||||
OpenBisWiper,
|
||||
ListAccessibleSaveDataOwnerId,
|
||||
ControlMmcPatrol,
|
||||
OverrideSaveDataTransferTokenSignVerificationKey,
|
||||
OpenSdCardDetectionEventNotifier,
|
||||
OpenGameCardDetectionEventNotifier,
|
||||
OpenSystemDataUpdateEventNotifier,
|
||||
NotifySystemDataUpdateEvent,
|
||||
OpenAccessFailureDetectionEventNotifier,
|
||||
GetAccessFailureDetectionEvent,
|
||||
IsAccessFailureDetected,
|
||||
ResolveAccessFailure,
|
||||
AbandonAccessFailure,
|
||||
QuerySaveDataInternalStorageTotalSize,
|
||||
GetSaveDataCommitId,
|
||||
SetSdCardAccessibility,
|
||||
SimulateDevice,
|
||||
CreateSaveDataWithHashSalt,
|
||||
RegisterProgramIndexMapInfo,
|
||||
ChallengeCardExistence,
|
||||
CreateOwnSaveData,
|
||||
DeleteOwnSaveData,
|
||||
ReadOwnSaveDataFileSystemExtraData,
|
||||
ExtendOwnSaveData,
|
||||
OpenOwnSaveDataTransferProhibiter,
|
||||
FindOwnSaveDataWithFilter,
|
||||
OpenSaveDataTransferManagerForRepair,
|
||||
SetDebugConfiguration,
|
||||
OpenDataStorageByPath,
|
||||
|
||||
Count,
|
||||
};
|
||||
|
||||
AMS_PRAGMA_BEGIN_PACK(4)
|
||||
struct AccessControlDataHeader {
|
||||
u8 version;
|
||||
u8 reserved[3];
|
||||
u64 flag_bits;
|
||||
u32 content_owner_infos_offset;
|
||||
u32 content_owner_infos_size;
|
||||
u32 save_data_owner_infos_offset;
|
||||
u32 save_data_owner_infos_size;
|
||||
};
|
||||
|
||||
struct AccessControlDescriptor {
|
||||
u8 version;
|
||||
u8 content_owner_id_count;
|
||||
u8 save_data_owner_id_count;
|
||||
u8 reserved;
|
||||
u64 flag_bits;
|
||||
u64 content_owner_id_min;
|
||||
u64 content_owner_id_max;
|
||||
u64 save_data_owner_id_min;
|
||||
u64 save_data_owner_id_max;
|
||||
/* ... */
|
||||
};
|
||||
AMS_PRAGMA_END_PACK()
|
||||
|
||||
static_assert(util::is_pod<AccessControlDataHeader>::value);
|
||||
static_assert(util::is_pod<AccessControlDescriptor>::value);
|
||||
|
||||
static constexpr u64 AllFlagBitsMask = ~static_cast<u64>(0);
|
||||
static constexpr u64 DebugFlagDisableMask = AllFlagBitsMask & ~util::ToUnderlying(AccessControlBits::Bits::Debug);
|
||||
private:
|
||||
using ContentOwnerInfoList = util::IntrusiveListBaseTraits<ContentOwnerInfo>::ListType;
|
||||
using SaveDataOwnerInfoList = util::IntrusiveListBaseTraits<SaveDataOwnerInfo>::ListType;
|
||||
private:
|
||||
util::optional<AccessControlBits> m_flag_bits;
|
||||
ContentOwnerInfoList m_content_owner_infos;
|
||||
SaveDataOwnerInfoList m_save_data_owner_infos;
|
||||
public:
|
||||
AccessControl(const void *data, s64 data_size, const void *desc, s64 desc_size);
|
||||
AccessControl(const void *data, s64 data_size, const void *desc, s64 desc_size, u64 flag_mask);
|
||||
~AccessControl();
|
||||
public:
|
||||
bool HasContentOwnerId(u64 owner_id) const;
|
||||
Accessibility GetAccessibilitySaveDataOwnedBy(u64 owner_id) const;
|
||||
|
||||
void ListContentOwnerId(s32 *out_count, u64 *out_owner_ids, s32 offset, s32 count) const;
|
||||
void ListSaveDataOwnedId(s32 *out_count, ncm::ApplicationId *out_owner_ids, s32 offset, s32 count) const;
|
||||
|
||||
Accessibility GetAccessibilityFor(AccessibilityType type) const;
|
||||
bool CanCall(OperationType type) const;
|
||||
public:
|
||||
u64 GetRawFlagBits() const {
|
||||
return m_flag_bits.value().GetValue();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,252 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/ncm/ncm_ids.hpp>
|
||||
#include <stratosphere/fs/impl/fs_newable.hpp>
|
||||
#include <stratosphere/fssrv/impl/fssrv_access_control_bits.hpp>
|
||||
|
||||
namespace ams::fssrv::impl {
|
||||
|
||||
#define AMS_FSSRV_FOR_EACH_ACCESS_CONTROL_CAPABILITY(HANDLER, _NS_) \
|
||||
HANDLER(CanAbandonAccessFailure, _NS_::AccessFailureResolution) \
|
||||
HANDLER(CanChallengeCardExistence, _NS_::GameCard) \
|
||||
HANDLER(CanControlMmcPatrol, _NS_::None) \
|
||||
HANDLER(CanCorruptSaveData, _NS_::Debug, _NS_::CorruptSaveData) \
|
||||
HANDLER(CanCorruptSystemSaveData, _NS_::CorruptSaveData, _NS_::SaveDataManagement, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanCreateOthersSystemSaveData, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanCreateOwnSaveData, _NS_::CreateOwnSaveData) \
|
||||
HANDLER(CanCreateSaveData, _NS_::CreateSaveData, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanCreateSaveDataWithHashSalt, _NS_::None) \
|
||||
HANDLER(CanCreateSystemSaveData, _NS_::SaveDataBackUp, _NS_::SystemSaveData) \
|
||||
HANDLER(CanDebugSaveData, _NS_::Debug, _NS_::SaveDataForDebug) \
|
||||
HANDLER(CanDeleteOwnSaveData, _NS_::CreateOwnSaveData) \
|
||||
HANDLER(CanDeleteSaveData, _NS_::SaveDataManagement, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanDeleteSystemSaveData, _NS_::SystemSaveDataManagement, _NS_::SaveDataBackUp, _NS_::SystemSaveData) \
|
||||
HANDLER(CanEraseMmc, _NS_::BisAllRaw) \
|
||||
HANDLER(CanExtendOthersSystemSaveData, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanExtendOwnSaveData, _NS_::CreateOwnSaveData) \
|
||||
HANDLER(CanExtendSaveData, _NS_::CreateSaveData, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanExtendSystemSaveData, _NS_::SaveDataBackUp, _NS_::SystemSaveData) \
|
||||
HANDLER(CanFillBis, _NS_::Debug, _NS_::FillBis) \
|
||||
HANDLER(CanFinalizeGameCardDriver, _NS_::GameCardPrivate) \
|
||||
HANDLER(CanFindOwnSaveDataWithFilter, _NS_::CreateOwnSaveData) \
|
||||
HANDLER(CanFormatSdCard, _NS_::FormatSdCard) \
|
||||
HANDLER(CanGetAccessFailureDetectionEvent, _NS_::AccessFailureResolution) \
|
||||
HANDLER(CanGetGameCardAsicInfo, _NS_::GameCardPrivate) \
|
||||
HANDLER(CanGetGameCardDeviceCertificate, _NS_::GameCard) \
|
||||
HANDLER(CanGetGameCardIdSet, _NS_::GameCard) \
|
||||
HANDLER(CanGetRightsId, _NS_::GetRightsId) \
|
||||
HANDLER(CanGetSaveDataCommitId, _NS_::SaveDataTransferVersion2, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanInvalidateBisCache, _NS_::BisAllRaw) \
|
||||
HANDLER(CanIsAccessFailureDetected, _NS_::AccessFailureResolution) \
|
||||
HANDLER(CanListAccessibleSaveDataOwnerId, _NS_::SaveDataTransferVersion2, _NS_::SaveDataTransfer, _NS_::CreateSaveData) \
|
||||
HANDLER(CanMountAllBaseFileSystemRead, _NS_::None) \
|
||||
HANDLER(CanMountAllBaseFileSystemWrite, _NS_::None) \
|
||||
HANDLER(CanMountApplicationPackageRead, _NS_::ContentManager, _NS_::ApplicationInfo) \
|
||||
HANDLER(CanMountBisCalibrationFileRead, _NS_::BisAllRaw, _NS_::Calibration) \
|
||||
HANDLER(CanMountBisCalibrationFileWrite, _NS_::BisAllRaw, _NS_::Calibration) \
|
||||
HANDLER(CanMountBisSafeModeRead, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountBisSafeModeWrite, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountBisSystemProperEncryptionRead, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountBisSystemProperEncryptionWrite, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountBisSystemProperPartitionRead, _NS_::BisFileSystem, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountBisSystemProperPartitionWrite, _NS_::BisFileSystem, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountBisSystemRead, _NS_::BisFileSystem, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountBisSystemWrite, _NS_::BisFileSystem, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountBisUserRead, _NS_::BisFileSystem, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountBisUserWrite, _NS_::BisFileSystem, _NS_::BisAllRaw) \
|
||||
HANDLER(CanMountCloudBackupWorkStorageRead, _NS_::SaveDataTransferVersion2) \
|
||||
HANDLER(CanMountCloudBackupWorkStorageWrite, _NS_::SaveDataTransferVersion2) \
|
||||
HANDLER(CanMountContentControlRead, _NS_::ContentManager, _NS_::ApplicationInfo) \
|
||||
HANDLER(CanMountContentDataRead, _NS_::ContentManager, _NS_::ApplicationInfo) \
|
||||
HANDLER(CanMountContentManualRead, _NS_::ContentManager, _NS_::ApplicationInfo) \
|
||||
HANDLER(CanMountContentMetaRead, _NS_::ContentManager, _NS_::ApplicationInfo) \
|
||||
HANDLER(CanMountContentStorageRead, _NS_::ContentManager) \
|
||||
HANDLER(CanMountContentStorageWrite, _NS_::ContentManager) \
|
||||
HANDLER(CanMountCustomStorage0Read, _NS_::None) \
|
||||
HANDLER(CanMountCustomStorage0Write, _NS_::None) \
|
||||
HANDLER(CanMountDeviceSaveDataRead, _NS_::DeviceSaveData, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanMountDeviceSaveDataWrite, _NS_::DeviceSaveData, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanMountGameCardRead, _NS_::GameCard) \
|
||||
HANDLER(CanMountHostRead, _NS_::Debug, _NS_::Host) \
|
||||
HANDLER(CanMountHostWrite, _NS_::Debug, _NS_::Host) \
|
||||
HANDLER(CanMountImageAndVideoStorageRead, _NS_::ImageManager) \
|
||||
HANDLER(CanMountImageAndVideoStorageWrite, _NS_::ImageManager) \
|
||||
HANDLER(CanMountLogoRead, _NS_::ContentManager, _NS_::ApplicationInfo) \
|
||||
HANDLER(CanMountOthersSaveDataRead, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanMountOthersSaveDataWrite, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanMountOthersSystemSaveDataRead, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanMountOthersSystemSaveDataWrite, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanMountRegisteredUpdatePartitionRead, _NS_::SystemUpdate) \
|
||||
HANDLER(CanMountSaveDataStorageRead, _NS_::None) \
|
||||
HANDLER(CanMountSaveDataStorageWrite, _NS_::None) \
|
||||
HANDLER(CanMountSdCardRead, _NS_::Debug, _NS_::SdCard) \
|
||||
HANDLER(CanMountSdCardWrite, _NS_::Debug, _NS_::SdCard) \
|
||||
HANDLER(CanMountSystemDataPrivateRead, _NS_::SystemData, _NS_::SystemSaveData) \
|
||||
HANDLER(CanMountSystemSaveDataRead, _NS_::SaveDataBackUp, _NS_::SystemSaveData) \
|
||||
HANDLER(CanMountSystemSaveDataWrite, _NS_::SaveDataBackUp, _NS_::SystemSaveData) \
|
||||
HANDLER(CanMountTemporaryDirectoryRead, _NS_::Debug) \
|
||||
HANDLER(CanMountTemporaryDirectoryWrite, _NS_::Debug) \
|
||||
HANDLER(CanNotifySystemDataUpdateEvent, _NS_::SystemUpdate) \
|
||||
HANDLER(CanOpenAccessFailureDetectionEventNotifier, _NS_::AccessFailureResolution) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part1Read, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part1Write, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part2Read, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part2Write, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part3Read, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part3Write, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part4Read, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part4Write, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part5Read, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part5Write, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part6Read, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootConfigAndPackage2Part6Write, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootPartition1RootRead, _NS_::SystemUpdate, _NS_::BisAllRaw, _NS_::BootModeControl) \
|
||||
HANDLER(CanOpenBisPartitionBootPartition1RootWrite, _NS_::SystemUpdate, _NS_::BisAllRaw, _NS_::BootModeControl) \
|
||||
HANDLER(CanOpenBisPartitionBootPartition2RootRead, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionBootPartition2RootWrite, _NS_::SystemUpdate, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionCalibrationBinaryRead, _NS_::BisAllRaw, _NS_::Calibration) \
|
||||
HANDLER(CanOpenBisPartitionCalibrationBinaryWrite, _NS_::BisAllRaw, _NS_::Calibration) \
|
||||
HANDLER(CanOpenBisPartitionCalibrationFileRead, _NS_::BisAllRaw, _NS_::Calibration) \
|
||||
HANDLER(CanOpenBisPartitionCalibrationFileWrite, _NS_::BisAllRaw, _NS_::Calibration) \
|
||||
HANDLER(CanOpenBisPartitionSafeModeRead, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionSafeModeWrite, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionSystemProperEncryptionRead, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionSystemProperEncryptionWrite, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionSystemProperPartitionRead, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionSystemProperPartitionWrite, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionSystemRead, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionSystemWrite, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionUserDataRootRead, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionUserDataRootWrite, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionUserRead, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisPartitionUserWrite, _NS_::BisAllRaw) \
|
||||
HANDLER(CanOpenBisWiper, _NS_::ContentManager) \
|
||||
HANDLER(CanOpenDataStorageByPath, _NS_::None) \
|
||||
HANDLER(CanOpenGameCardDetectionEventNotifier, _NS_::DeviceDetection, _NS_::GameCardRaw, _NS_::GameCard) \
|
||||
HANDLER(CanOpenGameCardStorageRead, _NS_::GameCardRaw) \
|
||||
HANDLER(CanOpenGameCardStorageWrite, _NS_::GameCardRaw) \
|
||||
HANDLER(CanOpenOwnSaveDataTransferProhibiter, _NS_::CreateOwnSaveData) \
|
||||
HANDLER(CanOpenSaveDataInfoReader, _NS_::SaveDataManagement, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanOpenSaveDataInfoReaderForInternal, _NS_::SaveDataManagement) \
|
||||
HANDLER(CanOpenSaveDataInfoReaderForSystem, _NS_::SystemSaveDataManagement, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanOpenSaveDataInternalStorageRead, _NS_::None) \
|
||||
HANDLER(CanOpenSaveDataInternalStorageWrite, _NS_::None) \
|
||||
HANDLER(CanOpenSaveDataMetaFile, _NS_::SaveDataMeta) \
|
||||
HANDLER(CanOpenSaveDataMover, _NS_::MoveCacheStorage) \
|
||||
HANDLER(CanOpenSaveDataTransferManager, _NS_::SaveDataTransfer) \
|
||||
HANDLER(CanOpenSaveDataTransferManagerForRepair, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanOpenSaveDataTransferManagerForSaveDataRepair, _NS_::SaveDataTransferVersion2) \
|
||||
HANDLER(CanOpenSaveDataTransferManagerForSaveDataRepairTool, _NS_::None) \
|
||||
HANDLER(CanOpenSaveDataTransferManagerVersion2, _NS_::SaveDataTransferVersion2) \
|
||||
HANDLER(CanOpenSaveDataTransferProhibiter, _NS_::SaveDataTransferVersion2, _NS_::CreateSaveData) \
|
||||
HANDLER(CanOpenSdCardDetectionEventNotifier, _NS_::DeviceDetection, _NS_::SdCard) \
|
||||
HANDLER(CanOpenSdCardStorageRead, _NS_::Debug, _NS_::SdCard) \
|
||||
HANDLER(CanOpenSdCardStorageWrite, _NS_::Debug, _NS_::SdCard) \
|
||||
HANDLER(CanOpenSystemDataUpdateEventNotifier, _NS_::SystemData, _NS_::SystemSaveData) \
|
||||
HANDLER(CanOverrideSaveDataTransferTokenSignVerificationKey, _NS_::None) \
|
||||
HANDLER(CanQuerySaveDataInternalStorageTotalSize, _NS_::SaveDataTransfer) \
|
||||
HANDLER(CanReadOwnSaveDataFileSystemExtraData, _NS_::CreateOwnSaveData) \
|
||||
HANDLER(CanReadSaveDataFileSystemExtraData, _NS_::SystemSaveDataManagement, _NS_::SaveDataManagement, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanRegisterExternalKey, _NS_::RegisterExternalKey) \
|
||||
HANDLER(CanRegisterProgramIndexMapInfo, _NS_::RegisterProgramIndexMapInfo) \
|
||||
HANDLER(CanRegisterUpdatePartition, _NS_::RegisterUpdatePartition) \
|
||||
HANDLER(CanResolveAccessFailure, _NS_::AccessFailureResolution) \
|
||||
HANDLER(CanSetCurrentPosixTime, _NS_::SetTime) \
|
||||
HANDLER(CanSetDebugConfiguration, _NS_::None) \
|
||||
HANDLER(CanSetEncryptionSeed, _NS_::ContentManager) \
|
||||
HANDLER(CanSetGlobalAccessLogMode, _NS_::SettingsControl) \
|
||||
HANDLER(CanSetSdCardAccessibility, _NS_::SdCard) \
|
||||
HANDLER(CanSetSpeedEmulationMode, _NS_::SettingsControl) \
|
||||
HANDLER(CanSimulateDevice, _NS_::Debug) \
|
||||
HANDLER(CanVerifySaveData, _NS_::SaveDataManagement, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanWriteSaveDataFileSystemExtraDataAll, _NS_::None) \
|
||||
HANDLER(CanWriteSaveDataFileSystemExtraDataCommitId, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanWriteSaveDataFileSystemExtraDataFlags, _NS_::SaveDataTransferVersion2, _NS_::SystemSaveDataManagement, _NS_::SaveDataBackUp) \
|
||||
HANDLER(CanWriteSaveDataFileSystemExtraDataTimeStamp, _NS_::SaveDataBackUp)
|
||||
|
||||
class AccessControlBits {
|
||||
public:
|
||||
enum class Bits : u64 {
|
||||
None = 0,
|
||||
|
||||
ApplicationInfo = UINT64_C(1) << 0,
|
||||
BootModeControl = UINT64_C(1) << 1,
|
||||
Calibration = UINT64_C(1) << 2,
|
||||
SystemSaveData = UINT64_C(1) << 3,
|
||||
GameCard = UINT64_C(1) << 4,
|
||||
SaveDataBackUp = UINT64_C(1) << 5,
|
||||
SaveDataManagement = UINT64_C(1) << 6,
|
||||
BisAllRaw = UINT64_C(1) << 7,
|
||||
GameCardRaw = UINT64_C(1) << 8,
|
||||
GameCardPrivate = UINT64_C(1) << 9,
|
||||
SetTime = UINT64_C(1) << 10,
|
||||
ContentManager = UINT64_C(1) << 11,
|
||||
ImageManager = UINT64_C(1) << 12,
|
||||
CreateSaveData = UINT64_C(1) << 13,
|
||||
SystemSaveDataManagement = UINT64_C(1) << 14,
|
||||
BisFileSystem = UINT64_C(1) << 15,
|
||||
SystemUpdate = UINT64_C(1) << 16,
|
||||
SaveDataMeta = UINT64_C(1) << 17,
|
||||
DeviceSaveData = UINT64_C(1) << 18,
|
||||
SettingsControl = UINT64_C(1) << 19,
|
||||
SystemData = UINT64_C(1) << 20,
|
||||
SdCard = UINT64_C(1) << 21,
|
||||
Host = UINT64_C(1) << 22,
|
||||
FillBis = UINT64_C(1) << 23,
|
||||
CorruptSaveData = UINT64_C(1) << 24,
|
||||
SaveDataForDebug = UINT64_C(1) << 25,
|
||||
FormatSdCard = UINT64_C(1) << 26,
|
||||
GetRightsId = UINT64_C(1) << 27,
|
||||
RegisterExternalKey = UINT64_C(1) << 28,
|
||||
RegisterUpdatePartition = UINT64_C(1) << 29,
|
||||
SaveDataTransfer = UINT64_C(1) << 30,
|
||||
DeviceDetection = UINT64_C(1) << 31,
|
||||
AccessFailureResolution = UINT64_C(1) << 32,
|
||||
SaveDataTransferVersion2 = UINT64_C(1) << 33,
|
||||
RegisterProgramIndexMapInfo = UINT64_C(1) << 34,
|
||||
CreateOwnSaveData = UINT64_C(1) << 35,
|
||||
MoveCacheStorage = UINT64_C(1) << 36,
|
||||
|
||||
Debug = UINT64_C(1) << 62,
|
||||
FullPermission = UINT64_C(1) << 63
|
||||
};
|
||||
private:
|
||||
static constexpr u64 CombineBits(Bits b) {
|
||||
return util::ToUnderlying(b);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
static constexpr u64 CombineBits(Bits b, Args... args) {
|
||||
return CombineBits(b) | CombineBits(args...);
|
||||
}
|
||||
private:
|
||||
const u64 m_value;
|
||||
public:
|
||||
constexpr AccessControlBits(u64 v) : m_value(v) { /* ... */ }
|
||||
|
||||
constexpr u64 GetValue() const { return m_value; }
|
||||
|
||||
#define DEFINE_ACCESS_GETTER(name, ...) \
|
||||
constexpr bool name() const { constexpr u64 Mask = CombineBits(Bits::FullPermission, ## __VA_ARGS__); return (m_value & Mask); }
|
||||
|
||||
AMS_FSSRV_FOR_EACH_ACCESS_CONTROL_CAPABILITY(DEFINE_ACCESS_GETTER, Bits)
|
||||
|
||||
#undef DEFINE_ACCESS_GETTER
|
||||
};
|
||||
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
#include <stratosphere/fssystem/fssystem_utility.hpp>
|
||||
#include <stratosphere/fssystem/fssystem_speed_emulation_configuration.hpp>
|
||||
#include <stratosphere/fssystem/fssystem_external_code.hpp>
|
||||
#include <stratosphere/fssystem/fssystem_forwarding_file_system.hpp>
|
||||
#include <stratosphere/fssystem/fssystem_partition_file_system.hpp>
|
||||
#include <stratosphere/fssystem/fssystem_partition_file_system_meta.hpp>
|
||||
#include <stratosphere/fssystem/fssystem_thread_priority_changer.hpp>
|
||||
|
|
|
@ -0,0 +1,175 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere/fs/fs_common.hpp>
|
||||
#include <stratosphere/fs/impl/fs_newable.hpp>
|
||||
#include <stratosphere/fs/fsa/fs_ifile.hpp>
|
||||
#include <stratosphere/fs/fsa/fs_idirectory.hpp>
|
||||
#include <stratosphere/fs/fsa/fs_ifilesystem.hpp>
|
||||
#include <stratosphere/fs/fs_query_range.hpp>
|
||||
|
||||
namespace ams::fssystem {
|
||||
|
||||
class ForwardingFile final : public ::ams::fs::fsa::IFile, public ::ams::fs::impl::Newable {
|
||||
NON_COPYABLE(ForwardingFile);
|
||||
NON_MOVEABLE(ForwardingFile);
|
||||
private:
|
||||
std::unique_ptr<fs::fsa::IFile> m_base_file;
|
||||
public:
|
||||
ForwardingFile(std::unique_ptr<fs::fsa::IFile> f) : m_base_file(std::move(f)) { /* ... */ }
|
||||
|
||||
virtual ~ForwardingFile() { /* ... */ }
|
||||
public:
|
||||
virtual Result DoRead(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override final {
|
||||
R_RETURN(m_base_file->Read(out, offset, buffer, size, option));
|
||||
}
|
||||
|
||||
virtual Result DoGetSize(s64 *out) override final {
|
||||
R_RETURN(m_base_file->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result DoFlush() override final {
|
||||
R_RETURN(m_base_file->Flush());
|
||||
}
|
||||
|
||||
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override final {
|
||||
R_RETURN(m_base_file->Write(offset, buffer, size, option));
|
||||
}
|
||||
|
||||
virtual Result DoSetSize(s64 size) override final {
|
||||
R_RETURN(m_base_file->SetSize(size));
|
||||
}
|
||||
|
||||
virtual Result DoOperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override final {
|
||||
R_RETURN(m_base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
|
||||
}
|
||||
public:
|
||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override final {
|
||||
return m_base_file->GetDomainObjectId();
|
||||
}
|
||||
};
|
||||
|
||||
class ForwardingDirectory final : public ::ams::fs::fsa::IDirectory, public ::ams::fs::impl::Newable {
|
||||
NON_COPYABLE(ForwardingDirectory);
|
||||
NON_MOVEABLE(ForwardingDirectory);
|
||||
private:
|
||||
std::unique_ptr<fs::fsa::IDirectory> m_base_dir;
|
||||
public:
|
||||
ForwardingDirectory(std::unique_ptr<fs::fsa::IDirectory> d) : m_base_dir(std::move(d)) { /* ... */ }
|
||||
|
||||
virtual ~ForwardingDirectory() { /* ... */ }
|
||||
public:
|
||||
virtual Result DoRead(s64 *out_count, fs::DirectoryEntry *out_entries, s64 max_entries) override final {
|
||||
R_RETURN(m_base_dir->Read(out_count, out_entries, max_entries));
|
||||
}
|
||||
|
||||
virtual Result DoGetEntryCount(s64 *out) override final {
|
||||
R_RETURN(m_base_dir->GetEntryCount(out));
|
||||
}
|
||||
public:
|
||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override final {
|
||||
return m_base_dir->GetDomainObjectId();
|
||||
}
|
||||
};
|
||||
|
||||
class ForwardingFileSystem final : public ::ams::fs::fsa::IFileSystem, public ::ams::fs::impl::Newable {
|
||||
NON_COPYABLE(ForwardingFileSystem);
|
||||
NON_MOVEABLE(ForwardingFileSystem);
|
||||
private:
|
||||
std::shared_ptr<fs::fsa::IFileSystem> m_base_fs;
|
||||
public:
|
||||
ForwardingFileSystem(std::shared_ptr<fs::fsa::IFileSystem> fs) : m_base_fs(std::move(fs)) { /* ... */ }
|
||||
|
||||
virtual ~ForwardingFileSystem() { /* ... */ }
|
||||
public:
|
||||
virtual Result DoCreateFile(const fs::Path &path, s64 size, int flags) override final {
|
||||
R_RETURN(m_base_fs->CreateFile(path, size, flags));
|
||||
}
|
||||
|
||||
virtual Result DoDeleteFile(const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->DeleteFile(path));
|
||||
}
|
||||
|
||||
virtual Result DoCreateDirectory(const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->CreateDirectory(path));
|
||||
}
|
||||
|
||||
virtual Result DoDeleteDirectory(const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->DeleteDirectory(path));
|
||||
}
|
||||
|
||||
virtual Result DoDeleteDirectoryRecursively(const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->DeleteDirectoryRecursively(path));
|
||||
}
|
||||
|
||||
virtual Result DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) override final {
|
||||
R_RETURN(m_base_fs->RenameFile(old_path, new_path));
|
||||
}
|
||||
|
||||
virtual Result DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) override final {
|
||||
R_RETURN(m_base_fs->RenameDirectory(old_path, new_path));
|
||||
}
|
||||
|
||||
virtual Result DoGetEntryType(fs::DirectoryEntryType *out, const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->GetEntryType(out, path));
|
||||
}
|
||||
|
||||
virtual Result DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const fs::Path &path, fs::OpenMode mode) override final {
|
||||
R_RETURN(m_base_fs->OpenFile(out_file, path, mode));
|
||||
}
|
||||
|
||||
virtual Result DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const fs::Path &path, fs::OpenDirectoryMode mode) override final {
|
||||
R_RETURN(m_base_fs->OpenDirectory(out_dir, path, mode));
|
||||
}
|
||||
|
||||
virtual Result DoCommit() override final {
|
||||
R_RETURN(m_base_fs->Commit());
|
||||
}
|
||||
|
||||
virtual Result DoGetFreeSpaceSize(s64 *out, const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->GetFreeSpaceSize(out, path));
|
||||
}
|
||||
|
||||
virtual Result DoGetTotalSpaceSize(s64 *out, const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->GetTotalSpaceSize(out, path));
|
||||
}
|
||||
|
||||
virtual Result DoCleanDirectoryRecursively(const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->CleanDirectoryRecursively(path));
|
||||
}
|
||||
|
||||
virtual Result DoGetFileTimeStampRaw(fs::FileTimeStampRaw *out, const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->GetFileTimeStampRaw(out, path));
|
||||
}
|
||||
|
||||
virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const fs::Path &path) override final {
|
||||
R_RETURN(m_base_fs->QueryEntry(dst, dst_size, src, src_size, query, path));
|
||||
}
|
||||
|
||||
virtual Result DoCommitProvisionally(s64 counter) override final {
|
||||
R_RETURN(m_base_fs->CommitProvisionally(counter));
|
||||
}
|
||||
|
||||
virtual Result DoRollback() override final {
|
||||
R_RETURN(m_base_fs->Rollback());
|
||||
}
|
||||
|
||||
virtual Result DoFlush() override final {
|
||||
R_RETURN(m_base_fs->Flush());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -40,7 +40,7 @@ namespace ams::fssystem {
|
|||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(dst_size == HashSize);
|
||||
|
||||
return this->GetHash(dst, dst_size);
|
||||
return this->DoGetHash(dst, dst_size);
|
||||
}
|
||||
protected:
|
||||
virtual void DoInitialize() = 0;
|
||||
|
|
|
@ -115,6 +115,7 @@ namespace ams::fssystem {
|
|||
u32 GetMagic() const;
|
||||
NcaHeader::DistributionType GetDistributionType() const;
|
||||
NcaHeader::ContentType GetContentType() const;
|
||||
u8 GetHeaderSign1KeyGeneration() const;
|
||||
u8 GetKeyGeneration() const;
|
||||
u8 GetKeyIndex() const;
|
||||
u64 GetContentSize() const;
|
||||
|
|
|
@ -128,8 +128,8 @@ namespace ams::fssystem {
|
|||
|
||||
struct NcaBucketInfo {
|
||||
static constexpr size_t HeaderSize = 0x10;
|
||||
s64 offset;
|
||||
s64 size;
|
||||
fs::Int64 offset;
|
||||
fs::Int64 size;
|
||||
u8 header[HeaderSize];
|
||||
};
|
||||
static_assert(util::is_pod<NcaBucketInfo>::value);
|
||||
|
@ -138,11 +138,11 @@ namespace ams::fssystem {
|
|||
static constexpr size_t Size = 0x40;
|
||||
static constexpr size_t Offset = 0x100;
|
||||
|
||||
s64 indirect_offset;
|
||||
s64 indirect_size;
|
||||
fs::Int64 indirect_offset;
|
||||
fs::Int64 indirect_size;
|
||||
u8 indirect_header[NcaBucketInfo::HeaderSize];
|
||||
s64 aes_ctr_ex_offset;
|
||||
s64 aes_ctr_ex_size;
|
||||
fs::Int64 aes_ctr_ex_offset;
|
||||
fs::Int64 aes_ctr_ex_size;
|
||||
u8 aes_ctr_ex_header[NcaBucketInfo::HeaderSize];
|
||||
|
||||
bool HasIndirectTable() const;
|
||||
|
@ -161,7 +161,7 @@ namespace ams::fssystem {
|
|||
|
||||
struct NcaSparseInfo {
|
||||
NcaBucketInfo bucket;
|
||||
s64 physical_offset;
|
||||
fs::Int64 physical_offset;
|
||||
u16 generation;
|
||||
u8 reserved[6];
|
||||
|
||||
|
@ -191,8 +191,8 @@ namespace ams::fssystem {
|
|||
static constexpr size_t HashDataOffset = 0x8;
|
||||
|
||||
struct Region {
|
||||
s64 offset;
|
||||
s64 size;
|
||||
fs::Int64 offset;
|
||||
fs::Int64 size;
|
||||
};
|
||||
static_assert(util::is_pod<Region>::value);
|
||||
|
||||
|
@ -240,8 +240,8 @@ namespace ams::fssystem {
|
|||
|
||||
struct HierarchicalIntegrityVerificationLevelInformation {
|
||||
static constexpr size_t IntegrityMaxLayerCount = 7;
|
||||
s64 offset;
|
||||
s64 size;
|
||||
fs::Int64 offset;
|
||||
fs::Int64 size;
|
||||
s32 block_order;
|
||||
u8 reserved[4];
|
||||
} info[HierarchicalIntegrityVerificationLevelInformation::IntegrityMaxLayerCount - 1];
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
namespace ams::ldr {
|
||||
|
||||
/* General types. */
|
||||
struct ProgramInfo : sf::LargeData {
|
||||
struct ProgramInfo : public sf::LargeData {
|
||||
u8 main_thread_priority;
|
||||
u8 default_cpu_id;
|
||||
u16 flags;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue