Add various party related signatures

This commit is contained in:
Unnamed 2019-01-16 17:42:25 +00:00
parent f05021cfaa
commit 3a89bed924
4 changed files with 89 additions and 36 deletions

View File

@ -15,7 +15,7 @@ class CTFPartyClient
public:
static CTFPartyClient *GTFPartyClient();
static int SendPartyChat(CTFPartyClient *client, const char *message);
void SendPartyChat(const char *message);
int LoadSavedCasualCriteria();
static ITFGroupMatchCriteria *MutLocalGroupCriteria(CTFPartyClient *client);
static bool BCanQueueForStandby(CTFPartyClient *this_);
@ -29,6 +29,9 @@ public:
static bool BInQueue(CTFPartyClient *this_);
int GetNumOnlineMembers();
int GetNumMembers();
int PromotePlayerToLeader(CSteamID steamid);
int KickPlayer(CSteamID steamid);
bool GetCurrentPartyLeader(CSteamID &id);
};
class ITFMatchGroupDescription
{

View File

@ -27,7 +27,7 @@ void CTFGCClientSystem::AbandonCurrentMatch()
static AbandonCurrentMatch_t AbandonCurrentMatch_fn = AbandonCurrentMatch_t(addr1);
if (AbandonCurrentMatch_fn == nullptr)
{
logging::Info("calling NULL!");
logging::Info("CTFGCClientSystem::AbandonCurrentMatch() calling NULL!");
}
AbandonCurrentMatch_fn(this);
}
@ -47,7 +47,7 @@ bool CTFGCClientSystem::BHaveLiveMatch()
static uintptr_t addr = gSignatures.GetClientSignature("55 31 C0 89 E5 53 8B 4D ? 0F B6 91");
if (!addr)
{
logging::Info("calling NULL!");
logging::Info("CTFGCClientSystem::BHaveLiveMatch() calling NULL!");
addr = gSignatures.GetClientSignature("55 31 C0 89 E5 53 8B 4D ? 0F B6 91");
return true;
}
@ -68,7 +68,7 @@ int CTFGCClientSystem::JoinMMMatch()
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 56 53 83 EC ? 8B 5D ? 0F B6 83 ? ? ? ? 89 C2");
if (!addr)
{
logging::Info("calling NULL!");
logging::Info("CTFGCClientSystem::JoinMMMatch() calling NULL!");
addr = gSignatures.GetClientSignature("55 89 E5 56 53 83 EC ? 8B 5D ? 0F B6 83 ? ? ? ? 89 C2");
return true;
}

View File

