示例#1
0
        public Result GetGameCardHandle(out GameCardHandle handle)
        {
            if (!GameCard.IsGameCardInserted())
            {
                handle = default;
                return(ResultFs.GameCardNotInsertedOnGetHandle.Log());
            }

            handle = GameCard.GetGameCardHandle();
            return(Result.Success);
        }
示例#2
0
        public Result Read(GameCardHandle handle, long offset, Span <byte> destination)
        {
            if (IsGameCardHandleInvalid(handle))
            {
                return(ResultFs.InvalidGameCardHandleOnRead.Log());
            }
            if (!IsGameCardInserted())
            {
                return(ResultFs.GameCardNotInserted.Log());
            }

            return(CardImageStorage.Read(offset, destination));
        }
示例#3
0
        internal Result GetXci(out Xci xci, GameCardHandle handle)
        {
            xci = default;

            if (IsGameCardHandleInvalid(handle))
            {
                return(ResultFs.InvalidGameCardHandleOnRead.Log());
            }
            if (!IsGameCardInserted())
            {
                return(ResultFs.GameCardNotInserted.Log());
            }

            xci = CardImage;
            return(Result.Success);
        }
示例#4
0
        internal Result GetCardInfo(out GameCardInfo cardInfo, GameCardHandle handle)
        {
            cardInfo = default;

            if (IsGameCardHandleInvalid(handle))
            {
                return(ResultFs.InvalidGameCardHandleOnGetCardInfo.Log());
            }
            if (!IsGameCardInserted())
            {
                return(ResultFs.GameCardNotInserted.Log());
            }

            cardInfo = GetCardInfoImpl();
            return(Result.Success);
        }
示例#5
0
        public Result OpenGameCardStorage(out IStorage storage, GameCardHandle handle, GameCardPartitionRaw partitionId)
        {
            switch (partitionId)
            {
            case GameCardPartitionRaw.Normal:
                return(FsCreators.GameCardStorageCreator.CreateNormal(handle, out storage));

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

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

            default:
                throw new ArgumentOutOfRangeException(nameof(partitionId), partitionId, null);
            }
        }
示例#6
0
        public Result OpenGameCardFileSystem(out IFileSystem fileSystem, GameCardHandle handle,
                                             GameCardPartition partitionId)
        {
            Result rc;
            int    tries = 0;

            do
            {
                rc = FsCreators.GameCardFileSystemCreator.Create(out fileSystem, handle, partitionId);

                if (!ResultFs.DataCorrupted.Includes(rc))
                {
                    break;
                }

                tries++;
            } while (tries < 2);

            return(rc);
        }
示例#7
0
        public Result OpenGameCardStorage(out IStorage storage, GameCardHandle handle, GameCardPartitionRaw partitionId)
        {
            // Missing permission check and StorageInterfaceAdapter

            return(FsProxyCore.OpenGameCardStorage(out storage, handle, partitionId));
        }
示例#8
0
 public bool IsGameCardHandleInvalid(GameCardHandle handle)
 {
     return(Handle != handle.Value);
 }
示例#9
0
 public Result OpenGameCardFileSystem(out IFileSystem fileSystem, GameCardHandle handle,
                                      GameCardPartition partitionId)
 {
     return(FsCreators.GameCardFileSystemCreator.Create(out fileSystem, handle, partitionId));
 }