Move Gamepad structs to their respective correct location
- Structs that are reversed from the Game are moved to Structs.hpp - Structs that are custom to the Gamepad patch are moved into the Gamepad component class - Offsets to the Game's memory are moved to the Functions.hpp header - Arrays that hold data are moved to the Gamepad components class as static fields
This commit is contained in:
@ -454,6 +454,15 @@ namespace Game
|
||||
|
||||
cg_s* cgArray = reinterpret_cast<cg_s*>(0x7F0F78);
|
||||
|
||||
PlayerKeyState* playerKeys = reinterpret_cast<PlayerKeyState*>(0xA1B7D0);
|
||||
kbutton_t* playersKb = reinterpret_cast<kbutton_t*>(0xA1A9A8);
|
||||
AimAssistGlobals* aaGlobArray = reinterpret_cast<AimAssistGlobals*>(0x7A2110);
|
||||
|
||||
keyname_t* keyNames = reinterpret_cast<keyname_t*>(0x798580);
|
||||
keyname_t* localizedKeyNames = reinterpret_cast<keyname_t*>(0x798880);
|
||||
|
||||
GraphFloat* aaInputGraph = reinterpret_cast<GraphFloat*>(0x7A2FC0);
|
||||
|
||||
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize)
|
||||
{
|
||||
int elSize = DB_GetXAssetSizeHandlers[type]();
|
||||
|
@ -938,6 +938,18 @@ namespace Game
|
||||
|
||||
extern cg_s* cgArray;
|
||||
|
||||
extern PlayerKeyState* playerKeys;
|
||||
extern kbutton_t* playersKb;
|
||||
extern AimAssistGlobals* aaGlobArray;
|
||||
|
||||
constexpr auto KEY_NAME_COUNT = 95;
|
||||
constexpr auto LOCALIZED_KEY_NAME_COUNT = 95;
|
||||
extern keyname_t* keyNames;
|
||||
extern keyname_t* localizedKeyNames;
|
||||
|
||||
constexpr auto AIM_ASSIST_GRAPH_COUNT = 4u;
|
||||
extern GraphFloat* aaInputGraph;
|
||||
|
||||
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
|
||||
void Menu_FreeItemMemory(Game::itemDef_s* item);
|
||||
void Menu_SetNextCursorItem(Game::UiContext* ctx, Game::menuDef_t* currentMenu, int unk = 1);
|
||||
|
@ -6198,6 +6198,244 @@ namespace Game
|
||||
char _pad4[0x89740];
|
||||
};
|
||||
|
||||
static constexpr auto MAX_GAMEPADS = 1;
|
||||
|
||||
static constexpr auto GPAD_VALUE_MASK = 0xFFFFFFFu;
|
||||
static constexpr auto GPAD_DPAD_MASK = XINPUT_GAMEPAD_DPAD_UP | XINPUT_GAMEPAD_DPAD_DOWN | XINPUT_GAMEPAD_DPAD_LEFT | XINPUT_GAMEPAD_DPAD_RIGHT;
|
||||
static constexpr auto GPAD_DIGITAL_MASK = 1u << 28;
|
||||
static constexpr auto GPAD_ANALOG_MASK = 1u << 29;
|
||||
static constexpr auto GPAD_STICK_MASK = 1u << 30;
|
||||
|
||||
enum GamePadButton
|
||||
{
|
||||
GPAD_NONE = 0,
|
||||
GPAD_UP = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_DPAD_UP & GPAD_VALUE_MASK),
|
||||
GPAD_DOWN = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_DPAD_DOWN & GPAD_VALUE_MASK),
|
||||
GPAD_LEFT = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_DPAD_LEFT & GPAD_VALUE_MASK),
|
||||
GPAD_RIGHT = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_DPAD_RIGHT & GPAD_VALUE_MASK),
|
||||
GPAD_START = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_START & GPAD_VALUE_MASK),
|
||||
GPAD_BACK = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_BACK & GPAD_VALUE_MASK),
|
||||
GPAD_L3 = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_LEFT_THUMB & GPAD_VALUE_MASK),
|
||||
GPAD_R3 = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_RIGHT_THUMB & GPAD_VALUE_MASK),
|
||||
GPAD_L_SHLDR = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_LEFT_SHOULDER & GPAD_VALUE_MASK),
|
||||
GPAD_R_SHLDR = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_RIGHT_SHOULDER & GPAD_VALUE_MASK),
|
||||
GPAD_A = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_A & GPAD_VALUE_MASK),
|
||||
GPAD_B = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_B & GPAD_VALUE_MASK),
|
||||
GPAD_X = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_X & GPAD_VALUE_MASK),
|
||||
GPAD_Y = GPAD_DIGITAL_MASK | (XINPUT_GAMEPAD_Y & GPAD_VALUE_MASK),
|
||||
GPAD_L_TRIG = GPAD_ANALOG_MASK | (0 & GPAD_VALUE_MASK),
|
||||
GPAD_R_TRIG = GPAD_ANALOG_MASK | (1 & GPAD_VALUE_MASK),
|
||||
};
|
||||
|
||||
enum GamePadStick
|
||||
{
|
||||
GPAD_INVALID = 0x0,
|
||||
GPAD_LX = GPAD_STICK_MASK | (0 & GPAD_VALUE_MASK),
|
||||
GPAD_LY = GPAD_STICK_MASK | (1 & GPAD_VALUE_MASK),
|
||||
GPAD_RX = GPAD_STICK_MASK | (2 & GPAD_VALUE_MASK),
|
||||
GPAD_RY = GPAD_STICK_MASK | (3 & GPAD_VALUE_MASK),
|
||||
};
|
||||
|
||||
enum GamePadButtonEvent
|
||||
{
|
||||
GPAD_BUTTON_RELEASED = 0x0,
|
||||
GPAD_BUTTON_PRESSED = 0x1,
|
||||
GPAD_BUTTON_UPDATE = 0x2,
|
||||
};
|
||||
|
||||
enum GamepadPhysicalAxis
|
||||
{
|
||||
GPAD_PHYSAXIS_NONE = -1,
|
||||
GPAD_PHYSAXIS_RSTICK_X = 0x0,
|
||||
GPAD_PHYSAXIS_RSTICK_Y = 0x1,
|
||||
GPAD_PHYSAXIS_LSTICK_X = 0x2,
|
||||
GPAD_PHYSAXIS_LSTICK_Y = 0x3,
|
||||
GPAD_PHYSAXIS_RTRIGGER = 0x4,
|
||||
GPAD_PHYSAXIS_LTRIGGER = 0x5,
|
||||
|
||||
GPAD_PHYSAXIS_COUNT,
|
||||
};
|
||||
|
||||
enum GamepadVirtualAxis
|
||||
{
|
||||
GPAD_VIRTAXIS_NONE = -1,
|
||||
GPAD_VIRTAXIS_SIDE = 0x0,
|
||||
GPAD_VIRTAXIS_FORWARD = 0x1,
|
||||
GPAD_VIRTAXIS_UP = 0x2,
|
||||
GPAD_VIRTAXIS_YAW = 0x3,
|
||||
GPAD_VIRTAXIS_PITCH = 0x4,
|
||||
GPAD_VIRTAXIS_ATTACK = 0x5,
|
||||
|
||||
GPAD_VIRTAXIS_COUNT
|
||||
};
|
||||
|
||||
enum GamePadStickDir
|
||||
{
|
||||
GPAD_STICK_POS = 0x0,
|
||||
GPAD_STICK_NEG = 0x1,
|
||||
|
||||
GPAD_STICK_DIR_COUNT
|
||||
};
|
||||
|
||||
enum GamepadMapping
|
||||
{
|
||||
GPAD_MAP_NONE = -1,
|
||||
GPAD_MAP_LINEAR = 0x0,
|
||||
GPAD_MAP_SQUARED = 0x1,
|
||||
|
||||
GPAD_MAP_COUNT
|
||||
};
|
||||
|
||||
struct ButtonToCodeMap_t
|
||||
{
|
||||
GamePadButton padButton;
|
||||
int code;
|
||||
};
|
||||
|
||||
struct StickToCodeMap_t
|
||||
{
|
||||
GamePadStick padStick;
|
||||
int posCode;
|
||||
int negCode;
|
||||
};
|
||||
|
||||
struct GamepadVirtualAxisMapping
|
||||
{
|
||||
GamepadPhysicalAxis physicalAxis;
|
||||
GamepadMapping mapType;
|
||||
};
|
||||
|
||||
struct GpadAxesGlob
|
||||
{
|
||||
float axesValues[GPAD_PHYSAXIS_COUNT];
|
||||
GamepadVirtualAxisMapping virtualAxes[GPAD_VIRTAXIS_COUNT];
|
||||
};
|
||||
|
||||
enum weaponstate_t
|
||||
{
|
||||
WEAPON_READY = 0x0,
|
||||
WEAPON_RAISING = 0x1,
|
||||
WEAPON_RAISING_ALTSWITCH = 0x2,
|
||||
WEAPON_DROPPING = 0x3,
|
||||
WEAPON_DROPPING_QUICK = 0x4,
|
||||
WEAPON_DROPPING_ALT = 0x5,
|
||||
WEAPON_FIRING = 0x6,
|
||||
WEAPON_RECHAMBERING = 0x7,
|
||||
WEAPON_RELOADING = 0x8,
|
||||
WEAPON_RELOADING_INTERUPT = 0x9,
|
||||
WEAPON_RELOAD_START = 0xA,
|
||||
WEAPON_RELOAD_START_INTERUPT = 0xB,
|
||||
WEAPON_RELOAD_END = 0xC,
|
||||
WEAPON_MELEE_INIT = 0xD,
|
||||
WEAPON_MELEE_FIRE = 0xE,
|
||||
WEAPON_MELEE_END = 0xF,
|
||||
WEAPON_OFFHAND_INIT = 0x10,
|
||||
WEAPON_OFFHAND_PREPARE = 0x11,
|
||||
WEAPON_OFFHAND_HOLD = 0x12,
|
||||
WEAPON_OFFHAND_FIRE = 0x13,
|
||||
WEAPON_OFFHAND_DETONATE = 0x14,
|
||||
WEAPON_OFFHAND_END = 0x15,
|
||||
WEAPON_DETONATING = 0x16,
|
||||
WEAPON_SPRINT_RAISE = 0x17,
|
||||
WEAPON_SPRINT_LOOP = 0x18,
|
||||
WEAPON_SPRINT_DROP = 0x19,
|
||||
WEAPON_STUNNED_START = 0x1A,
|
||||
WEAPON_STUNNED_LOOP = 0x1B,
|
||||
WEAPON_STUNNED_END = 0x1C,
|
||||
WEAPON_NIGHTVISION_WEAR = 0x1D,
|
||||
WEAPON_NIGHTVISION_REMOVE = 0x1E,
|
||||
|
||||
WEAPONSTATES_NUM
|
||||
};
|
||||
|
||||
struct AimAssistPlayerState
|
||||
{
|
||||
float velocity[3];
|
||||
int eFlags;
|
||||
int linkFlags;
|
||||
int pm_flags;
|
||||
int weapFlags;
|
||||
int weaponState;
|
||||
float fWeaponPosFrac;
|
||||
int weapIndex;
|
||||
bool hasAmmo;
|
||||
bool isDualWielding;
|
||||
bool isThirdPerson;
|
||||
bool isExtendedMelee;
|
||||
};
|
||||
|
||||
struct AimTweakables
|
||||
{
|
||||
float slowdownRegionWidth;
|
||||
float slowdownRegionHeight;
|
||||
float autoAimRegionWidth;
|
||||
float autoAimRegionHeight;
|
||||
float autoMeleeRegionWidth;
|
||||
float autoMeleeRegionHeight;
|
||||
float lockOnRegionWidth;
|
||||
float lockOnRegionHeight;
|
||||
};
|
||||
|
||||
constexpr auto AIM_TARGET_INVALID = 0x3FF;
|
||||
struct AimScreenTarget
|
||||
{
|
||||
int entIndex;
|
||||
float clipMins[2];
|
||||
float clipMaxs[2];
|
||||
float aimPos[3];
|
||||
float velocity[3];
|
||||
float distSqr;
|
||||
float crosshairDistSqr;
|
||||
};
|
||||
|
||||
enum AutoMeleeState
|
||||
{
|
||||
AIM_MELEE_STATE_OFF = 0x0,
|
||||
AIM_MELEE_STATE_TARGETED = 0x1,
|
||||
AIM_MELEE_STATE_UPDATING = 0x2,
|
||||
};
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4324)
|
||||
struct __declspec(align(16)) AimAssistGlobals
|
||||
{
|
||||
AimAssistPlayerState ps;
|
||||
char _pad1[4];
|
||||
float screenMtx[4][4];
|
||||
float invScreenMtx[4][4];
|
||||
bool initialized;
|
||||
int prevButtons;
|
||||
AimTweakables tweakables;
|
||||
float eyeOrigin[3];
|
||||
float viewOrigin[3];
|
||||
float viewAngles[3];
|
||||
float viewAxis[3][3];
|
||||
float fovTurnRateScale;
|
||||
float fovScaleInv;
|
||||
float adsLerp;
|
||||
float pitchDelta;
|
||||
float yawDelta;
|
||||
float screenWidth;
|
||||
float screenHeight;
|
||||
AimScreenTarget screenTargets[64];
|
||||
int screenTargetCount;
|
||||
int autoAimTargetEnt;
|
||||
bool autoAimPressed;
|
||||
bool autoAimActive;
|
||||
float autoAimPitch;
|
||||
float autoAimPitchTarget;
|
||||
float autoAimYaw;
|
||||
float autoAimYawTarget;
|
||||
AutoMeleeState autoMeleeState;
|
||||
int autoMeleeTargetEnt;
|
||||
float autoMeleePitch;
|
||||
float autoMeleePitchTarget;
|
||||
float autoMeleeYaw;
|
||||
float autoMeleeYawTarget;
|
||||
int lockOnTargetEnt;
|
||||
};
|
||||
#pragma warning(pop)
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#ifndef IDA
|
||||
|
Reference in New Issue
Block a user