mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-01 07:18:22 -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
|
@ -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
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue