Add skybox changer

This commit is contained in:
BenCat07 2018-04-06 12:43:29 +02:00
parent 2a5f063aba
commit f7f8a1ad9f
15 changed files with 130 additions and 43 deletions

1
include/hooks/hookedmethods.hpp Executable file → Normal file
View File

@ -21,6 +21,7 @@ typedef bool (*DispatchUserMessage_t)(void *, int, bf_read &);
typedef void (*FrameStageNotify_t)(void *, int);
typedef void (*LevelInit_t)(void *, const char *);
typedef void (*LevelShutdown_t)(void *);
typedef void (*BeginFrame_t)(IStudioRender *);
typedef bool (*CanInspect_t)(IClientEntity *);
typedef void (*DrawModelExecute_t)(IVModelRender *, const DrawModelState_t &,

View File

@ -21,6 +21,7 @@ public:
static bool BCanQueueForStandby(CTFPartyClient *this_);
char RequestQueueForMatch(int type);
char RequestLeaveForMatch(int type);
int BInvitePlayerToParty(int steamid);
static bool BInQueue(CTFPartyClient *this_);
};
}

18
include/reclasses/ITFGroupMatchCriteria.hpp Executable file → Normal file
View File

@ -17,15 +17,15 @@ class ITFGroupMatchCriteria
public:
enum group
{
MvmPractice = 0,
MvmMannup = 1,
LadderMatch6v6 = 2,
LadderMatch9v9 = 3,
LadderMatch12v12 = 4,
CasualMatch6v6 = 5,
CasualMatch9v9 = 6,
CasualMatch12v12 = 7,
CompetitiveEventMatch12v12 = 8
MvmPractice = 0,
MvmMannup = 1,
LadderMatch6v6 = 2,
LadderMatch9v9 = 3,
LadderMatch12v12 = 4,
CasualMatch6v6 = 5,
CasualMatch9v9 = 6,
CasualMatch12v12 = 7,
CompetitiveEventMatch12v12 = 8
};
public:

View File

@ -14,7 +14,8 @@
CatVar enable_spinner(CV_SWITCH, "fidgetspinner", "0", "Fidget Spinner",
"Part of Cathook Autism Awareness program");
CatVar v9mode(CV_SWITCH, "nullcore_mode", "0", "Nullcore mode", "Part of Cathook Autism Awareness program");
CatVar v9mode(CV_SWITCH, "nullcore_mode", "0", "Nullcore mode",
"Part of Cathook Autism Awareness program");
float spinning_speed = 0.0f;
float angle = 0;
@ -96,7 +97,8 @@ void DrawSpinner()
while (!tex)
tex = glez_texture_load_png_rgba("/opt/cathook/data/res/atlas.png");
glez_rect_textured(draw::width / 2, draw::height / 2, size, size, color,
tex, 0 + 64 * state, (3 + (v9mode ? 1 : 0)) * 64, 64, 64, angle);
tex, 0 + 64 * state, (3 + (v9mode ? 1 : 0)) * 64, 64, 64,
angle);
if (angle > PI * 4)
angle -= PI * 4;
}

View File

@ -211,7 +211,6 @@ free(logname);*/
EndConVars();
#if ENABLE_VISUALS == 1
draw::Initialize();
#if ENABLE_GUI

5
src/hacks/AutoJoin.cpp Executable file → Normal file
View File

