Guest User

csgoinput classes

a guest
Jan 23rd, 2025
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.06 KB | None | 0 0
  1. #define MULTIPLAYER_BACKUP 150
  2.  
  3. enum ECommandButtons : int
  4. {
  5. IN_ATTACK = (1 << 0),
  6. IN_JUMP = (1 << 1),
  7. IN_DUCK = (1 << 2),
  8. IN_FORWARD = (1 << 3),
  9. IN_BACK = (1 << 4),
  10. IN_USE = (1 << 5),
  11. IN_CANCEL = (1 << 6),
  12. IN_LEFT = (1 << 7),
  13. IN_RIGHT = (1 << 8),
  14. IN_MOVELEFT = (1 << 9),
  15. IN_MOVERIGHT = (1 << 10),
  16. IN_SECOND_ATTACK = (1 << 11),
  17. IN_RUN = (1 << 12),
  18. IN_RELOAD = (1 << 13),
  19. IN_LEFT_ALT = (1 << 14),
  20. IN_RIGHT_ALT = (1 << 15),
  21. IN_SCORE = (1 << 16),
  22. IN_SPEED = (1 << 17),
  23. IN_WALK = (1 << 18),
  24. IN_ZOOM = (1 << 19),
  25. IN_FIRST_WEAPON = (1 << 20),
  26. IN_SECOND_WEAPON = (1 << 21),
  27. IN_BULLRUSH = (1 << 22),
  28. IN_FIRST_GRENADE = (1 << 23),
  29. IN_SECOND_GRENADE = (1 << 24),
  30. IN_MIDDLE_ATTACK = (1 << 25),
  31. IN_USE_OR_RELOAD = (1 << 26)
  32. };
  33.  
  34. //new classes:
  35.  
  36. enum ESubtickMoveStepBits : std::uint32_t
  37. {
  38. MOVESTEP_BITS_BUTTON = 0x1U,
  39. MOVESTEP_BITS_PRESSED = 0x2U,
  40. MOVESTEP_BITS_WHEN = 0x4U,
  41. MOVESTEP_BITS_ANALOG_FORWARD_DELTA = 0x8U,
  42. MOVESTEP_BITS_ANALOG_LEFT_DELTA = 0x10U
  43. };
  44.  
  45. enum EInputHistoryBits : std::uint32_t
  46. {
  47. INPUT_HISTORY_BITS_VIEWANGLES = 0x1U,
  48. INPUT_HISTORY_BITS_SHOOTPOSITION = 0x2U,
  49. INPUT_HISTORY_BITS_TARGETHEADPOSITIONCHECK = 0x4U,
  50. INPUT_HISTORY_BITS_TARGETABSPOSITIONCHECK = 0x8U,
  51. INPUT_HISTORY_BITS_TARGETANGCHECK = 0x10U,
  52. INPUT_HISTORY_BITS_CL_INTERP = 0x20U,
  53. INPUT_HISTORY_BITS_SV_INTERP0 = 0x40U,
  54. INPUT_HISTORY_BITS_SV_INTERP1 = 0x80U,
  55. INPUT_HISTORY_BITS_PLAYER_INTERP = 0x100U,
  56. INPUT_HISTORY_BITS_RENDERTICKCOUNT = 0x200U,
  57. INPUT_HISTORY_BITS_RENDERTICKFRACTION = 0x400U,
  58. INPUT_HISTORY_BITS_PLAYERTICKCOUNT = 0x800U,
  59. INPUT_HISTORY_BITS_PLAYERTICKFRACTION = 0x1000U,
  60. INPUT_HISTORY_BITS_FRAMENUMBER = 0x2000U,
  61. INPUT_HISTORY_BITS_TARGETENTINDEX = 0x4000U
  62. };
  63.  
  64. enum EButtonStatePBBits : uint32_t
  65. {
  66. BUTTON_STATE_PB_BITS_BUTTONSTATE1 = 0x1U,
  67. BUTTON_STATE_PB_BITS_BUTTONSTATE2 = 0x2U,
  68. BUTTON_STATE_PB_BITS_BUTTONSTATE3 = 0x4U
  69. };
  70.  
  71. enum EBaseCmdBits : std::uint32_t
  72. {
  73. BASE_BITS_MOVE_CRC = 0x1U,
  74. BASE_BITS_BUTTONPB = 0x2U,
  75. BASE_BITS_VIEWANGLES = 0x4U,
  76. BASE_BITS_COMMAND_NUMBER = 0x8U,
  77. BASE_BITS_CLIENT_TICK = 0x10U,
  78. BASE_BITS_FORWARDMOVE = 0x20U,
  79. BASE_BITS_LEFTMOVE = 0x40U,
  80. BASE_BITS_UPMOVE = 0x80U,
  81. BASE_BITS_IMPULSE = 0x100U,
  82. BASE_BITS_WEAPON_SELECT = 0x200U,
  83. BASE_BITS_RANDOM_SEED = 0x400U,
  84. BASE_BITS_MOUSEDX = 0x800U,
  85. BASE_BITS_MOUSEDY = 0x1000U,
  86. BASE_BITS_CONSUMED_SERVER_ANGLE = 0x2000U,
  87. BASE_BITS_CMD_FLAGS = 0x4000U,
  88. BASE_BITS_ENTITY_HANDLE = 0x8000U
  89. };
  90.  
  91. enum ECSGOUserCmdBits : std::uint32_t
  92. {
  93. CSGOUSERCMD_BITS_BASECMD = 0x1U,
  94. CSGOUSERCMD_BITS_LEFTHAND = 0x2U,
  95. CSGOUSERCMD_BITS_PREDICTING_BODY_SHOT = 0x4U,
  96. CSGOUSERCMD_BITS_PREDICTING_HEAD_SHOT = 0x8U,
  97. CSGOUSERCMD_BITS_PREDICTING_KILL_RAGDOLLS = 0x10U,
  98. CSGOUSERCMD_BITS_ATTACK3START = 0x20U,
  99. CSGOUSERCMD_BITS_ATTACK1START = 0x40U,
  100. CSGOUSERCMD_BITS_ATTACK2START = 0x80U
  101. };
  102.  
  103. template <typename T>
  104. struct RepeatedPtrField_t
  105. {
  106. struct Rep_t
  107. {
  108. int nAllocatedSize;
  109. T* tElements[(std::numeric_limits<int>::max() - 2 * sizeof(int)) / sizeof(void*)];
  110. };
  111.  
  112. void* pArena;
  113. int nCurrentSize;
  114. int nTotalSize;
  115. Rep_t* pRep;
  116. };
  117.  
  118. class CBasePB
  119. {
  120. public:
  121. std::byte pad01[0x8];
  122. std::uint32_t nHasBits; // 0x8
  123. std::uint64_t nCachedBits; // 0xC
  124. };//size: 0x18
  125.  
  126. class CMsgQAngle : public CBasePB
  127. {
  128. public:
  129. QAngle angValue; // 0x18
  130. }; //size: 0x28
  131.  
  132. class CMsgVector : public CBasePB
  133. {
  134. public:
  135. void* vecValue; // 0x18 //vec4
  136. };
  137.  
  138. class CCSGOInterpolationInfoPB : public CBasePB
  139. {
  140. public:
  141. float flFraction; // 0x18
  142. //int nSrcTick; // 0x1C
  143. //int nDstTick; // 0x20
  144. };
  145.  
  146. class CCSGOInputHistoryEntryPB : public CBasePB
  147. {
  148. public:
  149. CMsgQAngle* pViewAngles; // 0x18
  150. CMsgVector* pShootPosition; // 0x20
  151. CMsgVector* pTargetHeadPositionCheck; // 0x28
  152. CMsgVector* pTargetAbsPositionCheck; // 0x30
  153. CMsgQAngle* pTargetAngPositionCheck; // 0x38
  154. CCSGOInterpolationInfoPB* cl_interp; // 0x40
  155. CCSGOInterpolationInfoPB* sv_interp0; // 0x48
  156. CCSGOInterpolationInfoPB* sv_interp1; // 0x50
  157. CCSGOInterpolationInfoPB* player_interp; // 0x58
  158. int nRenderTickCount; // 0x60
  159. float flRenderTickFraction; // 0x64
  160. int nPlayerTickCount; // 0x68
  161. float flPlayerTickFraction; // 0x6C
  162. int nFrameNumber; // 0x70
  163. int nTargetEntIndex; // 0x74
  164. };
  165.  
  166. struct CInButtonStatePB : CBasePB
  167. {
  168. std::uint64_t nValue;
  169. std::uint64_t nValueChanged;
  170. std::uint64_t nValueScroll;
  171. };
  172.  
  173. struct CSubtickMoveStep : CBasePB
  174. {
  175. public:
  176. std::uint64_t nButton;
  177. bool bPressed;
  178. float flWhen;
  179. float flAnalogForwardDelta;
  180. float flAnalogLeftDelta;
  181. };
  182.  
  183. class CBaseUserCmdPB : public CBasePB
  184. {
  185. public:
  186. RepeatedPtrField_t<CSubtickMoveStep> subtickMovesField; //0x18
  187. std::string* strMoveCrc; //0x30
  188. CInButtonStatePB* pInButtonState; //0x38
  189. CMsgQAngle* pViewAngles;
  190. std::int32_t nLegacyCommandNumber;
  191. std::int32_t nClientTick;
  192. float flForwardMove; //Forwardmove, sidemove (and upmove?) - Range: -1.0 - 1.0
  193. float flSideMove;
  194. float flUpMove;
  195. std::int32_t nImpulse;
  196. std::int32_t nWeaponSelect;
  197. std::int32_t nRandomSeed;
  198. std::int32_t nMousedX;
  199. std::int32_t nMousedY;
  200. std::uint32_t nConsumedServerAngleChanges;
  201. std::int32_t nCmdFlags;
  202. std::uint32_t nPawnEntityHandle;
  203.  
  204. int CalculateCmdCRCSize()
  205. {
  206. return VTable::GetThiscall<int>(this, 7);
  207. }
  208.  
  209. }; //size: 0x68?
  210.  
  211. class CCSGOUserCmdPB
  212. {
  213. public:
  214. std::uint32_t nHasBits; //0x0
  215. std::uint64_t nCachedSize; //0x4
  216. RepeatedPtrField_t<CCSGOInputHistoryEntryPB> inputHistoryField; //0xC
  217. CBaseUserCmdPB* pBaseCmd; //0x14 //0x40
  218. bool bLeftHandDesired; //0x1C
  219. bool bIsPredictingBodyShotFX;
  220. bool bIsPredictingHeadShotFX;
  221. bool bIsPredictingKillRagdolls;
  222. std::int32_t nAttack3StartHistoryIndex; //0x20
  223. std::int32_t nAttack1StartHistoryIndex; //0x24
  224. std::int32_t nAttack2StartHistoryIndex; //0x28
  225.  
  226. // @note: this function is used to check if the bits are set and set them if they are not
  227. void CheckAndSetBits(std::uint32_t nBits)
  228. {
  229. if (!(nHasBits & nBits))
  230. nHasBits |= nBits;
  231. }
  232. };
  233.  
  234. struct CInButtonState
  235. {
  236. public:
  237. std::byte pad01[0x8];
  238. std::uint64_t nValue; // 0x8
  239. std::uint64_t nValueChanged; // 0x10
  240. std::uint64_t nValueScroll; // 0x18
  241. };
  242.  
  243. class CUserCmd
  244. {
  245. public:
  246. std::byte pad01[0x8];
  247. std::byte pad02[0x10];
  248. CCSGOUserCmdPB csgoUserCmd; // 0x18
  249. CInButtonState nButtons; // 0x58
  250. std::byte pad03[0x20];
  251.  
  252. CCSGOInputHistoryEntryPB* GetInputHistoryEntry(int nIndex)
  253. {
  254. if (nIndex >= csgoUserCmd.inputHistoryField.pRep->nAllocatedSize || nIndex >= csgoUserCmd.inputHistoryField.nCurrentSize)
  255. return nullptr;
  256.  
  257. return csgoUserCmd.inputHistoryField.pRep->tElements[nIndex];
  258. }
  259.  
  260. void SetSubTickAngle(const QAngle& angView)
  261. {
  262. //Doesnt work
  263. for (int i = 0; i < this->csgoUserCmd.inputHistoryField.pRep->nAllocatedSize; i++)
  264. {
  265. CCSGOInputHistoryEntryPB* pInputEntry = this->GetInputHistoryEntry(i);
  266. if (!pInputEntry || !pInputEntry->pViewAngles)
  267. continue;
  268.  
  269. pInputEntry->pViewAngles->angValue = angView;
  270. //pInputEntry->SetBits(EInputHistoryBits::INPUT_HISTORY_BITS_VIEWANGLES);
  271. }
  272. }
  273.  
  274. bool IsButtonPressed(uint64_t button) const
  275. {
  276. if (!csgoUserCmd.pBaseCmd)
  277. return false;
  278.  
  279. return csgoUserCmd.pBaseCmd->pInButtonState->nValue & button;
  280. }
  281. };
  282.  
  283. class CSGOInput
  284. {
  285. public:
  286. char pad_0000[0x250]; //0x0000
  287. bool block_shot; //0x0250
  288. bool in_thirdperson; //0x0251
  289. char pad_0252[0x6]; //0x0252
  290. Vector third_person_angles; //0x0258
  291. char pad_0264[0x14]; //0x0264
  292. uint64_t button_pressed; //0x0278
  293. uint64_t mouse_button_pressed; //0x0280
  294. uint64_t button_un_pressed; //0x0288
  295. uint64_t keyboard_copy; //0x0290
  296. float forward_move; //0x0298
  297. float left_move; //0x029C
  298. float up_move; //0x02A0
  299. int mouse_delta_x;
  300. int mouse_delta_y;
  301. int32_t subtick_count; //0x02AC
  302. void* subticks[0xC];//c_subtick_input subticks[12]; //0x02B0
  303. Vector view_angles; //0x03D0
  304. int32_t target_entity_index; //0x03DC
  305. char pad_03E0[0x230]; //0x03E0
  306. int32_t attack_history_1; //0x0610
  307. int32_t attack_history_2; //0x0614
  308. int32_t attack_history_3; //0x0618
  309. char pad_061C[0x4]; //0x061C
  310. int32_t message_size; //0x0620
  311. char pad_0624[0x4]; //0x0624
  312. void* message;//c_cs_input_message* message; //0x0628
  313. };
Advertisement
Add Comment
Please, Sign In to add comment