예제 #1
0
        public Result CreateNormal(GameCardHandle handle, out IStorage storage)
        {
            storage = default;

            if (GameCard.IsGameCardHandleInvalid(handle))
            {
                return(ResultFs.InvalidGameCardHandleOnOpenNormalPartition.Log());
            }

            var baseStorage = new ReadOnlyGameCardStorage(GameCard, handle);

            Result rc = GameCard.GetCardInfo(out GameCardInfo cardInfo, handle);

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

            storage = new SubStorage2(baseStorage, 0, cardInfo.SecureAreaOffset);
            return(Result.Success);
        }
예제 #2
0
        public Result CreateSecure(GameCardHandle handle, out IStorage storage)
        {
            storage = default;

            if (GameCard.IsGameCardHandleInvalid(handle))
            {
                return(ResultFs.InvalidGameCardHandleOnOpenSecurePartition.Log());
            }

            Span <byte> deviceId  = stackalloc byte[0x10];
            Span <byte> imageHash = stackalloc byte[0x20];

            Result rc = GameCard.GetGameCardDeviceId(deviceId);

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

            rc = GameCard.GetGameCardImageHash(imageHash);
            if (rc.IsFailure())
            {
                return(rc);
            }

            var baseStorage = new ReadOnlyGameCardStorage(GameCard, handle, deviceId, imageHash);

            rc = GameCard.GetCardInfo(out GameCardInfo cardInfo, handle);
            if (rc.IsFailure())
            {
                return(rc);
            }

            storage = new SubStorage2(baseStorage, cardInfo.SecureAreaOffset, cardInfo.SecureAreaSize);
            return(Result.Success);
        }