@ -28,6 +28,8 @@ CatVar preferred_class(classes_enum, "autojoin_class", "0", "AutoJoin class",
CatVar auto_queue(CV_SWITCH, "autoqueue", "0", "AutoQueue",
"Automatically queue in casual matches");
CatVar party_bypass(CV_SWITCH, "party_bypass", "1", "Party bypass",
"Bypass Join block when not friended");
const std::string classnames[] = { "scout", "sniper", "soldier",
"demoman", "medic", "heavyweapons",
@ -53,7 +55,7 @@ void UpdateSearch()
return;
if (g_pUserCmd)
tfmm::queue_leave();
tfmm::queue_leave();
if (autoqueue_timer.test_and_set(30000))
{
re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem();
@ -66,7 +68,6 @@ void UpdateSearch()
}
Timer timer{};
void Update()
{
if (timer.test_and_set(500))

20
src/hacks/ESP.cpp Executable file → Normal file
View File

@ -393,7 +393,7 @@ void _FASTCALL emoji(CachedEntity *ent)
float size = emoji_esp_scaling ? fabs(hbm.y - hbx.y)
: float(emoji_esp_size);
if (v9mode)
size *= 1.4;
size *= 1.4;
if (!size || !float(emoji_min_size))
return;
if (emoji_esp_scaling && (size < float(emoji_min_size)))
@ -401,7 +401,7 @@ void _FASTCALL emoji(CachedEntity *ent)
size = float(emoji_min_size);
}
glez_rgba_t white = glez_rgba(255, 255, 255, 255);
while (!textur)
while (!textur)
textur = glez_texture_load_png_rgba(
"/opt/cathook/data/res/atlas.png");
player_info_s info;
@ -432,18 +432,18 @@ void _FASTCALL emoji(CachedEntity *ent)
"/opt/cathook/data/res/idspec.png");
if (idspecific)
glez_rect_textured(head_scr.x - size / 2,
head_scr.y - size / 2,
size, size, white,
idspecific, i * 64,
1 * 64, 64, 64, 0);
head_scr.y - size / 2, size,
size, white, idspecific,
i * 64, 1 * 64, 64, 64, 0);
hascall = true;
}
}
if (textur && !hascall)
draw_api::draw_rect_textured(head_scr.x - size / 2,
head_scr.y - size / 2, size,
size, colors::white, {textur}, (3 + (v9mode ? 3 : (int)emoji_esp)) * 64,
3 * 64, 64, 64, 0);
draw_api::draw_rect_textured(
head_scr.x - size / 2, head_scr.y - size / 2, size,
size, colors::white, { textur },
(3 + (v9mode ? 3 : (int) emoji_esp)) * 64, 3 * 64,
64, 64, 0);
}
}
}

View File

@ -96,6 +96,7 @@ VMTHook baseclientstate8{};
VMTHook clientmode{};
VMTHook panel{};
VMTHook client{};
VMTHook ctfpartyclient;
VMTHook netchannel{};
VMTHook clientdll{};
VMTHook matsurface{};

0
src/hooks/PaintTraverse.cpp Executable file → Normal file
View File

73
src/hooks/others.cpp Executable file → Normal file
View File

