change reclasses, fix autojoin

This commit is contained in:
nullifiedcat 2017-12-10 16:43:23 +03:00
parent a5b2c29818
commit 65727dad8a
17 changed files with 137 additions and 16 deletions

View File

@ -7,9 +7,23 @@
#pragma once #pragma once
#include "reclasses.hpp"
namespace re
{
class CTFGCClientSystem class CTFGCClientSystem
{ {
public: public:
CTFGCClientSystem() = delete;
static CTFGCClientSystem *GTFGCClientSystem(); static CTFGCClientSystem *GTFGCClientSystem();
static void AbandonCurrentMatch(CTFGCClientSystem *);
public:
void AbandonCurrentMatch();
bool BConnectedToMatchServer(bool flag);
bool BHaveLiveMatch();
CTFParty *GetParty();
int JoinMMMatch();
}; };
}

View File

@ -7,6 +7,11 @@
#pragma once #pragma once
#include "reclasses.hpp"
namespace re
{
class CTFParty class CTFParty
{ {
public: public:
@ -18,3 +23,5 @@ public:
return *((int *) party + 19); return *((int *) party + 19);
} }
}; };
}

View File

@ -7,6 +7,9 @@
#pragma once #pragma once
namespace re
{
class CTFPartyClient class CTFPartyClient
{ {
public: public:
@ -17,4 +20,7 @@ public:
static ITFGroupMatchCriteria *MutLocalGroupCriteria(CTFPartyClient *client); static ITFGroupMatchCriteria *MutLocalGroupCriteria(CTFPartyClient *client);
static bool BCanQueueForStandby(CTFPartyClient *this_); static bool BCanQueueForStandby(CTFPartyClient *this_);
static void RequestQueueForMatch(CTFPartyClient *client); static void RequestQueueForMatch(CTFPartyClient *client);
static bool BInQueue(CTFPartyClient *this_);
}; };
}

View File

@ -1,3 +1,8 @@
#include "reclasses.hpp"
namespace re
{
class CTFPlayerShared class CTFPlayerShared
{ {
public: public:
@ -15,3 +20,5 @@ public:
return false; return false;
} }
}; };
}

View File

@ -7,6 +7,11 @@
#pragma once #pragma once
#include "reclasses.hpp"
namespace re
{
class C_BaseCombatWeapon : public C_BaseEntity class C_BaseCombatWeapon : public C_BaseEntity
{ {
public: public:
@ -32,3 +37,5 @@ public:
0)(self); 0)(self);
} }
}; };
}

View File

@ -7,6 +7,11 @@
#pragma once #pragma once
#include "reclasses.hpp"
namespace re
{
class C_BaseEntity class C_BaseEntity
{ {
public: public:
@ -23,3 +28,5 @@ public:
return placeholder; return placeholder;
} }
}; };
}

View File

@ -1,3 +1,10 @@
#pragma once
#include "reclasses.hpp"
namespace re
{
class C_BasePlayer : public C_BaseEntity class C_BasePlayer : public C_BaseEntity
{ {
public: public:
@ -6,3 +13,5 @@ public:
return *((CTFPlayerShared *) (unsigned(self) + 6092)); return *((CTFPlayerShared *) (unsigned(self) + 6092));
} }
}; };
}

View File

@ -7,6 +7,11 @@
#pragma once #pragma once
#include <common.hpp>
namespace re
{
class C_TFWeaponBase : public re::C_BaseCombatWeapon class C_TFWeaponBase : public re::C_BaseCombatWeapon
{ {
public: public:
@ -181,3 +186,5 @@ public:
return *(float *) (unsigned(self) + 2616u); return *(float *) (unsigned(self) + 2616u);
} }
}; };
}

View File

@ -7,6 +7,11 @@
#pragma once #pragma once
#include "reclasses.hpp"
namespace re
{
class C_TFWeaponBaseGun : public C_TFWeaponBase class C_TFWeaponBaseGun : public C_TFWeaponBase
{ {
public: public:
@ -25,3 +30,5 @@ public:
0)(self); 0)(self);
} }
}; };
}

View File

@ -7,6 +7,11 @@
#pragma once #pragma once
#include "reclasses.hpp"
namespace re
{
class C_TFWeaponBaseMelee : public C_TFWeaponBase class C_TFWeaponBaseMelee : public C_TFWeaponBase
{ {
public: public:
@ -18,3 +23,5 @@ public:
0)(self, trace); 0)(self, trace);
} }
}; };
}

View File

