Merge pull request #13 from nullifiedcat/master

update fork
This commit is contained in:
julianacat 2017-08-02 23:58:59 +00:00 committed by GitHub
commit f8d0a5a361
10 changed files with 83 additions and 14 deletions

View File

@ -259,6 +259,24 @@ void hack::Initialize() {
hooks::client.Set(g_IBaseClient);
hooks::client.HookMethod((void*)FrameStageNotify_hook, offsets::FrameStageNotify());
hooks::client.HookMethod((void*)DispatchUserMessage_hook, offsets::DispatchUserMessage());
#if TEXTMODE
//g_IMaterialSystem->SetInStubMode(true);
/*IF_GAME(IsTF2()) {
logging::Info("Graphics Nullified");
// TODO offsets::()?
hooks::materialsystem.Set((void*)g_IMaterialSystem);
uintptr_t base = *(uintptr_t*)(g_IMaterialSystem);
hooks::materialsystem.HookMethod((void*)ReloadTextures_null_hook, 70);
hooks::materialsystem.HookMethod((void*)ReloadMaterials_null_hook, 71);
hooks::materialsystem.HookMethod((void*)FindMaterial_null_hook, 73);
hooks::materialsystem.HookMethod((void*)FindTexture_null_hook, 81);
hooks::materialsystem.HookMethod((void*)ReloadFilesInList_null_hook, 121);
hooks::materialsystem.HookMethod((void*)FindMaterialEx_null_hook, 123);
hooks::materialsystem.Apply();
//hooks::materialsystem.HookMethod();
}*/
#endif
#ifndef TEXTMODE
hooks::client.HookMethod((void*)IN_KeyEvent_hook, offsets::IN_KeyEvent());
#endif /* TEXTMODE */
@ -288,12 +306,6 @@ void hack::Initialize() {
// FIXME [MP]
hacks::shared::killsay::Init();
hack::command_stack().push("exec cat_autoexec");
#ifdef TEXTMODE
hack::command_stack().push("exec cat_autoexec_textmode");
#endif
hack::command_stack().push("cat_killsay_reload");
hack::command_stack().push("cat_spam_reload");
logging::Info("Hooked!");
velocity::Init();
playerlist::Load();
@ -338,6 +350,13 @@ void hack::Initialize() {
init_stack().pop();
}
logging::Info("Initializer stack done");
#ifdef TEXTMODE
hack::command_stack().push("exec cat_autoexec_textmode");
#endif
hack::command_stack().push("exec cat_autoexec");
hack::command_stack().push("cat_killsay_reload");
hack::command_stack().push("cat_spam_reload");
}
void hack::Think() {

View File

@ -753,6 +753,9 @@ bool IsEntityVisiblePenetration(CachedEntity* entity, int hb) {
}
void PrintChat(const char* fmt, ...) {
#if TEXTMODE
return;
#endif
CHudBaseChat* chat = (CHudBaseChat*)g_CHUD->FindElement("CHudChat");
if (chat) {
char* buf = new char[1024];

View File

@ -87,5 +87,6 @@ VMTHook matsurface {};
VMTHook studiorender {};
VMTHook modelrender {};
VMTHook clientmode4 {};
VMTHook materialsystem {};
}

View File

@ -59,6 +59,7 @@ extern VMTHook modelrender;
extern VMTHook baseclientstate;
extern VMTHook baseclientstate8;
extern VMTHook steamfriends;
extern VMTHook materialsystem;
}

31
src/hooks/nographics.cpp Normal file
View File

@ -0,0 +1,31 @@
/*
* nographics.cpp
*
* Created on: Aug 1, 2017
* Author: nullifiedcat
*/
#include "../common.h"
/*// 81
ITexture *FindTexture_null_hook(void* this_, char const* pTextureName, const char *pTextureGroupName, bool complain, int nAdditionalCreationFlags) {
static ITexture *st = ((FindTexture_t)hooks::materialsystem.GetMethod(81))(this_, pTextureName, pTextureGroupName, complain, nAdditionalCreationFlags);
return st;
}
// 123
IMaterial *FindMaterialEx_null_hook(void* this_, char const* pMaterialName, const char *pTextureGroupName, int nContext, bool complain, const char *pComplainPrefix) {
static IMaterial *st = ((FindMaterialEx_t)hooks::materialsystem.GetMethod(123))(this_, pMaterialName, pTextureGroupName, nContext, complain, pComplainPrefix);
return st;
}
// 73
IMaterial *FindMaterial_null_hook(void* this_, char const* pMaterialName, const char *pTextureGroupName, bool complain, const char *pComplainPrefix) {
static IMaterial *st = ((FindMaterial_t)hooks::materialsystem.GetMethod(73))(this_, pMaterialName, pTextureGroupName, complain, pComplainPrefix);
return st;
}
void ReloadTextures_null_hook(void* this_) {}
void ReloadMaterials_null_hook(void* this_, const char *pSubString) {}
void ReloadFilesInList_null_hook(void* this_, IFileList *pFilesToReload) {}
*/

View File

@ -26,6 +26,20 @@ void FrameStageNotify_hook(void*, int);
void LevelInit_hook(void*, const char*);
void LevelShutdown_hook(void*);
#ifdef TEXTMODE
typedef ITexture*(*FindTexture_t)(void*, const char*, const char*, bool, int);
typedef IMaterial*(*FindMaterialEx_t)(void*, const char*, const char*, int, bool, const char*);
typedef IMaterial*(*FindMaterial_t)(void*, const char*, const char*, bool, const char*);
/* 70 */ void ReloadTextures_null_hook(void* this_);
/* 71 */ void ReloadMaterials_null_hook(void* this_, const char *pSubString);
/* 73 */ IMaterial *FindMaterial_null_hook(void* this_, char const* pMaterialName, const char *pTextureGroupName, bool complain, const char *pComplainPrefix);
/* 81 */ ITexture *FindTexture_null_hook(void* this_, char const* pTextureName, const char *pTextureGroupName, bool complain, int nAdditionalCreationFlags);
/* 121 */ void ReloadFilesInList_null_hook(void* this_, IFileList *pFilesToReload);
/* 123 */ IMaterial *FindMaterialEx_null_hook(void* this_, char const* pMaterialName, const char *pTextureGroupName, int nContext, bool complain, const char *pComplainPrefix);
#endif
//extern unsigned int* swapwindow_ptr;
//extern unsigned int swapwindow_orig;

View File

@ -127,13 +127,13 @@ void CreateInterfaces() {
logging::Info("GTFGCClientSystem() = 0x%08x", get_gc);
g_TFGCClientSystem = get_gc();
}
g_IMaterialSystem = BruteforceInterface<IMaterialSystemFixed>("VMaterialSystem", sharedobj::materialsystem());
#ifndef TEXTMODE
g_IVDebugOverlay = BruteforceInterface<IVDebugOverlay>("VDebugOverlay", sharedobj::engine());
g_IPanel = BruteforceInterface<vgui::IPanel>("VGUI_Panel", sharedobj::vgui2());
g_ISurface = BruteforceInterface<vgui::ISurface>("VGUI_Surface", sharedobj::vguimatsurface());
g_IStudioRender = BruteforceInterface<IStudioRender>("VStudioRender", sharedobj::studiorender());
g_IMaterialSystem = BruteforceInterface<IMaterialSystemFixed>("VMaterialSystem", sharedobj::materialsystem());
g_IVRenderView = BruteforceInterface<IVRenderView>("VEngineRenderView", sharedobj::engine());
g_IMaterialSystemHL = (IMaterialSystem*)g_IMaterialSystem;
IF_GAME (IsTF2()) {

View File

@ -193,7 +193,7 @@ void StoreClientData() {
UpdateServerAddress();
user_data_s& data = peer->memory->peer_user_data[peer->client_id];
data.friendid = g_ISteamUser->GetSteamID().GetAccountID();
strncpy(data.name, g_ISteamFriends->GetPersonaName(), sizeof(data.name));
strncpy(data.name, GetFriendPersonaName_hook(g_ISteamFriends, g_ISteamUser->GetSteamID()), sizeof(data.name));
}

View File

@ -79,11 +79,11 @@ void LoadAllSharedObjects() {
vstdlib().Load();
tier0().Load();
inputsystem().Load();
materialsystem().Load();
#ifndef TEXTMODE
vguimatsurface().Load();
vgui2().Load();
studiorender().Load();
materialsystem().Load();
libsdl().Load();
#endif
} catch (std::exception& ex) {
@ -115,6 +115,10 @@ SharedObject& inputsystem() {
static SharedObject obj("inputsystem.so", true);
return obj;
}
SharedObject& materialsystem() {
static SharedObject obj("materialsystem.so", true);
return obj;
}
#ifndef TEXTMODE
SharedObject& vguimatsurface() {
static SharedObject obj("vguimatsurface.so", true);
@ -128,10 +132,6 @@ SharedObject& studiorender() {
static SharedObject obj("studiorender.so", true);
return obj;
}
SharedObject& materialsystem() {
static SharedObject obj("materialsystem.so", true);
return obj;
}
SharedObject& libsdl() {
static SharedObject obj("libSDL2-2.0.so.0", false);
return obj;

View File

@ -42,11 +42,11 @@ SharedObject& engine();
SharedObject& vstdlib();
SharedObject& tier0();
SharedObject& inputsystem();
SharedObject& materialsystem();
#ifndef TEXTMODE
SharedObject& vguimatsurface();
SharedObject& vgui2();
SharedObject& studiorender();
SharedObject& materialsystem();
SharedObject& libsdl();
#endif