CDImage: Support SBI replacement subchannel Q for cue/bin images

This commit is contained in:
Connor McLaughlin
2019-12-06 16:23:08 +10:00
parent 53621bd3eb
commit bc44d4b1b0
11 changed files with 226 additions and 22 deletions

View File

@ -139,15 +139,22 @@ ALWAYS_INLINE constexpr u32 Truncate32(TValue value)
}
// BCD helpers
ALWAYS_INLINE constexpr u8 DecimalToBCD(u8 value)
ALWAYS_INLINE constexpr u8 BinaryToBCD(u8 value)
{
return ((value / 10) << 4) + (value % 10);
}
ALWAYS_INLINE constexpr u8 BCDToDecimal(u8 value)
ALWAYS_INLINE constexpr u8 PackedBCDToBinary(u8 value)
{
return ((value >> 4) * 10) + (value % 16);
}
ALWAYS_INLINE constexpr u8 IsValidBCDDigit(u8 digit)
{
return (digit <= 9);
}
ALWAYS_INLINE constexpr u8 IsValidPackedBCD(u8 value)
{
return IsValidBCDDigit(value & 0x0F) && IsValidBCDDigit(value >> 4);
}
// Boolean to integer
ALWAYS_INLINE constexpr u8 BoolToUInt8(bool value)