add new subchannel interleaving code and fix errors in CCD subcode loading
This commit is contained in:
parent
87ff7f9a71
commit
f2def57b90
|
@ -457,12 +457,12 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
if ((job.Parts & (ESectorSynthPart.SubcodeAny)) != 0)
|
if ((job.Parts & (ESectorSynthPart.SubcodeAny)) != 0)
|
||||||
{
|
{
|
||||||
ofs = job.LBA * 96;
|
ofs = job.LBA * 96;
|
||||||
imgBlob.Read(ofs, job.DestBuffer2448, 2352, 96);
|
subBlob.Read(ofs, job.DestBuffer2448, 2352, 96);
|
||||||
|
|
||||||
//we may still need to deinterleave it
|
//sub data comes to us deinterleved; we may still need to interleave it
|
||||||
if ((job.Parts & (ESectorSynthPart.SubcodeDeinterleave)) != 0)
|
if ((job.Parts & (ESectorSynthPart.SubcodeDeinterleave)) == 0)
|
||||||
{
|
{
|
||||||
SubcodeUtils.DeinterleaveInplace(job.DestBuffer2448, 2352);
|
SubcodeUtils.InterleaveInplace(job.DestBuffer2448, 2352);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,34 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the useful (but unrealistic) deinterleaved data into the useless (but realistic) interleaved subchannel format.
|
||||||
|
/// </summary>
|
||||||
|
public unsafe static void InterleaveInplace(byte[] buf, int buf_index)
|
||||||
|
{
|
||||||
|
byte* out_buf = stackalloc byte[96];
|
||||||
|
|
||||||
|
for (int i = 0; i < 96; i++)
|
||||||
|
out_buf[i] = 0;
|
||||||
|
|
||||||
|
for (int d = 0; d < 12; d++)
|
||||||
|
{
|
||||||
|
for (int bitpoodle = 0; bitpoodle < 8; bitpoodle++)
|
||||||
|
{
|
||||||
|
int rawb = 0;
|
||||||
|
|
||||||
|
for (int ch = 0; ch < 8; ch++)
|
||||||
|
{
|
||||||
|
rawb |= ((buf[ch * 12 + d + buf_index] >> (7 - bitpoodle)) & 1) << (7 - ch);
|
||||||
|
}
|
||||||
|
out_buf[(d << 3) + bitpoodle] = (byte)rawb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 96; i++)
|
||||||
|
buf[i + buf_index] = out_buf[i];
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts the useless (but realistic) interleaved subchannel data into a useful (but unrealistic) deinterleaved format.
|
/// Converts the useless (but realistic) interleaved subchannel data into a useful (but unrealistic) deinterleaved format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue