before <vector> gui
This commit is contained in:
parent
6fe7cdab57
commit
808b157617
@ -50,6 +50,7 @@
|
|||||||
<option id="gnu.cpp.compiler.option.other.verbose.1509393088" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
<option id="gnu.cpp.compiler.option.other.verbose.1509393088" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||||
<option id="gnu.cpp.compiler.option.preprocessor.def.116822749" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
|
<option id="gnu.cpp.compiler.option.preprocessor.def.116822749" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
<listOptionValue builtIn="false" value="TF2"/>
|
<listOptionValue builtIn="false" value="TF2"/>
|
||||||
|
<listOptionValue builtIn="false" value="_DEVELOPER=1"/>
|
||||||
<listOptionValue builtIn="false" value="_POSIX=1"/>
|
<listOptionValue builtIn="false" value="_POSIX=1"/>
|
||||||
<listOptionValue builtIn="false" value="RAD_TELEMETRY_DISABLED"/>
|
<listOptionValue builtIn="false" value="RAD_TELEMETRY_DISABLED"/>
|
||||||
<listOptionValue builtIn="false" value="LINUX=1"/>
|
<listOptionValue builtIn="false" value="LINUX=1"/>
|
||||||
|
@ -13,6 +13,9 @@ alias clearcond "host_timescale 300;wait 500;host_timescale 1"
|
|||||||
alias clearcond_taunt "taunt;wait 50;host_timescale 300;wait 500;host_timescale 1"
|
alias clearcond_taunt "taunt;wait 50;host_timescale 300;wait 500;host_timescale 1"
|
||||||
bind l clearcond_taunt
|
bind l clearcond_taunt
|
||||||
|
|
||||||
|
Тебе нужно отследить, что MatSystemTopPanel отрисовался, поставить какой то флаг в 1, далее ждать FocusOverlayPanel и проверять что твой флаг был вяставлен в 1, потом рисовать всё что надо и ставить флаг в 0
|
||||||
|
|
||||||
|
|
||||||
fullbright toggle
|
fullbright toggle
|
||||||
instant taunt
|
instant taunt
|
||||||
TTS
|
TTS
|
||||||
|
@ -44,9 +44,10 @@
|
|||||||
|
|
||||||
#define SQR(x) x * x
|
#define SQR(x) x * x
|
||||||
|
|
||||||
#define CATHOOK_VERSION_MAJOR "0"
|
#ifndef CATHOOK_BUILD_NUMBER
|
||||||
#define CATHOOK_VERSION_MINOR "5"
|
#define CATHOOK_BUILD_NUMBER "1"
|
||||||
#define CATHOOK_VERSION_PATCH "2"
|
#endif
|
||||||
|
#define CATHOOK_BUILD_NAME "Sweet Roll"
|
||||||
|
|
||||||
#define CON_NAME "cat"
|
#define CON_NAME "cat"
|
||||||
#define CON_PREFIX CON_NAME "_"
|
#define CON_PREFIX CON_NAME "_"
|
||||||
|
@ -13,16 +13,10 @@
|
|||||||
#ifndef __DRM_ENABLED
|
#ifndef __DRM_ENABLED
|
||||||
#define __DRM_ENABLED true
|
#define __DRM_ENABLED true
|
||||||
#endif
|
#endif
|
||||||
#define __DRM_NOTES "Unstable build, for testing only!"
|
#define __DRM_NOTES "Semi-stable build"
|
||||||
|
|
||||||
#define __QUIT_SEGV (*((int*)0) = 0)
|
#define __QUIT_SEGV (*((int*)0) = 0)
|
||||||
|
|
||||||
#if __DRM_ENABLED == false
|
|
||||||
#define _DEVELOPER true
|
|
||||||
#else
|
|
||||||
#define _DEVELOPER false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __DRM_HWID_0
|
#ifndef __DRM_HWID_0
|
||||||
#define __DRM_HWID_0 0x7fa8d247bb8389e7
|
#define __DRM_HWID_0 0x7fa8d247bb8389e7
|
||||||
#define __DRM_HWID_1 0x08ebdb1cdb642f0e
|
#define __DRM_HWID_1 0x08ebdb1cdb642f0e
|
||||||
|
@ -39,6 +39,7 @@ void GlobalSettings::Init() {
|
|||||||
this->bThirdperson = CREATE_CV(CV_SWITCH, "thirdperson", "0", "Thirdperson");
|
this->bThirdperson = CREATE_CV(CV_SWITCH, "thirdperson", "0", "Thirdperson");
|
||||||
this->bNoVisuals = CREATE_CV(CV_SWITCH, "novisuals", "0", "Disable visuals");
|
this->bNoVisuals = CREATE_CV(CV_SWITCH, "novisuals", "0", "Disable visuals");
|
||||||
this->bCleanScreenshots = CREATE_CV(CV_SWITCH, "clean_screenshot", "1", "Clean screenshots");
|
this->bCleanScreenshots = CREATE_CV(CV_SWITCH, "clean_screenshot", "1", "Clean screenshots");
|
||||||
|
this->bDebugLog = CREATE_CV(CV_SWITCH, "log", "1", "Debug Log");
|
||||||
this->bThirdperson->m_pConVar->InstallChangeCallback(ThirdpersonCallback);
|
this->bThirdperson->m_pConVar->InstallChangeCallback(ThirdpersonCallback);
|
||||||
bInvalid = true;
|
bInvalid = true;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ public:
|
|||||||
CatVar* bThirdperson;
|
CatVar* bThirdperson;
|
||||||
CatVar* bNoVisuals;
|
CatVar* bNoVisuals;
|
||||||
CatVar* bCleanScreenshots;
|
CatVar* bCleanScreenshots;
|
||||||
|
CatVar* bDebugLog;
|
||||||
Vector last_angles;
|
Vector last_angles;
|
||||||
bool bInvalid;
|
bool bInvalid;
|
||||||
};
|
};
|
||||||
|
@ -10,13 +10,21 @@
|
|||||||
|
|
||||||
#include "IWidget.h"
|
#include "IWidget.h"
|
||||||
|
|
||||||
|
#include <KeyValues.h>
|
||||||
|
|
||||||
class CBaseWidget : public virtual IWidget {
|
class CBaseWidget : public virtual IWidget {
|
||||||
public:
|
public:
|
||||||
inline ~CBaseWidget() {
|
inline ~CBaseWidget() {
|
||||||
delete [] m_pszName;
|
delete [] m_pszName;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CBaseWidget(IWidget* parent, const char* name) {
|
KeyValues::AutoDelete m_pKeyValues;
|
||||||
|
|
||||||
|
inline KeyValues* GetKeyValues() {
|
||||||
|
return m_pKeyValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline CBaseWidget(IWidget* parent, const char* name) : m_pKeyValues("widgetkv") {
|
||||||
m_pParentWidget = parent;
|
m_pParentWidget = parent;
|
||||||
m_bMouseInside = false;
|
m_bMouseInside = false;
|
||||||
m_bMousePressed = false;
|
m_bMousePressed = false;
|
||||||
@ -32,9 +40,12 @@ public:
|
|||||||
m_bVisible = true;
|
m_bVisible = true;
|
||||||
m_nMaxX = 0;
|
m_nMaxX = 0;
|
||||||
m_nMaxY = 0;
|
m_nMaxY = 0;
|
||||||
|
m_bFocused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline virtual bool ConsumesKey(ButtonCode_t key) { return false; }
|
||||||
|
|
||||||
inline virtual void SetMaxSize(int w, int h) {
|
inline virtual void SetMaxSize(int w, int h) {
|
||||||
if (w >= 0)
|
if (w >= 0)
|
||||||
m_nMaxX = w;
|
m_nMaxX = w;
|
||||||
@ -106,6 +117,7 @@ public:
|
|||||||
|
|
||||||
inline virtual void Hide() {
|
inline virtual void Hide() {
|
||||||
m_bVisible = false;
|
m_bVisible = false;
|
||||||
|
OnFocusLose();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline virtual bool IsVisible() {
|
inline virtual bool IsVisible() {
|
||||||
@ -125,7 +137,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual IWidget* GetChildByPoint(int x, int y) {
|
virtual IWidget* GetChildByPoint(int x, int y) {
|
||||||
for (int i = 0; i < m_nChildCount; i++) {
|
for (int i = m_nChildCount - 1; i >= 0; i--) {
|
||||||
IWidget* child = m_pChildrenList[i];
|
IWidget* child = m_pChildrenList[i];
|
||||||
int ox, oy;
|
int ox, oy;
|
||||||
child->GetOffset(ox, oy);
|
child->GetOffset(ox, oy);
|
||||||
|
@ -94,6 +94,11 @@ void CBaseWindow::Update() {
|
|||||||
hovered = nhov;
|
hovered = nhov;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBaseWindow::OnFocusLose() {
|
||||||
|
m_bFocused = false;
|
||||||
|
if (focused) focused->OnFocusLose();
|
||||||
|
}
|
||||||
|
|
||||||
void CBaseWindow::OnMouseLeave() {
|
void CBaseWindow::OnMouseLeave() {
|
||||||
if (hovered) hovered->OnMouseLeave();
|
if (hovered) hovered->OnMouseLeave();
|
||||||
hovered = 0;
|
hovered = 0;
|
||||||
@ -102,13 +107,11 @@ void CBaseWindow::OnMouseLeave() {
|
|||||||
void CBaseWindow::OnMousePress() {
|
void CBaseWindow::OnMousePress() {
|
||||||
int ax, ay;
|
int ax, ay;
|
||||||
this->GetAbsolutePosition(ax, ay);
|
this->GetAbsolutePosition(ax, ay);
|
||||||
logging::Info("%s MousePress! %i %i", GetName(), g_pGUI->m_iMouseX - ax, g_pGUI->m_iMouseY - ay);
|
|
||||||
IWidget* newfocus = GetChildByPoint(g_pGUI->m_iMouseX - ax, g_pGUI->m_iMouseY - ay);
|
IWidget* newfocus = GetChildByPoint(g_pGUI->m_iMouseX - ax, g_pGUI->m_iMouseY - ay);
|
||||||
if (newfocus) {
|
if (newfocus) {
|
||||||
if (focused) focused->OnFocusLose();
|
if (focused) focused->OnFocusLose();
|
||||||
focused = newfocus;
|
focused = newfocus;
|
||||||
newfocus->OnFocusGain();
|
newfocus->OnFocusGain();
|
||||||
logging::Info("%s Child MousePress! %s", GetName(), focused->GetName());
|
|
||||||
newfocus->OnMousePress();
|
newfocus->OnMousePress();
|
||||||
} else {
|
} else {
|
||||||
if (focused) focused->OnFocusLose();
|
if (focused) focused->OnFocusLose();
|
||||||
@ -140,8 +143,15 @@ void CBaseWindow::Draw() {
|
|||||||
GetSize(sx, sy);
|
GetSize(sx, sy);
|
||||||
draw::DrawRect(px, py, sx, sy, colors::Transparent(colors::black));
|
draw::DrawRect(px, py, sx, sy, colors::Transparent(colors::black));
|
||||||
draw::OutlineRect(px, py, sx, sy, colors::pink);
|
draw::OutlineRect(px, py, sx, sy, colors::pink);
|
||||||
for (int i = 0; i < m_nChildCount; i++) {
|
for (int i = m_nChildCount - 1; i >= 0; i--) {
|
||||||
if (m_pChildrenList[i]->IsVisible())
|
if (m_pChildrenList[i]->IsVisible())
|
||||||
m_pChildrenList[i]->Draw();
|
m_pChildrenList[i]->Draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CBaseWindow::ConsumesKey(ButtonCode_t key) {
|
||||||
|
if (focused && focused->IsVisible()) {
|
||||||
|
return focused->ConsumesKey(key);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -29,7 +29,10 @@ public:
|
|||||||
virtual void OnMousePress();
|
virtual void OnMousePress();
|
||||||
virtual void OnMouseRelease();
|
virtual void OnMouseRelease();
|
||||||
virtual void OnKeyPress(ButtonCode_t key);
|
virtual void OnKeyPress(ButtonCode_t key);
|
||||||
virtual void OnKeyRelease(ButtonCode_t key);/*
|
virtual void OnKeyRelease(ButtonCode_t key);
|
||||||
|
virtual bool ConsumesKey(ButtonCode_t key);
|
||||||
|
virtual void OnFocusLose();
|
||||||
|
/*
|
||||||
|
|
||||||
virtual void SetOffset(int x, int y);
|
virtual void SetOffset(int x, int y);
|
||||||
virtual void GetOffset(int& x, int& y);*/
|
virtual void GetOffset(int& x, int& y);*/
|
||||||
|
@ -17,6 +17,10 @@ CTextInput::CTextInput(IWidget* parent, const char* name) : CBaseWidget(parent,
|
|||||||
m_nLength = 0;
|
m_nLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CTextInput::ConsumesKey(ButtonCode_t key) {
|
||||||
|
return key >= ButtonCode_t::KEY_FIRST && key <= ButtonCode_t::KEY_LAST && key != KEY_INSERT;
|
||||||
|
}
|
||||||
|
|
||||||
void CTextInput::SetMaxWidth(int width) {
|
void CTextInput::SetMaxWidth(int width) {
|
||||||
int length, height;
|
int length, height;
|
||||||
draw::GetStringLength(fonts::MENU, "W", length, height);
|
draw::GetStringLength(fonts::MENU, "W", length, height);
|
||||||
@ -30,7 +34,7 @@ void CTextInput::Draw() {
|
|||||||
int height, length;
|
int height, length;
|
||||||
draw::GetStringLength(fonts::MENU, "W", length, height);
|
draw::GetStringLength(fonts::MENU, "W", length, height);
|
||||||
int color = colors::Create(0, 0, 0, 80);
|
int color = colors::Create(0, 0, 0, 80);
|
||||||
if (m_bFocused) color = colors::Create(255, 255, 255, 80);
|
if (m_bFocused) color = colors::Transparent(colors::pink, 0.25);
|
||||||
draw::DrawRect(ax, ay, m_nSizeX, height + 4, color);
|
draw::DrawRect(ax, ay, m_nSizeX, height + 4, color);
|
||||||
draw::OutlineRect(ax, ay, m_nSizeX, height + 4, colors::pink);
|
draw::OutlineRect(ax, ay, m_nSizeX, height + 4, colors::pink);
|
||||||
int ml = 0;
|
int ml = 0;
|
||||||
@ -40,8 +44,8 @@ void CTextInput::Draw() {
|
|||||||
for (int i = 0; i < strlen(m_pszContents); i++) {
|
for (int i = 0; i < strlen(m_pszContents); i++) {
|
||||||
int w, h;
|
int w, h;
|
||||||
draw::GetStringLength(fonts::MENU, m_pszContents + i, w, h);
|
draw::GetStringLength(fonts::MENU, m_pszContents + i, w, h);
|
||||||
if (w + 4 + tx > m_nSizeX) md = i;
|
if (w + 10 + tx >= m_nSizeX) md = i;
|
||||||
if (w + 4 > m_nSizeX) ml = i;
|
if (w + 8 > m_nSizeX) ml = i;
|
||||||
}
|
}
|
||||||
if (ml) {
|
if (ml) {
|
||||||
draw::FString(fonts::MENU, ax + 2, ay + 2, colors::white, 1, "...%s", (m_pszContents + md));
|
draw::FString(fonts::MENU, ax + 2, ay + 2, colors::white, 1, "...%s", (m_pszContents + md));
|
||||||
@ -87,12 +91,14 @@ void CTextInput::OnKeyPress(ButtonCode_t key) {
|
|||||||
PutChar(' ');
|
PutChar(' ');
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (strlen(interfaces::input->ButtonCodeToString(key)) == 1) {
|
char ch = 0;
|
||||||
if (g_pGUI->m_bPressedState[ButtonCode_t::KEY_LSHIFT] || g_pGUI->m_bPressedState[ButtonCode_t::KEY_RSHIFT]) {
|
if (g_pGUI->m_bPressedState[ButtonCode_t::KEY_LSHIFT] || g_pGUI->m_bPressedState[ButtonCode_t::KEY_RSHIFT]) {
|
||||||
PutChar(GetUpperChar(key));
|
ch = GetUpperChar(key);
|
||||||
} else {
|
} else {
|
||||||
PutChar(GetChar(key));
|
ch = GetChar(key);
|
||||||
}
|
}
|
||||||
|
if (ch) {
|
||||||
|
PutChar(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ public:
|
|||||||
|
|
||||||
virtual void OnKeyPress(ButtonCode_t key);
|
virtual void OnKeyPress(ButtonCode_t key);
|
||||||
virtual void Draw();
|
virtual void Draw();
|
||||||
|
virtual bool ConsumesKey(ButtonCode_t key);
|
||||||
|
|
||||||
void PutChar(char ch);
|
void PutChar(char ch);
|
||||||
void SetLength(int newlength);
|
void SetLength(int newlength);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "../sdk.h"
|
#include "../sdk.h"
|
||||||
|
|
||||||
CTooltip::CTooltip(IWidget* parent, const char* name) : CBaseWidget(parent, name) {
|
CTooltip::CTooltip(IWidget* parent, const char* name) : CBaseWidget(parent, name) {
|
||||||
|
m_pszText = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTooltip::SetText(const char* text) {
|
void CTooltip::SetText(const char* text) {
|
||||||
|
@ -30,8 +30,6 @@ CatGUI::~CatGUI() {
|
|||||||
|
|
||||||
void CatGUI::Setup() {
|
void CatGUI::Setup() {
|
||||||
m_pRootWindow = new RootWindow();
|
m_pRootWindow = new RootWindow();
|
||||||
m_pTooltip = new CTooltip(m_pRootWindow, "tooltip");
|
|
||||||
m_pRootWindow->AddChild(m_pTooltip);
|
|
||||||
v_bGUIVisible->m_pConVar->InstallChangeCallback(GUIVisibleCallback);
|
v_bGUIVisible->m_pConVar->InstallChangeCallback(GUIVisibleCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,10 +37,11 @@ void CatGUI::ShowTooltip(const char* text) {
|
|||||||
m_pTooltip->SetText(text);
|
m_pTooltip->SetText(text);
|
||||||
m_pTooltip->SetOffset(m_iMouseX + 5, m_iMouseY + 5);
|
m_pTooltip->SetOffset(m_iMouseX + 5, m_iMouseY + 5);
|
||||||
m_pTooltip->Show();
|
m_pTooltip->Show();
|
||||||
|
m_bShowTooltip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CatGUI::Update() {
|
void CatGUI::Update() {
|
||||||
m_pTooltip->Hide();
|
m_bShowTooltip = false;
|
||||||
for (int i = 0; i < ButtonCode_t::MOUSE_LAST; i++) {
|
for (int i = 0; i < ButtonCode_t::MOUSE_LAST; i++) {
|
||||||
bool down = interfaces::input->IsButtonDown((ButtonCode_t)(KEY_FIRST + i));
|
bool down = interfaces::input->IsButtonDown((ButtonCode_t)(KEY_FIRST + i));
|
||||||
bool changed = m_bPressedState[i] != down;
|
bool changed = m_bPressedState[i] != down;
|
||||||
@ -58,27 +57,53 @@ void CatGUI::Update() {
|
|||||||
if (down) m_pRootWindow->OnKeyPress((ButtonCode_t)i);
|
if (down) m_pRootWindow->OnKeyPress((ButtonCode_t)i);
|
||||||
else m_pRootWindow->OnKeyRelease((ButtonCode_t)i);
|
else m_pRootWindow->OnKeyRelease((ButtonCode_t)i);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (down && i >= ButtonCode_t::KEY_FIRST && i <= ButtonCode_t::KEY_LAST) {
|
||||||
|
int frame = interfaces::gvars->framecount - m_iPressedFrame[i];
|
||||||
|
bool shouldrepeat = false;
|
||||||
|
if (frame) {
|
||||||
|
if (frame > 150) {
|
||||||
|
if (frame > 400) {
|
||||||
|
if (frame % 30 == 0) shouldrepeat = true;
|
||||||
|
} else {
|
||||||
|
if (frame % 80 == 0) shouldrepeat = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shouldrepeat) m_pRootWindow->OnKeyPress((ButtonCode_t)i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_iMouseX = interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_X);
|
m_iMouseX = interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_X);
|
||||||
m_iMouseY = interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_Y);
|
m_iMouseY = interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_Y);
|
||||||
|
|
||||||
if (!m_bKeysInit) m_bKeysInit = 1;
|
if (!m_bKeysInit) m_bKeysInit = 1;
|
||||||
if (v_bGUIVisible->GetBool()) {
|
if (v_bGUIVisible->GetBool()) {
|
||||||
|
m_pRootWindow->Show();
|
||||||
m_pRootWindow->Update();
|
m_pRootWindow->Update();
|
||||||
|
if (!m_bShowTooltip) m_pTooltip->Hide();
|
||||||
m_pRootWindow->Draw();
|
m_pRootWindow->Draw();
|
||||||
draw::DrawRect(m_iMouseX - 5, m_iMouseY - 5, 10, 10, colors::Transparent(colors::white));
|
draw::DrawRect(m_iMouseX - 5, m_iMouseY - 5, 10, 10, colors::Transparent(colors::white));
|
||||||
draw::OutlineRect(m_iMouseX - 5, m_iMouseY - 5, 10, 10, colors::pink);
|
draw::OutlineRect(m_iMouseX - 5, m_iMouseY - 5, 10, 10, colors::pink);
|
||||||
if (v_bDrawBounds->GetBool()) {
|
if (v_bDrawBounds->GetBool()) {
|
||||||
m_pRootWindow->DrawBounds();
|
m_pRootWindow->DrawBounds();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
m_pRootWindow->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CatGUI::ConsumesKey(ButtonCode_t key) {
|
||||||
|
if (m_pRootWindow->IsVisible())
|
||||||
|
return m_pRootWindow->ConsumesKey(key);
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
IWidget* CatGUI::GetRootWindow() {
|
IWidget* CatGUI::GetRootWindow() {
|
||||||
return m_pRootWindow;
|
return m_pRootWindow;
|
||||||
}
|
}
|
||||||
|
@ -26,14 +26,17 @@ public:
|
|||||||
void Update();
|
void Update();
|
||||||
void Setup();
|
void Setup();
|
||||||
IWidget* GetRootWindow();
|
IWidget* GetRootWindow();
|
||||||
|
bool ConsumesKey(ButtonCode_t key);
|
||||||
|
|
||||||
void ShowTooltip(const char* text);
|
void ShowTooltip(const char* text);
|
||||||
CTooltip* m_pTooltip;
|
|
||||||
|
|
||||||
|
CTooltip* m_pTooltip;
|
||||||
IWidget* m_pRootWindow;
|
IWidget* m_pRootWindow;
|
||||||
CatVar* v_bGUIVisible;
|
CatVar* v_bGUIVisible;
|
||||||
CatVar* v_bDrawBounds;
|
CatVar* v_bDrawBounds;
|
||||||
|
|
||||||
|
bool m_bShowTooltip;
|
||||||
|
bool m_bConsumeKeys;
|
||||||
bool m_bKeysInit;
|
bool m_bKeysInit;
|
||||||
bool m_bPressedState[ButtonCode_t::MOUSE_LAST];
|
bool m_bPressedState[ButtonCode_t::MOUSE_LAST];
|
||||||
int m_iPressedFrame[ButtonCode_t::MOUSE_LAST];
|
int m_iPressedFrame[ButtonCode_t::MOUSE_LAST];
|
||||||
|
@ -18,18 +18,23 @@ enum PositionMode {
|
|||||||
FLOATING
|
FLOATING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class KeyValues;
|
||||||
|
|
||||||
class IWidget {
|
class IWidget {
|
||||||
public:
|
public:
|
||||||
virtual ~IWidget();
|
virtual ~IWidget();
|
||||||
|
|
||||||
virtual void Update() = 0;
|
virtual void Update() = 0;
|
||||||
|
|
||||||
|
virtual KeyValues* GetKeyValues() = 0;
|
||||||
|
|
||||||
virtual void OnMouseEnter() = 0;
|
virtual void OnMouseEnter() = 0;
|
||||||
virtual void OnMouseLeave() = 0;
|
virtual void OnMouseLeave() = 0;
|
||||||
virtual void OnMousePress() = 0;
|
virtual void OnMousePress() = 0;
|
||||||
virtual void OnMouseRelease() = 0;
|
virtual void OnMouseRelease() = 0;
|
||||||
virtual void OnKeyPress(ButtonCode_t key) = 0;
|
virtual void OnKeyPress(ButtonCode_t key) = 0;
|
||||||
virtual void OnKeyRelease(ButtonCode_t key) = 0;
|
virtual void OnKeyRelease(ButtonCode_t key) = 0;
|
||||||
|
virtual bool ConsumesKey(ButtonCode_t key) = 0;
|
||||||
|
|
||||||
virtual void OnFocusGain() = 0;
|
virtual void OnFocusGain() = 0;
|
||||||
virtual void OnFocusLose() = 0;
|
virtual void OnFocusLose() = 0;
|
||||||
|
@ -13,16 +13,15 @@
|
|||||||
#include "CTextInput.h"
|
#include "CTextInput.h"
|
||||||
#include "CSplitContainer.h"
|
#include "CSplitContainer.h"
|
||||||
#include "CSlider.h"
|
#include "CSlider.h"
|
||||||
|
#include "CTooltip.h"
|
||||||
|
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
|
|
||||||
void B1Callback(IWidget* thisptr) {
|
void B1Callback(IWidget* thisptr) {
|
||||||
IWidget* label = thisptr->GetParent()->GetChildByName("td");
|
IWidget* label = thisptr->GetParent()->GetChildByName("td");
|
||||||
logging::Info("0x%08x", label);
|
|
||||||
CTextLabel* tl = dynamic_cast<CTextLabel*>(label);
|
CTextLabel* tl = dynamic_cast<CTextLabel*>(label);
|
||||||
logging::Info("0x%08x", tl);
|
|
||||||
if (tl) {
|
if (tl) {
|
||||||
char* text = strfmt("wow! curtime: %.2f", interfaces::gvars->curtime);
|
char* text = strfmt("wow! this[\"%s\"] = %i", "test_value", thisptr->GetKeyValues()->GetInt("test_value"));
|
||||||
tl->SetText(text);
|
tl->SetText(text);
|
||||||
delete [] text;
|
delete [] text;
|
||||||
}
|
}
|
||||||
@ -30,9 +29,7 @@ void B1Callback(IWidget* thisptr) {
|
|||||||
|
|
||||||
void TICallback(IWidget* thisptr, const char* old, const char* newc) {
|
void TICallback(IWidget* thisptr, const char* old, const char* newc) {
|
||||||
IWidget* label = thisptr->GetParent()->GetChildByName("td");
|
IWidget* label = thisptr->GetParent()->GetChildByName("td");
|
||||||
logging::Info("0x%08x", label);
|
|
||||||
CTextLabel* tl = dynamic_cast<CTextLabel*>(label);
|
CTextLabel* tl = dynamic_cast<CTextLabel*>(label);
|
||||||
logging::Info("0x%08x", tl);
|
|
||||||
if (tl) {
|
if (tl) {
|
||||||
char* text = strfmt("wow! text: %s", newc);
|
char* text = strfmt("wow! text: %s", newc);
|
||||||
tl->SetText(text);
|
tl->SetText(text);
|
||||||
@ -41,6 +38,8 @@ void TICallback(IWidget* thisptr, const char* old, const char* newc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RootWindow::RootWindow() : CBaseWindow(0, "root") {
|
RootWindow::RootWindow() : CBaseWindow(0, "root") {
|
||||||
|
g_pGUI->m_pTooltip = new CTooltip(this, "tooltip");
|
||||||
|
this->AddChild(g_pGUI->m_pTooltip);
|
||||||
CBaseWindow* ws = new CBaseWindow(this, "splitwindow");
|
CBaseWindow* ws = new CBaseWindow(this, "splitwindow");
|
||||||
ws->SetPositionMode(ABSOLUTE);
|
ws->SetPositionMode(ABSOLUTE);
|
||||||
TitleBar* wst = new TitleBar(ws, "Window Layout Test");
|
TitleBar* wst = new TitleBar(ws, "Window Layout Test");
|
||||||
@ -55,11 +54,15 @@ RootWindow::RootWindow() : CBaseWindow(0, "root") {
|
|||||||
CBaseButton* ccb1 = new CBaseButton(sc1, "b1");
|
CBaseButton* ccb1 = new CBaseButton(sc1, "b1");
|
||||||
ccb1->SetText("Ayy Lmao");
|
ccb1->SetText("Ayy Lmao");
|
||||||
CSlider* sl = new CSlider(ws, "sl");
|
CSlider* sl = new CSlider(ws, "sl");
|
||||||
sl->Setup(0.0f, 100.0f);
|
sl->GetKeyValues()->SetString("cvar", "cat_fov");
|
||||||
|
sl->Setup(10.0f, 150.0f);
|
||||||
|
sl->SetCallback([](CSlider* slider, float newv, float oldv) {
|
||||||
|
interfaces::cvar->FindVar(slider->GetKeyValues()->GetString("cvar"))->SetValue(newv);
|
||||||
|
});
|
||||||
sc1->AddChild(ccb1);
|
sc1->AddChild(ccb1);
|
||||||
//sc1->AddChild(new CTextLabel(sc1, "tl3", "wow"));
|
//sc1->AddChild(new CTextLabel(sc1, "tl3", "wow"));
|
||||||
ws->AddChild(sc1);
|
ws->AddChild(sc1);
|
||||||
CSplitContainer* sc2 = new CSplitContainer(ws, "sc1");
|
CSplitContainer* sc2 = new CSplitContainer(ws, "sc2");
|
||||||
sc2->m_nSizeX = 480;
|
sc2->m_nSizeX = 480;
|
||||||
sc2->m_nMaxX = 480;
|
sc2->m_nMaxX = 480;
|
||||||
sc2->AddChild(new CTextLabel(sc2, "tl1", "1"));
|
sc2->AddChild(new CTextLabel(sc2, "tl1", "1"));
|
||||||
@ -67,7 +70,7 @@ RootWindow::RootWindow() : CBaseWindow(0, "root") {
|
|||||||
sc2->AddChild(new CTextLabel(sc2, "tl3", "3"));
|
sc2->AddChild(new CTextLabel(sc2, "tl3", "3"));
|
||||||
sc2->AddChild(new CTextLabel(sc2, "tl4", "4"));
|
sc2->AddChild(new CTextLabel(sc2, "tl4", "4"));
|
||||||
ws->AddChild(sc2);
|
ws->AddChild(sc2);
|
||||||
CSplitContainer* sc3 = new CSplitContainer(ws, "sc1");
|
CSplitContainer* sc3 = new CSplitContainer(ws, "sc3");
|
||||||
sc3->m_nSizeX = 480;
|
sc3->m_nSizeX = 480;
|
||||||
sc3->m_nMaxX = 480;
|
sc3->m_nMaxX = 480;
|
||||||
sc3->AddChild(new CTextLabel(sc3, "tl1", "ayy"));
|
sc3->AddChild(new CTextLabel(sc3, "tl1", "ayy"));
|
||||||
@ -105,6 +108,7 @@ RootWindow::RootWindow() : CBaseWindow(0, "root") {
|
|||||||
b1->SetText("Press me!");
|
b1->SetText("Press me!");
|
||||||
b1->SetCallback(B1Callback);
|
b1->SetCallback(B1Callback);
|
||||||
b1->SetPositionMode(INLINE_BLOCK);
|
b1->SetPositionMode(INLINE_BLOCK);
|
||||||
|
b1->GetKeyValues()->SetInt("test_value", 1337);
|
||||||
wgt->AddChild(b1);
|
wgt->AddChild(b1);
|
||||||
wgt->SetOffset(200, 200);
|
wgt->SetOffset(200, 200);
|
||||||
CTextLabel* td = new CTextLabel(wgt, "td", "");
|
CTextLabel* td = new CTextLabel(wgt, "td", "");
|
||||||
|
@ -49,15 +49,14 @@
|
|||||||
#include "CDumper.h"
|
#include "CDumper.h"
|
||||||
#include "ipc/ipcctl.h"
|
#include "ipc/ipcctl.h"
|
||||||
|
|
||||||
|
#include <KeyValues.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Credits to josh33901 aka F1ssi0N for butifel F1Public and Darkstorm 2015 Linux
|
* Credits to josh33901 aka F1ssi0N for butifel F1Public and Darkstorm 2015 Linux
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool hack::shutdown = false;
|
bool hack::shutdown = false;
|
||||||
|
|
||||||
ICvar* g_pCVar = 0;
|
|
||||||
std::string ggggppppvvvv;
|
|
||||||
|
|
||||||
void hack::InitHacks() {
|
void hack::InitHacks() {
|
||||||
ADD_HACK(AutoStrafe);
|
ADD_HACK(AutoStrafe);
|
||||||
ADD_HACK(AntiAim);
|
ADD_HACK(AntiAim);
|
||||||
@ -83,22 +82,25 @@ void hack::InitHacks() {
|
|||||||
ConCommand* hack::c_Cat = 0;
|
ConCommand* hack::c_Cat = 0;
|
||||||
|
|
||||||
void hack::CC_Cat(const CCommand& args) {
|
void hack::CC_Cat(const CCommand& args) {
|
||||||
Color x = *reinterpret_cast<Color*>(&colors::blu);
|
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "cathook");
|
||||||
logging::Info("x: %i", x.GetRawColor());
|
|
||||||
logging::Info("r %i g %i b %i", x.r(), x.g(), x.b());
|
|
||||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "CatHook");
|
|
||||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), " by ");
|
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), " by ");
|
||||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "d4rkc4t\n");
|
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "d4rkc4t\n");
|
||||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), "Build: " __DATE__ " " __TIME__"\n");
|
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), "build: " CATHOOK_BUILD_NUMBER " \"" CATHOOK_BUILD_NAME "\"\n");
|
||||||
#if _DEVELOPER
|
#if _DEVELOPER
|
||||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "[DEVELOPER BUILD]\n");
|
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "[DEVELOPER BUILD]\n");
|
||||||
#endif
|
#else
|
||||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build for user " __DRM_NAME " (Early Access)\n");
|
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build for user " __DRM_NAME " (Early Access)\n");
|
||||||
|
#endif
|
||||||
#ifdef __DRM_NOTES
|
#ifdef __DRM_NOTES
|
||||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build notes: " __DRM_NOTES "\n");
|
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build notes: " __DRM_NOTES "\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef bool(handlevent_t)(IMatSystemSurface* thisptr, const InputEvent_t& event);
|
||||||
|
bool test_handleevent(IMatSystemSurface* thisptr, const InputEvent_t& event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void hack::Initialize() {
|
void hack::Initialize() {
|
||||||
logging::Initialize();
|
logging::Initialize();
|
||||||
srand(time(0));
|
srand(time(0));
|
||||||
@ -107,22 +109,13 @@ void hack::Initialize() {
|
|||||||
hwid::read_hwid_fstab();
|
hwid::read_hwid_fstab();
|
||||||
hwid::read_hwid_machineid();
|
hwid::read_hwid_machineid();
|
||||||
hwid::compute_result();
|
hwid::compute_result();
|
||||||
logging::Info("Build: " __DATE__ " " __TIME__);
|
|
||||||
logging::Info("Loading shared objects...");
|
|
||||||
sharedobj::LoadAllSharedObjects();
|
sharedobj::LoadAllSharedObjects();
|
||||||
g_pszTFPath = tf_path_from_maps();
|
g_pszTFPath = tf_path_from_maps();
|
||||||
logging::Info("TF folder: %s", g_pszTFPath);
|
|
||||||
logging::Info("Creating interfaces...");
|
|
||||||
interfaces::CreateInterfaces();
|
interfaces::CreateInterfaces();
|
||||||
logging::Info("User: %llu", interfaces::user->GetSteamID().ConvertToUint64());
|
|
||||||
DRM_ENFORCE;
|
DRM_ENFORCE;
|
||||||
logging::Info("Interfaces created!");
|
|
||||||
logging::Info("Dumping NetVars...");
|
|
||||||
CDumper dumper;
|
CDumper dumper;
|
||||||
dumper.SaveDump();
|
dumper.SaveDump();
|
||||||
logging::Info("Initializing surface...");
|
|
||||||
draw::Initialize();
|
draw::Initialize();
|
||||||
logging::Info("Colorizing...");
|
|
||||||
colors::Init();
|
colors::Init();
|
||||||
uintptr_t mmmf = (gSignatures.GetClientSignature("C7 44 24 04 09 00 00 00 BB ? ? ? ? C7 04 24 00 00 00 00 E8 ? ? ? ? BA ? ? ? ? 85 C0 B8 ? ? ? ? 0F 44 DA") + 37);
|
uintptr_t mmmf = (gSignatures.GetClientSignature("C7 44 24 04 09 00 00 00 BB ? ? ? ? C7 04 24 00 00 00 00 E8 ? ? ? ? BA ? ? ? ? 85 C0 B8 ? ? ? ? 0F 44 DA") + 37);
|
||||||
if (mmmf) {
|
if (mmmf) {
|
||||||
@ -130,13 +123,9 @@ void hack::Initialize() {
|
|||||||
unsigned char patch2[] = { 0x89, 0xC2, 0x90 };
|
unsigned char patch2[] = { 0x89, 0xC2, 0x90 };
|
||||||
Patch((void*)mmmf, (void*)patch1, 3);
|
Patch((void*)mmmf, (void*)patch1, 3);
|
||||||
Patch((void*)(mmmf + 8), (void*)patch2, 3);
|
Patch((void*)(mmmf + 8), (void*)patch2, 3);
|
||||||
} else logging::Info("You are already filled with luck.");
|
}BeginConVars();
|
||||||
logging::Info("Adding hacks...");
|
|
||||||
|
|
||||||
BeginConVars();
|
|
||||||
hack::c_Cat = CreateConCommand(CON_NAME, &hack::CC_Cat, "Info");
|
hack::c_Cat = CreateConCommand(CON_NAME, &hack::CC_Cat, "Info");
|
||||||
hack::InitHacks();
|
hack::InitHacks();
|
||||||
logging::Info("Init global settings");
|
|
||||||
g_Settings.Init();
|
g_Settings.Init();
|
||||||
#if ENTITY_CACHE_PROFILER == true
|
#if ENTITY_CACHE_PROFILER == true
|
||||||
if (!g_vEntityCacheProfiling) {
|
if (!g_vEntityCacheProfiling) {
|
||||||
@ -146,15 +135,12 @@ void hack::Initialize() {
|
|||||||
g_pGUI = new CatGUI();
|
g_pGUI = new CatGUI();
|
||||||
g_pGUI->Setup();
|
g_pGUI->Setup();
|
||||||
EndConVars();
|
EndConVars();
|
||||||
logging::Info("Initializing NetVar tree...");
|
|
||||||
gNetvars.init();
|
gNetvars.init();
|
||||||
logging::Info("Initializing entity offsets...");
|
|
||||||
InitNetVars();
|
InitNetVars();
|
||||||
|
|
||||||
g_pLocalPlayer = new LocalPlayer();
|
g_pLocalPlayer = new LocalPlayer();
|
||||||
g_pPlayerResource = new TFPlayerResource();
|
g_pPlayerResource = new TFPlayerResource();
|
||||||
|
|
||||||
logging::Info("Hooking methods...");
|
|
||||||
hooks::hkPanel = new hooks::VMTHook();
|
hooks::hkPanel = new hooks::VMTHook();
|
||||||
hooks::hkPanel->Init(interfaces::panel, 0);
|
hooks::hkPanel->Init(interfaces::panel, 0);
|
||||||
//hooks::hkPanel->HookMethod((void*)&hack::Hk_PaintTraverse, hooks::offPaintTraverse);
|
//hooks::hkPanel->HookMethod((void*)&hack::Hk_PaintTraverse, hooks::offPaintTraverse);
|
||||||
@ -165,6 +151,9 @@ void hack::Initialize() {
|
|||||||
while(!(clientMode = **(uintptr_t***)((uintptr_t)((*(void***)interfaces::baseClient)[10]) + 1))) {
|
while(!(clientMode = **(uintptr_t***)((uintptr_t)((*(void***)interfaces::baseClient)[10]) + 1))) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
//hooks::hkMatSurface = new hooks::VMTHook();
|
||||||
|
//hooks::hkMatSurface->Init((void*)interfaces::matsurface, 0);
|
||||||
|
//hooks::hkMatSurface->HookMethod((void*)test_handleevent, 1);
|
||||||
hooks::hkClientMode->Init((void*)clientMode, 0);
|
hooks::hkClientMode->Init((void*)clientMode, 0);
|
||||||
//hooks::hkClientMode->HookMethod((void*)&hack::Hk_CreateMove, hooks::offCreateMove);
|
//hooks::hkClientMode->HookMethod((void*)&hack::Hk_CreateMove, hooks::offCreateMove);
|
||||||
hooks::hkClientMode->HookMethod((void*)CreateMove_hook, hooks::offCreateMove);
|
hooks::hkClientMode->HookMethod((void*)CreateMove_hook, hooks::offCreateMove);
|
||||||
@ -178,18 +167,9 @@ void hack::Initialize() {
|
|||||||
hooks::hkClient->HookMethod((void*)DispatchUserMessage_hook, hooks::offFrameStageNotify + 1);
|
hooks::hkClient->HookMethod((void*)DispatchUserMessage_hook, hooks::offFrameStageNotify + 1);
|
||||||
hooks::hkClient->HookMethod((void*)IN_KeyEvent_hook, hooks::offKeyEvent);
|
hooks::hkClient->HookMethod((void*)IN_KeyEvent_hook, hooks::offKeyEvent);
|
||||||
hooks::hkClient->Apply();
|
hooks::hkClient->Apply();
|
||||||
/*hooks::hkMatSurface = new hooks::VMTHook();
|
|
||||||
hooks::hkMatSurface->Init((void*)interfaces::matsurface, 0);
|
|
||||||
hooks::hkMatSurface->HookMethod((void*)hk_HandleInputEvent, hooks::offHandleInputEvent);
|
|
||||||
hooks::hkMatSurface->Apply();
|
|
||||||
logging::Info("MatSurface Hooked? %f", interfaces::matsurface->DrawGetAlphaMultiplier());*/
|
|
||||||
logging::Info("Hooked!");
|
|
||||||
logging::Info("Finding GlowObjectManager...");
|
|
||||||
g_GlowObjectManager = *reinterpret_cast<CGlowObjectManager**>(gSignatures.GetClientSignature("C1 E0 05 03 05") + 5);
|
g_GlowObjectManager = *reinterpret_cast<CGlowObjectManager**>(gSignatures.GetClientSignature("C1 E0 05 03 05") + 5);
|
||||||
logging::Info("GlowObjectManager: 0x%08x", g_GlowObjectManager);
|
|
||||||
InitStrings();
|
InitStrings();
|
||||||
g_pChatStack = new ChatStack();
|
g_pChatStack = new ChatStack();
|
||||||
logging::Info("Init done!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hack::Think() {
|
void hack::Think() {
|
||||||
@ -199,7 +179,6 @@ void hack::Think() {
|
|||||||
void hack::Shutdown() {
|
void hack::Shutdown() {
|
||||||
if (hack::shutdown) return;
|
if (hack::shutdown) return;
|
||||||
hack::shutdown = true;
|
hack::shutdown = true;
|
||||||
logging::Info("Shutting down...");
|
|
||||||
logging::Shutdown();
|
logging::Shutdown();
|
||||||
if (hooks::hkPanel) hooks::hkPanel->Kill();
|
if (hooks::hkPanel) hooks::hkPanel->Kill();
|
||||||
if (hooks::hkClientMode) hooks::hkClientMode->Kill();
|
if (hooks::hkClientMode) hooks::hkClientMode->Kill();
|
||||||
|
@ -26,11 +26,6 @@
|
|||||||
#define DELETE_HACK(x) \
|
#define DELETE_HACK(x) \
|
||||||
delete g_ph##x
|
delete g_ph##x
|
||||||
|
|
||||||
#include "beforecheaders.h"
|
|
||||||
#include <string>
|
|
||||||
#include "aftercheaders.h"
|
|
||||||
extern std::string ggggppppvvvv;
|
|
||||||
|
|
||||||
class IHack;
|
class IHack;
|
||||||
class CUserCmd;
|
class CUserCmd;
|
||||||
class CViewSetup;
|
class CViewSetup;
|
||||||
|
@ -266,6 +266,7 @@ char GetUpperChar(ButtonCode_t button) {
|
|||||||
case KEY_EQUAL:
|
case KEY_EQUAL:
|
||||||
return '+';
|
return '+';
|
||||||
default:
|
default:
|
||||||
|
if (strlen(interfaces::input->ButtonCodeToString(button)) != 1) return 0;
|
||||||
return toupper(*interfaces::input->ButtonCodeToString(button));
|
return toupper(*interfaces::input->ButtonCodeToString(button));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,6 +287,7 @@ char GetChar(ButtonCode_t button) {
|
|||||||
if (button >= KEY_PAD_0 && button <= KEY_PAD_9) {
|
if (button >= KEY_PAD_0 && button <= KEY_PAD_9) {
|
||||||
return button - KEY_PAD_0 + '0';
|
return button - KEY_PAD_0 + '0';
|
||||||
}
|
}
|
||||||
|
if (strlen(interfaces::input->ButtonCodeToString(button)) != 1) return 0;
|
||||||
return *interfaces::input->ButtonCodeToString(button);
|
return *interfaces::input->ButtonCodeToString(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,6 +546,9 @@ bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Developer(CachedEntity* ent) {
|
bool Developer(CachedEntity* ent) {
|
||||||
|
#if _DEVELOPER == 1
|
||||||
|
return (ent == LOCAL_E);
|
||||||
|
#endif
|
||||||
return (ent->m_pPlayerInfo && ent->m_pPlayerInfo->friendsID == 347272825UL);
|
return (ent->m_pPlayerInfo && ent->m_pPlayerInfo->friendsID == 347272825UL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,11 +40,9 @@ void**& hooks::GetVMT(void* inst, unsigned int offset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void hooks::VMTHook::Init(void* inst, unsigned int offset) {
|
void hooks::VMTHook::Init(void* inst, unsigned int offset) {
|
||||||
logging::Info("Initializing VMTHook at 0x%08x", inst);
|
|
||||||
vmt = &GetVMT(inst, offset);
|
vmt = &GetVMT(inst, offset);
|
||||||
oldvmt = *vmt;
|
oldvmt = *vmt;
|
||||||
unsigned int cnt = CountMethods(oldvmt);
|
unsigned int cnt = CountMethods(oldvmt);
|
||||||
logging::Info("found %i methods...", cnt);
|
|
||||||
void **arr = array = (void**)malloc((cnt + 4) * sizeof(void*));
|
void **arr = array = (void**)malloc((cnt + 4) * sizeof(void*));
|
||||||
arr[0] = this;
|
arr[0] = this;
|
||||||
arr[1] = (void* )GUARD;
|
arr[1] = (void* )GUARD;
|
||||||
|
@ -17,12 +17,13 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
|||||||
if (!segvcatch::handler_fpe || !segvcatch::handler_segv) {
|
if (!segvcatch::handler_fpe || !segvcatch::handler_segv) {
|
||||||
segvcatch::init_segv();
|
segvcatch::init_segv();
|
||||||
segvcatch::init_fpe();
|
segvcatch::init_fpe();
|
||||||
logging::Info("segvcatch init!");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
SEGV_BEGIN;
|
SEGV_BEGIN;
|
||||||
|
static unsigned long panel_focus = 0;
|
||||||
static unsigned long panel_scope = 0;
|
static unsigned long panel_scope = 0;
|
||||||
static unsigned long panel_top = 0;
|
static unsigned long panel_top = 0;
|
||||||
|
static bool draw_flag = false;
|
||||||
bool call_default = true;
|
bool call_default = true;
|
||||||
if (g_Settings.bHackEnabled->GetBool() && panel_scope && g_Settings.bNoZoom->GetBool() && vp == panel_scope) call_default = false;
|
if (g_Settings.bHackEnabled->GetBool() && panel_scope && g_Settings.bNoZoom->GetBool() && vp == panel_scope) call_default = false;
|
||||||
if (g_Settings.bHackEnabled->GetBool()) {
|
if (g_Settings.bHackEnabled->GetBool()) {
|
||||||
@ -30,15 +31,10 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
|||||||
interfaces::surface->SetCursorAlwaysVisible(vis);
|
interfaces::surface->SetCursorAlwaysVisible(vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (call_default) SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar));
|
if (call_default) SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar));
|
||||||
|
if (vp == panel_top) draw_flag = true;
|
||||||
if (!g_Settings.bHackEnabled->GetBool()) return;
|
if (!g_Settings.bHackEnabled->GetBool()) return;
|
||||||
#if GUI_ENABLED == true
|
|
||||||
/*g_pGUI->UpdateKeys();
|
|
||||||
g_pGUI->UpdateMouse();
|
|
||||||
g_pGUI->Draw();*/
|
|
||||||
if (vp == panel_top)
|
|
||||||
g_pGUI->Update();
|
|
||||||
#endif
|
|
||||||
// Because of single-multi thread shit I'm gonna put this thing riiiight here.
|
// Because of single-multi thread shit I'm gonna put this thing riiiight here.
|
||||||
static bool autoexec_done = false;
|
static bool autoexec_done = false;
|
||||||
if (!autoexec_done) {
|
if (!autoexec_done) {
|
||||||
@ -72,10 +68,6 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_Settings.bNoVisuals->GetBool()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (g_Settings.bCleanScreenshots->GetBool() && interfaces::engineClient->IsTakingScreenshot()) return;
|
|
||||||
|
|
||||||
if (!draw::width || !draw::height) {
|
if (!draw::width || !draw::height) {
|
||||||
interfaces::engineClient->GetScreenSize(draw::width, draw::height);
|
interfaces::engineClient->GetScreenSize(draw::width, draw::height);
|
||||||
@ -85,7 +77,9 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
|||||||
if (strlen(name) > 4) {
|
if (strlen(name) > 4) {
|
||||||
if (name[0] == 'M' && name[3] == 'S') {
|
if (name[0] == 'M' && name[3] == 'S') {
|
||||||
panel_top = vp;
|
panel_top = vp;
|
||||||
logging::Info("Got top panel: %i", vp);
|
}
|
||||||
|
if (name[0] == 'F' && name[5] == 'O') {
|
||||||
|
panel_focus = vp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,24 +91,36 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
|||||||
if (!interfaces::engineClient->IsInGame()) {
|
if (!interfaces::engineClient->IsInGame()) {
|
||||||
g_Settings.bInvalid = true;
|
g_Settings.bInvalid = true;
|
||||||
}
|
}
|
||||||
if (g_Settings.bInvalid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (CE_BAD(g_pLocalPlayer->entity)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (panel_top == vp) {
|
|
||||||
ResetStrings();
|
|
||||||
if (g_Settings.bShowLogo->GetBool()) {
|
|
||||||
AddSideString(colors::green, "cathook by d4rkc4t");
|
|
||||||
#if _DEVELOPER
|
|
||||||
AddSideString(colors::red, "DEVELOPER BUILD");
|
|
||||||
#else
|
|
||||||
AddSideString(colors::green, "Early Access: " __DRM_NAME);
|
|
||||||
#endif
|
|
||||||
AddSideString(colors::green, "Version: " CATHOOK_VERSION_MAJOR "." CATHOOK_VERSION_MINOR "." CATHOOK_VERSION_PATCH);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (g_Settings.bNoVisuals->GetBool()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (g_Settings.bCleanScreenshots->GetBool() && interfaces::engineClient->IsTakingScreenshot()) return;
|
||||||
|
|
||||||
|
ResetStrings();
|
||||||
|
|
||||||
|
if (vp != panel_focus) return;
|
||||||
|
if (!draw_flag) return;
|
||||||
|
draw_flag = false;
|
||||||
|
|
||||||
|
#if GUI_ENABLED == true
|
||||||
|
/*g_pGUI->UpdateKeys();
|
||||||
|
g_pGUI->UpdateMouse();
|
||||||
|
g_pGUI->Draw();*/
|
||||||
|
g_pGUI->Update();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
if (g_Settings.bShowLogo->GetBool()) {
|
||||||
|
AddSideString(colors::green, "cathook by d4rkc4t");
|
||||||
|
#if _DEVELOPER
|
||||||
|
AddSideString(colors::red, "[developer build]");
|
||||||
|
#else
|
||||||
|
AddSideString(colors::green, "built for " __DRM_NAME);
|
||||||
|
#endif
|
||||||
|
AddSideString(colors::green, "alpha build " CATHOOK_BUILD_NUMBER " \"" CATHOOK_BUILD_NAME "\"");
|
||||||
|
}
|
||||||
|
if (CE_GOOD(g_pLocalPlayer->entity) && !g_Settings.bInvalid) {
|
||||||
//SAFE_CALL(PAINT_TRAVERSE(AutoStrafe));
|
//SAFE_CALL(PAINT_TRAVERSE(AutoStrafe));
|
||||||
//SAFE_CALL(PAINT_TRAVERSE(AntiAim));
|
//SAFE_CALL(PAINT_TRAVERSE(AntiAim));
|
||||||
SAFE_CALL(PAINT_TRAVERSE(AntiDisguise));
|
SAFE_CALL(PAINT_TRAVERSE(AntiDisguise));
|
||||||
@ -154,8 +160,9 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
|||||||
RemoveCondition(g_pLocalPlayer->entity, condition::TFCond_Zoomed);
|
RemoveCondition(g_pLocalPlayer->entity, condition::TFCond_Zoomed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DrawStrings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawStrings();
|
||||||
SEGV_END;
|
SEGV_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ bool CanPacket_hook(void* thisptr) {
|
|||||||
|
|
||||||
int IN_KeyEvent_hook(void* thisptr, int eventcode, int keynum, const char* pszCurrentBinding) {
|
int IN_KeyEvent_hook(void* thisptr, int eventcode, int keynum, const char* pszCurrentBinding) {
|
||||||
SEGV_BEGIN;
|
SEGV_BEGIN;
|
||||||
/*if (eventcode == 1) {
|
if (g_pGUI->ConsumesKey((ButtonCode_t)keynum)) {
|
||||||
if (g_pGUI->KeyEvent((ButtonCode_t)keynum)) return 1;
|
return 0;
|
||||||
}*/
|
}
|
||||||
return ((IN_KeyEvent_t*)hooks::hkClient->GetMethod(hooks::offKeyEvent))(thisptr, eventcode, keynum, pszCurrentBinding);
|
return ((IN_KeyEvent_t*)hooks::hkClient->GetMethod(hooks::offKeyEvent))(thisptr, eventcode, keynum, pszCurrentBinding);
|
||||||
SEGV_END;
|
SEGV_END;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -5,14 +5,11 @@
|
|||||||
* Author: nullifiedcat
|
* Author: nullifiedcat
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "logging.h"
|
|
||||||
#include "helpers.h"
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
#include "interfaces.h"
|
#include "common.h"
|
||||||
#include "sdk.h"
|
#include "sdk.h"
|
||||||
|
|
||||||
FILE* logging::handle = 0;
|
FILE* logging::handle = 0;
|
||||||
@ -36,6 +33,7 @@ void logging::Info(const char* fmt, ...) {
|
|||||||
fprintf(logging::handle, "%s", result);
|
fprintf(logging::handle, "%s", result);
|
||||||
fflush(logging::handle);
|
fflush(logging::handle);
|
||||||
if (interfaces::cvar) {
|
if (interfaces::cvar) {
|
||||||
|
if (g_Settings.bDebugLog && g_Settings.bDebugLog->GetBool())
|
||||||
interfaces::cvar->ConsolePrintf("%s", result);
|
interfaces::cvar->ConsolePrintf("%s", result);
|
||||||
}
|
}
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
|
3169
cathook/src/sdk/KeyValues.cpp
Normal file
3169
cathook/src/sdk/KeyValues.cpp
Normal file
File diff suppressed because it is too large
Load Diff
63
cathook/src/sdk/tier1.cpp
Normal file
63
cathook/src/sdk/tier1.cpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||||
|
//
|
||||||
|
// Purpose: A higher level link library for general use in the game and tools.
|
||||||
|
//
|
||||||
|
//===========================================================================//
|
||||||
|
|
||||||
|
#include <tier1/tier1.h>
|
||||||
|
#include "tier0/dbg.h"
|
||||||
|
#include "vstdlib/iprocessutils.h"
|
||||||
|
#include "icvar.h"
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// These tier1 libraries must be set by any users of this library.
|
||||||
|
// They can be set by calling ConnectTier1Libraries or InitDefaultFileSystem.
|
||||||
|
// It is hoped that setting this, and using this library will be the common mechanism for
|
||||||
|
// allowing link libraries to access tier1 library interfaces
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
ICvar *cvar = 0;
|
||||||
|
ICvar *g_pCVar = 0;
|
||||||
|
IProcessUtils *g_pProcessUtils = 0;
|
||||||
|
static bool s_bConnected = false;
|
||||||
|
|
||||||
|
// for utlsortvector.h
|
||||||
|
#ifndef _WIN32
|
||||||
|
void *g_pUtlSortVectorQSortContext = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Call this to connect to all tier 1 libraries.
|
||||||
|
// It's up to the caller to check the globals it cares about to see if ones are missing
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void ConnectTier1Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount )
|
||||||
|
{
|
||||||
|
// Don't connect twice..
|
||||||
|
if ( s_bConnected )
|
||||||
|
return;
|
||||||
|
|
||||||
|
s_bConnected = true;
|
||||||
|
|
||||||
|
for ( int i = 0; i < nFactoryCount; ++i )
|
||||||
|
{
|
||||||
|
if ( !g_pCVar )
|
||||||
|
{
|
||||||
|
cvar = g_pCVar = ( ICvar * )pFactoryList[i]( CVAR_INTERFACE_VERSION, NULL );
|
||||||
|
}
|
||||||
|
if ( !g_pProcessUtils )
|
||||||
|
{
|
||||||
|
g_pProcessUtils = ( IProcessUtils * )pFactoryList[i]( PROCESS_UTILS_INTERFACE_VERSION, NULL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisconnectTier1Libraries()
|
||||||
|
{
|
||||||
|
if ( !s_bConnected )
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_pCVar = cvar = 0;
|
||||||
|
g_pProcessUtils = NULL;
|
||||||
|
s_bConnected = false;
|
||||||
|
}
|
Reference in New Issue
Block a user