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

            handle = GameCard.GetGameCardHandle();
            return(Result.Success);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
0
        public Result OpenGameCardStorage(out IStorage storage, GameCardHandle handle, GameCardPartitionRaw partitionId)
        {
            // Missing permission check and StorageInterfaceAdapter

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