mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-29 12:34:17 +01:00
Fix CRC errors on MacOS(/Linux?) (#375)
Fixes graphic packs (like FPS++) not working even when enabled.
This commit is contained in:
parent
df0e2f7881
commit
f0938e1a23
@ -322,29 +322,34 @@ unsigned int crc32_calc_slice_by_8(unsigned int previousCrc32, const void* data,
|
|||||||
// process eight bytes at once (Slicing-by-8)
|
// process eight bytes at once (Slicing-by-8)
|
||||||
while (length >= 8)
|
while (length >= 8)
|
||||||
{
|
{
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
if constexpr (std::endian::native == std::endian::big){
|
||||||
uint32_t one = *current++ ^ swap(crc);
|
uint32_t one = *current++ ^ swap(crc);
|
||||||
uint32_t two = *current++;
|
uint32_t two = *current++;
|
||||||
crc = Crc32Lookup[0][two & 0xFF] ^
|
crc = Crc32Lookup[0][two & 0xFF] ^
|
||||||
Crc32Lookup[1][(two >> 8) & 0xFF] ^
|
Crc32Lookup[1][(two >> 8) & 0xFF] ^
|
||||||
Crc32Lookup[2][(two >> 16) & 0xFF] ^
|
Crc32Lookup[2][(two >> 16) & 0xFF] ^
|
||||||
Crc32Lookup[3][(two >> 24) & 0xFF] ^
|
Crc32Lookup[3][(two >> 24) & 0xFF] ^
|
||||||
Crc32Lookup[4][one & 0xFF] ^
|
Crc32Lookup[4][one & 0xFF] ^
|
||||||
Crc32Lookup[5][(one >> 8) & 0xFF] ^
|
Crc32Lookup[5][(one >> 8) & 0xFF] ^
|
||||||
Crc32Lookup[6][(one >> 16) & 0xFF] ^
|
Crc32Lookup[6][(one >> 16) & 0xFF] ^
|
||||||
Crc32Lookup[7][(one >> 24) & 0xFF];
|
Crc32Lookup[7][(one >> 24) & 0xFF];
|
||||||
#else
|
}
|
||||||
uint32_t one = *current++ ^ crc;
|
else if constexpr (std::endian::native == std::endian::little)
|
||||||
uint32_t two = *current++;
|
{
|
||||||
crc = Crc32Lookup[0][(two >> 24) & 0xFF] ^
|
uint32_t one = *current++ ^ crc;
|
||||||
Crc32Lookup[1][(two >> 16) & 0xFF] ^
|
uint32_t two = *current++;
|
||||||
Crc32Lookup[2][(two >> 8) & 0xFF] ^
|
crc = Crc32Lookup[0][(two >> 24) & 0xFF] ^
|
||||||
Crc32Lookup[3][two & 0xFF] ^
|
Crc32Lookup[1][(two >> 16) & 0xFF] ^
|
||||||
Crc32Lookup[4][(one >> 24) & 0xFF] ^
|
Crc32Lookup[2][(two >> 8) & 0xFF] ^
|
||||||
Crc32Lookup[5][(one >> 16) & 0xFF] ^
|
Crc32Lookup[3][two & 0xFF] ^
|
||||||
Crc32Lookup[6][(one >> 8) & 0xFF] ^
|
Crc32Lookup[4][(one >> 24) & 0xFF] ^
|
||||||
Crc32Lookup[7][one & 0xFF];
|
Crc32Lookup[5][(one >> 16) & 0xFF] ^
|
||||||
#endif
|
Crc32Lookup[6][(one >> 8) & 0xFF] ^
|
||||||
|
Crc32Lookup[7][one & 0xFF];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cemu_assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
length -= 8;
|
length -= 8;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user