[General] Small fixes

This commit is contained in:
momo5502 2017-06-21 15:11:33 +02:00
parent 185bb4a291
commit 2d2c4c2c31
4 changed files with 18 additions and 16 deletions

View File

@ -491,7 +491,7 @@ namespace Components
void Console::FreeNativeConsole()
{
if (!Monitor::IsEnabled() && !Flags::HasFlag("stdout") && (!Dedicated::IsEnabled() || Flags::HasFlag("console")))
if (!Monitor::IsEnabled() && !Flags::HasFlag("stdout") && (!Dedicated::IsEnabled() || Flags::HasFlag("console")) && !Loader::PerformingUnitTests())
{
FreeConsole();
}
@ -643,7 +643,7 @@ namespace Components
Utils::Hook(0x43D570, Console::Error, HOOK_JUMP).install()->quick();
Utils::Hook(0x4859A5, Console::Input, HOOK_CALL).install()->quick();
}
else
else if(!Loader::PerformingUnitTests())
{
FreeConsole();
}

View File

@ -345,12 +345,10 @@ namespace Components
{
Logger::Error("The fastfile you are trying to load is outdated (%d, expected %d)", header[1], XFILE_VERSION_IW4X);
}
#ifdef DEBUG
else if (header[1] > XFILE_VERSION_IW4X)
{
Logger::Error("You are loading a fastfile that is too new (%d, expected %d), how's that possible?", header[1], XFILE_VERSION_IW4X);
Logger::Error("You are loading a fastfile that is too new (%d, expected %d), update your game", header[1], XFILE_VERSION_IW4X);
}
#endif
*reinterpret_cast<unsigned __int64*>(header) = XFILE_MAGIC_UNSIGNED;
}

View File

@ -6,12 +6,12 @@ namespace Steam
{
unsigned int Utils::GetSecondsSinceAppActive()
{
return 0;
return Game::Sys_Milliseconds() / 1000;
}
unsigned int Utils::GetSecondsSinceComputerActive()
{
return 0;
return timeGetTime();
}
int Utils::GetConnectedUniverse()
@ -21,12 +21,10 @@ namespace Steam
unsigned int Utils::GetServerRealTime()
{
static ::std::optional<unsigned int> timeDelta;
static std::optional<unsigned int> timeDelta;
if(!timeDelta.has_value())
{
unsigned int steamTime = static_cast<unsigned int>(time(nullptr));
if(Steam::Proxy::SteamUtils)
{
steamTime = Steam::Proxy::SteamUtils->GetServerRealTime();
@ -40,6 +38,11 @@ namespace Steam
const char* Utils::GetIPCountry()
{
if (Steam::Proxy::SteamUtils)
{
return Steam::Proxy::SteamUtils->GetIPCountry();
}
return "US";
}
@ -60,6 +63,11 @@ namespace Steam
unsigned char Utils::GetCurrentBatteryPower()
{
if (Steam::Proxy::SteamUtils)
{
return Steam::Proxy::SteamUtils->GetCurrentBatteryPower();
}
return 255;
}

View File

@ -48,10 +48,8 @@ namespace Utils
{
ECC::Key key;
register_prng(&sprng_desc);
ltc_mp = ltm_desc;
register_prng(&sprng_desc);
ecc_make_key(nullptr, find_prng("sprng"), bits / 8, key.getKeyPtr());
return key;
@ -64,10 +62,8 @@ namespace Utils
uint8_t buffer[512];
DWORD length = sizeof(buffer);
register_prng(&sprng_desc);
ltc_mp = ltm_desc;
register_prng(&sprng_desc);
ecc_sign_hash(reinterpret_cast<const uint8_t*>(message.data()), message.size(), buffer, &length, nullptr, find_prng("sprng"), key.getKeyPtr());
return std::string(reinterpret_cast<char*>(buffer), length);