remove segvcatch
This commit is contained in:
parent
441066f5a4
commit
bad88d7ed8
@ -128,7 +128,6 @@
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="include/reclasses"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="include/sdk"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="include/visual"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="segvcatch"/>
|
||||
<entry excluding="autogen|segvcatch|targeting|visual|classinfo|vtables|gui|ipc|mem|memory|imgui|hacks/ac" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/classinfo"/>
|
||||
<entry excluding="cmdui|im|depr|ncc" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/gui"/>
|
||||
|
@ -51,7 +51,6 @@
|
||||
|
||||
#include "timer.hpp"
|
||||
#include "averager.hpp"
|
||||
#include "segvcatch/segvcatch.h"
|
||||
|
||||
#include <aftercheaders.hpp>
|
||||
|
||||
@ -133,11 +132,6 @@ constexpr T _clamp(T _min, T _max, T _val) {
|
||||
|
||||
#define SQR(x) (x) * (x)
|
||||
|
||||
#ifndef CATHOOK_BUILD_NUMBER
|
||||
#define CATHOOK_BUILD_NUMBER "LATEST"
|
||||
#endif
|
||||
#define CATHOOK_BUILD_NAME "Cat's Eye"
|
||||
|
||||
#define CON_NAME "cat"
|
||||
#define CON_PREFIX CON_NAME "_"
|
||||
|
||||
@ -152,38 +146,8 @@ constexpr T _clamp(T _min, T _max, T _val) {
|
||||
#define DEG2RAD(x) (float)(x) * (PI / 180.0f)
|
||||
#endif
|
||||
|
||||
#define DEBUG_SEGV false
|
||||
#define STR(c) #c
|
||||
|
||||
#if DEBUG_SEGV == true
|
||||
|
||||
#define SEGV_BEGIN \
|
||||
try {
|
||||
|
||||
#define SEGV_END \
|
||||
} catch (...) { \
|
||||
logging::Info("SEGV/FPE occured! %s in %s:%d", __func__, __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
#define SEGV_END_INFO(x) \
|
||||
} catch (...) { \
|
||||
logging::Info("SEGV/FPE occured! (%s)", x); \
|
||||
}
|
||||
|
||||
#define SAFE_CALL(x) \
|
||||
SEGV_BEGIN \
|
||||
x; \
|
||||
SEGV_END_INFO(#x)
|
||||
|
||||
#else
|
||||
|
||||
#define SEGV_BEGIN
|
||||
#define SEGV_END
|
||||
#define SEGV_END_INFO(x)
|
||||
#define SAFE_CALL(x) x
|
||||
|
||||
#endif
|
||||
|
||||
#define GET_RENDER_CONTEXT (IsTF2() ? g_IMaterialSystem->GetRenderContext() : g_IMaterialSystemHL->GetRenderContext())
|
||||
|
||||
#endif /* COMMON_H_ */
|
||||
|
@ -1,168 +0,0 @@
|
||||
// i386-signal.h - Catch runtime signals and turn them into exceptions
|
||||
// on an i386 based Linux system.
|
||||
|
||||
/* Copyright (C) 1998, 1999, 2001, 2002, 2006, 2007 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
|
||||
#ifndef JAVA_SIGNAL_H
|
||||
#define JAVA_SIGNAL_H 1
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define HANDLE_SEGV 1
|
||||
#define HANDLE_FPE 1
|
||||
|
||||
#define SIGNAL_HANDLER(_name) \
|
||||
static void _Jv_##_name (int, siginfo_t *, \
|
||||
void *_p __attribute__ ((__unused__)))
|
||||
|
||||
#define HANDLE_DIVIDE_OVERFLOW \
|
||||
do \
|
||||
{ \
|
||||
struct ucontext *_uc = (struct ucontext *)_p; \
|
||||
gregset_t &_gregs = _uc->uc_mcontext.gregs; \
|
||||
unsigned char *_eip = (unsigned char *)_gregs[REG_EIP]; \
|
||||
\
|
||||
/* According to the JVM spec, "if the dividend is the negative \
|
||||
* integer of largest possible magnitude for the type and the \
|
||||
* divisor is -1, then overflow occurs and the result is equal to \
|
||||
* the dividend. Despite the overflow, no exception occurs". \
|
||||
\
|
||||
* We handle this by inspecting the instruction which generated the \
|
||||
* signal and advancing ip to point to the following instruction. \
|
||||
* As the instructions are variable length it is necessary to do a \
|
||||
* little calculation to figure out where the following instruction \
|
||||
* actually is. \
|
||||
\
|
||||
*/ \
|
||||
\
|
||||
/* Detect a signed division of Integer.MIN_VALUE. */ \
|
||||
if (_eip[0] == 0xf7) \
|
||||
{ \
|
||||
bool _min_value_dividend = false; \
|
||||
unsigned char _modrm = _eip[1]; \
|
||||
\
|
||||
if (((_modrm >> 3) & 7) == 7) /* Signed divide */ \
|
||||
{ \
|
||||
_min_value_dividend = \
|
||||
_gregs[REG_EAX] == (greg_t)0x80000000UL; \
|
||||
} \
|
||||
\
|
||||
if (_min_value_dividend) \
|
||||
{ \
|
||||
unsigned char _rm = _modrm & 7; \
|
||||
_gregs[REG_EDX] = 0; /* the remainder is zero */ \
|
||||
switch (_modrm >> 6) \
|
||||
{ \
|
||||
case 0: /* register indirect */ \
|
||||
if (_rm == 5) /* 32-bit displacement */ \
|
||||
_eip += 4; \
|
||||
if (_rm == 4) /* A SIB byte follows the ModR/M byte */ \
|
||||
_eip += 1; \
|
||||
break; \
|
||||
case 1: /* register indirect + 8-bit displacement */ \
|
||||
_eip += 1; \
|
||||
if (_rm == 4) /* A SIB byte follows the ModR/M byte */ \
|
||||
_eip += 1; \
|
||||
break; \
|
||||
case 2: /* register indirect + 32-bit displacement */ \
|
||||
_eip += 4; \
|
||||
if (_rm == 4) /* A SIB byte follows the ModR/M byte */ \
|
||||
_eip += 1; \
|
||||
break; \
|
||||
case 3: \
|
||||
break; \
|
||||
} \
|
||||
_eip += 2; \
|
||||
_gregs[REG_EIP] = (greg_t)_eip; \
|
||||
return; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* We use kernel_sigaction here because we're calling the kernel
|
||||
directly rather than via glibc. The sigaction structure that the
|
||||
syscall uses is a different shape from the one in userland and not
|
||||
visible to us in a header file so we define it here. */
|
||||
|
||||
extern "C"
|
||||
{
|
||||
struct kernel_sigaction
|
||||
{
|
||||
void (*k_sa_sigaction)(int,siginfo_t *,void *);
|
||||
unsigned long k_sa_flags;
|
||||
void (*k_sa_restorer) (void);
|
||||
sigset_t k_sa_mask;
|
||||
};
|
||||
}
|
||||
|
||||
#define MAKE_THROW_FRAME(_exception)
|
||||
|
||||
#define RESTORE(name, syscall) RESTORE2 (name, syscall)
|
||||
#define RESTORE2(name, syscall) \
|
||||
asm \
|
||||
( \
|
||||
".text\n" \
|
||||
".byte 0 # Yes, this really is necessary\n" \
|
||||
" .align 16\n" \
|
||||
"__" #name ":\n" \
|
||||
" movl $" #syscall ", %eax\n" \
|
||||
" int $0x80" \
|
||||
);
|
||||
|
||||
/* The return code for realtime-signals. */
|
||||
RESTORE (restore_rt, __NR_rt_sigreturn)
|
||||
void restore_rt (void) asm ("__restore_rt")
|
||||
__attribute__ ((visibility ("hidden")));
|
||||
|
||||
#define INIT_SEGV \
|
||||
do \
|
||||
{ \
|
||||
struct kernel_sigaction act; \
|
||||
act.k_sa_sigaction = _Jv_catch_segv; \
|
||||
sigemptyset (&act.k_sa_mask); \
|
||||
act.k_sa_flags = SA_SIGINFO|0x4000000; \
|
||||
act.k_sa_restorer = restore_rt; \
|
||||
syscall (SYS_rt_sigaction, SIGSEGV, &act, NULL, _NSIG / 8); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define INIT_FPE \
|
||||
do \
|
||||
{ \
|
||||
struct kernel_sigaction act; \
|
||||
act.k_sa_sigaction = _Jv_catch_fpe; \
|
||||
sigemptyset (&act.k_sa_mask); \
|
||||
act.k_sa_flags = SA_SIGINFO|0x4000000; \
|
||||
act.k_sa_restorer = restore_rt; \
|
||||
syscall (SYS_rt_sigaction, SIGFPE, &act, NULL, _NSIG / 8); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* You might wonder why we use syscall(SYS_sigaction) in INIT_FPE
|
||||
* instead of the standard sigaction(). This is necessary because of
|
||||
* the shenanigans above where we increment the PC saved in the
|
||||
* context and then return. This trick will only work when we are
|
||||
* called _directly_ by the kernel, because linuxthreads wraps signal
|
||||
* handlers and its wrappers do not copy the sigcontext struct back
|
||||
* when returning from a signal handler. If we return from our divide
|
||||
* handler to a linuxthreads wrapper, we will lose the PC adjustment
|
||||
* we made and return to the faulting instruction again. Using
|
||||
* syscall(SYS_sigaction) causes our handler to be called directly
|
||||
* by the kernel, bypassing any wrappers.
|
||||
|
||||
* Also, there may not be any unwind info in the linuxthreads
|
||||
* library's signal handlers and so we can't unwind through them
|
||||
* anyway. */
|
||||
|
||||
#endif /* JAVA_SIGNAL_H */
|
||||
|
@ -1,150 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 by VisualData *
|
||||
* *
|
||||
* Redistributed under LGPL license terms. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "segvcatch.h"
|
||||
|
||||
//#include <stdexcept>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace segvcatch
|
||||
{
|
||||
|
||||
segvcatch::handler handler_segv = 0;
|
||||
segvcatch::handler handler_fpe = 0;
|
||||
|
||||
#if defined __GNUC__ && __linux
|
||||
|
||||
#ifdef __i386__
|
||||
#include "i386-signal.h"
|
||||
#endif /*__i386__*/
|
||||
|
||||
#ifdef __x86_64__
|
||||
#include "x86_64-signal.h"
|
||||
#endif /*__x86_64__*/
|
||||
|
||||
#endif /*defined __GNUC__ && __linux*/
|
||||
|
||||
void default_segv()
|
||||
{
|
||||
throw "Segmentation fault";
|
||||
}
|
||||
|
||||
void default_fpe()
|
||||
{
|
||||
throw "Floating-point exception";
|
||||
}
|
||||
|
||||
void handle_segv()
|
||||
{
|
||||
if (handler_segv)
|
||||
handler_segv();
|
||||
}
|
||||
|
||||
void handle_fpe()
|
||||
{
|
||||
if (handler_fpe)
|
||||
handler_fpe();
|
||||
}
|
||||
|
||||
#if defined (HANDLE_SEGV) || defined(HANDLE_FPE)
|
||||
|
||||
#include <execinfo.h>
|
||||
|
||||
/* Unblock a signal. Unless we do this, the signal may only be sent
|
||||
once. */
|
||||
static void unblock_signal(int signum __attribute__((__unused__)))
|
||||
{
|
||||
#ifdef _POSIX_VERSION
|
||||
sigset_t sigs;
|
||||
sigemptyset(&sigs);
|
||||
sigaddset(&sigs, signum);
|
||||
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HANDLE_SEGV
|
||||
|
||||
SIGNAL_HANDLER(catch_segv)
|
||||
{
|
||||
unblock_signal(SIGSEGV);
|
||||
MAKE_THROW_FRAME(nullp);
|
||||
handle_segv();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HANDLE_FPE
|
||||
|
||||
SIGNAL_HANDLER(catch_fpe)
|
||||
{
|
||||
unblock_signal(SIGFPE);
|
||||
#ifdef HANDLE_DIVIDE_OVERFLOW
|
||||
HANDLE_DIVIDE_OVERFLOW;
|
||||
#else
|
||||
MAKE_THROW_FRAME(arithexception);
|
||||
#endif
|
||||
handle_fpe();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
|
||||
static LONG CALLBACK win32_exception_handler(LPEXCEPTION_POINTERS e)
|
||||
{
|
||||
if (e->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
|
||||
{
|
||||
handle_segv();
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
else if (e->ExceptionRecord->ExceptionCode == EXCEPTION_INT_DIVIDE_BY_ZERO)
|
||||
{
|
||||
handle_fpe();
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
else
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
namespace segvcatch
|
||||
{
|
||||
|
||||
void init_segv(handler h)
|
||||
{
|
||||
if (h)
|
||||
handler_segv = h;
|
||||
else
|
||||
handler_segv = default_segv;
|
||||
#ifdef HANDLE_SEGV
|
||||
INIT_SEGV;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
SetUnhandledExceptionFilter(win32_exception_handler);
|
||||
#endif
|
||||
}
|
||||
|
||||
void init_fpe(handler h)
|
||||
{
|
||||
if (h)
|
||||
handler_fpe = h;
|
||||
else
|
||||
handler_fpe = default_fpe;
|
||||
#ifdef HANDLE_FPE
|
||||
INIT_FPE;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
SetUnhandledExceptionFilter(win32_exception_handler);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 by VisualData *
|
||||
* *
|
||||
* Redistributed under LGPL license terms. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _SEGVCATCH_H
|
||||
#define _SEGVCATCH_H
|
||||
|
||||
/*! \brief segvcatch namespace
|
||||
|
||||
|
||||
*/
|
||||
namespace segvcatch
|
||||
{
|
||||
|
||||
|
||||
/*! Signal handler, used to redefine standart exception throwing. */
|
||||
typedef void (*handler)();
|
||||
|
||||
|
||||
extern segvcatch::handler handler_segv;
|
||||
extern segvcatch::handler handler_fpe;
|
||||
|
||||
/*! Initialize segmentation violation handler.
|
||||
\param h (optional) - optional user's signal handler. By default used an internal signal handler to throw
|
||||
std::runtime_error.
|
||||
*/
|
||||
void init_segv(handler h = 0);
|
||||
|
||||
/*! Initialize floating point error handler.
|
||||
\param h - optional user's signal handler. By default used an internal signal handler to throw
|
||||
std::runtime_error.*/
|
||||
void init_fpe(handler h = 0);
|
||||
|
||||
}
|
||||
|
||||
#endif /* _SEGVCATCH_H */
|
@ -1,181 +0,0 @@
|
||||
// x86_64-signal.h - Catch runtime signals and turn them into exceptions
|
||||
// on an x86_64 based GNU/Linux system.
|
||||
|
||||
/* Copyright (C) 2003, 2006, 2007 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
#ifndef JAVA_SIGNAL_H
|
||||
#define JAVA_SIGNAL_H 1
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#define HANDLE_SEGV 1
|
||||
#define HANDLE_FPE 1
|
||||
|
||||
#define SIGNAL_HANDLER(_name) \
|
||||
static void _Jv_##_name (int, siginfo_t *, \
|
||||
void *_p __attribute__ ((__unused__)))
|
||||
|
||||
#define HANDLE_DIVIDE_OVERFLOW \
|
||||
do \
|
||||
{ \
|
||||
struct ucontext *_uc = (struct ucontext *)_p; \
|
||||
gregset_t &_gregs = _uc->uc_mcontext.gregs; \
|
||||
unsigned char *_rip = (unsigned char *)_gregs[REG_RIP]; \
|
||||
\
|
||||
/* According to the JVM spec, "if the dividend is the negative \
|
||||
* integer of largest possible magnitude for the type and the \
|
||||
* divisor is -1, then overflow occurs and the result is equal to \
|
||||
* the dividend. Despite the overflow, no exception occurs". \
|
||||
\
|
||||
* We handle this by inspecting the instruction which generated the \
|
||||
* signal and advancing ip to point to the following instruction. \
|
||||
* As the instructions are variable length it is necessary to do a \
|
||||
* little calculation to figure out where the following instruction \
|
||||
* actually is. \
|
||||
\
|
||||
*/ \
|
||||
\
|
||||
bool _is_64_bit = false; \
|
||||
\
|
||||
if ((_rip[0] & 0xf0) == 0x40) /* REX byte present. */ \
|
||||
{ \
|
||||
unsigned char _rex = _rip[0] & 0x0f; \
|
||||
_is_64_bit = (_rex & 0x08) != 0; \
|
||||
_rip++; \
|
||||
} \
|
||||
\
|
||||
/* Detect a signed division of Integer.MIN_VALUE or Long.MIN_VALUE. */ \
|
||||
if (_rip[0] == 0xf7) \
|
||||
{ \
|
||||
bool _min_value_dividend = false; \
|
||||
unsigned char _modrm = _rip[1]; \
|
||||
\
|
||||
if (((_modrm >> 3) & 7) == 7) \
|
||||
{ \
|
||||
if (_is_64_bit) \
|
||||
_min_value_dividend = \
|
||||
_gregs[REG_RAX] == (greg_t)0x8000000000000000UL; \
|
||||
else \
|
||||
_min_value_dividend = \
|
||||
(_gregs[REG_RAX] & 0xffffffff) == (greg_t)0x80000000UL; \
|
||||
} \
|
||||
\
|
||||
if (_min_value_dividend) \
|
||||
{ \
|
||||
unsigned char _rm = _modrm & 7; \
|
||||
_gregs[REG_RDX] = 0; /* the remainder is zero */ \
|
||||
switch (_modrm >> 6) \
|
||||
{ \
|
||||
case 0: /* register indirect */ \
|
||||
if (_rm == 5) /* 32-bit displacement */ \
|
||||
_rip += 4; \
|
||||
if (_rm == 4) /* A SIB byte follows the ModR/M byte */ \
|
||||
_rip += 1; \
|
||||
break; \
|
||||
case 1: /* register indirect + 8-bit displacement */ \
|
||||
_rip += 1; \
|
||||
if (_rm == 4) /* A SIB byte follows the ModR/M byte */ \
|
||||
_rip += 1; \
|
||||
break; \
|
||||
case 2: /* register indirect + 32-bit displacement */ \
|
||||
_rip += 4; \
|
||||
if (_rm == 4) /* A SIB byte follows the ModR/M byte */ \
|
||||
_rip += 1; \
|
||||
break; \
|
||||
case 3: \
|
||||
break; \
|
||||
} \
|
||||
_rip += 2; \
|
||||
_gregs[REG_RIP] = (greg_t)_rip; \
|
||||
return; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
extern "C"
|
||||
{
|
||||
struct kernel_sigaction
|
||||
{
|
||||
void (*k_sa_sigaction)(int,siginfo_t *,void *);
|
||||
unsigned long k_sa_flags;
|
||||
void (*k_sa_restorer) (void);
|
||||
sigset_t k_sa_mask;
|
||||
};
|
||||
}
|
||||
|
||||
#define MAKE_THROW_FRAME(_exception)
|
||||
|
||||
#define RESTORE(name, syscall) RESTORE2 (name, syscall)
|
||||
#define RESTORE2(name, syscall) \
|
||||
asm \
|
||||
( \
|
||||
".text\n" \
|
||||
".byte 0 # Yes, this really is necessary\n" \
|
||||
".align 16\n" \
|
||||
"__" #name ":\n" \
|
||||
" movq $" #syscall ", %rax\n" \
|
||||
" syscall\n" \
|
||||
);
|
||||
|
||||
/* The return code for realtime-signals. */
|
||||
RESTORE (restore_rt, __NR_rt_sigreturn)
|
||||
void restore_rt (void) asm ("__restore_rt")
|
||||
__attribute__ ((visibility ("hidden")));
|
||||
|
||||
#define INIT_SEGV \
|
||||
do \
|
||||
{ \
|
||||
struct kernel_sigaction act; \
|
||||
act.k_sa_sigaction = _Jv_catch_segv; \
|
||||
sigemptyset (&act.k_sa_mask); \
|
||||
act.k_sa_flags = SA_SIGINFO|0x4000000; \
|
||||
act.k_sa_restorer = restore_rt; \
|
||||
syscall (SYS_rt_sigaction, SIGSEGV, &act, 0, _NSIG / 8); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define INIT_FPE \
|
||||
do \
|
||||
{ \
|
||||
struct kernel_sigaction act; \
|
||||
act.k_sa_sigaction = _Jv_catch_fpe; \
|
||||
sigemptyset (&act.k_sa_mask); \
|
||||
act.k_sa_flags = SA_SIGINFO|0x4000000; \
|
||||
act.k_sa_restorer = restore_rt; \
|
||||
syscall (SYS_rt_sigaction, SIGFPE, &act, 0, _NSIG / 8); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* You might wonder why we use syscall(SYS_sigaction) in INIT_FPE
|
||||
* instead of the standard sigaction(). This is necessary because of
|
||||
* the shenanigans above where we increment the PC saved in the
|
||||
* context and then return. This trick will only work when we are
|
||||
* called _directly_ by the kernel, because linuxthreads wraps signal
|
||||
* handlers and its wrappers do not copy the sigcontext struct back
|
||||
* when returning from a signal handler. If we return from our divide
|
||||
* handler to a linuxthreads wrapper, we will lose the PC adjustment
|
||||
* we made and return to the faulting instruction again. Using
|
||||
* syscall(SYS_sigaction) causes our handler to be called directly
|
||||
* by the kernel, bypassing any wrappers. */
|
||||
|
||||
#endif /* JAVA_SIGNAL_H */
|
||||
|
||||
#else /* __x86_64__ */
|
||||
|
||||
/* This is for the 32-bit subsystem on x86-64. */
|
||||
|
||||
#define sigcontext_struct sigcontext
|
||||
#include <java-signal-aux.h>
|
||||
|
||||
#endif /* __x86_64__ */
|
@ -50,8 +50,6 @@ static CatVar ve_smooth(CV_SWITCH, "debug_ve_smooth", "1", "VE Smoothing");
|
||||
static CatVar ve_averager_size(CV_INT, "debug_ve_averaging", "8", "VE Averaging");
|
||||
|
||||
void CachedEntity::Update() {
|
||||
SEGV_BEGIN
|
||||
|
||||
auto raw = RAW_ENT(this);
|
||||
|
||||
if (!raw) return;
|
||||
@ -182,7 +180,6 @@ void CachedEntity::Update() {
|
||||
m_iHealth = NET_INT(raw, netvar.iBuildingHealth);
|
||||
m_iMaxHealth = NET_INT(raw, netvar.iBuildingMaxHealth);
|
||||
}
|
||||
SEGV_END_INFO("Updating entity");
|
||||
}
|
||||
|
||||
static CatVar fast_vischeck(CV_SWITCH, "fast_vischeck", "0", "Fast VisCheck", "VisCheck only certain player hitboxes");
|
||||
@ -194,8 +191,7 @@ bool CachedEntity::IsVisible() {
|
||||
PROF_SECTION(CE_IsVisible);
|
||||
if (m_bVisCheckComplete) return m_bAnyHitboxVisible;
|
||||
|
||||
vischeck0 = false;
|
||||
SAFE_CALL(vischeck0 = IsEntityVectorVisible(this, m_vecOrigin));
|
||||
vischeck0 = IsEntityVectorVisible(this, m_vecOrigin);
|
||||
|
||||
if (vischeck0) {
|
||||
m_bAnyHitboxVisible = true;
|
||||
@ -218,7 +214,7 @@ bool CachedEntity::IsVisible() {
|
||||
|
||||
for (int i = 0; i < hitboxes.m_nNumHitboxes; i++) {
|
||||
vischeck = false;
|
||||
SAFE_CALL(vischeck = hitboxes.VisibilityCheck(i));
|
||||
vischeck = hitboxes.VisibilityCheck(i);
|
||||
if (vischeck) {
|
||||
m_bAnyHitboxVisible = true;
|
||||
m_bVisCheckComplete = true;
|
||||
|
@ -33,7 +33,7 @@ void EntityHitboxCache::InvalidateCache() {
|
||||
}
|
||||
|
||||
void EntityHitboxCache::Update() {
|
||||
SAFE_CALL(InvalidateCache());
|
||||
InvalidateCache();
|
||||
if (CE_BAD(parent_ref)) return;
|
||||
}
|
||||
|
||||
@ -43,9 +43,8 @@ void EntityHitboxCache::Init() {
|
||||
mstudiohitboxset_t *set;
|
||||
|
||||
m_bInit = true;
|
||||
model = 0;
|
||||
if (CE_BAD(parent_ref)) return;
|
||||
SAFE_CALL(model = (model_t*)RAW_ENT(parent_ref)->GetModel());
|
||||
if (CE_BAD(parent_ref)) return;
|
||||
model = (model_t*)RAW_ENT(parent_ref)->GetModel();
|
||||
if (!model) return;
|
||||
if (!m_bModelSet || model != m_pLastModel) {
|
||||
shdr = g_IModelInfo->GetStudiomodel(model);
|
||||
@ -56,7 +55,7 @@ void EntityHitboxCache::Init() {
|
||||
m_pHitboxSet = set;
|
||||
m_nNumHitboxes = 0;
|
||||
if (set) {
|
||||
SAFE_CALL(m_nNumHitboxes = set->numhitboxes);
|
||||
m_nNumHitboxes = set->numhitboxes;
|
||||
}
|
||||
if (m_nNumHitboxes > CACHE_MAX_HITBOXES) m_nNumHitboxes = CACHE_MAX_HITBOXES;
|
||||
m_bModelSet = true;
|
||||
@ -74,7 +73,7 @@ bool EntityHitboxCache::VisibilityCheck(int id) {
|
||||
// TODO corners
|
||||
hitbox = GetHitbox(id);
|
||||
if (!hitbox) return 0;
|
||||
SAFE_CALL(m_VisCheck[id] = (IsEntityVectorVisible(parent_ref, hitbox->center)));
|
||||
m_VisCheck[id] = (IsEntityVectorVisible(parent_ref, hitbox->center));
|
||||
m_VisCheckValidationFlags[id] = true;
|
||||
return m_VisCheck[id];
|
||||
}
|
||||
|
@ -107,7 +107,6 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
Vector vsilent, ang;
|
||||
INetChannel* ch;
|
||||
|
||||
SEGV_BEGIN;
|
||||
tickcount++;
|
||||
g_pUserCmd = cmd;
|
||||
|
||||
@ -195,16 +194,16 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
// PROF_BEGIN();
|
||||
{
|
||||
PROF_SECTION(EntityCache);
|
||||
SAFE_CALL(entity_cache::Update());
|
||||
entity_cache::Update();
|
||||
}
|
||||
// PROF_END("Entity Cache updating");
|
||||
{
|
||||
PROF_SECTION(CM_PlayerResource);
|
||||
SAFE_CALL(g_pPlayerResource->Update());
|
||||
g_pPlayerResource->Update();
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_LocalPlayer);
|
||||
SAFE_CALL(g_pLocalPlayer->Update());
|
||||
g_pLocalPlayer->Update();
|
||||
}
|
||||
g_Settings.bInvalid = false;
|
||||
|
||||
@ -264,19 +263,19 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
#endif
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
IF_GAME (IsTF2()) {
|
||||
SAFE_CALL(UpdateHoovyList());
|
||||
UpdateHoovyList();
|
||||
}
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
#if ENABLE_VISUALS == 1
|
||||
{
|
||||
PROF_SECTION(CM_esp);
|
||||
SAFE_CALL(hacks::shared::esp::CreateMove());
|
||||
hacks::shared::esp::CreateMove();
|
||||
}
|
||||
#endif
|
||||
if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) {
|
||||
{
|
||||
PROF_SECTION(CM_walkbot);
|
||||
SAFE_CALL(hacks::shared::walkbot::Move());
|
||||
hacks::shared::walkbot::Move();
|
||||
}
|
||||
// Walkbot can leave game.
|
||||
if (!g_IEngine->IsInGame()) {
|
||||
@ -285,24 +284,24 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
}
|
||||
IF_GAME (IsTF()) {
|
||||
PROF_SECTION(CM_uberspam);
|
||||
SAFE_CALL(hacks::tf::uberspam::CreateMove());
|
||||
hacks::tf::uberspam::CreateMove();
|
||||
}
|
||||
IF_GAME (IsTF2()) {
|
||||
PROF_SECTION(CM_antibackstab);
|
||||
SAFE_CALL(hacks::tf2::antibackstab::CreateMove());
|
||||
hacks::tf2::antibackstab::CreateMove();
|
||||
}
|
||||
IF_GAME (IsTF2()) {
|
||||
PROF_SECTION(CM_noisemaker);
|
||||
SAFE_CALL(hacks::tf2::noisemaker::CreateMove());
|
||||
hacks::tf2::noisemaker::CreateMove();
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_bunnyhop);
|
||||
SAFE_CALL(hacks::shared::bunnyhop::CreateMove());
|
||||
hacks::shared::bunnyhop::CreateMove();
|
||||
}
|
||||
if (engine_pred) engine_prediction::RunEnginePrediction(RAW_ENT(LOCAL_E), g_pUserCmd);
|
||||
{
|
||||
PROF_SECTION(CM_aimbot);
|
||||
SAFE_CALL(hacks::shared::aimbot::CreateMove());
|
||||
hacks::shared::aimbot::CreateMove();
|
||||
}
|
||||
static int attackticks = 0;
|
||||
if (g_pUserCmd->buttons & IN_ATTACK)
|
||||
@ -321,27 +320,27 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_antiaim);
|
||||
SAFE_CALL(hacks::shared::antiaim::ProcessUserCmd(cmd));
|
||||
hacks::shared::antiaim::ProcessUserCmd(cmd);
|
||||
}
|
||||
IF_GAME (IsTF()) {
|
||||
PROF_SECTION(CM_autosticky);
|
||||
SAFE_CALL(hacks::tf::autosticky::CreateMove());
|
||||
hacks::tf::autosticky::CreateMove();
|
||||
}
|
||||
IF_GAME (IsTF()) {
|
||||
PROF_SECTION(CM_autoreflect);
|
||||
SAFE_CALL(hacks::tf::autoreflect::CreateMove());
|
||||
hacks::tf::autoreflect::CreateMove();
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_triggerbot);
|
||||
SAFE_CALL(hacks::shared::triggerbot::CreateMove());
|
||||
hacks::shared::triggerbot::CreateMove();
|
||||
}
|
||||
IF_GAME (IsTF()) {
|
||||
PROF_SECTION(CM_autoheal);
|
||||
SAFE_CALL(hacks::tf::autoheal::CreateMove());
|
||||
hacks::tf::autoheal::CreateMove();
|
||||
}
|
||||
IF_GAME (IsTF2()) {
|
||||
PROF_SECTION(CM_autobackstab);
|
||||
SAFE_CALL(hacks::tf2::autobackstab::CreateMove());
|
||||
hacks::tf2::autobackstab::CreateMove();
|
||||
}
|
||||
if (debug_projectiles)
|
||||
projectile_logging::Update();
|
||||
@ -349,7 +348,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_misc);
|
||||
SAFE_CALL(hacks::shared::misc::CreateMove());
|
||||
hacks::shared::misc::CreateMove();
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_crits);
|
||||
@ -357,7 +356,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_spam);
|
||||
SAFE_CALL(hacks::shared::spam::CreateMove());
|
||||
hacks::shared::spam::CreateMove();
|
||||
}
|
||||
}
|
||||
if (time_replaced) g_GlobalVars->curtime = curtime_old;
|
||||
@ -434,7 +433,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
#if ENABLE_IPC == 1
|
||||
if (CE_GOOD(g_pLocalPlayer->entity) && !g_pLocalPlayer->life_state) {
|
||||
PROF_SECTION(CM_followbot);
|
||||
SAFE_CALL(hacks::shared::followbot::AfterCreateMove());
|
||||
hacks::shared::followbot::AfterCreateMove();
|
||||
}
|
||||
#endif
|
||||
if (cmd)
|
||||
@ -448,7 +447,4 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
g_pLocalPlayer->bAttackLastTick = (cmd->buttons & IN_ATTACK);
|
||||
g_Settings.is_create_move = false;
|
||||
return ret;
|
||||
|
||||
SEGV_END;
|
||||
return true;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
|
||||
}
|
||||
}
|
||||
|
||||
if (call_default) SAFE_CALL(original(_this, vp, fr, ar));
|
||||
if (call_default) original(_this, vp, fr, ar);
|
||||
// To avoid threading problems.
|
||||
|
||||
PROF_SECTION(PT_total);
|
||||
@ -128,6 +128,5 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
|
||||
|
||||
PROF_SECTION(PT_active);
|
||||
draw::UpdateWTS();
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,6 @@ CatCommand spectate("spectate", "Spectate", [](const CCommand& args) {
|
||||
void OverrideView_hook(void* _this, CViewSetup* setup) {
|
||||
static const OverrideView_t original = (OverrideView_t)hooks::clientmode.GetMethod(offsets::OverrideView());
|
||||
static bool zoomed;
|
||||
SEGV_BEGIN;
|
||||
original(_this, setup);
|
||||
if (!cathook) return;
|
||||
if (g_pLocalPlayer->bZoomed && override_fov_zoomed) {
|
||||
@ -162,17 +161,13 @@ void OverrideView_hook(void* _this, CViewSetup* setup) {
|
||||
}
|
||||
|
||||
draw::fov = setup->fov;
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool CanPacket_hook(void* _this) {
|
||||
const CanPacket_t original = (CanPacket_t)hooks::netchannel.GetMethod(offsets::CanPacket());
|
||||
SEGV_BEGIN;
|
||||
return *bSendPackets && original(_this);
|
||||
SEGV_END;
|
||||
return false;
|
||||
}
|
||||
|
||||
CUserCmd* GetUserCmd_hook(IInput* _this, int sequence_number) {
|
||||
@ -225,7 +220,6 @@ bool SendNetMsg_hook(void* _this, INetMessage& msg, bool bForceReliable = false,
|
||||
|
||||
// This is a INetChannel hook - it SHOULDN'T be static because netchannel changes.
|
||||
const SendNetMsg_t original = (SendNetMsg_t)hooks::netchannel.GetMethod(offsets::SendNetMsg());
|
||||
SEGV_BEGIN;
|
||||
// net_StringCmd
|
||||
if (msg.GetType() == 4 && (newlines_msg || crypt_chat)) {
|
||||
std::string str(msg.ToString());
|
||||
@ -283,8 +277,6 @@ bool SendNetMsg_hook(void* _this, INetMessage& msg, bool bForceReliable = false,
|
||||
logging::Info("%i bytes => %s", buffer.GetNumBytesWritten(), bytes.c_str());
|
||||
}
|
||||
return original(_this, msg, bForceReliable, bVoice);
|
||||
SEGV_END;
|
||||
return false;
|
||||
}
|
||||
|
||||
static CatVar die_if_vac(CV_SWITCH, "die_if_vac", "0", "Die if VAC banned");
|
||||
@ -305,13 +297,11 @@ void Shutdown_hook(void* _this, const char* reason) {
|
||||
#if ENABLE_IPC
|
||||
ipc::UpdateServerAddress(true);
|
||||
#endif
|
||||
SEGV_BEGIN;
|
||||
if (cathook && (disconnect_reason.convar_parent->m_StringLength > 3) && strstr(reason, "user")) {
|
||||
original(_this, disconnect_reason_newlined);
|
||||
} else {
|
||||
original(_this, reason);
|
||||
}
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles");
|
||||
@ -449,7 +439,6 @@ void FrameStageNotify_hook(void* _this, int stage) {
|
||||
hacks::tf2::killstreak::apply_killstreaks();
|
||||
|
||||
static const FrameStageNotify_t original = (FrameStageNotify_t)hooks::client.GetMethod(offsets::FrameStageNotify());
|
||||
SEGV_BEGIN;
|
||||
if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true;
|
||||
#if ENABLE_VISUALS == 1
|
||||
{
|
||||
@ -542,8 +531,7 @@ void FrameStageNotify_hook(void* _this, int stage) {
|
||||
}
|
||||
}
|
||||
#endif /* TEXTMODE */
|
||||
SAFE_CALL(original(_this, stage));
|
||||
SEGV_END;
|
||||
original(_this, stage);
|
||||
}
|
||||
|
||||
static CatVar clean_chat(CV_SWITCH, "clean_chat", "0", "Clean chat", "Removes newlines from chat");
|
||||
@ -554,7 +542,6 @@ bool DispatchUserMessage_hook(void* _this, int type, bf_read& buf) {
|
||||
char *data, c;
|
||||
|
||||
static const DispatchUserMessage_t original = (DispatchUserMessage_t)hooks::client.GetMethod(offsets::DispatchUserMessage());
|
||||
SEGV_BEGIN;
|
||||
if (type == 4) {
|
||||
loop_index = 0;
|
||||
s = buf.GetNumBytesLeft();
|
||||
@ -590,8 +577,6 @@ bool DispatchUserMessage_hook(void* _this, int type, bf_read& buf) {
|
||||
logging::Info("D> %i", type);
|
||||
}
|
||||
return original(_this, type, buf);
|
||||
SEGV_END;
|
||||
return false;
|
||||
}
|
||||
|
||||
void LevelInit_hook(void* _this, const char* newmap) {
|
||||
|
@ -40,7 +40,7 @@ void DrawCheatVisuals() {
|
||||
#endif
|
||||
{
|
||||
PROF_SECTION(DRAW_misc);
|
||||
SAFE_CALL(hacks::shared::misc::DrawText());
|
||||
hacks::shared::misc::DrawText();
|
||||
}
|
||||
if (info_text) {
|
||||
PROF_SECTION(DRAW_info);
|
||||
@ -82,12 +82,12 @@ void DrawCheatVisuals() {
|
||||
}
|
||||
IF_GAME(IsTF2()) {
|
||||
PROF_SECTION(DRAW_skinchanger);
|
||||
SAFE_CALL(hacks::tf2::skinchanger::DrawText());
|
||||
hacks::tf2::skinchanger::DrawText();
|
||||
}
|
||||
#ifndef FEATURE_RADAR_DISABLED
|
||||
IF_GAME(IsTF()) {
|
||||
PROF_SECTION(DRAW_radar);
|
||||
SAFE_CALL(hacks::tf::radar::Draw());
|
||||
hacks::tf::radar::Draw();
|
||||
}
|
||||
#endif
|
||||
IF_GAME(IsTF2()) {
|
||||
@ -100,14 +100,14 @@ void DrawCheatVisuals() {
|
||||
}
|
||||
IF_GAME(IsTF()) {
|
||||
PROF_SECTION(PT_antidisguise);
|
||||
SAFE_CALL(hacks::tf2::antidisguise::Draw());
|
||||
hacks::tf2::antidisguise::Draw();
|
||||
}
|
||||
IF_GAME(IsTF()) {
|
||||
PROF_SECTION(PT_spyalert);
|
||||
SAFE_CALL(hacks::tf::spyalert::Draw());
|
||||
hacks::tf::spyalert::Draw();
|
||||
}
|
||||
#if ENABLE_IPC == 1
|
||||
IF_GAME(IsTF()) SAFE_CALL(hacks::shared::followbot::Draw());
|
||||
IF_GAME(IsTF()) hacks::shared::followbot::Draw();
|
||||
#endif
|
||||
{
|
||||
PROF_SECTION(DRAW_esp);
|
||||
|
Reference in New Issue
Block a user