Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Angles for those willing to make aimbots...
- //It doesn't work when in vehicle tho, I may give it a look later, and the pointer is constantly changing... Anyways, any Q feel //free to ask, It's kinda messy
- //Angles are in rads btw.
- #define K_TPSCAMERATHISPTR 0x001DCF1B0
- #define K_FPSCAMERAANGLESOFFSET 0x001DCE670
- #define K_GETTPSCAMERAOFFSET 0x0027E5D0
- //Weird class names, but as long as I understand them, it's aight for me...
- ------------------------------------------------------------------------------------------------------------
- class CGameCameraAngles
- {
- public:
- CCameraManagerAngles* pMyCameraManagerAngles; //0x0000
- char _0x0008[56];
- };//Size=0x0040
- class CCameraManagerAngles
- {
- public:
- CCameraAngles* pMyCameraAngles; //0x0000
- };//Size=0x0008
- class CCameraAngles
- {
- public:
- char _0x0000[960];
- CPlayerAngles* pMyFPSAngles; //0x03C0
- char _0x03C8[16];
- __int64 pTPSCamEDX; //0x03D8 // This is passed as second parameter to oGetTPSCamera
- char _0x03E0[40];
- };//Size=0x0408
- class CPlayerAngles
- {
- public:
- char _0x0000[64];
- float fUnknwn_X; //0x0040 // Seems to change the X angle too but still weird
- D3DXVECTOR3 vViewAngles; //0x0044
- char _0x0050[64];
- };//Size=0x0090
- ------------------------------------------------------------------------------------------------------------------
- .text:000000000027D2D4 sub_27D2D4 proc near ; CODE XREF: .text:00000000007FB185p
- .text:000000000027D2D4 ; sub_8CF714+15Cp ...
- .text:000000000027D2D4
- .text:000000000027D2D4 arg_0 = qword ptr 8
- .text:000000000027D2D4
- .text:000000000027D2D4 mov [rsp+arg_0], rbx
- .text:000000000027D2D9 push rdi
- .text:000000000027D2DA sub rsp, 20h
- .text:000000000027D2DE mov rbx, rcx
- .text:000000000027D2E1 mov rdx, rcx // QWORD qwEDX = pGameCam->pMyCameraManagerAngles->pMyCameraAngles->pTPSCamEDX;
- .text:000000000027D2E4 mov rcx, cs:TPSCAMERATHISPTR
- .text:000000000027D2EB call oGetTPSCamera // Returns NULL if FPS Cam
- .text:000000000027D2F0 mov rcx, cs:TPSCAMERATHISPTR
- .text:000000000027D2F7 mov rdx, rbx
- .text:000000000027D2FA mov rdi, rax
- .text:000000000027D2FD call sub_27B334
- .text:000000000027D302 mov ecx, [rbx+1408h]
- .text:000000000027D308 shr ecx, 0Dh
- .text:000000000027D30B test cl, 1
- .text:000000000027D30E jz short loc_27D337
- .text:000000000027D310 mov rcx, cs:qword_1DCE690
- .text:000000000027D317 cmp byte ptr [rcx+2E7h], 0
- .text:000000000027D31E jnz short loc_27D337
- .text:000000000027D320 cmp dword ptr [rcx+2E0h], 3
- .text:000000000027D327 jz short loc_27D337
- .text:000000000027D329 add rcx, 1F0h
- .text:000000000027D330 call sub_2536D4
- .text:000000000027D335 jmp short loc_27D3A5
- .text:000000000027D337 ; -------------------------------------------------------------.text:000000000027D337 loc_27D337: ; CODE XREF: sub_27D2D4+3Aj
- .text:000000000027D337 ; sub_27D2D4+4Aj ...
- .text:000000000027D337 test rdi, rdi
- .text:000000000027D33A jz short loc_27D38E
- .text:000000000027D33C mov rax, [rdi]
- .text:000000000027D33F mov rcx, rdi
- .text:000000000027D342 call qword ptr [rax+28h] // pPlayerAngles = (CPlayerAngles*)((LPVOID)(QWORD(pPlayerAngles) + 0x390));
- .text:000000000027D345 mov rbx, rax
- .text:000000000027D348 movss xmm0, dword ptr [rax]
- -----------------------------------------------------------------------------------------------------------------------------
- typedef CPlayerAngles*(__fastcall* GetTPSCamera_t)(LPVOID pECX, LPVOID pEDX); // If NULL is returned, then We are on First Person.
- GetTPSCamera_t oGetTPSCamera = NULL;
- ----------------------------------------------------------------------------------------------------------------------------
- CGameCameraAngles* pGameCamManager = (CGameCameraAngles*)(qBaseAddr + K_FPSCAMERAANGLESOFFSET);
- MyFunctions::oGetTPSCamera = (GetTPSCamera_t)((QWORD)(qwGameBase + K_GETTPSCAMERAOFFSET));
- ---------------------------------------------------------------------------------------------------------------------------
- CPlayerAngles* MyFunctions::GetCurrentCamera()
- {
- CPlayerAngles* pPlayerAngles = NULL;
- CGameCameraAngles* pGameCam = MyVariables::pGameCamManager;
- if (pGameCam)
- {
- QWORD qwEDX = pGameCam->pMyCameraManagerAngles->pMyCameraAngles->pTPSCamEDX;
- pPlayerAngles = oGetTPSCamera((LPVOID)*(QWORD*)(MyVariables::qBaseAddr + K_TPSCAMERATHISPTR), (LPVOID)qwEDX);
- if (pPlayerAngles)
- {
- pPlayerAngles = (CPlayerAngles*)((LPVOID)(QWORD(pPlayerAngles) + 0x390));
- }
- else
- {
- pPlayerAngles = pGameCam->pMyCameraManagerAngles->pMyCameraAngles->pMyFPSAngles;
- }
- }
- MyVariables::pPlayerAngles = pPlayerAngles; // Why not!
- return pPlayerAngles;
- }
- -----------------------------------------------------------------------------------------------------------------------------
- VOID MyFunctions::SetViewAngles(D3DXVECTOR3& vAngles)
- {
- GetCurrentCamera();
- if (MyVariables::pPlayerAngles)
- {
- CPlayerAngles* pPlayerAngles = MyVariables::pPlayerAngles;
- pPlayerAngles->vViewAngles.x = vAngles.x;
- pPlayerAngles->vViewAngles.y = vAngles.y;
- }
- }
- -----------------------------------------------------------------------------------------------------------------------------
- BOOL MyFunctions::GetViewAngles(D3DXVECTOR3& vAngles)
- {
- BOOL bReturn = FALSE;
- GetCurrentCamera();
- if (MyVariables::pPlayerAngles)
- {
- vAngles = (MyVariables::pPlayerAngles->vViewAngles);
- bReturn = TRUE;
- }
- return bReturn;
- }
- -----------------------------------------------------------------------------------------------------------------------------
- Signature:
- 57 48 83 EC 20 48 8B D9 48 8B D1 ? ? ? ? ? ? ? E8 ? ? ? ? ? ? ? ? ? ? ? 48 8B D3 48 8B F8 E8 ? ? ? ?
- Should show up two matches, they are all fine
- Leads to:
- .text:000000000027D2D9 push rdi
- .text:000000000027D2DA sub rsp, 20h
- .text:000000000027D2DE mov rbx, rcx
- .text:000000000027D2E1 mov rdx, rcx // QWORD qwEDX = pGameCam->pMyCameraManagerAngles->pMyCameraAngles->pTPSCamEDX;
- .text:000000000027D2E4 mov rcx, cs:TPSCAMERATHISPTR
- .text:000000000027D2EB call oGetTPSCamera // Returns NULL if FPS Cam
- .text:000000000027D2F0 mov rcx, cs:TPSCAMERATHISPTR
- -----------------------------------------------------------------------------------------------------------------------------
- ? ? ? ? ? ? ? 4A 8B 1C F0 48 85
- K_FPSCAMERAANGLESOFFSET // Pointer to the CGameCameraAngles class, check my post above...
- 57 48 83 EC 20 48 8B D9 48 8B D1 ? ? ? ? ? ? ? E8 ? ? ? ? ? ? ? ? ? ? ? 48 8B D3 48 8B F8 E8 ? ? ? ?
- K_TPSCAMERATHISPTR // Value/Address passed as RDX ( SecondParameter ) to oGetTPSCamera
- oGetTPSCamera addr will be found around the K_TPSCAMERATHISPTR addr, the function returns null if you're on first person
- ----------------------------------------------------------------------------------------------------------------------------
- //Sin and Cos vals switch between those two values aswel which means that the Yaw can be calculated this way:
- //Get X Angle:
- // sin(alpha) = opposite/hyp
- vAngle.x = (vDist.y / f2DDistance);
- // I may be wrong but my guessing is that the yaw is nothing but the sin/cos of an angle and not the angle itself like we're used to in other games
- //where vDist.y = vEnemy.y - vLocal.y ( worldposition, if you have bone pos, you could use it aswel)
- //and f2DDistance is the length of the 2D Vector position(X, Y)
- //There are several values with the same sin and cos, but only one per quadrant so consider that when calculating the x angle...
- //Hope you got my point, i'm rly bad explaining stuff... Try it out and let us know plz
- --------------------------------------------------------------------------------------------------------------------------------
- class CGameCameraAngles
- {
- public:
- CCameraManagerAngles* pMyCameraManagerAngles; //0x0000
- char _0x0008[56];
- };//Size=0x0040
- class CCameraManagerAngles
- {
- public:
- CCameraAngles* pMyCameraAngles; //0x0000
- };//Size=0x0008
- class CCameraAngles
- {
- public:
- char _0x0000[960];
- CPlayerAngles* pMyFPSAngles; //0x03C0
- char _0x03C8[16];
- __int64 pTPSCamEDX; //0x03D8 // This is passed as second parameter to oGetTPSCamera
- char _0x03E0[40];
- };//Size=0x0408
- class CPlayerCameraData
- {
- public:
- char _0x0000[48];
- float Fov_Zoom; //0x0030
- char _0x0034[36];
- __int32 m_ZoomState; //0x0058 1 = Normal, 0 = Zoom, 10000+ = FPS
- };//Size=0x0548
- class CPlayerAngles
- {
- public:
- char _0x0000[16];
- CPlayerCameraData* CamData; //0x0010
- __int32 m_UnknownCounter; //0x0018
- char _0x001C[20];
- D3DXVECTOR3 weird_ViewAngles; //0x0030
- char _0x003C[4];
- float fUnknwn_X; //0x0040
- D3DXVECTOR3 vViewAngles; //0x0044
- };//Size=0x0840
- Offsets for non-Steam
- -------------------------------------------------------------------------------------------------------------------------------
- #define K_TPSCAMERATHISPTR 0x001DCBD40
- #define K_FPSCAMERAANGLESOFFSET 0x001DCB200
- #define K_GETTPSCAMERAOFFSET 0x0027E06C
- -------------------------------------------------------------------------------------------------------------------------------
- World 2 Screen
- bool Math::worldToScreen(CVector3 entityPosition, CVector3 &out){
- D3DXVECTOR4 vUpward, vRight, vForward;
- D3DXMATRIX mView = matricManager->pMatrices->mViewMatrix;
- D3DXMatrixTranspose(&mView, &mView);
- vForward = D3DXVECTOR4(mView._41, mView._42, mView._43, mView._44);
- vRight = D3DXVECTOR4(mView._21, mView._22, mView._23, mView._24);
- vUpward = D3DXVECTOR4(mView._31, mView._32, mView._33, mView._34);
- out.z = (vForward.x * entityPosition.x) + (vForward.y * entityPosition.y) + (vForward.z * entityPosition.z) + vForward.w;
- out.x = (vRight.x * entityPosition.x) + (vRight.y * entityPosition.y) + (vRight.z * entityPosition.z) + vRight.w;
- out.y = (vUpward.x * entityPosition.x) + (vUpward.y * entityPosition.y) + (vUpward.z * entityPosition.z) + vUpward.w;
- if (out.z < 0.001f)
- return false;
- float invw = 1.0f / out.z;
- out.x *= invw;
- out.y *= invw;
- int width = viewport.Width;
- int height = viewport.Height;
- float xTmp = width / 2;
- float yTmp = height / 2;
- xTmp += (int)(0.5*out.x*width + 0.5);
- yTmp -= (int)(0.5*out.y*height + 0.5);
- out.x += xTmp;
- out.y = yTmp;
- return true;
- }
- ---------------------------------------------------------------------------------------------------------------------------------
- extern "C" void* GetBonePositionASM(CPlayer* pThis, D3DXVECTOR4& vBonePosition, D3DXVECTOR4* pBoneVec);
- PHP Code:
- D3DXVECTOR4 MyFunctions::GetBonePosition(CPlayer* pThis, D3DXVECTOR4& vBone4D)
- {
- __declspec(align(16)) D3DXVECTOR4 v3DBonePos;
- __declspec(align(16)) D3DXVECTOR4 v4DBonePos;
- v4DBonePos = vBone4D;
- GetBonePositionASM(pThis, v3DBonePos, &v4DBonePos);
- return v3DBonePos;
- }
- --------------------------------------------------------------------------------------------------------------------------------
- .data
- .code
- GetBonePositionASM proc
- ; RCX = pThis
- ; RDX = &vBonePosition
- ; R8 = pBoneVec
- TEST R8, R8
- JZ RETURN_NULL_PTR
- MOV RAX, QWORD PTR[RCX+180h];
- MOVAPS XMM1, XMMWORD PTR[R8];
- PSHUFD XMM2, XMM1, 000h;
- PSHUFD XMM0, XMM1, 055h;
- MULPS XMM2, XMMWORD PTR[RAX+000h];
- MULPS XMM0, XMMWORD PTR[RAX+010h];
- PSHUFD XMM1, XMM1, 0AAh;
- ADDPS XMM2, XMMWORD PTR[RAX+030h];
- MULPS XMM1, XMMWORD PTR[RAX+020h];
- ADDPS XMM2, XMM0;
- ADDPS XMM2, XMM1;
- MOVAPS XMMWORD PTR[RDX+000h], XMM2;
- RETURN_NULL_PTR:
- XOR RAX, RAX;
- RET;
- GetBonePositionASM endp
- end
- -----------------------------------------------------------------------------------------------------------------------------
- //usage
- vBonePos3D = MyFunctions::GetBonePosition(pPlayer, pPlayer->vHead);
- if (MyFunctions::World2Screen(vBonePos3D, MyVariables::vScreenPos))
- -----------------------------------------------------------------------------------------------------------------------------
- Engine W2S sig: 48 89 5C 24 ? 55 56 57 48 83 EC 70 65 4C 8B 0C 25 ? ? ? ?
- //( not tested )
- bool __fastcall WorldToScreen(Vec3 & worldPos, float & screenPosX, float & screenPosY )
- //or use native unk_0x1F950E4B which is world2screen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement