Fix random menu crashes

This commit is contained in:
BenCat07 2018-05-01 10:21:17 +02:00
parent 915365bb49
commit 03fa2aad09
25 changed files with 74 additions and 95 deletions

View File

@ -7,7 +7,4 @@
namespace options namespace options
{ {
} }

1
include/hacks/Achievement.hpp Executable file → Normal file
View File

@ -12,5 +12,4 @@ namespace hacks::tf2::achievement
void Lock(); void Lock();
void Unlock(); void Unlock();
} }

12
include/prediction.hpp Executable file → Normal file
View File

@ -1,9 +1,9 @@
/* /*
* prediction.h *prediction.h
* *
* Created on: Dec 5, 2016 * Created on: Dec 5, 2016
* Author: nullifiedcat * Author: nullifiedcat
*/ */
#pragma once #pragma once

View File

@ -14,5 +14,4 @@ extern SDL_Window *window;
void applySdlHooks(); void applySdlHooks();
void cleanSdlHooks(); void cleanSdlHooks();
} }

View File

@ -28,9 +28,8 @@ CatVar servercrash(CV_SWITCH, "servercrash", "0", "crash servers",
"Crash servers by spamming signon net messages"); "Crash servers by spamming signon net messages");
bool *bSendPackets; bool *bSendPackets;
CatVar crypt_chat( CatVar crypt_chat(
CV_SWITCH, "chat_crypto", "1", "Crypto chat", CV_SWITCH, "chat_crypto", "1", "Crypto chat",
"Start message with !! and it will be only visible to cathook users"); "Start message with !! and it will be only visible to cathook users");
int spectator_target; int spectator_target;

View File

@ -5,4 +5,3 @@
#include "Options.hpp" #include "Options.hpp"
#include "core/cvwrapper.hpp" #include "core/cvwrapper.hpp"

View File

@ -329,7 +329,8 @@ free(logname);*/
hooks::panel.Set(g_IPanel); hooks::panel.Set(g_IPanel);
hooks::panel.HookMethod(hooked_methods::methods::PaintTraverse, hooks::panel.HookMethod(hooked_methods::methods::PaintTraverse,
offsets::PaintTraverse(), &hooked_methods::original::PaintTraverse); offsets::PaintTraverse(),
&hooked_methods::original::PaintTraverse);
hooks::panel.Apply(); hooks::panel.Apply();
#endif #endif

View File

@ -111,5 +111,4 @@ CatCommand
}); });
CatCommand lock("achievement_lock", "Lock all achievements", Lock); CatCommand lock("achievement_lock", "Lock all achievements", Lock);
CatCommand unlock("achievement_unlock", "Unlock all achievements", Unlock); CatCommand unlock("achievement_unlock", "Unlock all achievements", Unlock);
} }

1
src/hacks/AutoBackstab.cpp Executable file → Normal file
View File

@ -98,7 +98,6 @@ void CreateMove()
g_pUserCmd->buttons |= IN_ATTACK; g_pUserCmd->buttons |= IN_ATTACK;
} }
} }
} }
} }
} }

View File

