diff --git a/dependencies/ih264d/decoder/x86/ih264d_function_selector.c b/dependencies/ih264d/decoder/x86/ih264d_function_selector.c index 8b4b0ca3..3bcd7efe 100644 --- a/dependencies/ih264d/decoder/x86/ih264d_function_selector.c +++ b/dependencies/ih264d/decoder/x86/ih264d_function_selector.c @@ -77,7 +77,7 @@ void ih264d_init_function_ptr(dec_struct_t *ps_codec) } } -#ifdef __clang__ +#ifndef __WIN32 #include void __cpuid2(signed int* cpuInfo, unsigned int level) diff --git a/src/Cafe/Account/Account.cpp b/src/Cafe/Account/Account.cpp index 0ea74f65..0cbcdb0f 100644 --- a/src/Cafe/Account/Account.cpp +++ b/src/Cafe/Account/Account.cpp @@ -9,6 +9,10 @@ #include "Cafe/IOSU/legacy/iosu_crypto.h" #include "Common/filestream.h" +#ifndef __WIN32 +#include +#endif + std::vector Account::s_account_list; Account::Account(uint32 persistent_id) @@ -65,8 +69,16 @@ 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 + //TODO: Look for fix in libstdc++ + #ifndef __WIN32 + boost::random::uniform_int_distribution dist(std::numeric_limits::min(), std::numeric_limits::max()); + #else + std::uniform_int_distribution dist(std::numeric_limits::min(), std::numeric_limits::max()); + #endif + + 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 +587,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..69a55343 100644 --- a/src/Cemu/nex/prudp.cpp +++ b/src/Cemu/nex/prudp.cpp @@ -4,6 +4,10 @@ #include #include +#ifndef __WIN32 +#include +#endif + void swap(unsigned char *a, unsigned char *b) { int tmp = *a; @@ -111,7 +115,13 @@ void releasePRUDPPort(uint16 port) } std::mt19937_64 prudpRG(GetTickCount()); +//Workaround for static asserts when using uniform_int_distribution +//TODO: Look for fix in libstdc++ +#ifdef __WIN32 std::uniform_int_distribution prudpDis8(0, 0xFF); +#else +boost::random::uniform_int_distribution prudpDis8(0, 0xFF); +#endif 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 dfc36975..249a37f7 100644 --- a/src/util/helpers/helpers.cpp +++ b/src/util/helpers/helpers.cpp @@ -9,6 +9,11 @@ #include "config/ActiveSettings.h" +#ifndef __WIN32 +#include +#endif + + #if BOOST_OS_WINDOWS #include #endif @@ -426,11 +431,17 @@ std::string GenerateRandomString(size_t length, std::string_view characters) std::random_device rd; std::mt19937 gen(rd()); - std::uniform_int_distribution index_dist(0, characters.size() - 1); - for (uint32_t i = 0; i < length; ++i) + //Workaround for static asserts using boost + //TODO: Wait for fix in libstdc++ + #ifdef __WIN32 + std::uniform_int_distribution index_dist(0, characters.size() - 1); + #else + boost::random::uniform_int_distribution index_dist(0, characters.size() - 1); + #endif + for (uint32_t i = 0; i < length; ++i) { result << characters[index_dist(gen)]; } return result.str(); -} \ No newline at end of file +}