@ -7,6 +7,11 @@
#pragma once #pragma once
#include "reclasses.hpp"
namespace re
{
class ITFGroupMatchCriteria class ITFGroupMatchCriteria
{ {
public: public:
@ -18,3 +23,5 @@ public:
public: public:
static int SetMatchGroup(ITFGroupMatchCriteria *this_, int group); static int SetMatchGroup(ITFGroupMatchCriteria *this_, int group);
}; };
}

View File

@ -9,9 +9,6 @@
#include "common.hpp" #include "common.hpp"
namespace re
{
#include "C_BaseEntity.hpp" #include "C_BaseEntity.hpp"
#include "CTFPlayerShared.hpp" #include "CTFPlayerShared.hpp"
#include "C_BasePlayer.hpp" #include "C_BasePlayer.hpp"
@ -20,8 +17,7 @@ namespace re
#include "C_TFWeaponBaseMelee.hpp" #include "C_TFWeaponBaseMelee.hpp"
#include "C_TFWeaponBaseGun.hpp" #include "C_TFWeaponBaseGun.hpp"
#include "CTFGCClientSystem.hpp"
#include "CTFParty.hpp" #include "CTFParty.hpp"
#include "CTFGCClientSystem.hpp"
#include "ITFGroupMatchCriteria.hpp" #include "ITFGroupMatchCriteria.hpp"
#include "CTFPartyClient.hpp" #include "CTFPartyClient.hpp"
}

View File

@ -57,6 +57,7 @@ LIBXOVERLAY=libxoverlay/bin32/libxoverlay.so
INCLUDES=-I. -Iinclude -Iucccccp -isystem/usr/include/c++/6.3.1 -isystem$(SSDK_DIR)/public -isystem$(SSDK_DIR)/mathlib -isystem$(SSDK_DIR)/common -isystem$(SSDK_DIR)/public/tier1 -isystem$(SSDK_DIR)/public/tier0 -isystem$(SSDK_DIR) INCLUDES=-I. -Iinclude -Iucccccp -isystem/usr/include/c++/6.3.1 -isystem$(SSDK_DIR)/public -isystem$(SSDK_DIR)/mathlib -isystem$(SSDK_DIR)/common -isystem$(SSDK_DIR)/public/tier1 -isystem$(SSDK_DIR)/public/tier0 -isystem$(SSDK_DIR)
LDLIBS=-static -l:libc.so.6 -l:libstdc++.so.6 -l:libtier0.so -l:libvstdlib.so LDLIBS=-static -l:libc.so.6 -l:libstdc++.so.6 -l:libtier0.so -l:libvstdlib.so
LDFLAGS=-shared -L$(realpath $(LIB_DIR)) LDFLAGS=-shared -L$(realpath $(LIB_DIR))
#LDFLAGS+=-Wl,--no-undefined
SOURCES=$(shell find $(SRC_DIR) -name "*.c*" -print) SOURCES=$(shell find $(SRC_DIR) -name "*.c*" -print)
ifndef CLANG ifndef CLANG

View File

