Fuck those unit-tests on wine.

This commit is contained in:
momo5502 2016-11-06 14:26:03 +01:00
parent 5710f30376
commit f46f5590ff
3 changed files with 30 additions and 18 deletions

View File

@ -157,32 +157,35 @@ namespace Components
}).detach();
});
News::Terminate = false;
News::Thread = std::thread([] ()
if (!Utils::IsWineEnvironment())
{
Localization::Set("MPUI_CHANGELOG_TEXT", Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/changelog.txt").SetTimeout(5000)->Get());
std::string data = Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/motd.txt").SetTimeout(5000)->Get();
if (!data.empty())
News::Terminate = false;
News::Thread = std::thread([] ()
{
Localization::Set("MPUI_MOTD_TEXT", data);
}
Localization::Set("MPUI_CHANGELOG_TEXT", Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/changelog.txt").SetTimeout(5000)->Get());
if (!Loader::PerformingUnitTests())
{
while (!News::Terminate)
std::string data = Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/motd.txt").SetTimeout(5000)->Get();
if (!data.empty())
{
News::CheckForUpdate();
Localization::Set("MPUI_MOTD_TEXT", data);
}
// Sleep for 3 minutes
for (int i = 0; i < 180 && !News::Terminate; ++i)
if (!Loader::PerformingUnitTests())
{
while (!News::Terminate)
{
std::this_thread::sleep_for(1s);
News::CheckForUpdate();
// Sleep for 3 minutes
for (int i = 0; i < 180 && !News::Terminate; ++i)
{
std::this_thread::sleep_for(1s);
}
}
}
}
});
});
}
}
News::~News()

View File

@ -35,4 +35,11 @@ namespace Utils
LocalFree(messageBuffer);
}
bool IsWineEnvironment()
{
HMODULE hntdll = GetModuleHandleA("ntdll.dll");
if (!hntdll) return false;
return (GetProcAddress(hntdll, "wine_get_version") != nullptr);
}
}

View File

@ -4,6 +4,8 @@ namespace Utils
std::string ParseChallenge(std::string data);
void OutputDebugLastError();
bool IsWineEnvironment();
template <typename T> void Merge(std::vector<T>* target, T* source, size_t length)
{
if (source)