[Merge] develop
This commit is contained in:
commit
7d64cae095
2
deps/mongoose
vendored
2
deps/mongoose
vendored
@ -1 +1 @@
|
||||
Subproject commit 8c2e641ed748756b07f67cb0749760ab642fe703
|
||||
Subproject commit 02499d672b0eef48c784bd6533f1a24aa1c715b2
|
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
||||
Subproject commit 2ff42dcf2c99105e7b550bfaccb0a42b9721138c
|
||||
Subproject commit 83d681ee2caef1feb009656417830f846382d8ba
|
@ -4,9 +4,10 @@ namespace Components
|
||||
{
|
||||
std::vector<std::string> Bots::BotNames;
|
||||
|
||||
void Bots::InsertBotName(const char* arg)
|
||||
void Bots::BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port)
|
||||
{
|
||||
const char** args = &arg;
|
||||
static int botId = 0;
|
||||
|
||||
if (Bots::BotNames.empty())
|
||||
{
|
||||
FileSystem::File bots("bots.txt");
|
||||
@ -27,27 +28,14 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
if(Bots::BotNames.empty())
|
||||
if (Bots::BotNames.empty())
|
||||
{
|
||||
Bots::BotNames.push_back("bot");
|
||||
}
|
||||
}
|
||||
|
||||
int botId = reinterpret_cast<int>(args[12]);
|
||||
args[12] = Utils::String::VA("%s", Bots::BotNames[botId % Bots::BotNames.size()].data());
|
||||
}
|
||||
|
||||
__declspec(naked) void Bots::BuildConnectStringStub()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
pushad
|
||||
call Bots::InsertBotName
|
||||
popad
|
||||
|
||||
push 6B5D80h // sprintf
|
||||
retn
|
||||
}
|
||||
botId %= Bots::BotNames.size();
|
||||
strncpy_s(buffer, 0x400, Utils::String::VA(connectString, num, Bots::BotNames[botId++].data(), protocol, checksum, statVer, statStuff, port), 0x400);
|
||||
}
|
||||
|
||||
Bots::Bots()
|
||||
@ -56,7 +44,7 @@ namespace Components
|
||||
Utils::Hook::Set<const char*>(0x48ADA6, "connect bot%d \"\\cg_predictItems\\1\\cl_anonymous\\0\\color\\4\\head\\default\\model\\multi\\snaps\\20\\rate\\5000\\name\\%s\\protocol\\%d\\checksum\\%d\\statver\\%d %u\\qport\\%d\"");
|
||||
|
||||
// Intercept sprintf for the connect string
|
||||
Utils::Hook(0x48ADAB, Bots::BuildConnectStringStub, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x48ADAB, Bots::BuildConnectString, HOOK_CALL).install()->quick();
|
||||
}
|
||||
|
||||
Bots::~Bots()
|
||||
|
@ -13,7 +13,6 @@ namespace Components
|
||||
private:
|
||||
static std::vector<std::string> BotNames;
|
||||
|
||||
static void InsertBotName(const char* arg);
|
||||
static void BuildConnectStringStub();
|
||||
static void BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port);
|
||||
};
|
||||
}
|
||||
|
@ -162,19 +162,7 @@ namespace Components
|
||||
}
|
||||
});
|
||||
|
||||
std::string username = "Unknown Soldier";
|
||||
|
||||
if (Steam::Proxy::SteamFriends)
|
||||
{
|
||||
const char* steamName = Steam::Proxy::SteamFriends->GetPersonaName();
|
||||
|
||||
if (steamName && !std::string(steamName).empty())
|
||||
{
|
||||
username = steamName;
|
||||
}
|
||||
}
|
||||
|
||||
return Dvar::Register<const char*>(name, username.data(), Dvar::Flag(flag | Game::dvar_flag::DVAR_FLAG_SAVED).val, description).get<Game::dvar_t*>();
|
||||
return Dvar::Register<const char*>(name, "Unknown Soldier", Dvar::Flag(flag | Game::dvar_flag::DVAR_FLAG_SAVED).val, description).get<Game::dvar_t*>();
|
||||
}
|
||||
|
||||
Dvar::Dvar()
|
||||
|
Loading…
Reference in New Issue
Block a user