Merge pull request #409 from BenCat07/master

Fix random menu crashes
This commit is contained in:
BenCat07 2018-05-01 10:23:56 +02:00 committed by GitHub
commit 81e44cc81d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,7 +28,6 @@ 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");

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 {};
@ -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

@ -102,7 +102,6 @@ bool StolenName()
return false; return false;
} }
namespace hooked_methods namespace hooked_methods
{ {

View File

@ -25,8 +25,7 @@ DEFINE_HOOKED_METHOD(GetUserCmd, CUserCmd *, IInput *this_, int sequence_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;

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",

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,7 +55,8 @@ 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);
//} //}
} }
} }

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

@ -12,10 +12,11 @@ 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;

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;
} }
} }

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

@ -156,6 +156,7 @@ 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();

View File

@ -25,6 +25,7 @@ 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.c_str())
if (!catvar.desc_long.empty()) if (!catvar.desc_long.empty())
if (catvar.desc_long.length() && IsHovered() && if (catvar.desc_long.length() && IsHovered() &&
catvar.desc_long != "no description") catvar.desc_long != "no description")