diff --git a/src/Cafe/Account/Account.cpp b/src/Cafe/Account/Account.cpp index 0ea74f65..159e6466 100644 --- a/src/Cafe/Account/Account.cpp +++ b/src/Cafe/Account/Account.cpp @@ -3,12 +3,13 @@ #include "gui/CemuApp.h" #include "util/helpers/SystemException.h" -#include - #include "config/ActiveSettings.h" #include "Cafe/IOSU/legacy/iosu_crypto.h" #include "Common/filestream.h" +#include +#include + std::vector Account::s_account_list; Account::Account(uint32 persistent_id) @@ -65,8 +66,11 @@ Account::Account(uint32 persistent_id, std::wstring_view mii_name) static std::random_device s_random_device; static std::mt19937 s_mte(s_random_device()); - std::uniform_int_distribution dist(std::numeric_limits::min(), std::numeric_limits::max()); - std::generate(m_uuid.begin(), m_uuid.end(), [&]() { return (uint8)dist(s_mte); }); + + // use boost library to escape static asserts in linux builds + boost::random::uniform_int_distribution dist(std::numeric_limits::min(), std::numeric_limits::max()); + + std::generate(m_uuid.begin(), m_uuid.end(), [&]() { return (uint8)dist(s_mte); }); // 1000004 or 2000004 | lower uint32 from uuid from uuid m_transferable_id_base = (0x2000004ULL << 32); @@ -575,4 +579,4 @@ void actPwTest() makePWHash(pwHash, 32, pid, pwHash); // calculates AccountPasswordHash assert_dbg(); -} \ No newline at end of file +} diff --git a/src/Cemu/nex/prudp.cpp b/src/Cemu/nex/prudp.cpp index d3dddda5..7700e5eb 100644 --- a/src/Cemu/nex/prudp.cpp +++ b/src/Cemu/nex/prudp.cpp @@ -4,6 +4,8 @@ #include #include +#include + void swap(unsigned char *a, unsigned char *b) { int tmp = *a; @@ -111,7 +113,8 @@ void releasePRUDPPort(uint16 port) } std::mt19937_64 prudpRG(GetTickCount()); -std::uniform_int_distribution prudpDis8(0, 0xFF); +// workaround for static asserts when using uniform_int_distribution +boost::random::uniform_int_distribution prudpDis8(0, 0xFF); uint8 prudp_generateRandomU8() { diff --git a/src/Common/precompiled.h b/src/Common/precompiled.h index 4ced91a4..ad080e6e 100644 --- a/src/Common/precompiled.h +++ b/src/Common/precompiled.h @@ -1,9 +1,3 @@ -//Temporary Workaround for static_assert related errors in libstdc++12 -//TODO: Make a proper fix -#ifdef __clang__ -#define static_assert(...) static_assert(true, "") -#endif - #pragma once #include // for size_t diff --git a/src/util/helpers/helpers.cpp b/src/util/helpers/helpers.cpp index 2a076aca..a52aa439 100644 --- a/src/util/helpers/helpers.cpp +++ b/src/util/helpers/helpers.cpp @@ -9,6 +9,9 @@ #include "config/ActiveSettings.h" +#include + + #if BOOST_OS_WINDOWS #include #endif @@ -427,7 +430,9 @@ std::string GenerateRandomString(const size_t length, const std::string_view cha std::random_device rd; std::mt19937 gen(rd()); - std::uniform_int_distribution index_dist(0, characters.size() - 1); + + // workaround for static asserts using boost + boost::random::uniform_int_distribution index_dist(0, characters.size() - 1); std::generate_n( result.begin(), length, diff --git a/vcpkg.json b/vcpkg.json index 8a5095f5..519a5618 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -29,6 +29,7 @@ "boost-ptr-container", "boost-property-tree", "boost-static-string", + "boost-random", "fmt", "glm", "glslang",