@ -14,7 +14,6 @@
#include "HookedMethods.hpp" #include "HookedMethods.hpp"
class CMoveData; class CMoveData;
namespace engine_prediction namespace engine_prediction
{ {
@ -31,9 +30,9 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd)
void **predictionVtable = *((void ***) g_IPrediction); void **predictionVtable = *((void ***) g_IPrediction);
SetupMoveFn oSetupMove = SetupMoveFn oSetupMove =
(SetupMoveFn) (*(unsigned *) (predictionVtable + 19)); (SetupMoveFn)(*(unsigned *) (predictionVtable + 19));
FinishMoveFn oFinishMove = FinishMoveFn oFinishMove =
(FinishMoveFn) (*(unsigned *) (predictionVtable + 20)); (FinishMoveFn)(*(unsigned *) (predictionVtable + 20));
// CMoveData *pMoveData = (CMoveData*)(sharedobj::client->lmap->l_addr + // CMoveData *pMoveData = (CMoveData*)(sharedobj::client->lmap->l_addr +
// 0x1F69C0C); CMoveData movedata {}; // 0x1F69C0C); CMoveData movedata {};
@ -41,7 +40,7 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd)
CMoveData *pMoveData = (CMoveData *) object; CMoveData *pMoveData = (CMoveData *) object;
float frameTime = g_GlobalVars->frametime; float frameTime = g_GlobalVars->frametime;
float curTime = g_GlobalVars->curtime; float curTime = g_GlobalVars->curtime;
CUserCmd defaultCmd; CUserCmd defaultCmd;
if (ucmd == NULL) if (ucmd == NULL)
@ -52,24 +51,24 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd)
NET_VAR(ent, 4188, CUserCmd *) = ucmd; NET_VAR(ent, 4188, CUserCmd *) = ucmd;
g_GlobalVars->curtime = g_GlobalVars->curtime =
g_GlobalVars->interval_per_tick * NET_INT(ent, netvar.nTickBase); g_GlobalVars->interval_per_tick * NET_INT(ent, netvar.nTickBase);
g_GlobalVars->frametime = g_GlobalVars->interval_per_tick; g_GlobalVars->frametime = g_GlobalVars->interval_per_tick;
*g_PredictionRandomSeed = *g_PredictionRandomSeed =
MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF; MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF;
g_IGameMovement->StartTrackPredictionErrors( g_IGameMovement->StartTrackPredictionErrors(
reinterpret_cast<CBasePlayer *>(ent)); reinterpret_cast<CBasePlayer *>(ent));
oSetupMove(g_IPrediction, ent, ucmd, NULL, pMoveData); oSetupMove(g_IPrediction, ent, ucmd, NULL, pMoveData);
g_IGameMovement->ProcessMovement(reinterpret_cast<CBasePlayer *>(ent), g_IGameMovement->ProcessMovement(reinterpret_cast<CBasePlayer *>(ent),
pMoveData); pMoveData);
oFinishMove(g_IPrediction, ent, ucmd, pMoveData); oFinishMove(g_IPrediction, ent, ucmd, pMoveData);
g_IGameMovement->FinishTrackPredictionErrors( g_IGameMovement->FinishTrackPredictionErrors(
reinterpret_cast<CBasePlayer *>(ent)); reinterpret_cast<CBasePlayer *>(ent));
NET_VAR(ent, 4188, CUserCmd *) = nullptr; NET_VAR(ent, 4188, CUserCmd *) = nullptr;
g_GlobalVars->frametime = frameTime; g_GlobalVars->frametime = frameTime;
g_GlobalVars->curtime = curTime; g_GlobalVars->curtime = curTime;
return; return;
} }
@ -219,7 +218,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
{ {
logging::Info("Trying to change CLASS"); logging::Info("Trying to change CLASS");
g_IEngine->ExecuteClientCmd( g_IEngine->ExecuteClientCmd(
format("join_class ", joinclass.GetString()).c_str()); format("join_class ", joinclass.GetString()).c_str());
} }
team_joining_state = 0; team_joining_state = 0;
} }
@ -441,7 +440,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
speedapplied = false; speedapplied = false;
if (roll_speedhack && if (roll_speedhack &&
g_IInputSystem->IsButtonDown( g_IInputSystem->IsButtonDown(
(ButtonCode_t)((int) roll_speedhack)) && (ButtonCode_t)((int) roll_speedhack)) &&
!(cmd->buttons & IN_ATTACK)) !(cmd->buttons & IN_ATTACK))
{ {
speed = cmd->forwardmove; speed = cmd->forwardmove;
@ -503,7 +502,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
} }
} }
/*float o_curtime; /*float o_curtime;
float o_frametime; float o_frametime;

View File

@ -19,7 +19,7 @@ static CatVar dispatch_log(CV_SWITCH, "debug_log_usermessages", "0",
"Log dispatched user messages"); "Log dispatched user messages");
static CatVar chat_filter(CV_STRING, "chat_censor", "", "Censor words", static CatVar chat_filter(CV_STRING, "chat_censor", "", "Censor words",
"Spam Chat with newlines if the chosen words are " "Spam Chat with newlines if the chosen words are "
"said, seperate with commas"); "said, seperate with commas");
static CatVar chat_filter_enabled(CV_SWITCH, "chat_censor_enabled", "0", static CatVar chat_filter_enabled(CV_SWITCH, "chat_censor_enabled", "0",
"Enable censor", "Censor Words in chat"); "Enable censor", "Censor Words in chat");
std::string clear = ""; std::string clear = "";
@ -149,9 +149,9 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type,
name3.push_back(tmp2); name3.push_back(tmp2);
iii = 0; iii = 0;
std::vector<std::string> res = { std::vector<std::string> res = {
"skid", "script", "cheat", "hak", "hac", "f1", "skid", "script", "cheat", "hak", "hac", "f1",
"hax", "vac", "ban", "lmao", "bot", "report", "hax", "vac", "ban", "lmao", "bot", "report",
"cat", "insta", "revv", "brass", "kick", claz "cat", "insta", "revv", "brass", "kick", claz
}; };
for (auto i : name2) for (auto i : name2)
{ {
@ -238,10 +238,10 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type,
hacks::shared::antiaim::communicate && hacks::shared::antiaim::communicate &&
data[0] != LOCAL_E->m_IDX && data[0] != LOCAL_E->m_IDX &&
playerlist::AccessData(ENTITY(data[0])).state != playerlist::AccessData(ENTITY(data[0])).state !=
playerlist::k_EState::CAT) playerlist::k_EState::CAT)
{ {
playerlist::AccessData(ENTITY(data[0])).state = playerlist::AccessData(ENTITY(data[0])).state =
playerlist::k_EState::CAT; playerlist::k_EState::CAT;
chat_stack::Say("!!meow"); chat_stack::Say("!!meow");
} }
PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(), PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(),

View File

@ -10,9 +10,9 @@ static CatVar ipc_name(CV_STRING, "name_ipc", "", "IPC Name");
CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" }); CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" });
CatVar namesteal(namesteal_enum, "name_stealer", "0", "Name Stealer", CatVar namesteal(namesteal_enum, "name_stealer", "0", "Name Stealer",
"Attemt to steal your teammates names. Usefull for avoiding " "Attemt to steal your teammates names. Usefull for avoiding "
"kicks\nPassive only changes when the name stolen is no " "kicks\nPassive only changes when the name stolen is no "
"longer the best name to use\nActive Attemps to change the " "longer the best name to use\nActive Attemps to change the "
"name whenever possible"); "name whenever possible");
static std::string stolen_name; static std::string stolen_name;
@ -83,7 +83,7 @@ bool StolenName()
// Get random number that we can use with our array // Get random number that we can use with our array
int target_random_num = int target_random_num =
floor(RandFloatRange(0, potential_targets_length - 0.1F)); floor(RandFloatRange(0, potential_targets_length - 0.1F));
// Get a idx from our random array position // Get a idx from our random array position
int new_target = potential_targets[target_random_num]; int new_target = potential_targets[target_random_num];
@ -102,7 +102,6 @@ bool StolenName()
return false; return false;
} }
namespace hooked_methods namespace hooked_methods
{ {

View File

@ -18,24 +18,23 @@ DEFINE_HOOKED_METHOD(GetUserCmd, CUserCmd *, IInput *this_, int sequence_number)
return def; return def;
if (command_number_mod.find(def->command_number) != if (command_number_mod.find(def->command_number) !=
command_number_mod.end()) command_number_mod.end())
{ {
// logging::Info("Replacing command %i with %i", def->command_number, // logging::Info("Replacing command %i with %i", def->command_number,
// command_number_mod[def->command_number]); // command_number_mod[def->command_number]);
oldcmd = def->command_number; oldcmd = def->command_number;
def->command_number = command_number_mod[def->command_number]; def->command_number = command_number_mod[def->command_number];
def->random_seed = def->random_seed =
MD5_PseudoRandom(unsigned(def->command_number)) & MD5_PseudoRandom(unsigned(def->command_number)) & 0x7fffffff;
0x7fffffff;
command_number_mod.erase(command_number_mod.find(oldcmd)); command_number_mod.erase(command_number_mod.find(oldcmd));
*(int *) ((unsigned) g_IBaseClientState + *(int *) ((unsigned) g_IBaseClientState +
offsets::lastoutgoingcommand()) = def->command_number - 1; offsets::lastoutgoingcommand()) = def->command_number - 1;
ch = ch =
(INetChannel *) g_IEngine (INetChannel *) g_IEngine
->GetNetChannelInfo(); //*(INetChannel**)((unsigned)g_IBaseClientState ->GetNetChannelInfo(); //*(INetChannel**)((unsigned)g_IBaseClientState
//+ offsets::m_NetChannel()); //+ offsets::m_NetChannel());
*(int *) ((unsigned) ch + offsets::m_nOutSequenceNr()) = *(int *) ((unsigned) ch + offsets::m_nOutSequenceNr()) =
def->command_number - 1; def->command_number - 1;
} }
return def; return def;
} }

View File

@ -6,8 +6,6 @@
#include <hacks/hacklist.hpp> #include <hacks/hacklist.hpp>
#include "HookedMethods.hpp" #include "HookedMethods.hpp"
const char *skynum[] = { "sky_tf2_04", const char *skynum[] = { "sky_tf2_04",
"sky_upward", "sky_upward",
"sky_dustbowl_01", "sky_dustbowl_01",
@ -71,8 +69,8 @@ CatEnum skys({ "sky_tf2_04",
"sky_pyroland_02", "sky_pyroland_02",
"sky_pyroland_03" }); "sky_pyroland_03" });
static CatVar static CatVar
skybox_changer(skys, "skybox_changer", "0", "Change Skybox to this skybox", skybox_changer(skys, "skybox_changer", "0", "Change Skybox to this skybox",
"Change Skybox to this skybox, only changes on map load"); "Change Skybox to this skybox, only changes on map load");
static CatVar halloween_mode(CV_SWITCH, "halloween_mode", "0", static CatVar halloween_mode(CV_SWITCH, "halloween_mode", "0",
"Forced Halloween mode", "Forced Halloween mode",
"forced tf_forced_holiday 2"); "forced tf_forced_holiday 2");
@ -88,7 +86,7 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
#if ENABLE_VISUALS #if ENABLE_VISUALS
typedef bool *(*LoadNamedSkys_Fn)(const char *); typedef bool *(*LoadNamedSkys_Fn)(const char *);
uintptr_t addr = gSignatures.GetEngineSignature( uintptr_t addr = gSignatures.GetEngineSignature(
"55 89 E5 57 31 FF 56 8D B5 ? ? ? ? 53 81 EC 6C 01 00 00"); "55 89 E5 57 31 FF 56 8D B5 ? ? ? ? 53 81 EC 6C 01 00 00");
static LoadNamedSkys_Fn LoadNamedSkys = LoadNamedSkys_Fn(addr); static LoadNamedSkys_Fn LoadNamedSkys = LoadNamedSkys_Fn(addr);
bool succ; bool succ;
logging::Info("Going to load the skybox"); logging::Info("Going to load the skybox");
@ -119,7 +117,7 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
if (ipc::peer) if (ipc::peer)
{ {
ipc::peer->memory->peer_user_data[ipc::peer->client_id].ts_connected = ipc::peer->memory->peer_user_data[ipc::peer->client_id].ts_connected =
time(nullptr); time(nullptr);
} }
#endif #endif
} }

View File

@ -22,7 +22,7 @@ DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_)
if (ipc::peer) if (ipc::peer)
{ {
ipc::peer->memory->peer_user_data[ipc::peer->client_id] ipc::peer->memory->peer_user_data[ipc::peer->client_id]
.ts_disconnected = time(nullptr); .ts_disconnected = time(nullptr);
} }
#endif #endif
return original::LevelShutdown(this_); return original::LevelShutdown(this_);

View File

@ -62,7 +62,7 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
// logging::Info("executing %s", // logging::Info("executing %s",
// hack::command_stack().top().c_str()); // hack::command_stack().top().c_str());
g_IEngine->ClientCmd_Unrestricted( g_IEngine->ClientCmd_Unrestricted(
hack::command_stack().top().c_str()); hack::command_stack().top().c_str());
hack::command_stack().pop(); hack::command_stack().pop();
} }
} }

View File

@ -10,7 +10,6 @@
static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines", static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines",
"Add # newlines before each your message", 0, 24); "Add # newlines before each your message", 0, 24);
static CatVar log_sent(CV_SWITCH, "debug_log_sent_messages", "0", static CatVar log_sent(CV_SWITCH, "debug_log_sent_messages", "0",
"Log sent messages"); "Log sent messages");
static CatVar airstuck(CV_KEY, "airstuck", "0", "Airstuck", ""); static CatVar airstuck(CV_KEY, "airstuck", "0", "Airstuck", "");
@ -56,12 +55,13 @@ DEFINE_HOOKED_METHOD(SendNetMsg, bool, INetChannel *this_, INetMessage &msg,
str = str.substr(16, str.length() - 17); str = str.substr(16, str.length() - 17);
// if (queue_messages && !chat_stack::CanSend()) { // if (queue_messages && !chat_stack::CanSend()) {
stringcmd.m_szCommand = str.c_str(); stringcmd.m_szCommand = str.c_str();
return original::SendNetMsg(this_, stringcmd, force_reliable, voice); return original::SendNetMsg(this_, stringcmd, force_reliable,
voice);
//} //}
} }
} }
static ConVar *sv_player_usercommand_timeout = static ConVar *sv_player_usercommand_timeout =
g_ICvar->FindVar("sv_player_usercommand_timeout"); g_ICvar->FindVar("sv_player_usercommand_timeout");
static float lastcmd = 0.0f; static float lastcmd = 0.0f;
if (lastcmd > g_GlobalVars->absoluteframetime) if (lastcmd > g_GlobalVars->absoluteframetime)
{ {

View File

@ -31,11 +31,8 @@
*(float *) ((uintptr_t) _this + 79u) = old_invis; *(float *) ((uintptr_t) _this + 79u) = old_invis;
}*/ }*/
float last_say = 0.0f; float last_say = 0.0f;
CatCommand spectate("spectate", "Spectate", [](const CCommand &args) { CatCommand spectate("spectate", "Spectate", [](const CCommand &args) {
if (args.ArgC() < 1) if (args.ArgC() < 1)
{ {
@ -53,7 +50,6 @@ CatCommand spectate("spectate", "Spectate", [](const CCommand &args) {
#endif #endif
static CatCommand plus_use_action_slot_item_server( static CatCommand plus_use_action_slot_item_server(
"+cat_use_action_slot_item_server", "use_action_slot_item_server", []() { "+cat_use_action_slot_item_server", "use_action_slot_item_server", []() {
KeyValues *kv = new KeyValues("+use_action_slot_item_server"); KeyValues *kv = new KeyValues("+use_action_slot_item_server");
@ -76,9 +72,3 @@ static CatCommand minus_use_action_slot_item_server(
static CatVar server_crash_key(CV_KEY, "crash_server", "0", "Server crash key", static CatVar server_crash_key(CV_KEY, "crash_server", "0", "Server crash key",
"hold key and wait..."); "hold key and wait...");

View File

@ -23,11 +23,11 @@ DEFINE_HOOKED_METHOD(FrameStageNotify, void, void *this_,
{ {
static ConVar *r_DrawSpecificStaticProp = static ConVar *r_DrawSpecificStaticProp =
g_ICvar->FindVar("r_DrawSpecificStaticProp"); g_ICvar->FindVar("r_DrawSpecificStaticProp");
if (!r_DrawSpecificStaticProp) if (!r_DrawSpecificStaticProp)
{ {
r_DrawSpecificStaticProp = r_DrawSpecificStaticProp =
g_ICvar->FindVar("r_DrawSpecificStaticProp"); g_ICvar->FindVar("r_DrawSpecificStaticProp");
return; return;
} }
r_DrawSpecificStaticProp->SetValue(0); r_DrawSpecificStaticProp->SetValue(0);
@ -122,9 +122,9 @@ DEFINE_HOOKED_METHOD(FrameStageNotify, void, void *this_,
if (CE_GOOD(g_pLocalPlayer->entity)) if (CE_GOOD(g_pLocalPlayer->entity))
{ {
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 4) = CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 4) =
g_Settings.last_angles.x; g_Settings.last_angles.x;
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 8) = CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 8) =
g_Settings.last_angles.y; g_Settings.last_angles.y;
} }
} }
} }

View File

@ -8,7 +8,7 @@
CatVar override_fov_zoomed(CV_FLOAT, "fov_zoomed", "0", "FOV override (zoomed)", CatVar override_fov_zoomed(CV_FLOAT, "fov_zoomed", "0", "FOV override (zoomed)",
"Overrides FOV with this value when zoomed in " "Overrides FOV with this value when zoomed in "
"(default FOV when zoomed is 20)"); "(default FOV when zoomed is 20)");
CatVar override_fov(CV_FLOAT, "fov", "0", "FOV override", CatVar override_fov(CV_FLOAT, "fov", "0", "FOV override",
"Overrides FOV with this value"); "Overrides FOV with this value");
@ -41,12 +41,12 @@ DEFINE_HOOKED_METHOD(OverrideView, void, void *this_, CViewSetup *setup)
if (CE_GOOD(spec) && !CE_BYTE(spec, netvar.iLifeState)) if (CE_GOOD(spec) && !CE_BYTE(spec, netvar.iLifeState))
{ {
setup->origin = setup->origin =
spec->m_vecOrigin + CE_VECTOR(spec, netvar.vViewOffset); spec->m_vecOrigin + CE_VECTOR(spec, netvar.vViewOffset);
// why not spectate yourself // why not spectate yourself
if (spec == LOCAL_E) if (spec == LOCAL_E)
{ {
setup->angles = setup->angles =
CE_VAR(spec, netvar.m_angEyeAnglesLocal, QAngle); CE_VAR(spec, netvar.m_angEyeAnglesLocal, QAngle);
} }
else else
{ {

View File

@ -20,9 +20,9 @@ void **pure_addr = nullptr;
CatEnum software_cursor_enum({ "KEEP", "ALWAYS", "NEVER", "MENU ON", CatEnum software_cursor_enum({ "KEEP", "ALWAYS", "NEVER", "MENU ON",
"MENU OFF" }); "MENU OFF" });
CatVar CatVar
software_cursor_mode(software_cursor_enum, "software_cursor_mode", "0", software_cursor_mode(software_cursor_enum, "software_cursor_mode", "0",
"Software cursor", "Software cursor",
"Try to change this and see what works best for you"); "Try to change this and see what works best for you");
namespace hooked_methods namespace hooked_methods
{ {
@ -54,9 +54,9 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
if (!pure_addr) if (!pure_addr)
{ {
pure_addr = *reinterpret_cast<void ***>( pure_addr = *reinterpret_cast<void ***>(
gSignatures.GetEngineSignature( gSignatures.GetEngineSignature(
"A1 ? ? ? ? 85 C0 74 ? C7 44 24 ? ? ? ? ? 89 04 24") + "A1 ? ? ? ? 85 C0 74 ? C7 44 24 ? ? ? ? ? 89 04 24") +
1); 1);
} }
if (*pure_addr) if (*pure_addr)
pure_orig = *pure_addr; pure_orig = *pure_addr;

View File

@ -12,12 +12,13 @@ static bool init{ false };
static bool init_wminfo{ false }; static bool init_wminfo{ false };
static SDL_SysWMinfo wminfo{}; static SDL_SysWMinfo wminfo{};
int static_init_wminfo = (wminfo.version.major = 2, wminfo.version.minor = 0, 1); int static_init_wminfo =
(wminfo.version.major = 2, wminfo.version.minor = 0, 1);
typedef SDL_bool (*SDL_GetWindowWMInfo_t)(SDL_Window * window, typedef SDL_bool (*SDL_GetWindowWMInfo_t)(SDL_Window *window,
SDL_SysWMinfo * info); SDL_SysWMinfo *info);
static SDL_GetWindowWMInfo_t GetWindowWMInfo = nullptr; static SDL_GetWindowWMInfo_t GetWindowWMInfo = nullptr;
static SDL_GLContext tf2_sdl = nullptr; static SDL_GLContext tf2_sdl = nullptr;
namespace hooked_methods namespace hooked_methods
{ {
@ -27,7 +28,7 @@ DEFINE_HOOKED_METHOD(SDL_GL_SwapWindow, void, SDL_Window *window)
if (!init_wminfo) if (!init_wminfo)
{ {
GetWindowWMInfo = *reinterpret_cast<SDL_GetWindowWMInfo_t *>( GetWindowWMInfo = *reinterpret_cast<SDL_GetWindowWMInfo_t *>(
sharedobj::libsdl().Pointer(0xFD4D8)); sharedobj::libsdl().Pointer(0xFD4D8));
GetWindowWMInfo(window, &wminfo); GetWindowWMInfo(window, &wminfo);
init_wminfo = true; init_wminfo = true;
} }

View File

@ -16,10 +16,11 @@ namespace pointers
hooked_methods::types::SDL_GL_SwapWindow *SDL_GL_SwapWindow{ nullptr }; hooked_methods::types::SDL_GL_SwapWindow *SDL_GL_SwapWindow{ nullptr };
} }
void applySdlHooks() void applySdlHooks()
{ {
pointers::SDL_GL_SwapWindow = reinterpret_cast<hooked_methods::types::SDL_GL_SwapWindow *>(sharedobj::libsdl().Pointer(0xFD648)); pointers::SDL_GL_SwapWindow =
reinterpret_cast<hooked_methods::types::SDL_GL_SwapWindow *>(
sharedobj::libsdl().Pointer(0xFD648));
hooked_methods::original::SDL_GL_SwapWindow = *pointers::SDL_GL_SwapWindow; hooked_methods::original::SDL_GL_SwapWindow = *pointers::SDL_GL_SwapWindow;
*pointers::SDL_GL_SwapWindow = hooked_methods::methods::SDL_GL_SwapWindow; *pointers::SDL_GL_SwapWindow = hooked_methods::methods::SDL_GL_SwapWindow;
@ -29,5 +30,4 @@ void cleanSdlHooks()
{ {
*pointers::SDL_GL_SwapWindow = hooked_methods::original::SDL_GL_SwapWindow; *pointers::SDL_GL_SwapWindow = hooked_methods::original::SDL_GL_SwapWindow;
} }
} }

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

@ -156,12 +156,13 @@ void get_string_size(const char *string, font_handle_t &font, float *x,
void draw_begin() void draw_begin()
{ {
glColor3f(1, 1, 1);
PROF_SECTION(DRAWEX_draw_begin); PROF_SECTION(DRAWEX_draw_begin);
#if EXTERNAL_DRAWING #if EXTERNAL_DRAWING
xoverlay_draw_begin(); xoverlay_draw_begin();
{ {
PROF_SECTION(draw_begin__SDL_GL_MakeCurrent); PROF_SECTION(draw_begin__SDL_GL_MakeCurrent);
// SDL_GL_MakeCurrent(sdl_hooks::window, context); // SDL_GL_MakeCurrent(sdl_hooks::window, context);
} }
#endif #endif
{ {

View File

@ -25,10 +25,11 @@ void ItemVariable::Update()
Item::Update(); Item::Update();
if (catvar.name.c_str()) if (catvar.name.c_str())
if (catvar.registered == true) if (catvar.registered == true)
if (!catvar.desc_long.empty()) if (catvar.desc_long.c_str())
if (catvar.desc_long.length() && IsHovered() && if (!catvar.desc_long.empty())
catvar.desc_long != "no description") if (catvar.desc_long.length() && IsHovered() &&
ShowTooltip(catvar.desc_long); catvar.desc_long != "no description")
ShowTooltip(catvar.desc_long);
} }
void ItemVariable::Change(float amount) void ItemVariable::Change(float amount)