public static Result CreateDeviceSaveData(this FileSystemClient fs, TitleId applicationId, TitleId ownerId,
                                                  long size, long journalSize, SaveDataFlags flags)
        {
            return(fs.RunOperationWithAccessLog(AccessLogTarget.System,
                                                () =>
            {
                IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

                var attribute = new SaveDataAttribute
                {
                    TitleId = applicationId,
                    Type = SaveDataType.Device
                };

                var createInfo = new SaveDataCreationInfo
                {
                    Size = size,
                    JournalSize = journalSize,
                    BlockSize = 0x4000,
                    OwnerId = ownerId,
                    Flags = flags,
                    SpaceId = SaveDataSpaceId.User
                };

                var metaInfo = new SaveMetaCreateInfo();

                return fsProxy.CreateSaveDataFileSystem(ref attribute, ref createInfo, ref metaInfo);
            },
                                                () => $", applicationid: 0x{applicationId.Value:X}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{(int)flags:X8}"));
        }
Example #2
0
        public static Result Make(out SaveDataCreationInfo creationInfo, long size, long journalSize, ulong ownerId,
                                  SaveDataFlags flags, SaveDataSpaceId spaceId)
        {
            UnsafeHelpers.SkipParamInit(out creationInfo);
            SaveDataCreationInfo tempCreationInfo = default;

            tempCreationInfo.Size        = size;
            tempCreationInfo.JournalSize = journalSize;
            tempCreationInfo.BlockSize   = SaveDataProperties.DefaultSaveDataBlockSize;
            tempCreationInfo.OwnerId     = ownerId;
            tempCreationInfo.Flags       = flags;
            tempCreationInfo.SpaceId     = spaceId;
            tempCreationInfo.Field25     = false;

            if (!SaveDataTypesValidity.IsValid(in tempCreationInfo))
            {
                return(ResultFs.InvalidArgument.Log());
            }

            creationInfo = tempCreationInfo;
            return(Result.Success);
        }
 public static Result CreateSystemSaveData(this FileSystemClient fs, SaveDataSpaceId spaceId, ulong saveDataId,
                                           TitleId ownerId, long size, long journalSize, SaveDataFlags flags)
 {
     return(CreateSystemSaveData(fs, spaceId, saveDataId, UserId.Zero, ownerId, size, journalSize, flags));
 }
        public static Result CreateSystemSaveData(this FileSystemClient fs, SaveDataSpaceId spaceId,
                                                  ulong saveDataId, UserId userId, TitleId ownerId, long size, long journalSize, SaveDataFlags flags)
        {
            return(fs.RunOperationWithAccessLog(AccessLogTarget.System,
                                                () =>
            {
                IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

                var attribute = new SaveDataAttribute
                {
                    UserId = userId,
                    SaveDataId = saveDataId
                };

                var createInfo = new SaveDataCreationInfo
                {
                    Size = size,
                    JournalSize = journalSize,
                    BlockSize = 0x4000,
                    OwnerId = ownerId,
                    Flags = flags,
                    SpaceId = spaceId
                };

                return fsProxy.CreateSaveDataFileSystemBySystemSaveDataId(ref attribute, ref createInfo);
            },
                                                () => $", savedataspaceid: {spaceId}, savedataid: 0x{saveDataId:X}, userid: 0x{userId.Id.High:X16}{userId.Id.Low:X16}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{(int)flags:x8}"));
        }
 public static Result CreateCacheStorage(this FileSystemClient fs, TitleId applicationId, TitleId ownerId,
                                         long size, long journalSize, SaveDataFlags flags)
 {
     return(CreateCacheStorage(fs, applicationId, SaveDataSpaceId.User, ownerId, 0, size, journalSize, flags));
 }
Example #6
0
        public static Result CreateSaveData(this FileSystemClient fs, Ncm.ApplicationId applicationId, UserId userId,
                                            ulong ownerId, long size, long journalSize, HashSalt hashSalt, SaveDataFlags flags)
        {
            return(fs.RunOperationWithAccessLog(AccessLogTarget.System,
                                                () =>
            {
                IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

                var attribute = new SaveDataAttribute(applicationId, SaveDataType.Account, userId, 0);

                var createInfo = new SaveDataCreationInfo
                {
                    Size = size,
                    JournalSize = journalSize,
                    BlockSize = 0x4000,
                    OwnerId = ownerId,
                    Flags = flags,
                    SpaceId = SaveDataSpaceId.User
                };

                var metaInfo = new SaveMetaCreateInfo
                {
                    Type = SaveDataMetaType.Thumbnail,
                    Size = 0x40060
                };

                return fsProxy.CreateSaveDataFileSystemWithHashSalt(ref attribute, ref createInfo, ref metaInfo,
                                                                    ref hashSalt);
            },
                                                () =>
                                                $", applicationid: 0x{applicationId.Value:X}, userid: 0x{userId}, save_data_owner_id: 0x{ownerId:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{(int)flags:X8}"));
        }
Example #7
0
 public static Result CreateSystemSaveData(this FileSystemClient fs, ulong saveDataId, UserId userId, long size,
                                           long journalSize, SaveDataFlags flags)
 {
     return(CreateSystemSaveData(fs, SaveDataSpaceId.System, saveDataId, userId, 0, size, journalSize, flags));
 }
Example #8
0
        public static Result CreateCacheStorage(this FileSystemClient fs, Ncm.ApplicationId applicationId,
                                                SaveDataSpaceId spaceId, ulong ownerId, short index, long size, long journalSize, SaveDataFlags flags)
        {
            return(fs.RunOperationWithAccessLog(AccessLogTarget.System,
                                                () =>
            {
                IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

                var attribute = new SaveDataAttribute(applicationId, SaveDataType.Cache, UserId.Zero, 0, index);

                var creationInfo = new SaveDataCreationInfo
                {
                    Size = size,
                    JournalSize = journalSize,
                    BlockSize = 0x4000,
                    OwnerId = ownerId,
                    Flags = flags,
                    SpaceId = spaceId
                };

                var metaInfo = new SaveMetaCreateInfo();

                return fsProxy.CreateSaveDataFileSystem(ref attribute, ref creationInfo, ref metaInfo);
            },
                                                () => $", applicationid: 0x{applicationId.Value:X}, savedataspaceid: {spaceId}, save_data_owner_id: 0x{ownerId:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{(int)flags:X8}"));
        }