@ -895,12 +895,83 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
votelogger::user_message(buf, type);
return original(_this, type, buf);
}
const char *skynum[] = { "sky_tf2_04",
"sky_upward",
"sky_dustbowl_01",
"sky_goldrush_01",
"sky_granary_01",
"sky_well_01",
"sky_gravel_01",
"sky_badlands_01",
"sky_hydro_01",
"sky_night_01",
"sky_nightfall_01",
"sky_trainyard_01",
"sky_stormfront_01",
"sky_morningsnow_01",
"sky_alpinestorm_01",
"sky_harvest_01",
"sky_harvest_night_01",
"sky_halloween",
"sky_halloween_night_01",
"sky_halloween_night2014_01",
"sky_island_01",
"sky_jungle_01",
"sky_invasion2fort_01",
"sky_well_02",
"sky_outpost_01",
"sky_coastal_01",
"sky_rainbow_01",
"sky_badlands_pyroland_01",
"sky_pyroland_01",
"sky_pyroland_02",
"sky_pyroland_03" };
CatEnum skys({ "sky_tf2_04",
"sky_upward",
"sky_dustbowl_01",
"sky_goldrush_01",
"sky_granary_01",
"sky_well_01",
"sky_gravel_01",
"sky_badlands_01",
"sky_hydro_01",
"sky_night_01",
"sky_nightfall_01",
"sky_trainyard_01",
"sky_stormfront_01",
"sky_morningsnow_01",
"sky_alpinestorm_01",
"sky_harvest_01",
"sky_harvest_night_01",
"sky_halloween",
"sky_halloween_night_01",
"sky_halloween_night2014_01",
"sky_island_01",
"sky_jungle_01",
"sky_invasion2fort_01",
"sky_well_02",
"sky_outpost_01",
"sky_coastal_01",
"sky_rainbow_01",
"sky_badlands_pyroland_01",
"sky_pyroland_01",
"sky_pyroland_02",
"sky_pyroland_03" });
static CatVar skybox_changer(skys, "skybox_changer", "0", "Change Skybox to this skybox",
"Change Skybox to this skybox, only changes on map load");
void LevelInit_hook(void *_this, const char *newmap)
{
static const LevelInit_t original =
(LevelInit_t) hooks::clientmode.GetMethod(offsets::LevelInit());
playerlist::Save();
typedef bool *(*LoadNamedSkys_Fn)(const char *);
uintptr_t addr =
gSignatures.GetEngineSignature("55 89 E5 57 31 FF 56 8D B5 ? ? ? ? 53 "
"81 EC ? ? ? ? C7 85 ? ? ? ? ? ? ? ?");
static LoadNamedSkys_Fn LoadNamedSkys = LoadNamedSkys_Fn(addr);
bool load_success = LoadNamedSkys(skynum[(int)skybox_changer]);
logging::Info("Skybox Loading successful: %s",
load_success ? "true" : "false");
g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec");
hacks::shared::aimbot::Reset();
chat_stack::Reset();

View File

@ -653,6 +653,7 @@ static const std::string list_tf2 = R"(
]
"Misc" [
"Misc Menu"
"skybox_changer"
"name"
"disconnect_reason"
"pure_bypass"
@ -725,6 +726,7 @@ static const std::string list_tf2 = R"(
"Automated" [
"Automated Menu"
"autoqueue"
"autoqueue_mode"
"autojoin_team"
"autojoin_class"
"autotaunt"

10
src/reclasses/CTFGCClientSystem.cpp Executable file → Normal file
View File

@ -14,7 +14,8 @@ CTFGCClientSystem *CTFGCClientSystem::GTFGCClientSystem()
{
typedef CTFGCClientSystem *(*GTFGCClientSystem_t)();
static uintptr_t addr1 = gSignatures.GetClientSignature(
"55 B8 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 55 A1 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 A1 ? ? ? ?");
"55 B8 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 55 A1 ? ? ? ? 89 E5 5D C3 "
"8D B6 00 00 00 00 A1 ? ? ? ?");
static GTFGCClientSystem_t GTFGCClientSystem_fn =
GTFGCClientSystem_t(addr1);
@ -38,8 +39,8 @@ void CTFGCClientSystem::AbandonCurrentMatch()
bool CTFGCClientSystem::BConnectedToMatchServer(bool flag)
{
typedef bool (*BConnectedToMatchServer_t)(CTFGCClientSystem *, bool);
static uintptr_t addr = gSignatures.GetClientSignature(
"55 89 E5 53 80 7D ? ? 8B 55 ? 75 ?");
static uintptr_t addr =
gSignatures.GetClientSignature("55 89 E5 53 80 7D ? ? 8B 55 ? 75 ?");
static BConnectedToMatchServer_t BConnectedToMatchServer_fn =
BConnectedToMatchServer_t(addr);
@ -49,7 +50,8 @@ bool CTFGCClientSystem::BConnectedToMatchServer(bool flag)
bool CTFGCClientSystem::BHaveLiveMatch()
{
typedef int (*BHaveLiveMatch_t)(CTFGCClientSystem *);
static uintptr_t addr = gSignatures.GetClientSignature("55 31 C0 89 E5 53 8B 4D ? 0F B6 91 ? ? ? ?");
static uintptr_t addr = gSignatures.GetClientSignature(
"55 31 C0 89 E5 53 8B 4D ? 0F B6 91 ? ? ? ?");
static BHaveLiveMatch_t BHaveLiveMatch_fn = BHaveLiveMatch_t(addr);
if (BHaveLiveMatch_fn == nullptr)
{

View File

@ -11,10 +11,9 @@
re::CTFPartyClient *re::CTFPartyClient::GTFPartyClient()
{
typedef re::CTFPartyClient *(*GTFPartyClient_t)(void);
uintptr_t addr =
gSignatures.GetClientSignature("55 A1 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 A1 ? ? ? ? 85 C0");
GTFPartyClient_t GTFPartyClient_fn =
GTFPartyClient_t(addr);
uintptr_t addr = gSignatures.GetClientSignature(
"55 A1 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 A1 ? ? ? ? 85 C0");
GTFPartyClient_t GTFPartyClient_fn = GTFPartyClient_t(addr);
return GTFPartyClient_fn();
}
@ -59,7 +58,7 @@ int re::CTFPartyClient::LoadSavedCasualCriteria()
{
typedef int (*LoadSavedCasualCriteria_t)(re::CTFPartyClient *);
uintptr_t addr = gSignatures.GetClientSignature(
"55 89 E5 83 EC ? 8B 45 ? 8B 50 ? C6 80 ? ? ? ? ?");
"55 89 E5 83 EC ? 8B 45 ? 8B 50 ? C6 80 ? ? ? ? ?");
LoadSavedCasualCriteria_t LoadSavedCasualCriteria_fn =
LoadSavedCasualCriteria_t(addr);
@ -80,7 +79,8 @@ char re::CTFPartyClient::RequestLeaveForMatch(int type)
{
typedef char (*RequestLeaveForMatch_t)(re::CTFPartyClient *, int);
uintptr_t addr = gSignatures.GetClientSignature(
"55 89 E5 57 56 53 83 EC ? 8B 45 ? 89 44 24 ? 8B 45 ? 89 04 24 E8 ? ? ? ? 84 C0 89 C6 75 ?");
"55 89 E5 57 56 53 83 EC ? 8B 45 ? 89 44 24 ? 8B 45 ? 89 04 24 E8 ? ? "
"? ? 84 C0 89 C6 75 ?");
RequestLeaveForMatch_t RequestLeaveForMatch_fn =
RequestLeaveForMatch_t(addr);

20
src/tfmm.cpp Executable file → Normal file
View File

@ -12,8 +12,12 @@ CatCommand cmd_queue_start("mm_queue_casual", "Start casual queue",
CatCommand cmd_abandon("mm_abandon", "Abandon match",
[]() { tfmm::abandon(); });
static CatEnum queue_mode({ "MvmPractice", "MvmMannup", "LadderMatch6v6", "LadderMatch9v9", "LadderMatch12v12", "CasualMatch6v6", "CasualMatch9v9", "CasualMatch12v12", "CompetitiveEventMatch12v12"});
static CatVar queue(queue_mode, "autoqueue_mode", "7", "Autoqueue for this mode", "");
static CatEnum queue_mode({ "MvmPractice", "MvmMannup", "LadderMatch6v6",
"LadderMatch9v9", "LadderMatch12v12",
"CasualMatch6v6", "CasualMatch9v9",
"CasualMatch12v12", "CompetitiveEventMatch12v12" });
static CatVar queue(queue_mode, "autoqueue_mode", "7",
"Autoqueue for this mode", "");
CatCommand get_state("mm_state", "Get party state", []() {
re::CTFParty *party = re::CTFParty::GetParty();
@ -28,20 +32,22 @@ CatCommand get_state("mm_state", "Get party state", []() {
namespace tfmm
{
void queue_start() {
void queue_start()
{
re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient();
if (client)
{
client->LoadSavedCasualCriteria();
client->RequestQueueForMatch((int)queue);
client->LoadSavedCasualCriteria();
client->RequestQueueForMatch((int) queue);
}
else
logging::Info("queue_start: CTFPartyClient == null!");
}
void queue_leave() {
void queue_leave()
{
re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient();
if (client)
client->RequestLeaveForMatch((int)queue);
client->RequestLeaveForMatch((int) queue);
else
logging::Info("queue_start: CTFPartyClient == null!");
}

3
src/visual/drawmgr.cpp Executable file → Normal file
View File

@ -40,7 +40,8 @@ CatVar info_text(CV_SWITCH, "info", "1", "Show info",
"Show cathook version in top left corner");
CatVar info_text_min(CV_SWITCH, "info_min", "0", "Show minimal info",
"Only show cathook title in top left corner");
CatVar enable_logo(CV_SWITCH, "nullcore_mode_logo", "1", "Enable Nullcore watermark", "");
CatVar enable_logo(CV_SWITCH, "nullcore_mode_logo", "1",
"Enable Nullcore watermark", "");
void DrawCheatVisuals()
{