@ -37,9 +37,13 @@ int re::CTFPartyClient::GetNumMembers()
return GetNumMembers_fn(this);
}
int re::CTFPartyClient::SendPartyChat(re::CTFPartyClient *client, const char *message)
void re::CTFPartyClient::SendPartyChat(const char *message)
{
// todo
typedef void (*SendPartyChat_t)(re::CTFPartyClient *, const char *);
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 81 EC ? ? ? ? 8B 5D 0C 89 1C 24");
static SendPartyChat_t SendPartyChat_fn = SendPartyChat_t(addr);
SendPartyChat_fn(this, message);
}
bool re::CTFPartyClient::BCanQueueForStandby(re::CTFPartyClient *this_)
@ -65,8 +69,7 @@ int re::CTFPartyClient::LoadSavedCasualCriteria()
{
typedef int (*LoadSavedCasualCriteria_t)(re::CTFPartyClient *);
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 8B 45 ? 5D 8B 80 ? ? ? ? C3 66 90 55 89 E5 "
"8B 45 ? 5D 0F B6 80 ? ? ? ? C3 90 55 89 E5 56") -
0x40;
"8B 45 ? 5D 0F B6 80 ? ? ? ? C3 90 55 89 E5 56") - 0x40;
static LoadSavedCasualCriteria_t LoadSavedCasualCriteria_fn = LoadSavedCasualCriteria_t(addr);
return LoadSavedCasualCriteria_fn(this);
@ -118,12 +121,37 @@ int re::CTFPartyClient::BInvitePlayerToParty(CSteamID steamid)
}
int re::CTFPartyClient::BRequestJoinPlayer(CSteamID steamid)
{
// 55 89 E5 57 56 53 81 EC 8C 00 00 00 8B 45 14 8B 55 10 89 45 A4 8B 45 0C
typedef int (*BRequestJoinPlayer_t)(re::CTFPartyClient *, CSteamID, bool);
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 81 EC ? ? ? ? 8B 45 ? 8B 5D ? 8B 55 ? 89 85 ? ? ? ? "
"65 A1 ? ? ? ? 89 45 ? 31 C0 8B 45");
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 81 EC ? ? ? ? 8B 45 14 8B 55 ? 89 45 ? 8B");
static BRequestJoinPlayer_t BRequestJoinPlayer_fn = BRequestJoinPlayer_t(addr);
return BRequestJoinPlayer_fn(this, steamid, false);
}
int re::CTFPartyClient::PromotePlayerToLeader(CSteamID steamid)
{
typedef int (*PromotePlayerToLeader_t)(re::CTFPartyClient *, CSteamID);
static uintptr_t addr = gSignatures.GetClientSignature("8B 55 08 8B 8A A0 01 00 00 8B 92 9C 01 00 00 89 04 24 89 4C 24 08 89 54 24 04 E8") + 27;
static PromotePlayerToLeader_t PromotePlayerToLeader_fn = PromotePlayerToLeader_t(e8call(reinterpret_cast<void *>(addr)));
return PromotePlayerToLeader_fn(this, steamid);
}
int re::CTFPartyClient::KickPlayer(CSteamID steamid)
{
typedef int (*KickPlayer_t)(re::CTFPartyClient *, CSteamID);
static uintptr_t addr = gSignatures.GetClientSignature("8B 93 9C 01 00 00 8B 8B A0 01 00 00 89 04 24 89 54 24 04 89 4C 24 08 E8") + 24;
static KickPlayer_t KickPlayer_fn = KickPlayer_t(e8call(reinterpret_cast<void *>(addr)));
return KickPlayer_fn(this, steamid);
}
bool re::CTFPartyClient::GetCurrentPartyLeader(CSteamID &id)
{
uintptr_t party = *reinterpret_cast<uintptr_t *>(reinterpret_cast<uintptr_t>(this) + 0x30);
if (!party)
return false;
id = *reinterpret_cast<CSteamID *>(party + 0x1C);
return true;
}
re::ITFMatchGroupDescription *re::GetMatchGroupDescription(int &idx)
{
typedef re::ITFMatchGroupDescription *(*GetMatchGroupDescription_t)(int &);

View File

@ -31,6 +31,40 @@ CatCommand get_state("mm_state", "Get party state", []() {
});
static CatCommand mm_stop_queue("mm_stop_queue", "Stop current TF2 MM queue", []() { tfmm::leaveQueue(); });
static CatCommand mm_debug_leader("mm_debug_leader", "Get party's leader", []() {
CSteamID id;
bool success = re::CTFPartyClient::GTFPartyClient()->GetCurrentPartyLeader(id);
if (success)
logging::Info("%u", id.GetAccountID());
else
logging::Info("Failed to get party leader");
});
static CatCommand mm_debug_promote("mm_debug_promote", "Promote player to leader", [](const CCommand &args) {
if (args.ArgC() < 2)
return;
uint32_t id32 = std::strtoul(args.Arg(1), nullptr, 10);
CSteamID id(id32, EUniverse::k_EUniversePublic, EAccountType::k_EAccountTypeIndividual);
logging::Info("Attempting to promote %u", id);
int succ = re::CTFPartyClient::GTFPartyClient()->PromotePlayerToLeader(id);
logging::Info("Success ? %d", succ);
});
static CatCommand mm_debug_kick("mm_debug_kick", "Kick player from party", [](const CCommand &args) {
if (args.ArgC() < 2)
return;
uint32_t id32 = std::strtoul(args.Arg(1), nullptr, 10);
CSteamID id(id32, EUniverse::k_EUniversePublic, EAccountType::k_EAccountTypeIndividual);
logging::Info("Attempting to kick %u", id);
int succ = re::CTFPartyClient::GTFPartyClient()->KickPlayer(id);
logging::Info("Success ? %d", succ);
});
static CatCommand mm_debug_chat("mm_debug_chat", "Debug party chat", [](const CCommand &args) {
if (args.ArgC() <= 1)
return;
re::CTFPartyClient::GTFPartyClient()->SendPartyChat(args.ArgS());
});
namespace tfmm
{
@ -83,19 +117,7 @@ void leaveQueue()
void disconnectAndAbandon()
{
re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient();
re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem();
if (client)
abandon();
else
{
logging::Info("your party client is gay!");
if (gc)
leaveQueue();
else
logging::Info("your gc is gay!");
}
if (gc && client)
leaveQueue();
}