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.SendCount = 0;
|
||||||
ServerList::RefreshContainer.SentCount = 0;
|
ServerList::RefreshContainer.SentCount = 0;
|
||||||
|
|
||||||
|
ServerList::RefreshContainer.AwatingList = true;
|
||||||
|
ServerList::RefreshContainer.AwaitTime = Game::Com_Milliseconds();
|
||||||
|
|
||||||
int masterPort = Dvar::Var("masterPort").Get<int>();
|
int masterPort = Dvar::Var("masterPort").Get<int>();
|
||||||
const char* masterServerName = Dvar::Var("masterServerName").Get<const char*>();
|
const char* masterServerName = Dvar::Var("masterServerName").Get<const char*>();
|
||||||
|
|
||||||
ServerList::RefreshContainer.Host = Network::Address(Utils::VA("%s:%u", masterServerName, masterPort));
|
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 IW4 145 full empty");
|
||||||
Network::Send(ServerList::RefreshContainer.Host, "getservers 0 full empty\n");
|
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();
|
ServerList::RefreshContainer.Mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +144,17 @@ namespace Components
|
|||||||
{
|
{
|
||||||
ServerList::RefreshContainer.Mutex.lock();
|
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
|
// Send requests to 10 servers each frame
|
||||||
int SendServers = 10;
|
int SendServers = 10;
|
||||||
|
|
||||||
@ -177,9 +191,12 @@ namespace Components
|
|||||||
{
|
{
|
||||||
if (ServerList::RefreshContainer.Host != address) return; // Only parse from host we sent to
|
if (ServerList::RefreshContainer.Host != address) return; // Only parse from host we sent to
|
||||||
|
|
||||||
|
ServerList::RefreshContainer.AwatingList = false;
|
||||||
|
|
||||||
ServerList::RefreshContainer.Mutex.lock();
|
ServerList::RefreshContainer.Mutex.lock();
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
int count = ServerList::RefreshContainer.Servers.size();
|
||||||
ServerList::MasterEntry* entry = nullptr;
|
ServerList::MasterEntry* entry = nullptr;
|
||||||
|
|
||||||
// Find first entry
|
// 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();
|
ServerList::RefreshContainer.Mutex.unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set default masterServerName + port and save it
|
// 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>(0x60AD90, Game::dvar_flag::DVAR_FLAG_SAVED); // masterServerName
|
||||||
Utils::Hook::Set<BYTE>(0x60ADC6, Game::dvar_flag::DVAR_FLAG_SAVED); // masterPort
|
Utils::Hook::Set<BYTE>(0x60ADC6, Game::dvar_flag::DVAR_FLAG_SAVED); // masterPort
|
||||||
|
|
||||||
|
@ -70,8 +70,12 @@ namespace Components
|
|||||||
Network::Address Target;
|
Network::Address Target;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool AwatingList;
|
||||||
|
int AwaitTime;
|
||||||
|
|
||||||
int SentCount;
|
int SentCount;
|
||||||
int SendCount;
|
int SendCount;
|
||||||
|
|
||||||
Network::Address Host;
|
Network::Address Host;
|
||||||
std::vector<ServerContainer> Servers;
|
std::vector<ServerContainer> Servers;
|
||||||
std::mutex Mutex;
|
std::mutex Mutex;
|
||||||
|
@ -59,7 +59,7 @@ namespace Components
|
|||||||
|
|
||||||
call UIFeeder::SetItemSelection
|
call UIFeeder::SetItemSelection
|
||||||
|
|
||||||
test eax, eax
|
test al, al
|
||||||
jz continue
|
jz continue
|
||||||
|
|
||||||
retn
|
retn
|
||||||
@ -142,7 +142,7 @@ namespace Components
|
|||||||
call UIFeeder::CheckFeeder
|
call UIFeeder::CheckFeeder
|
||||||
pop ebx
|
pop ebx
|
||||||
|
|
||||||
test eax, eax
|
test al, al
|
||||||
jz continueOriginal
|
jz continueOriginal
|
||||||
|
|
||||||
// Get current milliseconds
|
// Get current milliseconds
|
||||||
@ -200,7 +200,7 @@ namespace Components
|
|||||||
|
|
||||||
call UIFeeder::CheckFeeder
|
call UIFeeder::CheckFeeder
|
||||||
|
|
||||||
test eax, eax
|
test al, al
|
||||||
jnz continue
|
jnz continue
|
||||||
|
|
||||||
mov[edi + 130h], esi
|
mov[edi + 130h], esi
|
||||||
@ -220,7 +220,7 @@ namespace Components
|
|||||||
|
|
||||||
call UIFeeder::CheckFeeder
|
call UIFeeder::CheckFeeder
|
||||||
|
|
||||||
test eax, eax
|
test al, al
|
||||||
jnz continue
|
jnz continue
|
||||||
|
|
||||||
mov eax, 4C25D0h
|
mov eax, 4C25D0h
|
||||||
@ -240,7 +240,7 @@ namespace Components
|
|||||||
|
|
||||||
call UIFeeder::CheckFeeder
|
call UIFeeder::CheckFeeder
|
||||||
|
|
||||||
test eax, eax
|
test al, al
|
||||||
jnz continue
|
jnz continue
|
||||||
|
|
||||||
mov eax, 685E10h
|
mov eax, 685E10h
|
||||||
|
@ -82,7 +82,7 @@ namespace Components
|
|||||||
call UIScript::RunMenuScript
|
call UIScript::RunMenuScript
|
||||||
add esp, 8h
|
add esp, 8h
|
||||||
|
|
||||||
test eax, eax
|
test al, al
|
||||||
jz continue
|
jz continue
|
||||||
|
|
||||||
// if returned
|
// if returned
|
||||||
|
Loading…
Reference in New Issue
Block a user