Kutu_Kucing

bone

Dec 6th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.31 KB | None | 0 0
  1. class Matrix4x4
  2. {
  3. public:
  4.     D3DXVECTOR3 ConverMathtoVector3(int BoneIndex)
  5.     {
  6.         static float cx=0;
  7.         static float cy=0;
  8.         static float cz=0;
  9.         int v6;
  10.         v6 =BoneIndex;
  11.         v6<<=6;
  12.         ReadProcessMemory (GetCurrentProcess (), (LPVOID)(this+v6+0x30), &cx, sizeof(cx), 0);
  13.         ReadProcessMemory (GetCurrentProcess (), (LPVOID)(this+v6+0x34), &cy, sizeof(cy), 0);
  14.         ReadProcessMemory (GetCurrentProcess (), (LPVOID)(this+v6+0x38), &cz, sizeof(cz), 0);
  15.         return D3DXVECTOR3(cx, cy, cz);
  16.     }
  17.     D3DXMATRIX Getmath(int idx)
  18.     {
  19.         D3DXMATRIX Bones;
  20.         ReadProcessMemory (GetCurrentProcess (), (LPVOID)(this+idx*64), &Bones, sizeof(Bones), 0);
  21.         return Bones;
  22.     }
  23. }; //Size: 0x039C
  24.  
  25. class i3MatrixArray
  26. {
  27. public:
  28.     char pad_0000[12]; //0x0000
  29.      Matrix4x4* MathArray; //0x000C
  30.     char pad_0010[52]; //0x0010
  31.  
  32.  
  33.     D3DXVECTOR3 getBonePosition(int BoneIndex)
  34.     {
  35.         D3DXMATRIX *pBone = (D3DXMATRIX*)(*((DWORD *)this + 0xC));
  36.         return D3DXVECTOR3(pBone[ BoneIndex ]._41, pBone[ BoneIndex ]._42, pBone[ BoneIndex ]._43);
  37.     }
  38.     D3DXMATRIX * getMatrixBone4x4()
  39.     {
  40.         D3DXMATRIX *pBone = (D3DXMATRIX*)(*((DWORD *)this + 0xC));
  41.         return pBone;
  42.     }
  43.     D3DXMATRIX testgetmath(int idx)
  44.     {
  45.         D3DXMATRIX res;
  46.         DWORD addmath = 0;
  47.         addmath = (*((DWORD *)this + 0xC));
  48.         if(addmath)
  49.         {
  50.             ReadProcessMemory (GetCurrentProcess (), (LPVOID)(addmath+idx*64), &res, sizeof(res), 0);
  51.             return res;
  52.         }
  53.         return res;
  54.     }
  55. }; //Size: 0x0044
  56.  
  57. class nama
  58. {
  59. public:
  60.     __int32 unk; //0x0000
  61.     __int32 SizeName; //0x0004
  62.     char Namanya[6]; //0x0008
  63.     char pad_000E[56]; //0x000E
  64. }; //Size: 0x0046
  65.  
  66.  
  67. class i3Bone
  68. {
  69. public:
  70.     nama* nama; //0x0000
  71.     char pad_0004[12]; //0x0004
  72.     D3DXMATRIX Pos; //0x0010
  73.     char pad_0050[2]; //0x0050
  74.     __int8 idx; //0x0052
  75. };
  76. class toi3bone
  77. {
  78. public:
  79.     i3Bone* geti3Bone(int index)
  80.     {
  81.         return (i3Bone*)(((DWORD)this+0x0)+(index * 0x60));
  82.     }
  83. };
  84. class i3BoneMatrixListAttr
  85. {
  86. public:
  87.     char pad_0000[16]; //0x0000
  88.      toi3bone* ptoi3bone; //0x0010
  89.     __int32 m_Count; //0x0014
  90.     i3MatrixArray* ai3MatrixArray; //0x0018
  91.     i3MatrixArray* ai3MatrixArray2; //0x001C
  92.     char pad_0020[36]; //0x0020
  93.  
  94.  
  95.     i3MatrixArray* Geti3MatrixArray1(void)
  96.     {
  97.         return (i3MatrixArray*)*(DWORD*)(this + 0x18);
  98.     }
  99.     i3MatrixArray* Geti3MatrixArray2(void)
  100.     {
  101.         return (i3MatrixArray*)*(DWORD*)(this + 0x1C);
  102.     }
  103.     toi3bone * Gettoi3Bone(void)
  104.     {
  105.         return (toi3bone*)*(DWORD*)(this + 0x10);
  106.     }
  107. }; //Size: 0x0044
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. class StrBone
  115. {
  116. public:
  117.     char lpStrName[15]; //0x0000
  118.     char pad_000F[64]; //0x000F
  119. }; //Size: 0x004F
  120.  
  121. class BoneName
  122. {
  123. public:
  124.     StrBone* StrBone; //0x0000
  125.     __int32 SizeBoneName; //0x0004
  126.     char pad_0008[4]; //0x0008
  127.     __int32 BoneIndex; //0x000C
  128.     char pad_0010[308]; //0x0010
  129. }; //Size: 0x0144
  130. class CBoneName
  131. {
  132. public:
  133.     BoneName* getBoneNamebyidx(int index)
  134.     {
  135.         return (BoneName*)(((DWORD)this + 0x0)+(index * 0x10));
  136.     }
  137. };
  138. class i3Skeleton
  139. {
  140. public:
  141.     char pad_0000[16]; //0x0000
  142.      i3BoneMatrixListAttr* i3BoneMatrixListAttr; //0x0010
  143.     char pad_0014[8]; //0x0014
  144.      CBoneName* CBoneName; //0x001C
  145.     char pad_0020[288]; //0x0020
  146.  
  147. }; //Size: 0x0140
  148.  
  149.  
  150.  
  151. class i3LOD
  152. {
  153. public:
  154.     char pad_0000[12]; //0x0000
  155.     i3Skeleton* i3Skeleton; //0x000C
  156.     char pad_0010[48]; //0x0010
  157. }; //Size: 0x0040
  158.  
  159. class i3AnimationContext
  160. {
  161. public:
  162.     char pad_0000[12]; //0x0000
  163.     i3MatrixArray* pi3MatrixArray; //0x000C
  164.     i3Skeleton * getFrameSkeleton; //0x0010 //sama i3LOD skeleton
  165.     char pad_0014[4]; //0x0014
  166.     class getCombiner* CgetCombiner; //0x0018
  167.     char pad_001C[28]; //0x001C
  168.  
  169.  
  170.     i3MatrixArray* Geti3MatrixArray(void)
  171.     {
  172.         return (i3MatrixArray*)*(DWORD*)(this + 0xC);
  173.     }
  174. }; //Size: 0x0038
  175.  
  176.  
  177. class i3Body
  178. {
  179. public:
  180.     //char pad_0000[104]; //0x0000
  181.     //i3LOD* i3LOD; //0x0068
  182.     //i3AnimationContext* i3AnimationContext; //0x006C
  183.     //char pad_0070[20]; //0x0070
  184.     char pad_0000[108]; //0x0000
  185.     i3LOD* i3LOD; //0x006C
  186.     i3AnimationContext* i3AnimationContext; //0x0070
  187.     char pad_0074[208]; //0x0074
  188.  
  189. }; //Size: 0x0084
  190.  
  191.  
  192. class i3SceneObject
  193. {
  194. public:
  195.     //char pad_0000[96]; //0x0000
  196.     //D3DXMATRIX pos; //0x0060
  197.     //char pad_00A0[28]; //0x00A0
  198.     //class i3Body* i3Body; //0x00BC
  199.     //char pad_00C0[128]; //0x00C0
  200.     char pad_0000[56]; //0x0000
  201.     i3Body* i3Body; //0x0038
  202.     char pad_003C[248]; //0x003C
  203.  
  204.  
  205. }; //Size: 0x0104
  206.  
  207.  
  208.  
  209.  
  210. class CharaViewMgr
  211. {
  212. public:
  213.     char pad_0000[4]; //0x0000
  214.     class UICharaView* UICharaView; //0x0004
  215.     char pad_0008[36]; //0x0008
  216.     class UIFloatCharacterView_V10* UIFloatCharacterView_V10; //0x002C
  217.     i3SceneObject* i3SceneObject; //0x0030
  218.     char pad_0034[256]; //0x0034
  219.     static CharaViewMgr * pCharaViewMgr()
  220.     {
  221.         return (CharaViewMgr*)(*(DWORD*)(i3Tools->GetValueByKey("CCharaViewMgr")));
  222.     }
  223. }; //Size: 0x0134
  224.  
  225. static bool isSameStr(string str1, string str2)
  226. {
  227.     if (strstr(str1.c_str(), str2.c_str()))
  228.     {
  229.     return true;
  230.     }
  231.     return false;
  232. }
  233. bool GetVECTORBoneTest01(i3SceneObject * pi3SceneObject,int idx,D3DXVECTOR3 &Out)
  234. {
  235.  
  236. if(pi3SceneObject)
  237. {
  238.     i3Body * pi3Body = pi3SceneObject->i3Body;
  239.     if(pi3Body)
  240.     {
  241.         i3LOD * pi3LOD = pi3Body->i3LOD;
  242.         i3AnimationContext * pi3AnimationContext = pi3Body->i3AnimationContext;
  243.         if(pi3AnimationContext&&pi3LOD)
  244.         {
  245.             i3Skeleton * pi3Skeleton = pi3LOD->i3Skeleton;
  246.             if(pi3Skeleton)
  247.             {
  248.                 i3BoneMatrixListAttr * pi3BoneMatrixListAttr = pi3Skeleton->i3BoneMatrixListAttr;
  249.                 if(pi3BoneMatrixListAttr)
  250.                 {
  251.  
  252.                 }
  253.             }
  254.         }return false;
  255.     }return false;
  256. }return false;
  257. }
  258. bool GetVectorBoneByName(i3SceneObject * pi3SceneObject,string BoneNam,D3DXVECTOR3 &Out)
  259. {
  260.  
  261.     D3DXMATRIX Mathhanim;
  262.         if(pi3SceneObject)
  263.         {
  264.             i3Body * pi3Body = pi3SceneObject->i3Body;
  265.             if(pi3Body)
  266.             {
  267.            
  268.             i3LOD * pi3LOD = pi3Body->i3LOD;
  269.             i3AnimationContext * pi3AnimationContext = pi3Body->i3AnimationContext;
  270.                     if(pi3LOD&&pi3AnimationContext)
  271.                     {
  272.                         i3Skeleton * pi3Skeleton = pi3LOD->i3Skeleton;
  273.                         if(pi3Skeleton)
  274.                         {
  275.                         i3BoneMatrixListAttr * pi3BoneMatrixListAttr = pi3Skeleton->i3BoneMatrixListAttr;
  276.                         CBoneName * pCBoneName = pi3Skeleton->CBoneName;
  277.                             if(pCBoneName&&pi3BoneMatrixListAttr)
  278.                             {
  279.                                
  280.                                 int i=0;
  281.                                 do{
  282.                                     BoneName * pBoneName = pCBoneName->getBoneNamebyidx(i);
  283.                                     if(pBoneName&&pBoneName->StrBone)
  284.                                     {
  285.                                         string NameBone(pBoneName->StrBone->lpStrName);
  286.                                         if(isSameStr(NameBone,BoneNam))
  287.                                         {
  288.                                            
  289.                                                 i3MatrixArray * pi3MatrixArrayanim = pi3AnimationContext->pi3MatrixArray;
  290.                                                 if(pi3MatrixArrayanim)
  291.                                                 {
  292.                                                 Matrix4x4 * pMatrix4x4anim = pi3MatrixArrayanim->MathArray;
  293.                                                     if(pMatrix4x4anim)
  294.                                                     {
  295.                                                         Mathhanim = pMatrix4x4anim->Getmath(pBoneName->BoneIndex);
  296.                                                         if(!D3DXMatrixIsIdentity(&Mathhanim))
  297.                                                         {
  298.  
  299.                                                          Out = D3DXVECTOR3(Mathhanim._41, Mathhanim._42, Mathhanim._43);
  300.                                                         return true;
  301.                                                         }
  302.                                                     }
  303.                                                 }
  304.                                         }
  305.                                     }
  306.                                     i++;
  307.                                 }while(i<=pi3BoneMatrixListAttr->m_Count);
  308.                             }return false;
  309.                         }return false;
  310.  
  311.                     }return false;
  312.             }return false;
  313.         }return false;
  314. }
  315.  
  316.  
  317. void DrawBoneNew(i3SceneObject * pi3SceneObject,i3RenderContext * Render,string start,string end,LPDIRECT3DDEVICE9 pDevice)
  318. {
  319. D3DXVECTOR3 OnWorldA,OnScreenA;
  320.     D3DXVECTOR3 OnWorldB,OnScreenB;
  321.     if(GetVectorBoneByName(pi3SceneObject,start,OnWorldA)
  322.         && Render->W2S(OnWorldA,OnScreenA,pDevice)
  323.         && GetVectorBoneByName(pi3SceneObject,end,OnWorldB)
  324.         && Render->W2S(OnWorldB,OnScreenB,pDevice))
  325.     {
  326.         DrawLines(pDevice,OnScreenA.x,OnScreenA.y,OnScreenB.x,OnScreenB.y,1,WHITE);
  327.     }
  328. }
  329.  
  330.  
  331.  
  332.  
  333. void PrintEspBone(i3SceneObject * pi3SceneObject,i3RenderContext * Render,LPDIRECT3DDEVICE9 pDevice)
  334. {
  335. DrawBoneNew(pi3SceneObject,Render,"Head","Neck",pDevice);
  336.  
  337. DrawBoneNew(pi3SceneObject,Render,"Neck","L Clavicle",pDevice);
  338. DrawBoneNew(pi3SceneObject,Render,"L Clavicle","L UpperArm",pDevice);
  339. DrawBoneNew(pi3SceneObject,Render,"L UpperArm","L Forearm",pDevice);
  340. DrawBoneNew(pi3SceneObject,Render,"L Forearm","L Hand",pDevice);
  341.  
  342. DrawBoneNew(pi3SceneObject,Render,"Neck","R Clavicle",pDevice);
  343. DrawBoneNew(pi3SceneObject,Render,"R Clavicle","R UpperArm",pDevice);
  344. DrawBoneNew(pi3SceneObject,Render,"R UpperArm","R Forearm",pDevice);
  345. DrawBoneNew(pi3SceneObject,Render,"R Forearm","R Hand",pDevice);
  346.  
  347.  
  348. DrawBoneNew(pi3SceneObject,Render,"Neck","Spine3",pDevice);
  349. DrawBoneNew(pi3SceneObject,Render,"Spine3","Spine2",pDevice);
  350. DrawBoneNew(pi3SceneObject,Render,"Spine3","IK",pDevice);
  351.  
  352.  
  353. DrawBoneNew(pi3SceneObject,Render,"IK","L Thigh",pDevice);
  354. DrawBoneNew(pi3SceneObject,Render,"L Thigh","L Calf",pDevice);
  355. DrawBoneNew(pi3SceneObject,Render,"L Calf","L Foot",pDevice);
  356. DrawBoneNew(pi3SceneObject,Render,"L Foot","L Toe",pDevice);
  357.  
  358.  
  359. DrawBoneNew(pi3SceneObject,Render,"IK","R Thigh",pDevice);
  360. DrawBoneNew(pi3SceneObject,Render,"R Thigh","R Calf",pDevice);
  361. DrawBoneNew(pi3SceneObject,Render,"R Calf","R Foot",pDevice);
  362. DrawBoneNew(pi3SceneObject,Render,"R Foot","R Toe",pDevice);
  363.  
  364.  
  365.  
  366. }
  367.  
  368. void __EspBoneNewMethod(int i,LPDIRECT3DDEVICE9 pDevice)
  369. {
  370. unsigned long Avatar = NULL;
  371. i3RenderContext * Render        = i3Viewer::pi3Viewer()->GetRenderContext();
  372. Avatar                          = __GetAvatarAddress(i);
  373. if(Avatar&&*(PDWORD)((DWORD)(Avatar+0x50))!=0)
  374. {
  375. i3SceneObject * pi3SceneObject =(i3SceneObject*)(*(PDWORD)((DWORD)(Avatar+0x50)));
  376.     if(pi3SceneObject)
  377.     {
  378.         PrintEspBone(pi3SceneObject,Render,pDevice);
  379.     }
  380. }
  381. }
Advertisement
Add Comment
Please, Sign In to add comment