Add files via upload

This commit is contained in:
0TheSpy 2022-11-13 21:57:56 +03:00 committed by GitHub
parent a7ae5617e7
commit 97eb82f707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 132 additions and 2 deletions

View File

@ -64,6 +64,8 @@ public:
NETVAR2(GetViewOffset, "DT_CSPlayer", "m_vecViewOffset[0]", Vector);
NETVAR2(GetVelocity, "DT_CSPlayer", "m_vecVelocity[0]", Vector);
NETVAR2(GetGroundEntity, "DT_BasePlayer", "m_hGroundEntity", int);
int GetSequenceActivity(int sequence, studiohdr_t* hdr)
{
static auto getSequenceActivity = (DWORD)(FindPatternV2("client.dll", "55 8B EC 53 8B 5D 08 56 8B F1 83"));
@ -83,7 +85,7 @@ public:
printf("Set new sequence %d\n",sequence);
typedef void(__thiscall* OriginalFn)(void*, int);
return getvfunc<OriginalFn>(this, 246)(this, sequence);
}
}
};

View File

@ -48,4 +48,7 @@ inline bool MD5Value_t::operator!=(const MD5Value_t& src) const
return !MD5_Compare(*this, src);
}
//
#endif

View File

@ -721,7 +721,22 @@ inline int ClampArrayBounds(int n, unsigned maxindex)
: \
BoxOnPlaneSide( (emins), (emaxs), (p)))
void AngleVectors(const QAngle& angles, Vector* forward);
inline void AngleVectors(const QAngle& angles, Vector* forward)
{
Assert(s_bMathlibInitialized);
Assert(forward);
float sp, sy, cp, cy;
SinCos(DEG2RAD(angles[YAW]), &sy, &cy);
SinCos(DEG2RAD(angles[PITCH]), &sp, &cp);
forward->x = cp * cy;
forward->y = cp * sy;
forward->z = -sp;
}
void AngleVectors(const QAngle& angles, Vector* forward, Vector* right, Vector* up);
void AngleVectorsTranspose(const QAngle& angles, Vector* forward, Vector* right, Vector* up);
void AngleMatrix(const QAngle& angles, matrix3x4_t& mat);

View File

@ -1921,6 +1921,116 @@ inline bool Vector::IsLengthLessThan(float val) const
}
#include <emmintrin.h>
#include <xmmintrin.h>
inline void SinCosX(const float rad, float& sin, float& cos)
{
const __m128 _ps_fopi = _mm_set_ss(1.27323954473516f);
const __m128 _ps_0p5 = _mm_set_ss(0.5f);
const __m128 _ps_1 = _mm_set_ss(1.0f);
const __m128 _ps_dp1 = _mm_set_ss(-0.7851562f);
const __m128 _ps_dp2 = _mm_set_ss(-2.4187564849853515625e-4f);
const __m128 _ps_dp3 = _mm_set_ss(-3.77489497744594108e-8f);
const __m128 _ps_sincof_p0 = _mm_set_ss(2.443315711809948e-5f);
const __m128 _ps_sincof_p1 = _mm_set_ss(8.3321608736e-3f);
const __m128 _ps_sincof_p2 = _mm_set_ss(-1.6666654611e-1f);
const __m128 _ps_coscof_p0 = _mm_set_ss(2.443315711809948e-5f);
const __m128 _ps_coscof_p1 = _mm_set_ss(-1.388731625493765e-3f);
const __m128 _ps_coscof_p2 = _mm_set_ss(4.166664568298827e-2f);
const __m128i _pi32_1 = _mm_set1_epi32(1);
const __m128i _pi32_i1 = _mm_set1_epi32(~1);
const __m128i _pi32_2 = _mm_set1_epi32(2);
const __m128i _pi32_4 = _mm_set1_epi32(4);
const __m128 _mask_sign_raw = *(__m128*) & _mm_set1_epi32(0x80000000);
const __m128 _mask_sign_inv = *(__m128*) & _mm_set1_epi32(~0x80000000);
__m128 xmm3 = _mm_setzero_ps();
__m128i emm0, emm2, emm4;
__m128 sign_bit_cos, sign_bit_sin;
__m128 x, y, z;
__m128 y1, y2;
__m128 a = _mm_set_ss(rad);
x = _mm_and_ps(a, _mask_sign_inv);
y = _mm_mul_ps(x, _ps_fopi);
emm2 = _mm_cvtps_epi32(y);
emm2 = _mm_add_epi32(emm2, _pi32_1);
emm2 = _mm_and_si128(emm2, _pi32_i1);
y = _mm_cvtepi32_ps(emm2);
emm4 = emm2;
emm0 = _mm_and_si128(emm2, _pi32_4);
emm0 = _mm_slli_epi32(emm0, 29);
__m128 swap_sign_bit_sin = _mm_castsi128_ps(emm0);
emm2 = _mm_and_si128(emm2, _pi32_2);
emm2 = _mm_cmpeq_epi32(emm2, _mm_setzero_si128());
__m128 poly_mask = _mm_castsi128_ps(emm2);
x = _mm_add_ps(x, _mm_mul_ps(y, _ps_dp1));
x = _mm_add_ps(x, _mm_mul_ps(y, _ps_dp2));
x = _mm_add_ps(x, _mm_mul_ps(y, _ps_dp3));
emm4 = _mm_sub_epi32(emm4, _pi32_2);
emm4 = _mm_andnot_si128(emm4, _pi32_4);
emm4 = _mm_slli_epi32(emm4, 29);
sign_bit_cos = _mm_castsi128_ps(emm4);
sign_bit_sin = _mm_xor_ps(_mm_and_ps(a, _mask_sign_raw), swap_sign_bit_sin);
z = _mm_mul_ps(x, x);
y1 = _mm_mul_ps(_ps_coscof_p0, z);
y1 = _mm_add_ps(y1, _ps_coscof_p1);
y1 = _mm_mul_ps(y1, z);
y1 = _mm_add_ps(y1, _ps_coscof_p2);
y1 = _mm_mul_ps(y1, z);
y1 = _mm_mul_ps(y1, z);
y1 = _mm_sub_ps(y1, _mm_mul_ps(z, _ps_0p5));
y1 = _mm_add_ps(y1, _ps_1);
y2 = _mm_mul_ps(_ps_sincof_p0, z);
y2 = _mm_add_ps(y2, _ps_sincof_p1);
y2 = _mm_mul_ps(y2, z);
y2 = _mm_add_ps(y2, _ps_sincof_p2);
y2 = _mm_mul_ps(y2, z);
y2 = _mm_mul_ps(y2, x);
y2 = _mm_add_ps(y2, x);
xmm3 = poly_mask;
__m128 ysin2 = _mm_and_ps(xmm3, y2);
__m128 ysin1 = _mm_andnot_ps(xmm3, y1);
sin = _mm_cvtss_f32(_mm_xor_ps(_mm_add_ps(ysin1, ysin2), sign_bit_sin));
cos = _mm_cvtss_f32(_mm_xor_ps(_mm_add_ps(_mm_sub_ps(y1, ysin1), _mm_sub_ps(y2, ysin2)), sign_bit_cos));
}
inline float sqrt2(float sqr)
{
float root = 0;
__asm
{
sqrtss xmm0, sqr
movss root, xmm0
}
return root;
}