Facebook
From Eratic Ostrich, 5 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 256
  1.  
  2. class CInput
  3. {
  4. public:
  5.         class CUserCmd
  6.         {
  7.         public:
  8.                 CRC32_t GetChecksum() const
  9.                 {
  10.                         CRC32_t crc;
  11.                         CRC32_Init(&crc);
  12.                         CRC32_ProcessBuffer(&crc, &command_number, sizeof(command_number));
  13.                         CRC32_ProcessBuffer(&crc, &tick_count, sizeof(tick_count));
  14.                         CRC32_ProcessBuffer(&crc, &viewangles, sizeof(viewangles));
  15.                         CRC32_ProcessBuffer(&crc, &aimdirection, sizeof(aimdirection));
  16.                         CRC32_ProcessBuffer(&crc, &forwardmove, sizeof(forwardmove));
  17.                         CRC32_ProcessBuffer(&crc, &sidemove, sizeof(sidemove));
  18.                         CRC32_ProcessBuffer(&crc, &upmove, sizeof(upmove));
  19.                         CRC32_ProcessBuffer(&crc, &buttons, sizeof(buttons));
  20.                         CRC32_ProcessBuffer(&crc, &impulse, sizeof(impulse));
  21.                         CRC32_ProcessBuffer(&crc, &weaponselect, sizeof(weaponselect));
  22.                         CRC32_ProcessBuffer(&crc, &weaponsubtype, sizeof(weaponsubtype));
  23.                         CRC32_ProcessBuffer(&crc, &random_seed, sizeof(random_seed));
  24.                         CRC32_ProcessBuffer(&crc, &mousedx, sizeof(mousedx));
  25.                         CRC32_ProcessBuffer(&crc, &mousedy, sizeof(mousedy));
  26.                         CRC32_Final(&crc);
  27.                         return crc;
  28.                 }
  29.  
  30.                 BYTE u1[4];
  31.                 int command_number;
  32.                 int     tick_count;
  33.                 QAngle viewangles;
  34.                 Vector aimdirection;
  35.                 float forwardmove;
  36.                 float sidemove;
  37.                 float upmove;
  38.                 int buttons;
  39.                 BYTE impulse;
  40.                 int weaponselect;
  41.                 int weaponsubtype;
  42.                 int random_seed;
  43.                 short mousedx;
  44.                 short mousedy;
  45.                 bool hasbeenpredicted;
  46.                 Vector headangles;
  47.                 Vector headoffset;
  48.         };
  49.  
  50.         class CVerifiedUserCmd
  51.         {
  52.         public:
  53.                 CUserCmd m_cmd;
  54.                 unsigned long m_crc;
  55.         };
  56.  
  57.         CInput::CUserCmd *GetUserCmd(int slot, int seq)
  58.         {
  59.                 using OriginalFn = CUserCmd *(__thiscall *)(void *, int, int);
  60.                 return GetVirtualFunction<OriginalFn>(this, 8)(this, slot, seq);
  61.         }
  62.  
  63.  
  64.         CUserCmd* GetUserCmd2(int sequence_number)
  65.         {
  66.                 return &m_pCommands[sequence_number % 150];
  67.         }
  68.  
  69.         CInput::CUserCmd* GetUserCmdz(signed int sequence_number)
  70.         {
  71.                 int result; // eax@3
  72.  
  73.                 result = *(DWORD*)&m_pCommands[sequence_number % 150];
  74.                 if (*(DWORD *)(result + 4) != sequence_number)
  75.                         result = 0;
  76.                 return (CInput::CUserCmd*)result;
  77.         }
  78.  
  79.  
  80.  
  81.  
  82. public:
  83.         void*               pvftable;                     //0x00
  84.         bool                m_fTrackIRAvailable;          //0x04
  85.         bool                m_fMouseInitialized;          //0x05
  86.         bool                m_fMouseActive;               //0x06
  87.         bool                m_fJoystickAdvancedInit;      //0x07
  88.         char                pad_0x08[0x2C];               //0x08
  89.         void*               m_pKeys;                      //0x34
  90.         char                pad_0x38[0x64];               //0x38
  91.         int                                     pad_0x41;
  92.         int                                     pad_0x42;
  93.         bool                m_fCameraInterceptingMouse;   //0x9C
  94.         bool                m_fCameraInThirdPerson;       //0x9D
  95.         bool                m_fCameraMovingWithMouse;     //0x9E
  96.         Vector                          m_vecCameraOffset;            //0xA0
  97.         bool                m_fCameraDistanceMove;        //0xAC
  98.         int                 m_nCameraOldX;                //0xB0
  99.         int                 m_nCameraOldY;                //0xB4
  100.         int                 m_nCameraX;                   //0xB8
  101.         int                 m_nCameraY;                   //0xBC
  102.         bool                m_CameraIsOrthographic;       //0xC0
  103.         Vector              m_angPreviousViewAngles;      //0xC4
  104.         Vector              m_angPreviousViewAnglesTilt;  //0xD0
  105.         float               m_flLastForwardMove;          //0xDC
  106.         int                 m_nClearInputState;           //0xE0
  107.         char                pad_0xE4[0x8];                //0xE4
  108.         CInput::CUserCmd*   m_pCommands;                  //0xEC
  109.         CVerifiedUserCmd*   m_pVerifiedCommands;          //0xF0
  110. };