@ -43,19 +43,21 @@ bool UnassignedClass()
return g_pLocalPlayer->clazz != int(preferred_class); return g_pLocalPlayer->clazz != int(preferred_class);
} }
Timer autoqueue_timer{};
void UpdateSearch() void UpdateSearch()
{ {
if (!auto_queue) if (!auto_queue)
return; return;
if (g_IEngine->IsInGame()) if (g_IEngine->IsInGame())
return; return;
static Timer autoqueue_timer{};
if (autoqueue_timer.test_and_set(5000)) if (autoqueue_timer.test_and_set(5000))
{ {
re::CTFParty *party = re::CTFParty::GetParty(); re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem();
if (!party || re::CTFParty::state_(party) == 0)
{ if (gc && !gc->BConnectedToMatchServer(false) && !gc->BHaveLiveMatch())
{
logging::Info("Starting queue"); logging::Info("Starting queue");
tfmm::queue_start(); tfmm::queue_start();
} }

View File

@ -8,9 +8,11 @@
#include "common.hpp" #include "common.hpp"
#include "e8call.hpp" #include "e8call.hpp"
re::CTFGCClientSystem *re::CTFGCClientSystem::GTFGCClientSystem() using namespace re;
CTFGCClientSystem *CTFGCClientSystem::GTFGCClientSystem()
{ {
typedef re::CTFGCClientSystem *(*GTFGCClientSystem_t)(); typedef CTFGCClientSystem *(*GTFGCClientSystem_t)();
static uintptr_t addr1 = gSignatures.GetClientSignature( static uintptr_t addr1 = gSignatures.GetClientSignature(
"E8 ? ? ? ? 84 C0 0F 85 7B 02 00 00 E8 ? ? ? ? BE 01 00 00 00 89 04 24 " "E8 ? ? ? ? 84 C0 0F 85 7B 02 00 00 E8 ? ? ? ? BE 01 00 00 00 89 04 24 "
"E8 ? ? ? ? 85 C0 0F 84 E5 02 00 00"); "E8 ? ? ? ? 85 C0 0F 84 E5 02 00 00");
@ -20,9 +22,9 @@ re::CTFGCClientSystem *re::CTFGCClientSystem::GTFGCClientSystem()
return GTFGCClientSystem_fn(); return GTFGCClientSystem_fn();
} }
void re::CTFGCClientSystem::AbandonCurrentMatch(re::CTFGCClientSystem *this_) void CTFGCClientSystem::AbandonCurrentMatch()
{ {
typedef void *(*AbandonCurrentMatch_t)(re::CTFGCClientSystem *); typedef void *(*AbandonCurrentMatch_t)(CTFGCClientSystem *);
static uintptr_t addr1 = gSignatures.GetClientSignature( static uintptr_t addr1 = gSignatures.GetClientSignature(
"55 89 E5 57 56 8D 75 C8 53 81 EC 8C 00 00 00 C7 04 24 ? ? ? ? 8B 5D " "55 89 E5 57 56 8D 75 C8 53 81 EC 8C 00 00 00 C7 04 24 ? ? ? ? 8B 5D "
"08 E8 ? ? ? ? C7 44 24 04 91 18 00 00 89 34 24 E8 ? ? ? ? A1 ? ? ? ? " "08 E8 ? ? ? ? C7 44 24 04 91 18 00 00 89 34 24 E8 ? ? ? ? A1 ? ? ? ? "
@ -30,5 +32,35 @@ void re::CTFGCClientSystem::AbandonCurrentMatch(re::CTFGCClientSystem *this_)
static AbandonCurrentMatch_t AbandonCurrentMatch_fn = static AbandonCurrentMatch_t AbandonCurrentMatch_fn =
AbandonCurrentMatch_t(addr1); AbandonCurrentMatch_t(addr1);
AbandonCurrentMatch_fn(this_); AbandonCurrentMatch_fn(this);
}
bool CTFGCClientSystem::BConnectedToMatchServer(bool flag)
{
typedef bool(*BConnectedToMatchServer_t)(CTFGCClientSystem *, bool);
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 53 80 7D 0C 00 8B 55 08 75 1B 8B 82 F8 04 00 00 83 E8 01 83 F8 01 0F 96 C0 8D 74 26 00 5B 5D C3");
static BConnectedToMatchServer_t BConnectedToMatchServer_fn = BConnectedToMatchServer_t(addr);
return BConnectedToMatchServer_fn(this, flag);
}
bool CTFGCClientSystem::BHaveLiveMatch()
{
typedef bool(*BHaveLiveMatch_t)(CTFGCClientSystem *);
static uintptr_t addr = gSignatures.GetClientSignature("55 31 C0 89 E5 53 8B 4D 08 0F B6 91 0F 05 00 00 89 D3 81 E3 F0 00 00 00 74 36 80 FA AF");
static BHaveLiveMatch_t BHaveLiveMatch_fn = BHaveLiveMatch_t(addr);
return BHaveLiveMatch_fn(this);
}
CTFParty *CTFGCClientSystem::GetParty()
{
// TODO
return nullptr;
}
int CTFGCClientSystem::JoinMMMatch()
{
// TODO
return 0;
} }

View File

@ -21,6 +21,11 @@ re::CTFPartyClient *re::CTFPartyClient::GTFPartyClient()
return GTFPartyClient_fn(); return GTFPartyClient_fn();
} }
bool re::CTFPartyClient::BInQueue(re::CTFPartyClient *this_)
{
return *(uint8_t *)((uint8_t *)this_ + 69);
}
int re::CTFPartyClient::SendPartyChat(re::CTFPartyClient *client, int re::CTFPartyClient::SendPartyChat(re::CTFPartyClient *client,
const char *message) const char *message)
{ {

View File

@ -43,6 +43,6 @@ void abandon()
{ {
re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem(); re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem();
if (gc != nullptr) if (gc != nullptr)
re::CTFGCClientSystem::AbandonCurrentMatch(gc); gc->AbandonCurrentMatch();
} }
} }