Fix RCTrack sector reads
It appears rcheevos expects user data, not raw sector data
This commit is contained in:
parent
6582431d4c
commit
b7e57db84f
|
@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private readonly Disc _disc;
|
||||
private readonly DiscSectorReader _dsr;
|
||||
private readonly DiscTrack _track;
|
||||
private readonly byte[] _buf2448;
|
||||
private readonly byte[] _buf2352;
|
||||
|
||||
public bool IsAvailable => _disc != null;
|
||||
public int LBA => _track.LBA;
|
||||
|
@ -194,8 +194,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
_dsr = new(_disc);
|
||||
_buf2448 = new byte[2448];
|
||||
_dsr = new(_disc) { Policy = { ThrowExceptions2048 = false } };
|
||||
_buf2352 = new byte[2352];
|
||||
}
|
||||
|
||||
public int ReadSector(int lba, IntPtr buffer, nuint requestedBytes)
|
||||
|
@ -205,9 +205,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
return 0;
|
||||
}
|
||||
|
||||
var numRead = _dsr.ReadLBA_2448(lba, _buf2448, 0);
|
||||
var numRead = _track.IsAudio
|
||||
? _dsr.ReadLBA_2352(lba, _buf2352, 0)
|
||||
: _dsr.ReadLBA_2048(lba, _buf2352, 0);
|
||||
var numCopied = (int)Math.Min((ulong)numRead, requestedBytes);
|
||||
Marshal.Copy(_buf2448, 0, buffer, numCopied);
|
||||
Marshal.Copy(_buf2352, 0, buffer, numCopied);
|
||||
return numCopied;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue