Fix GameCardErrorReportInfo

This commit is contained in:
Alex Barney 2023-10-30 21:24:46 -07:00
parent b60af3f66c
commit 253c0cb011
3 changed files with 41 additions and 27 deletions

View file

@ -72,28 +72,35 @@ public enum GameCardCompatibilityType : byte
public struct GameCardErrorInfo public struct GameCardErrorInfo
{ {
public ushort GameCardCrcErrorCount; public ushort GameCardCrcErrorNum;
public ushort Reserved2; public ushort Reserved2;
public ushort AsicCrcErrorCount; public ushort AsicCrcErrorNum;
public ushort Reserved6; public ushort Reserved6;
public ushort RefreshCount; public ushort RefreshNum;
public ushort ReservedA; public ushort ReservedA;
public ushort ReadRetryCount; public ushort RetryLimitOutNum;
public ushort TimeoutRetryErrorCount; public ushort TimeoutRetryNum;
} }
public struct GameCardErrorReportInfo public struct GameCardErrorReportInfo
{ {
public GameCardErrorInfo ErrorInfo; public ushort GameCardCrcErrorNum;
public ushort Reserved2;
public ushort AsicCrcErrorNum;
public ushort Reserved6;
public ushort RefreshNum;
public ushort ReservedA;
public ushort RetryLimitOutNum;
public ushort TimeoutRetryNum;
public ushort AsicReinitializeFailureDetail; public ushort AsicReinitializeFailureDetail;
public ushort InsertionCount; public ushort InsertionCount;
public ushort RemovalCount; public ushort RemovalCount;
public ushort AsicReinitializeCount; public ushort AsicReinitializeNum;
public uint AsicInitializeCount; public uint AsicInitializeNum;
public ushort AsicReinitializeFailureCount; public ushort AsicReinitializeFailureNum;
public ushort AwakenFailureCount; public ushort AwakenFailureNum;
public ushort Reserved20; public ushort Reserved20;
public ushort RefreshCount; public ushort RefreshSucceededCount;
public uint LastReadErrorPageAddress; public uint LastReadErrorPageAddress;
public uint LastReadErrorPageCount; public uint LastReadErrorPageCount;
public uint AwakenCount; public uint AwakenCount;

View file

@ -865,11 +865,11 @@ public class GameCardManager : IStorageDeviceManager, IStorageDeviceOperator, IG
Result res = _gc.GetErrorInfo(out GameCardErrorReportInfo errorInfo); Result res = _gc.GetErrorInfo(out GameCardErrorReportInfo errorInfo);
if (res.IsFailure()) return res.Miss(); if (res.IsFailure()) return res.Miss();
outErrorInfo.GameCardCrcErrorCount = errorInfo.ErrorInfo.GameCardCrcErrorCount; outErrorInfo.GameCardCrcErrorNum = errorInfo.GameCardCrcErrorNum;
outErrorInfo.AsicCrcErrorCount = errorInfo.ErrorInfo.AsicCrcErrorCount; outErrorInfo.AsicCrcErrorNum = errorInfo.AsicCrcErrorNum;
outErrorInfo.RefreshCount = errorInfo.ErrorInfo.RefreshCount; outErrorInfo.RefreshNum = errorInfo.RefreshNum;
outErrorInfo.TimeoutRetryErrorCount = errorInfo.ErrorInfo.TimeoutRetryErrorCount; outErrorInfo.TimeoutRetryNum = errorInfo.TimeoutRetryNum;
outErrorInfo.ReadRetryCount = errorInfo.ErrorInfo.ReadRetryCount; outErrorInfo.RetryLimitOutNum = errorInfo.RetryLimitOutNum;
return Result.Success; return Result.Success;
} }

View file

