internal Result GetCardInfo(out GameCardInfo cardInfo, GameCardHandle handle)
        {
            UnsafeHelpers.SkipParamInit(out cardInfo);

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

            cardInfo = GetCardInfoImpl();
            return(Result.Success);
        }
Example #2
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);
        }
        private GameCardInfo GetCardInfoImpl()
        {
            var info = new GameCardInfo();

            CardHeader.RootPartitionHeaderHash.AsSpan().CopyTo(info.RootPartitionHeaderHash);
            info.PackageId               = CardHeader.PackageId;
            info.Size                    = GameCard.GetGameCardSizeBytes(CardHeader.GameCardSize);
            info.RootPartitionOffset     = CardHeader.RootPartitionOffset;
            info.RootPartitionHeaderSize = CardHeader.RootPartitionHeaderSize;
            info.SecureAreaOffset        = GameCard.CardPageToOffset(CardHeader.LimAreaPage);
            info.SecureAreaSize          = info.Size - info.SecureAreaOffset;
            info.UpdateVersion           = CardHeader.UppVersion;
            info.UpdateTitleId           = CardHeader.UppId;
            info.Attribute               = CardHeader.Flags;

            return(info);
        }