Fix uiscript and feeders.
This commit is contained in:
parent
7804e693c2
commit
189f1cc965
@ -74,11 +74,16 @@ namespace Components
|
||||
ServerList::RefreshContainer.SendCount = 0;
|
||||
ServerList::RefreshContainer.SentCount = 0;
|
||||
|
||||
ServerList::RefreshContainer.AwatingList = true;
|
||||
ServerList::RefreshContainer.AwaitTime = Game::Com_Milliseconds();
|
||||
|
||||
int masterPort = Dvar::Var("masterPort").Get<int>();
|
||||
const char* masterServerName = Dvar::Var("masterServerName").Get<const char*>();
|
||||
|
||||
ServerList::RefreshContainer.Host = Network::Address(Utils::VA("%s:%u", masterServerName, masterPort));
|
||||
|
||||
Logger::Print("Sending serverlist request to master: %s:%u\n", masterServerName, masterPort);
|
||||
|
||||
//Network::Send(ServerList::RefreshContainer.Host, "getservers IW4 145 full empty");
|
||||
Network::Send(ServerList::RefreshContainer.Host, "getservers 0 full empty\n");
|
||||
}
|
||||
@ -132,8 +137,6 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
Logger::Print("Current server count: %d\n", ServerList::OnlineList.size());
|
||||
|
||||
ServerList::RefreshContainer.Mutex.unlock();
|
||||
}
|
||||
|
||||
@ -141,6 +144,17 @@ namespace Components
|
||||
{
|
||||
ServerList::RefreshContainer.Mutex.lock();
|
||||
|
||||
if (ServerList::RefreshContainer.AwatingList)
|
||||
{
|
||||
// Check if we haven't got a response within 10 seconds
|
||||
if (Game::Com_Milliseconds() - ServerList::RefreshContainer.AwaitTime > 5000)
|
||||
{
|
||||
ServerList::RefreshContainer.AwatingList = false;
|
||||
|
||||
Logger::Print("We haven't received a response from the master within %d seconds!\n", (Game::Com_Milliseconds() - ServerList::RefreshContainer.AwaitTime) / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
// Send requests to 10 servers each frame
|
||||
int SendServers = 10;
|
||||
|
||||
@ -177,9 +191,12 @@ namespace Components
|
||||
{
|
||||
if (ServerList::RefreshContainer.Host != address) return; // Only parse from host we sent to
|
||||
|
||||
ServerList::RefreshContainer.AwatingList = false;
|
||||
|
||||
ServerList::RefreshContainer.Mutex.lock();
|
||||
|
||||
int offset = 0;
|
||||
int count = ServerList::RefreshContainer.Servers.size();
|
||||
ServerList::MasterEntry* entry = nullptr;
|
||||
|
||||
// Find first entry
|
||||
@ -217,13 +234,13 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
Logger::Print("Parsed %d servers from master\n", ServerList::RefreshContainer.Servers.size());
|
||||
Logger::Print("Parsed %d servers from master\n", ServerList::RefreshContainer.Servers.size() - count);
|
||||
|
||||
ServerList::RefreshContainer.Mutex.unlock();
|
||||
});
|
||||
|
||||
// Set default masterServerName + port and save it
|
||||
//Utils::Hook::Set<const char*>(0x60AD92, "localhost");
|
||||
Utils::Hook::Set<const char*>(0x60AD92, "localhost");
|
||||
Utils::Hook::Set<BYTE>(0x60AD90, Game::dvar_flag::DVAR_FLAG_SAVED); // masterServerName
|
||||
Utils::Hook::Set<BYTE>(0x60ADC6, Game::dvar_flag::DVAR_FLAG_SAVED); // masterPort
|
||||
|
||||
|
@ -70,8 +70,12 @@ namespace Components
|
||||
Network::Address Target;
|
||||
};
|
||||
|
||||
bool AwatingList;
|
||||
int AwaitTime;
|
||||
|
||||
int SentCount;
|
||||
int SendCount;
|
||||
|
||||
Network::Address Host;
|
||||
std::vector<ServerContainer> Servers;
|
||||
std::mutex Mutex;
|
||||
|
@ -59,7 +59,7 @@ namespace Components
|
||||
|
||||
call UIFeeder::SetItemSelection
|
||||
|
||||
test eax, eax
|
||||
test al, al
|
||||
jz continue
|
||||
|
||||
retn
|
||||
@ -142,7 +142,7 @@ namespace Components
|
||||
call UIFeeder::CheckFeeder
|
||||
pop ebx
|
||||
|
||||
test eax, eax
|
||||
test al, al
|
||||
jz continueOriginal
|
||||
|
||||
// Get current milliseconds
|
||||
@ -200,7 +200,7 @@ namespace Components
|
||||
|
||||
call UIFeeder::CheckFeeder
|
||||
|
||||
test eax, eax
|
||||
test al, al
|
||||
jnz continue
|
||||
|
||||
mov[edi + 130h], esi
|
||||
@ -220,7 +220,7 @@ namespace Components
|
||||
|
||||
call UIFeeder::CheckFeeder
|
||||
|
||||
test eax, eax
|
||||
test al, al
|
||||
jnz continue
|
||||
|
||||
mov eax, 4C25D0h
|
||||
@ -240,7 +240,7 @@ namespace Components
|
||||
|
||||
call UIFeeder::CheckFeeder
|
||||
|
||||
test eax, eax
|
||||
test al, al
|
||||
jnz continue
|
||||
|
||||
mov eax, 685E10h
|
||||
|
@ -82,7 +82,7 @@ namespace Components
|
||||
call UIScript::RunMenuScript
|
||||
add esp, 8h
|
||||
|
||||
test eax, eax
|
||||
test al, al
|
||||
jz continue
|
||||
|
||||
// if returned
|
||||
|
Loading…
Reference in New Issue
Block a user