[Merge] develop

This commit is contained in:
momo5502 2016-12-15 21:54:23 +01:00
commit 7d64cae095
5 changed files with 11 additions and 36 deletions

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit 8c2e641ed748756b07f67cb0749760ab642fe703 Subproject commit 02499d672b0eef48c784bd6533f1a24aa1c715b2

2
deps/protobuf vendored

@ -1 +1 @@
Subproject commit 2ff42dcf2c99105e7b550bfaccb0a42b9721138c Subproject commit 83d681ee2caef1feb009656417830f846382d8ba

View File

@ -4,9 +4,10 @@ namespace Components
{ {
std::vector<std::string> Bots::BotNames; 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()) if (Bots::BotNames.empty())
{ {
FileSystem::File bots("bots.txt"); FileSystem::File bots("bots.txt");
@ -27,27 +28,14 @@ namespace Components
} }
} }
if(Bots::BotNames.empty()) if (Bots::BotNames.empty())
{ {
Bots::BotNames.push_back("bot"); Bots::BotNames.push_back("bot");
} }
} }
int botId = reinterpret_cast<int>(args[12]); botId %= Bots::BotNames.size();
args[12] = Utils::String::VA("%s", Bots::BotNames[botId % Bots::BotNames.size()].data()); strncpy_s(buffer, 0x400, Utils::String::VA(connectString, num, Bots::BotNames[botId++].data(), protocol, checksum, statVer, statStuff, port), 0x400);
}
__declspec(naked) void Bots::BuildConnectStringStub()
{
__asm
{
pushad
call Bots::InsertBotName
popad
push 6B5D80h // sprintf
retn
}
} }
Bots::Bots() 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\""); 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 // 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() Bots::~Bots()

View File

@ -13,7 +13,6 @@ namespace Components
private: private:
static std::vector<std::string> BotNames; static std::vector<std::string> BotNames;
static void InsertBotName(const char* arg); static void BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port);
static void BuildConnectStringStub();
}; };
} }

View File

@ -162,19 +162,7 @@ namespace Components
} }
}); });
std::string username = "Unknown Soldier"; return Dvar::Register<const char*>(name, "Unknown Soldier", Dvar::Flag(flag | Game::dvar_flag::DVAR_FLAG_SAVED).val, description).get<Game::dvar_t*>();
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*>();
} }
Dvar::Dvar() Dvar::Dvar()