示例#1
0
        public static Result OpenGameCardPartition(this FileSystemClient fs, out IStorage storage,
                                                   GameCardHandle handle, GameCardPartitionRaw partitionType)
        {
            IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

            return(fsProxy.OpenGameCardStorage(out storage, handle, partitionType));
        }
示例#2
0
        // OpenGameCardStorage(u32, u32) -> object<nn::fssrv::sf::IStorage>
        public ResultCode OpenGameCardStorage(ServiceCtx context)
        {
            GameCardHandle       handle      = new GameCardHandle(context.RequestData.ReadInt32());
            GameCardPartitionRaw partitionId = (GameCardPartitionRaw)context.RequestData.ReadInt32();

            Result result = _baseFileSystemProxy.OpenGameCardStorage(out LibHac.Fs.IStorage storage, handle, partitionId);

            if (result.IsSuccess())
            {
                MakeObject(context, new FileSystemProxy.IStorage(storage));
            }

            return((ResultCode)result.Value);
        }
示例#3
0
        public Result OpenGameCardPartition(out ReferenceCountedDisposable <IStorage> storage, GameCardHandle handle,
                                            GameCardPartitionRaw partitionId)
        {
            switch (partitionId)
            {
            case GameCardPartitionRaw.NormalReadOnly:
                return(Config.GameCardStorageCreator.CreateReadOnly(handle, out storage));

            case GameCardPartitionRaw.SecureReadOnly:
                return(Config.GameCardStorageCreator.CreateSecureReadOnly(handle, out storage));

            case GameCardPartitionRaw.RootWriteOnly:
                return(Config.GameCardStorageCreator.CreateWriteOnly(handle, out storage));

            default:
                UnsafeHelpers.SkipParamInit(out storage);
                return(ResultFs.InvalidArgument.Log());
            }
        }
示例#4
0
        public Result OpenGameCardStorage(out ReferenceCountedDisposable <IStorageSf> storage, GameCardHandle handle,
                                          GameCardPartitionRaw partitionId)
        {
            UnsafeHelpers.SkipParamInit(out storage);

            Result rc = GetProgramInfo(out ProgramInfo programInfo);

            if (rc.IsFailure())
            {
                return(rc);
            }

            Accessibility accessibility =
                programInfo.AccessControl.GetAccessibilityFor(AccessibilityType.OpenGameCardStorage);

            bool canAccess = accessibility.CanRead && accessibility.CanWrite;

            if (!canAccess)
            {
                return(ResultFs.PermissionDenied.Log());
            }

            ReferenceCountedDisposable <IStorage> tempStorage = null;

            try
            {
                rc = _serviceImpl.OpenGameCardPartition(out tempStorage, handle, partitionId);
                if (rc.IsFailure())
                {
                    return(rc);
                }

                // Todo: Async storage

                storage = StorageInterfaceAdapter.CreateShared(ref tempStorage);
                return(Result.Success);
            }
            finally
            {
                tempStorage?.Dispose();
            }
        }
示例#5
0
        public Result OpenGameCardStorage(out IStorage storage, GameCardHandle handle, GameCardPartitionRaw partitionId)
        {
            switch (partitionId)
            {
            case GameCardPartitionRaw.NormalReadOnly:
                return(FsCreators.GameCardStorageCreator.CreateNormal(handle, out storage));

            case GameCardPartitionRaw.SecureReadOnly:
                return(FsCreators.GameCardStorageCreator.CreateSecure(handle, out storage));

            case GameCardPartitionRaw.RootWriteOnly:
                return(FsCreators.GameCardStorageCreator.CreateWritable(handle, out storage));

            default:
                throw new ArgumentOutOfRangeException(nameof(partitionId), partitionId, null);
            }
        }
示例#6
0
        public Result OpenGameCardStorage(out IStorage storage, GameCardHandle handle, GameCardPartitionRaw partitionId)
        {
            // Missing permission check and StorageInterfaceAdapter

            return(FsProxyCore.OpenGameCardStorage(out storage, handle, partitionId));
        }