mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Make GameCardHandle an alias for uint
This commit is contained in:
parent
902e3e1424
commit
81051907a4
9 changed files with 41 additions and 71 deletions
|
@ -1,4 +1,6 @@
|
||||||
using System;
|
global using GameCardHandle = System.UInt32;
|
||||||
|
|
||||||
|
using System;
|
||||||
using LibHac.Common.FixedArrays;
|
using LibHac.Common.FixedArrays;
|
||||||
|
|
||||||
namespace LibHac.Fs;
|
namespace LibHac.Fs;
|
||||||
|
@ -82,19 +84,3 @@ public struct GameCardErrorReportInfo
|
||||||
public uint ReadCountFromAwaken;
|
public uint ReadCountFromAwaken;
|
||||||
public Array8<byte> Reserved38;
|
public Array8<byte> Reserved38;
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly struct GameCardHandle : IEquatable<GameCardHandle>
|
|
||||||
{
|
|
||||||
public readonly int Value;
|
|
||||||
|
|
||||||
public GameCardHandle(int value)
|
|
||||||
{
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Equals(object obj) => obj is GameCardHandle handle && Equals(handle);
|
|
||||||
public bool Equals(GameCardHandle other) => Value == other.Value;
|
|
||||||
public override int GetHashCode() => Value.GetHashCode();
|
|
||||||
public static bool operator ==(GameCardHandle left, GameCardHandle right) => left.Equals(right);
|
|
||||||
public static bool operator !=(GameCardHandle left, GameCardHandle right) => !(left == right);
|
|
||||||
}
|
|
|
@ -63,7 +63,7 @@ public static class GameCard
|
||||||
var sb = new U8StringBuilder(nameBuffer);
|
var sb = new U8StringBuilder(nameBuffer);
|
||||||
sb.Append(CommonMountNames.GameCardFileSystemMountName)
|
sb.Append(CommonMountNames.GameCardFileSystemMountName)
|
||||||
.Append(GetGameCardMountNameSuffix(_partitionId))
|
.Append(GetGameCardMountNameSuffix(_partitionId))
|
||||||
.AppendFormat(_handle.Value, 'x', (byte)handleDigitCount)
|
.AppendFormat(_handle, 'x', (byte)handleDigitCount)
|
||||||
.Append(StringTraits.DriveSeparator);
|
.Append(StringTraits.DriveSeparator);
|
||||||
|
|
||||||
Assert.SdkEqual(sb.Length, requiredNameBufferSize - 1);
|
Assert.SdkEqual(sb.Length, requiredNameBufferSize - 1);
|
||||||
|
@ -83,11 +83,11 @@ public static class GameCard
|
||||||
fs.Impl.AbortIfNeeded(rc);
|
fs.Impl.AbortIfNeeded(rc);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
|
||||||
rc = deviceOperator.Get.GetGameCardHandle(out uint handle);
|
rc = deviceOperator.Get.GetGameCardHandle(out GameCardHandle handle);
|
||||||
fs.Impl.AbortIfNeeded(rc);
|
fs.Impl.AbortIfNeeded(rc);
|
||||||
if (rc.IsFailure()) return rc.Miss();
|
if (rc.IsFailure()) return rc.Miss();
|
||||||
|
|
||||||
outHandle = new GameCardHandle((int)handle);
|
outHandle = handle;
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public static class GameCard
|
||||||
var sb = new U8StringBuilder(logBuffer, true);
|
var sb = new U8StringBuilder(logBuffer, true);
|
||||||
|
|
||||||
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
||||||
.Append(LogGameCardHandle).AppendFormat(handle.Value)
|
.Append(LogGameCardHandle).AppendFormat(handle)
|
||||||
.Append(LogGameCardPartition).Append(idString.ToString(partitionId));
|
.Append(LogGameCardPartition).Append(idString.ToString(partitionId));
|
||||||
|
|
||||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||||
|
|
|
@ -108,11 +108,6 @@ public class EmulatedDeviceOperator : IDeviceOperator
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetGameCardHandle(out uint outHandle)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Result GetGameCardUpdatePartitionInfo(out uint outCupVersion, out ulong outCupId, uint handle)
|
public Result GetGameCardUpdatePartitionInfo(out uint outCupVersion, out ulong outCupId, uint handle)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace LibHac.FsSrv;
|
||||||
public class EmulatedGameCard
|
public class EmulatedGameCard
|
||||||
{
|
{
|
||||||
private IStorage CardImageStorage { get; set; }
|
private IStorage CardImageStorage { get; set; }
|
||||||
private int Handle { get; set; }
|
private GameCardHandle Handle { get; set; }
|
||||||
private XciHeader CardHeader { get; set; }
|
private XciHeader CardHeader { get; set; }
|
||||||
private Xci CardImage { get; set; }
|
private Xci CardImage { get; set; }
|
||||||
private KeySet KeySet { get; set; }
|
private KeySet KeySet { get; set; }
|
||||||
|
@ -22,12 +22,12 @@ public class EmulatedGameCard
|
||||||
}
|
}
|
||||||
public GameCardHandle GetGameCardHandle()
|
public GameCardHandle GetGameCardHandle()
|
||||||
{
|
{
|
||||||
return new GameCardHandle(Handle);
|
return Handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsGameCardHandleInvalid(GameCardHandle handle)
|
public bool IsGameCardHandleInvalid(GameCardHandle handle)
|
||||||
{
|
{
|
||||||
return Handle != handle.Value;
|
return Handle != handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsGameCardInserted()
|
public bool IsGameCardInserted()
|
||||||
|
|
|
@ -225,7 +225,7 @@ public class DeviceOperator : IDeviceOperator
|
||||||
return _fsServer.Storage.EraseGameCard(gameCardSize, romAreaStartPageAddress).Ret();
|
return _fsServer.Storage.EraseGameCard(gameCardSize, romAreaStartPageAddress).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetGameCardHandle(out uint outHandle)
|
public Result GetGameCardHandle(out GameCardHandle outHandle)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outHandle);
|
UnsafeHelpers.SkipParamInit(out outHandle);
|
||||||
|
|
||||||
|
@ -236,14 +236,14 @@ public class DeviceOperator : IDeviceOperator
|
||||||
if (!isInserted)
|
if (!isInserted)
|
||||||
return ResultFs.GameCardFsGetHandleFailure.Log();
|
return ResultFs.GameCardFsGetHandleFailure.Log();
|
||||||
|
|
||||||
rc = _fsServer.Storage.GetGameCardHandle(out uint handle);
|
rc = _fsServer.Storage.GetGameCardHandle(out GameCardHandle handle);
|
||||||
if (rc.IsFailure()) return rc.Miss();
|
if (rc.IsFailure()) return rc.Miss();
|
||||||
|
|
||||||
outHandle = handle;
|
outHandle = handle;
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetGameCardUpdatePartitionInfo(out uint outCupVersion, out ulong outCupId, uint handle)
|
public Result GetGameCardUpdatePartitionInfo(out uint outCupVersion, out ulong outCupId, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outCupVersion, out outCupId);
|
UnsafeHelpers.SkipParamInit(out outCupVersion, out outCupId);
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ public class DeviceOperator : IDeviceOperator
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetGameCardAttribute(out byte outAttribute, uint handle)
|
public Result GetGameCardAttribute(out byte outAttribute, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outAttribute);
|
UnsafeHelpers.SkipParamInit(out outAttribute);
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ public class DeviceOperator : IDeviceOperator
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetGameCardCompatibilityType(out byte outCompatibilityType, uint handle)
|
public Result GetGameCardCompatibilityType(out byte outCompatibilityType, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outCompatibilityType);
|
UnsafeHelpers.SkipParamInit(out outCompatibilityType);
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ public class DeviceOperator : IDeviceOperator
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetGameCardDeviceCertificate(OutBuffer outBuffer, long outBufferSize, uint handle)
|
public Result GetGameCardDeviceCertificate(OutBuffer outBuffer, long outBufferSize, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
if (!_accessControl.CanCall(OperationType.GetGameCardDeviceCertificate))
|
if (!_accessControl.CanCall(OperationType.GetGameCardDeviceCertificate))
|
||||||
return ResultFs.PermissionDenied.Log();
|
return ResultFs.PermissionDenied.Log();
|
||||||
|
@ -299,7 +299,7 @@ public class DeviceOperator : IDeviceOperator
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result ChallengeCardExistence(OutBuffer outResponseBuffer, InBuffer challengeSeedBuffer,
|
public Result ChallengeCardExistence(OutBuffer outResponseBuffer, InBuffer challengeSeedBuffer,
|
||||||
InBuffer challengeValueBuffer, uint handle)
|
InBuffer challengeValueBuffer, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
if (!_accessControl.CanCall(OperationType.ChallengeCardExistence))
|
if (!_accessControl.CanCall(OperationType.ChallengeCardExistence))
|
||||||
return ResultFs.PermissionDenied.Log();
|
return ResultFs.PermissionDenied.Log();
|
||||||
|
@ -370,7 +370,7 @@ public class DeviceOperator : IDeviceOperator
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetGameCardImageHash(OutBuffer outBuffer, long outBufferSize, uint handle)
|
public Result GetGameCardImageHash(OutBuffer outBuffer, long outBufferSize, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
if (outBuffer.Size < outBufferSize)
|
if (outBuffer.Size < outBufferSize)
|
||||||
return ResultFs.InvalidSize.Log();
|
return ResultFs.InvalidSize.Log();
|
||||||
|
|
|
@ -104,8 +104,7 @@ public class NcaFileSystemServiceImpl
|
||||||
|
|
||||||
if (type == FileSystemProxyType.Logo && mountNameInfo.IsGameCard)
|
if (type == FileSystemProxyType.Logo && mountNameInfo.IsGameCard)
|
||||||
{
|
{
|
||||||
rc = _config.BaseFsService.OpenGameCardFileSystem(ref outFileSystem,
|
rc = _config.BaseFsService.OpenGameCardFileSystem(ref outFileSystem, (uint)mountNameInfo.GcHandle,
|
||||||
new GameCardHandle(mountNameInfo.GcHandle),
|
|
||||||
GameCardPartition.Logo);
|
GameCardPartition.Logo);
|
||||||
|
|
||||||
if (rc.IsSuccess())
|
if (rc.IsSuccess())
|
||||||
|
@ -352,8 +351,7 @@ public class NcaFileSystemServiceImpl
|
||||||
|
|
||||||
path = path.Slice(8);
|
path = path.Slice(8);
|
||||||
|
|
||||||
Result rc = _config.BaseFsService.OpenGameCardFileSystem(ref outFileSystem, new GameCardHandle(handle),
|
Result rc = _config.BaseFsService.OpenGameCardFileSystem(ref outFileSystem, (uint)handle, partition);
|
||||||
partition);
|
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
|
||||||
info.GcHandle = handle;
|
info.GcHandle = handle;
|
||||||
|
|
|
@ -23,16 +23,16 @@ public interface IDeviceOperator : IDisposable
|
||||||
Result ResumeMmcPatrol();
|
Result ResumeMmcPatrol();
|
||||||
Result IsGameCardInserted(out bool outIsInserted);
|
Result IsGameCardInserted(out bool outIsInserted);
|
||||||
Result EraseGameCard(uint gameCardSize, ulong romAreaStartPageAddress);
|
Result EraseGameCard(uint gameCardSize, ulong romAreaStartPageAddress);
|
||||||
Result GetGameCardHandle(out uint outHandle);
|
Result GetGameCardHandle(out GameCardHandle outHandle);
|
||||||
Result GetGameCardUpdatePartitionInfo(out uint outCupVersion, out ulong outCupId, uint handle);
|
Result GetGameCardUpdatePartitionInfo(out uint outCupVersion, out ulong outCupId, GameCardHandle handle);
|
||||||
Result FinalizeGameCardDriver();
|
Result FinalizeGameCardDriver();
|
||||||
Result GetGameCardAttribute(out byte outAttribute, uint handle);
|
Result GetGameCardAttribute(out byte outAttribute, GameCardHandle handle);
|
||||||
Result GetGameCardDeviceCertificate(OutBuffer outBuffer, long outBufferSize, uint handle);
|
Result GetGameCardDeviceCertificate(OutBuffer outBuffer, long outBufferSize, GameCardHandle handle);
|
||||||
Result GetGameCardAsicInfo(OutBuffer outRmaInfoBuffer, long rmaInfoBufferSize, InBuffer asicFirmwareBuffer, long asicFirmwareBufferSize);
|
Result GetGameCardAsicInfo(OutBuffer outRmaInfoBuffer, long rmaInfoBufferSize, InBuffer asicFirmwareBuffer, long asicFirmwareBufferSize);
|
||||||
Result GetGameCardIdSet(OutBuffer outBuffer, long outBufferSize);
|
Result GetGameCardIdSet(OutBuffer outBuffer, long outBufferSize);
|
||||||
Result WriteToGameCardDirectly(long offset, OutBuffer buffer, long bufferSize);
|
Result WriteToGameCardDirectly(long offset, OutBuffer buffer, long bufferSize);
|
||||||
Result SetVerifyWriteEnableFlag(bool isEnabled);
|
Result SetVerifyWriteEnableFlag(bool isEnabled);
|
||||||
Result GetGameCardImageHash(OutBuffer outBuffer, long outBufferSize, uint handle);
|
Result GetGameCardImageHash(OutBuffer outBuffer, long outBufferSize, GameCardHandle handle);
|
||||||
Result GetGameCardDeviceIdForProdCard(OutBuffer outBuffer, long outBufferSize, InBuffer devHeaderBuffer, long devHeaderBufferSize);
|
Result GetGameCardDeviceIdForProdCard(OutBuffer outBuffer, long outBufferSize, InBuffer devHeaderBuffer, long devHeaderBufferSize);
|
||||||
Result EraseAndWriteParamDirectly(InBuffer inBuffer, long inBufferSize);
|
Result EraseAndWriteParamDirectly(InBuffer inBuffer, long inBufferSize);
|
||||||
Result ReadParamDirectly(OutBuffer outBuffer, long outBufferSize);
|
Result ReadParamDirectly(OutBuffer outBuffer, long outBufferSize);
|
||||||
|
@ -40,8 +40,8 @@ public interface IDeviceOperator : IDisposable
|
||||||
Result GetGameCardErrorInfo(out GameCardErrorInfo outErrorInfo);
|
Result GetGameCardErrorInfo(out GameCardErrorInfo outErrorInfo);
|
||||||
Result GetGameCardErrorReportInfo(out GameCardErrorReportInfo outErrorInfo);
|
Result GetGameCardErrorReportInfo(out GameCardErrorReportInfo outErrorInfo);
|
||||||
Result GetGameCardDeviceId(OutBuffer outBuffer, long outBufferSize);
|
Result GetGameCardDeviceId(OutBuffer outBuffer, long outBufferSize);
|
||||||
Result ChallengeCardExistence(OutBuffer outResponseBuffer, InBuffer challengeSeedBuffer, InBuffer challengeValueBuffer, uint handle);
|
Result ChallengeCardExistence(OutBuffer outResponseBuffer, InBuffer challengeSeedBuffer, InBuffer challengeValueBuffer, GameCardHandle handle);
|
||||||
Result GetGameCardCompatibilityType(out byte outCompatibilityType, uint handle);
|
Result GetGameCardCompatibilityType(out byte outCompatibilityType, GameCardHandle handle);
|
||||||
Result SetSpeedEmulationMode(int mode);
|
Result SetSpeedEmulationMode(int mode);
|
||||||
Result GetSpeedEmulationMode(out int outMode);
|
Result GetSpeedEmulationMode(out int outMode);
|
||||||
Result SuspendSdmmcControl();
|
Result SuspendSdmmcControl();
|
||||||
|
|
|
@ -106,7 +106,7 @@ internal static class GameCardService
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result OpenGameCardStorage(this StorageService service, ref SharedRef<IStorage> outStorage,
|
public static Result OpenGameCardStorage(this StorageService service, ref SharedRef<IStorage> outStorage,
|
||||||
OpenGameCardAttribute attribute, uint handle)
|
OpenGameCardAttribute attribute, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
using var gameCardStorageDevice = new SharedRef<IStorageDevice>();
|
using var gameCardStorageDevice = new SharedRef<IStorageDevice>();
|
||||||
|
|
||||||
|
@ -153,10 +153,10 @@ internal static class GameCardService
|
||||||
{
|
{
|
||||||
if (g.CachedStorageDevice.HasValue)
|
if (g.CachedStorageDevice.HasValue)
|
||||||
{
|
{
|
||||||
Result rc = g.CachedStorageDevice.Get.GetHandle(out uint handleValue);
|
Result rc = g.CachedStorageDevice.Get.GetHandle(out GameCardHandle handle);
|
||||||
if (rc.IsFailure()) return rc.Miss();
|
if (rc.IsFailure()) return rc.Miss();
|
||||||
|
|
||||||
outHandle = new StorageDeviceHandle(handleValue, StorageDevicePortId.GameCard);
|
outHandle = new StorageDeviceHandle(handle, StorageDevicePortId.GameCard);
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ internal static class GameCardService
|
||||||
OpenGameCardAttribute.ReadOnly);
|
OpenGameCardAttribute.ReadOnly);
|
||||||
if (rc.IsFailure()) return rc.Miss();
|
if (rc.IsFailure()) return rc.Miss();
|
||||||
|
|
||||||
rc = gameCardStorageDevice.Get.GetHandle(out uint handleValue);
|
rc = gameCardStorageDevice.Get.GetHandle(out GameCardHandle handleValue);
|
||||||
if (rc.IsFailure()) return rc.Miss();
|
if (rc.IsFailure()) return rc.Miss();
|
||||||
|
|
||||||
outHandle = new StorageDeviceHandle(handleValue, StorageDevicePortId.GameCard);
|
outHandle = new StorageDeviceHandle(handleValue, StorageDevicePortId.GameCard);
|
||||||
|
@ -228,7 +228,7 @@ internal static class GameCardService
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result GetGameCardStatus(this StorageService service, out GameCardStatus outGameCardStatus,
|
public static Result GetGameCardStatus(this StorageService service, out GameCardStatus outGameCardStatus,
|
||||||
uint handle)
|
GameCardHandle handle)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outGameCardStatus);
|
UnsafeHelpers.SkipParamInit(out outGameCardStatus);
|
||||||
|
|
||||||
|
@ -267,7 +267,8 @@ internal static class GameCardService
|
||||||
return gcOperator.Get.Operate(operationId);
|
return gcOperator.Get.Operate(operationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result GetGameCardDeviceCertificate(this StorageService service, Span<byte> outBuffer, uint handle)
|
public static Result GetGameCardDeviceCertificate(this StorageService service, Span<byte> outBuffer,
|
||||||
|
GameCardHandle handle)
|
||||||
{
|
{
|
||||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||||
Result rc = service.GetGameCardOperator(ref gcOperator.Ref());
|
Result rc = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||||
|
@ -294,7 +295,7 @@ internal static class GameCardService
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result ChallengeCardExistence(this StorageService service, Span<byte> outResponseBuffer,
|
public static Result ChallengeCardExistence(this StorageService service, Span<byte> outResponseBuffer,
|
||||||
ReadOnlySpan<byte> challengeSeed, ReadOnlySpan<byte> challengeValue, uint handle)
|
ReadOnlySpan<byte> challengeSeed, ReadOnlySpan<byte> challengeValue, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||||
Result rc = service.GetGameCardOperator(ref gcOperator.Ref());
|
Result rc = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||||
|
@ -323,16 +324,16 @@ internal static class GameCardService
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result GetGameCardHandle(this StorageService service, out uint handle)
|
public static Result GetGameCardHandle(this StorageService service, out GameCardHandle outHandle)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out handle);
|
UnsafeHelpers.SkipParamInit(out outHandle);
|
||||||
|
|
||||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||||
Result rc = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
Result rc = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||||
if (rc.IsFailure()) return rc.Miss();
|
if (rc.IsFailure()) return rc.Miss();
|
||||||
|
|
||||||
// Get the current handle.
|
// Get the current handle.
|
||||||
OutBuffer handleOutBuffer = OutBuffer.FromStruct(ref handle);
|
OutBuffer handleOutBuffer = OutBuffer.FromStruct(ref outHandle);
|
||||||
int operationId = MakeOperationId(GameCardManagerOperationIdValue.GetHandle);
|
int operationId = MakeOperationId(GameCardManagerOperationIdValue.GetHandle);
|
||||||
|
|
||||||
rc = gcOperator.Get.OperateOut(out long bytesWritten, handleOutBuffer, operationId);
|
rc = gcOperator.Get.OperateOut(out long bytesWritten, handleOutBuffer, operationId);
|
||||||
|
@ -346,7 +347,7 @@ internal static class GameCardService
|
||||||
|
|
||||||
if (g.CachedStorageDevice.HasValue)
|
if (g.CachedStorageDevice.HasValue)
|
||||||
{
|
{
|
||||||
g.CachedStorageDevice.Get.GetHandle(out uint handleValue);
|
g.CachedStorageDevice.Get.GetHandle(out GameCardHandle handleValue);
|
||||||
if (rc.IsFailure()) return rc.Miss();
|
if (rc.IsFailure()) return rc.Miss();
|
||||||
|
|
||||||
var currentHandle = new StorageDeviceHandle(handleValue, StorageDevicePortId.GameCard);
|
var currentHandle = new StorageDeviceHandle(handleValue, StorageDevicePortId.GameCard);
|
||||||
|
@ -432,7 +433,7 @@ internal static class GameCardService
|
||||||
return gcOperator.Get.OperateIn(inIsEnabledBuffer, offset: 0, size: 0, operationId);
|
return gcOperator.Get.OperateIn(inIsEnabledBuffer, offset: 0, size: 0, operationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result GetGameCardImageHash(this StorageService service, Span<byte> outBuffer, uint handle)
|
public static Result GetGameCardImageHash(this StorageService service, Span<byte> outBuffer, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||||
Result rc = service.GetGameCardOperator(ref gcOperator.Ref());
|
Result rc = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||||
|
@ -573,7 +574,7 @@ internal static class GameCardService
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsGameCardActivationValid(this StorageService service, uint handle)
|
public static bool IsGameCardActivationValid(this StorageService service, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||||
Result rc = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
Result rc = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||||
|
|
|
@ -492,16 +492,6 @@ public class TypeLayoutTests
|
||||||
Assert.Equal(0x38, GetOffset(in s, in s.Reserved38));
|
Assert.Equal(0x38, GetOffset(in s, in s.Reserved38));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public static void GameCardHandle_Layout()
|
|
||||||
{
|
|
||||||
var s = new GameCardHandle();
|
|
||||||
|
|
||||||
Assert.Equal(4, Unsafe.SizeOf<GameCardHandle>());
|
|
||||||
|
|
||||||
Assert.Equal(0, GetOffset(in s, in s.Value));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public static void Int64_Layout()
|
public static void Int64_Layout()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue