Linux: Always use libpng from system (#381)

* Always use system libpng on Linux
* Remove dependency on boost-crc in DSU (reuse existing implementation)
This commit is contained in:
Exzap 2022-10-17 13:25:49 +02:00 committed by GitHub
parent 753040f73a
commit 665a34e518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 15 deletions

View File

@ -1,6 +1,5 @@
#include "input/api/DSU/DSUMessages.h" #include "input/api/DSU/DSUMessages.h"
#include "util/crypto/crc32.h"
#include <boost/crc.hpp>
constexpr uint32_t kMagicClient = 'CUSD'; constexpr uint32_t kMagicClient = 'CUSD';
constexpr uint32_t kMagicServer = 'SUSD'; constexpr uint32_t kMagicServer = 'SUSD';
@ -17,15 +16,7 @@ void MessageHeader::Finalize(size_t size)
uint32_t MessageHeader::CRC32(size_t size) const uint32_t MessageHeader::CRC32(size_t size) const
{ {
const auto tmp = m_crc32; return crc32_calc(this, size);
m_crc32 = 0;
boost::crc_32_type crc;
crc.process_bytes(this, size);
const auto result = crc.checksum();
m_crc32 = tmp;
return result;
} }
bool MessageHeader::IsClientMessage() const { return m_magic == kMagicClient; } bool MessageHeader::IsClientMessage() const { return m_magic == kMagicClient; }

View File

@ -234,6 +234,7 @@ void ppcAsmTest();
void gx2CopySurfaceTest(); void gx2CopySurfaceTest();
void ExpressionParser_test(); void ExpressionParser_test();
void FSTVolumeTest(); void FSTVolumeTest();
void CRCTest();
void unitTests() void unitTests()
{ {
@ -241,6 +242,7 @@ void unitTests()
gx2CopySurfaceTest(); gx2CopySurfaceTest();
ppcAsmTest(); ppcAsmTest();
FSTVolumeTest(); FSTVolumeTest();
CRCTest();
} }
int mainEmulatorHLE() int mainEmulatorHLE()

View File

@ -383,3 +383,12 @@ unsigned int crc32_calc(unsigned int c, const void* data, int length)
} }
return ~c; return ~c;
} }
void CRCTest()
{
std::vector<uint8> testData;
for (uint8 i = 0; i < 89; i++)
testData.emplace_back(i);
uint32 r = crc32_calc(0, testData.data(), testData.size());
cemu_assert(r == 0x3fc61683);
}

View File

@ -1,3 +1,8 @@
#pragma once #pragma once
unsigned int crc32_calc(unsigned int c, const void* data, int length); unsigned int crc32_calc(unsigned int c, const void* data, int length);
inline unsigned int crc32_calc(const void* data, int length)
{
return crc32_calc(0, data, length);
}

View File

@ -5,8 +5,11 @@
"dependencies": [ "dependencies": [
"pugixml", "pugixml",
"zlib", "zlib",
"libpng",
"zstd", "zstd",
{
"name": "libpng",
"platform": "!linux"
},
{ {
"name": "libzip", "name": "libzip",
"default-features": false "default-features": false
@ -23,7 +26,6 @@
"boost-dll", "boost-dll",
"boost-optional", "boost-optional",
"boost-signals2", "boost-signals2",
"boost-crc",
"boost-asio", "boost-asio",
"boost-ptr-container", "boost-ptr-container",
"boost-property-tree", "boost-property-tree",