@ -502,14 +502,14 @@ public class TypeLayoutTests
Assert.Equal(0x10, Unsafe.SizeOf<GameCardErrorInfo>()); Assert.Equal(0x10, Unsafe.SizeOf<GameCardErrorInfo>());
Assert.Equal(0x0, GetOffset(in s, in s.GameCardCrcErrorCount)); Assert.Equal(0x0, GetOffset(in s, in s.GameCardCrcErrorNum));
Assert.Equal(0x2, GetOffset(in s, in s.Reserved2)); Assert.Equal(0x2, GetOffset(in s, in s.Reserved2));
Assert.Equal(0x4, GetOffset(in s, in s.AsicCrcErrorCount)); Assert.Equal(0x4, GetOffset(in s, in s.AsicCrcErrorNum));
Assert.Equal(0x6, GetOffset(in s, in s.Reserved6)); Assert.Equal(0x6, GetOffset(in s, in s.Reserved6));
Assert.Equal(0x8, GetOffset(in s, in s.RefreshCount)); Assert.Equal(0x8, GetOffset(in s, in s.RefreshNum));
Assert.Equal(0xA, GetOffset(in s, in s.ReservedA)); Assert.Equal(0xA, GetOffset(in s, in s.ReservedA));
Assert.Equal(0xC, GetOffset(in s, in s.ReadRetryCount)); Assert.Equal(0xC, GetOffset(in s, in s.RetryLimitOutNum));
Assert.Equal(0xE, GetOffset(in s, in s.TimeoutRetryErrorCount)); Assert.Equal(0xE, GetOffset(in s, in s.TimeoutRetryNum));
} }
[Fact] [Fact]
@ -519,16 +519,23 @@ public class TypeLayoutTests
Assert.Equal(0x40, Unsafe.SizeOf<GameCardErrorReportInfo>()); Assert.Equal(0x40, Unsafe.SizeOf<GameCardErrorReportInfo>());
Assert.Equal(0x00, GetOffset(in s, in s.ErrorInfo)); Assert.Equal(0x00, GetOffset(in s, in s.GameCardCrcErrorNum));
Assert.Equal(0x02, GetOffset(in s, in s.Reserved2));
Assert.Equal(0x04, GetOffset(in s, in s.AsicCrcErrorNum));
Assert.Equal(0x06, GetOffset(in s, in s.Reserved6));
Assert.Equal(0x08, GetOffset(in s, in s.RefreshNum));
Assert.Equal(0x0A, GetOffset(in s, in s.ReservedA));
Assert.Equal(0x0C, GetOffset(in s, in s.RetryLimitOutNum));
Assert.Equal(0x0E, GetOffset(in s, in s.TimeoutRetryNum));
Assert.Equal(0x10, GetOffset(in s, in s.AsicReinitializeFailureDetail)); Assert.Equal(0x10, GetOffset(in s, in s.AsicReinitializeFailureDetail));
Assert.Equal(0x12, GetOffset(in s, in s.InsertionCount)); Assert.Equal(0x12, GetOffset(in s, in s.InsertionCount));
Assert.Equal(0x14, GetOffset(in s, in s.RemovalCount)); Assert.Equal(0x14, GetOffset(in s, in s.RemovalCount));
Assert.Equal(0x16, GetOffset(in s, in s.AsicReinitializeCount)); Assert.Equal(0x16, GetOffset(in s, in s.AsicReinitializeNum));
Assert.Equal(0x18, GetOffset(in s, in s.AsicInitializeCount)); Assert.Equal(0x18, GetOffset(in s, in s.AsicInitializeNum));
Assert.Equal(0x1C, GetOffset(in s, in s.AsicReinitializeFailureCount)); Assert.Equal(0x1C, GetOffset(in s, in s.AsicReinitializeFailureNum));
Assert.Equal(0x1E, GetOffset(in s, in s.AwakenFailureCount)); Assert.Equal(0x1E, GetOffset(in s, in s.AwakenFailureNum));
Assert.Equal(0x20, GetOffset(in s, in s.Reserved20)); Assert.Equal(0x20, GetOffset(in s, in s.Reserved20));
Assert.Equal(0x22, GetOffset(in s, in s.RefreshCount)); Assert.Equal(0x22, GetOffset(in s, in s.RefreshSucceededCount));
Assert.Equal(0x24, GetOffset(in s, in s.LastReadErrorPageAddress)); Assert.Equal(0x24, GetOffset(in s, in s.LastReadErrorPageAddress));
Assert.Equal(0x28, GetOffset(in s, in s.LastReadErrorPageCount)); Assert.Equal(0x28, GetOffset(in s, in s.LastReadErrorPageCount));
Assert.Equal(0x2C, GetOffset(in s, in s.AwakenCount)); Assert.Equal(0x2C, GetOffset(in s, in s.AwakenCount));