updated how IPC works

This commit is contained in:
nullifiedcat 2017-03-24 22:10:23 +03:00
parent 7db0c01e3d
commit dc6f47aab0
4 changed files with 10 additions and 10 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.d
*.o
bin/*
bin/*
/core

View File

@ -128,7 +128,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
}
if (found_entity && CE_GOOD(found_entity)) {
if (jointeam && team_joining_state == 1 && (g_GlobalVars->curtime - last_jointeam_try) > 1.0f) {
if (jointeam && (g_GlobalVars->curtime - last_jointeam_try) > 1.0f) {
last_jointeam_try = g_GlobalVars->curtime;
switch (CE_INT(found_entity, netvar.iTeamNum)) {
case TEAM_RED:

View File

@ -12,14 +12,6 @@
namespace ipc {
void CommandCallback(cat_ipc::command_s& command, void* payload) {
if (!strcmp("exec", (const char*)command.cmd_data) && payload) {
//std::lock_guard<std::mutex> lock(hack::command_stack_mutex);
hack::command_stack().push(std::string((const char*)payload));
} else if (!strcmp("owner", (const char*)command.cmd_data) && payload) {
}
}
std::atomic<bool> thread_running(false);
pthread_t listener_thread { 0 };
@ -50,6 +42,12 @@ CatCommand connect("ipc_connect", "Connect to IPC server", []() {
logging::Info("peer count: %i", peer->memory->peer_count);
logging::Info("magic number: 0x%08x", peer->memory->global_data.magic_number);
logging::Info("magic number offset: 0x%08x", (uintptr_t)&peer->memory->global_data.magic_number - (uintptr_t)peer->memory);
peer->SetCommandHandler(commands::execute_client_cmd, [](cat_ipc::command_s& command, void* payload) {
hack::command_stack().push(std::string((const char*)&command.cmd_data));
});
peer->SetCommandHandler(commands::execute_client_cmd_long, [](cat_ipc::command_s& command, void* payload) {
hack::command_stack().push(std::string((const char*)payload));
});
hacks::shared::followbot::AddMessageHandlers(peer);
StoreClientData();
thread_running = true;

View File

@ -12,6 +12,7 @@ void LocalPlayer::Update() {
entity_idx = g_IEngine->GetLocalPlayer();
entity = ENTITY(entity_idx);
if (CE_BAD(entity)) {
team = 0;
return;
}
team = CE_INT(entity, netvar.iTeamNum);