diff --git a/AMBuilder b/AMBuilder index 79b5ceac..cec62df6 100644 --- a/AMBuilder +++ b/AMBuilder @@ -14,7 +14,7 @@ for sdk_target in MMSPlugin.sdk_targets: try: version = subprocess.check_output(['git', 'describe', '--tags', '--long']).decode('ascii').strip() except subprocess.SubprocessError as e: - version = "1.7-dev" + version = "0.0.1-dev" print("git describe failed as there are no tags") print(f'Setting version to "{version}"') @@ -52,7 +52,7 @@ for sdk_target in MMSPlugin.sdk_targets: binary.sources += [ - 'src/cs2fixes.cpp', + 'src/cs2uc.cpp', 'src/cvars.cpp', ] diff --git a/src/common.h b/src/common.h index b0206184..83c548f1 100644 --- a/src/common.h +++ b/src/common.h @@ -21,8 +21,6 @@ #include "platform.h" -#define VPROF_LEVEL 1 - #define CS_TEAM_NONE 0 #define CS_TEAM_SPECTATOR 1 #define CS_TEAM_T 2 @@ -47,45 +45,4 @@ void UnlockConVars(); void UnlockConCommands(); void Message(const char *, ...); -void Panic(const char *, ...); - -// CONVAR_TODO -// Need to replace with actual cvars once available in SDK -#define FAKE_CVAR(name, description, variable_name, variable_type, variable_type_format, variable_default, protect) \ - CON_COMMAND_F(name, description, FCVAR_LINKED_CONCOMMAND | FCVAR_SPONLY | (protect ? FCVAR_PROTECTED : FCVAR_NONE)) \ - { \ - if (args.ArgC() < 2) \ - Msg("%s " #variable_type_format "\n", args[0], variable_name); \ - else \ - variable_name = V_StringTo##variable_type(args[1], variable_default); \ - } - -#define FAKE_INT_CVAR(name, description, variable_name, variable_default, protect) \ - FAKE_CVAR(name, description, variable_name, Int32, %i, variable_default, protect) - -#define FAKE_BOOL_CVAR(name, description, variable_name, variable_default, protect) \ - FAKE_CVAR(name, description, variable_name, Bool, %i, variable_default, protect) - -#define FAKE_FLOAT_CVAR(name, description, variable_name, variable_default, protect) \ - FAKE_CVAR(name, description, variable_name, Float32, %f, variable_default, protect) - -// assumes std::string variable -#define FAKE_STRING_CVAR(name, description, variable_name, protect) \ - CON_COMMAND_F(name, description, FCVAR_LINKED_CONCOMMAND | FCVAR_SPONLY | (protect ? FCVAR_PROTECTED : FCVAR_NONE)) \ - { \ - if (args.ArgC() < 2) \ - Msg("%s %s\n", args[0], variable_name.c_str()); \ - else \ - variable_name = args[1]; \ - } - -#define FAKE_COLOR_CVAR(name, description, variable_name, protect) \ - CON_COMMAND_F(name, description, FCVAR_LINKED_CONCOMMAND | FCVAR_SPONLY | (protect ? FCVAR_PROTECTED : FCVAR_NONE)) \ - { \ - if (args.ArgC() < 2) \ - Msg("%s %i %i %i\n", args[0], variable_name[0], variable_name[1], variable_name[2]); \ - else if (args.ArgC() == 2) \ - V_StringToColor(args[1], variable_name); \ - else \ - V_StringToColor(args.ArgS(), variable_name); \ - } \ No newline at end of file +void Panic(const char *, ...); \ No newline at end of file diff --git a/src/cs2_sdk/entity/cbaseentity.h b/src/cs2_sdk/entity/cbaseentity.h deleted file mode 100644 index fa6afaf8..00000000 --- a/src/cs2_sdk/entity/cbaseentity.h +++ /dev/null @@ -1,297 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "schema.h" -#include "ccollisionproperty.h" -#include "globaltypes.h" -#include "ctakedamageinfo.h" -#include "mathlib/vector.h" -#include "ehandle.h" -#include "../detours.h" -#include "entitykeyvalues.h" -#include "../../gameconfig.h" - -extern CGameConfig *g_GameConfig; - -class CGameUI; - -class CGameSceneNode -{ -public: - DECLARE_SCHEMA_CLASS(CGameSceneNode) - - SCHEMA_FIELD(CEntityInstance *, m_pOwner) - SCHEMA_FIELD(CGameSceneNode *, m_pParent) - SCHEMA_FIELD(CGameSceneNode *, m_pChild) - SCHEMA_FIELD(CNetworkOriginCellCoordQuantizedVector, m_vecOrigin) - SCHEMA_FIELD(QAngle, m_angRotation) - SCHEMA_FIELD(float, m_flScale) - SCHEMA_FIELD(float, m_flAbsScale) - SCHEMA_FIELD(Vector, m_vecAbsOrigin) - SCHEMA_FIELD(QAngle, m_angAbsRotation) - SCHEMA_FIELD(Vector, m_vRenderOrigin) - - matrix3x4_t EntityToWorldTransform() - { - matrix3x4_t mat; - - // issues with this and im tired so hardcoded it - //AngleMatrix(this->m_angAbsRotation(), this->m_vecAbsOrigin(), mat); - - QAngle angles = this->m_angAbsRotation(); - float sr, sp, sy, cr, cp, cy; - SinCos(DEG2RAD(angles[YAW]), &sy, &cy); - SinCos(DEG2RAD(angles[PITCH]), &sp, &cp); - SinCos(DEG2RAD(angles[ROLL]), &sr, &cr); - mat[0][0] = cp * cy; - mat[1][0] = cp * sy; - mat[2][0] = -sp; - - float crcy = cr * cy; - float crsy = cr * sy; - float srcy = sr * cy; - float srsy = sr * sy; - mat[0][1] = sp * srcy - crsy; - mat[1][1] = sp * srsy + crcy; - mat[2][1] = sr * cp; - - mat[0][2] = (sp * crcy + srsy); - mat[1][2] = (sp * crsy - srcy); - mat[2][2] = cr * cp; - - Vector pos = this->m_vecAbsOrigin(); - mat[0][3] = pos.x; - mat[1][3] = pos.y; - mat[2][3] = pos.z; - - return mat; - } -}; - -class CBodyComponent -{ -public: - DECLARE_SCHEMA_CLASS(CBodyComponent) - - SCHEMA_FIELD(CGameSceneNode *, m_pSceneNode) -}; - -class CModelState -{ -public: - DECLARE_SCHEMA_CLASS(CModelState) - - SCHEMA_FIELD(CUtlSymbolLarge, m_ModelName) -}; - -class CSkeletonInstance : CGameSceneNode -{ -public: - DECLARE_SCHEMA_CLASS(CSkeletonInstance) - - SCHEMA_FIELD(CModelState, m_modelState) -}; - -class CEntitySubclassVDataBase -{ -public: - DECLARE_SCHEMA_CLASS(CEntitySubclassVDataBase) -}; - -class Z_CBaseEntity : public CBaseEntity -{ -public: - // This is a unique case as CBaseEntity is already defined in the sdk - typedef Z_CBaseEntity ThisClass; - static constexpr const char *ThisClassName = "CBaseEntity"; - static constexpr bool IsStruct = false; - - SCHEMA_FIELD(CBodyComponent *, m_CBodyComponent) - SCHEMA_FIELD(CBitVec<64>, m_isSteadyState) - SCHEMA_FIELD(float, m_lastNetworkChange) - SCHEMA_FIELD_POINTER(CNetworkTransmitComponent, m_NetworkTransmitComponent) - SCHEMA_FIELD(int, m_iHealth) - SCHEMA_FIELD(int, m_iMaxHealth) - SCHEMA_FIELD(int, m_iTeamNum) - SCHEMA_FIELD(bool, m_bLagCompensate) - SCHEMA_FIELD(Vector, m_vecAbsVelocity) - SCHEMA_FIELD(Vector, m_vecBaseVelocity) - SCHEMA_FIELD(CCollisionProperty*, m_pCollision) - SCHEMA_FIELD(MoveCollide_t, m_MoveCollide) - SCHEMA_FIELD(MoveType_t, m_MoveType) - SCHEMA_FIELD(MoveType_t, m_nActualMoveType) - SCHEMA_FIELD(CHandle, m_hEffectEntity) - SCHEMA_FIELD(uint32, m_spawnflags) - SCHEMA_FIELD(uint32, m_fFlags) - SCHEMA_FIELD(LifeState_t, m_lifeState) - SCHEMA_FIELD(float, m_flDamageAccumulator) - SCHEMA_FIELD(bool, m_bTakesDamage) - SCHEMA_FIELD(TakeDamageFlags_t, m_nTakeDamageFlags) - SCHEMA_FIELD_POINTER(CUtlStringToken, m_nSubclassID) - SCHEMA_FIELD(float, m_flFriction) - SCHEMA_FIELD(float, m_flGravityScale) - SCHEMA_FIELD(float, m_flTimeScale) - SCHEMA_FIELD(float, m_flSpeed) - SCHEMA_FIELD(CUtlString, m_sUniqueHammerID); - SCHEMA_FIELD(CUtlSymbolLarge, m_target); - SCHEMA_FIELD(CUtlSymbolLarge, m_iGlobalname); - - int entindex() { return m_pEntity->m_EHandle.GetEntryIndex(); } - - Vector GetAbsOrigin() { return m_CBodyComponent->m_pSceneNode->m_vecAbsOrigin; } - QAngle GetAbsRotation() { return m_CBodyComponent->m_pSceneNode->m_angAbsRotation; } - void SetAbsOrigin(Vector vecOrigin) { m_CBodyComponent->m_pSceneNode->m_vecAbsOrigin = vecOrigin; } - void SetAbsRotation(QAngle angAbsRotation) { m_CBodyComponent->m_pSceneNode->m_angAbsRotation = angAbsRotation; } - - void SetAbsVelocity(Vector vecVelocity) { m_vecAbsVelocity = vecVelocity; } - void SetBaseVelocity(Vector vecVelocity) { m_vecBaseVelocity = vecVelocity; } - - void SetName(const char *pName) - { - addresses::CEntityIdentity_SetEntityName(m_pEntity, pName); - } - - void TakeDamage(CTakeDamageInfo &info) - { - Detour_CBaseEntity_TakeDamageOld(this, &info); - } - - void Teleport(const Vector *position, const QAngle *angles, const Vector *velocity) - { - static int offset = g_GameConfig->GetOffset("Teleport"); - CALL_VIRTUAL(void, offset, this, position, angles, velocity); - } - - void SetCollisionGroup(Collision_Group_t nCollisionGroup) - { - if (!m_pCollision()) - return; - - m_pCollision->m_collisionAttribute().m_nCollisionGroup = COLLISION_GROUP_DEBRIS; - m_pCollision->m_CollisionGroup = COLLISION_GROUP_DEBRIS; - CollisionRulesChanged(); - } - - void CollisionRulesChanged() - { - static int offset = g_GameConfig->GetOffset("CollisionRulesChanged"); - CALL_VIRTUAL(void, offset, this); - } - - bool IsPawn() - { - static int offset = g_GameConfig->GetOffset("IsEntityPawn"); - return CALL_VIRTUAL(bool, offset, this); - } - - bool IsController() - { - static int offset = g_GameConfig->GetOffset("IsEntityController"); - return CALL_VIRTUAL(bool, offset, this); - } - - void AcceptInput(const char *pInputName, variant_t value = variant_t(""), CEntityInstance *pActivator = nullptr, CEntityInstance *pCaller = nullptr) - { - addresses::CEntityInstance_AcceptInput(this, pInputName, pActivator, pCaller, &value, 0); - } - - bool IsAlive() { return m_lifeState == LifeState_t::LIFE_ALIVE; } - - CHandle GetHandle() { return m_pEntity->m_EHandle; } - - // A double pointer to entity VData is available 4 bytes past m_nSubclassID, if applicable - CEntitySubclassVDataBase* GetVData() { return *(CEntitySubclassVDataBase**)((uint8*)(m_nSubclassID()) + 4); } - - void DispatchSpawn(CEntityKeyValues *pEntityKeyValues = nullptr) - { - addresses::DispatchSpawn(this, pEntityKeyValues); - } - - // Emit a sound event - void EmitSound(const char *pszSound, int nPitch = 100, float flVolume = 1.0, float flDelay = 0.0) - { - addresses::CBaseEntity_EmitSoundParams(this, pszSound, nPitch, flVolume, flDelay); - } - - SndOpEventGuid_t EmitSoundFilter(IRecipientFilter &filter, const char *pszSound, float flVolume = 1.0, float flPitch = 1.0) - { - EmitSound_t params; - params.m_pSoundName = pszSound; - params.m_flVolume = flVolume; - params.m_nPitch = flPitch; - - return addresses::CBaseEntity_EmitSoundFilter(filter, entindex(), params); - } - - void DispatchParticle(const char *pszParticleName, IRecipientFilter *pFilter, ParticleAttachment_t nAttachType = PATTACH_POINT_FOLLOW, - char iAttachmentPoint = 0, CUtlSymbolLarge iAttachmentName = "") - { - addresses::DispatchParticleEffect(pszParticleName, nAttachType, this, iAttachmentPoint, iAttachmentName, false, 0, pFilter, 0); - } - - // This was needed so we can parent to nameless entities using pointers - void SetParent(Z_CBaseEntity *pNewParent) - { - addresses::CBaseEntity_SetParent(this, pNewParent, 0, nullptr); - } - - void Remove() - { - addresses::UTIL_Remove(this); - } - - void SetMoveType(MoveType_t nMoveType) - { - addresses::CBaseEntity_SetMoveType(this, nMoveType, m_MoveCollide); - } - - void SetGroundEntity(Z_CBaseEntity *pGround) - { - addresses::SetGroundEntity(this, pGround); - } - - const char* GetName() const { return m_pEntity->m_name.String(); } - - /* Begin Custom Entities Cast */ - - [[nodiscard]] CGameUI *AsGameUI() - { - if (V_strcasecmp(GetClassname(), "logic_case") != 0) - return nullptr; - - const auto tag = m_iszPrivateVScripts.IsValid() ? m_iszPrivateVScripts.String() : nullptr; - - if (tag && V_strcasecmp(tag, "game_ui") == 0) - return reinterpret_cast(this); - - return nullptr; - } - - /* End Custom Entities Cast */ -}; - -class SpawnPoint : public Z_CBaseEntity -{ -public: - DECLARE_SCHEMA_CLASS(SpawnPoint); - - SCHEMA_FIELD(bool, m_bEnabled); -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/cbasemodelentity.h b/src/cs2_sdk/entity/cbasemodelentity.h deleted file mode 100644 index 0c333666..00000000 --- a/src/cs2_sdk/entity/cbasemodelentity.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbaseentity.h" -#include "globaltypes.h" - -class CBaseModelEntity : public Z_CBaseEntity -{ -public: - DECLARE_SCHEMA_CLASS(CBaseModelEntity); - - SCHEMA_FIELD(CCollisionProperty , m_Collision) - SCHEMA_FIELD(CGlowProperty, m_Glow) - SCHEMA_FIELD(Color, m_clrRender) - SCHEMA_FIELD(RenderMode_t, m_nRenderMode) - SCHEMA_FIELD(float, m_flDissolveStartTime) - - void SetModel(const char *szModel) - { - addresses::CBaseModelEntity_SetModel(this, szModel); - } - - const char* GetModelName() - { - return ((CSkeletonInstance*)m_CBodyComponent->m_pSceneNode.Get())->m_modelState().m_ModelName.Get().String(); - } -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/cbaseplayercontroller.h b/src/cs2_sdk/entity/cbaseplayercontroller.h deleted file mode 100644 index eadf9280..00000000 --- a/src/cs2_sdk/entity/cbaseplayercontroller.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "ehandle.h" -#include "cbaseentity.h" -#include "ccsplayerpawn.h" - -enum class PlayerConnectedState : uint32_t -{ - PlayerNeverConnected = 0xFFFFFFFF, - PlayerConnected = 0x0, - PlayerConnecting = 0x1, - PlayerReconnecting = 0x2, - PlayerDisconnecting = 0x3, - PlayerDisconnected = 0x4, - PlayerReserved = 0x5, -}; - -class CBasePlayerController : public Z_CBaseEntity -{ -public: - DECLARE_SCHEMA_CLASS(CBasePlayerController); - - SCHEMA_FIELD(uint64, m_steamID) - SCHEMA_FIELD(CHandle, m_hPawn) - SCHEMA_FIELD_POINTER(char, m_iszPlayerName) - SCHEMA_FIELD(PlayerConnectedState, m_iConnected) - - // Returns the current pawn, which could be one of those: - // - The player's actual pawn - // - An observer pawn if spectating - // - A bot pawn if controlling one - CBasePlayerPawn *GetPawn() { return m_hPawn.Get(); } - const char *GetPlayerName() { return m_iszPlayerName(); } - int GetPlayerSlot() { return entindex() - 1; } - bool IsConnected() { return m_iConnected() == PlayerConnectedState::PlayerConnected; } - void SetPawn(CCSPlayerPawn* pawn) - { - addresses::CBasePlayerController_SetPawn(this, pawn, true, false); - } -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/cbaseplayerpawn.h b/src/cs2_sdk/entity/cbaseplayerpawn.h deleted file mode 100644 index fcc19857..00000000 --- a/src/cs2_sdk/entity/cbaseplayerpawn.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbaseentity.h" -#include "cbasemodelentity.h" -#include "services.h" - -class CBasePlayerPawn : public CBaseModelEntity -{ -public: - DECLARE_SCHEMA_CLASS(CBasePlayerPawn); - - SCHEMA_FIELD(CPlayer_MovementServices*, m_pMovementServices) - SCHEMA_FIELD(CPlayer_WeaponServices*, m_pWeaponServices) - SCHEMA_FIELD(CCSPlayer_ItemServices*, m_pItemServices) - SCHEMA_FIELD(CPlayer_ObserverServices*, m_pObserverServices) - SCHEMA_FIELD(CHandle, m_hController) - - void CommitSuicide(bool bExplode, bool bForce) - { - static int offset = g_GameConfig->GetOffset("CBasePlayerPawn_CommitSuicide"); - CALL_VIRTUAL(void, offset, this, bExplode, bForce); - } - - CBasePlayerController *GetController() { return m_hController.Get(); } -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/cbasetrigger.h b/src/cs2_sdk/entity/cbasetrigger.h deleted file mode 100644 index 716bd5eb..00000000 --- a/src/cs2_sdk/entity/cbasetrigger.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbasemodelentity.h" -#include"../schema.h" - -#define SF_TRIG_PUSH_ONCE 0x80 - -class CBaseTrigger : public CBaseModelEntity -{ -public: - DECLARE_SCHEMA_CLASS(CBaseTrigger); - - SCHEMA_FIELD(CUtlSymbolLarge, m_iFilterName) - SCHEMA_FIELD(CEntityHandle, m_hFilter) - - bool PassesTriggerFilters(Z_CBaseEntity *pOther) - { - static int offset = g_GameConfig->GetOffset("PassesTriggerFilters"); - return CALL_VIRTUAL(bool, offset, this, pOther); - } -}; diff --git a/src/cs2_sdk/entity/ccollisionproperty.h b/src/cs2_sdk/entity/ccollisionproperty.h deleted file mode 100644 index a21f5d6c..00000000 --- a/src/cs2_sdk/entity/ccollisionproperty.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbaseentity.h" - -struct VPhysicsCollisionAttribute_t -{ - DECLARE_SCHEMA_CLASS_INLINE(VPhysicsCollisionAttribute_t) - - SCHEMA_FIELD(uint8, m_nCollisionGroup) - SCHEMA_FIELD(uint64_t, m_nInteractsAs) - SCHEMA_FIELD(uint64_t, m_nInteractsWith) - SCHEMA_FIELD(uint64_t, m_nInteractsExclude) -}; - -class CCollisionProperty -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CCollisionProperty) - - SCHEMA_FIELD(VPhysicsCollisionAttribute_t, m_collisionAttribute) - SCHEMA_FIELD(SolidType_t, m_nSolidType) - SCHEMA_FIELD(uint8, m_usSolidFlags) - SCHEMA_FIELD(uint8, m_CollisionGroup) -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/ccsplayercontroller.h b/src/cs2_sdk/entity/ccsplayercontroller.h deleted file mode 100644 index 81e73b2e..00000000 --- a/src/cs2_sdk/entity/ccsplayercontroller.h +++ /dev/null @@ -1,135 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbaseplayercontroller.h" -#include "services.h" -#include "../playermanager.h" -#include "../serversideclient.h" - -extern CGameEntitySystem* g_pEntitySystem; - -class CCSPlayerController : public CBasePlayerController -{ -public: - DECLARE_SCHEMA_CLASS(CCSPlayerController); - - SCHEMA_FIELD(CCSPlayerController_InGameMoneyServices*, m_pInGameMoneyServices) - SCHEMA_FIELD(CCSPlayerController_ActionTrackingServices*, m_pActionTrackingServices) - SCHEMA_FIELD(bool, m_bPawnIsAlive); - SCHEMA_FIELD(CHandle, m_hPlayerPawn); - SCHEMA_FIELD(CHandle, m_hOriginalControllerOfCurrentPawn); - - static CCSPlayerController* FromPawn(CCSPlayerPawn* pawn) - { - return (CCSPlayerController*)pawn->m_hController().Get(); - } - - static CCSPlayerController* FromSlot(CPlayerSlot slot) - { - return (CCSPlayerController*)g_pEntitySystem->GetBaseEntity(CEntityIndex(slot.Get() + 1)); - } - - // Returns the actual player pawn - CCSPlayerPawn *GetPlayerPawn() - { - return m_hPlayerPawn().Get(); - } - - ZEPlayer* GetZEPlayer() - { - return g_playerManager->GetPlayer(GetPlayerSlot()); - } - - CServerSideClient *GetServerSideClient() - { - return GetClientBySlot(GetPlayerSlot()); - } - - bool IsBot() - { - return m_fFlags() & FL_CONTROLLER_FAKECLIENT; - } - - void ChangeTeam(int iTeam) - { - static int offset = g_GameConfig->GetOffset("CCSPlayerController_ChangeTeam"); - CALL_VIRTUAL(void, offset, this, iTeam); - } - - void SwitchTeam(int iTeam) - { - if (!IsController()) - return; - - if (iTeam == CS_TEAM_SPECTATOR) - { - ChangeTeam(iTeam); - } - else - { - addresses::CCSPlayerController_SwitchTeam(this, iTeam); - } - } - - void Respawn() - { - CCSPlayerPawn *pPawn = GetPlayerPawn(); - if (!pPawn || pPawn->IsAlive()) - return; - - SetPawn(pPawn); - static int offset = g_GameConfig->GetOffset("CCSPlayerController_Respawn"); - CALL_VIRTUAL(void, offset, this); - } - - CSPlayerState GetPawnState() - { - // All CS2 pawns are derived from this - CCSPlayerPawnBase *pPawn = (CCSPlayerPawnBase*)GetPawn(); - - // The player is still joining so their pawn doesn't exist yet, and STATE_WELCOME is what they start with - if (!pPawn) - return STATE_WELCOME; - - return pPawn->m_iPlayerState(); - } - - CSPlayerState GetPlayerPawnState() - { - CCSPlayerPawn *pPawn = GetPlayerPawn(); - - // The player is still joining so their pawn doesn't exist yet, and STATE_WELCOME is what they start with - if (!pPawn) - return STATE_WELCOME; - - return pPawn->m_iPlayerState(); - } - - Z_CBaseEntity *GetObserverTarget() - { - auto pPawn = GetPawn(); - - if (!pPawn) - return nullptr; - - return pPawn->m_pObserverServices->m_hObserverTarget().Get(); - } -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/ccsplayerpawn.h b/src/cs2_sdk/entity/ccsplayerpawn.h deleted file mode 100644 index 7cf50481..00000000 --- a/src/cs2_sdk/entity/ccsplayerpawn.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbaseplayerpawn.h" - -enum CSPlayerState -{ - STATE_ACTIVE = 0x0, - STATE_WELCOME = 0x1, - STATE_PICKINGTEAM = 0x2, - STATE_PICKINGCLASS = 0x3, - STATE_DEATH_ANIM = 0x4, - STATE_DEATH_WAIT_FOR_KEY = 0x5, - STATE_OBSERVER_MODE = 0x6, - STATE_GUNGAME_RESPAWN = 0x7, - STATE_DORMANT = 0x8, - NUM_PLAYER_STATES = 0x9, -}; - - -class CCSPlayerPawnBase : public CBasePlayerPawn -{ -public: - DECLARE_SCHEMA_CLASS(CCSPlayerPawnBase); - SCHEMA_FIELD(QAngle, m_angEyeAngles) - SCHEMA_FIELD(CSPlayerState, m_iPlayerState) - SCHEMA_FIELD(CHandle, m_hOriginalController) - - CCSPlayerController *GetOriginalController() - { - return m_hOriginalController().Get(); - } - - bool IsBot() - { - return m_fFlags() & FL_PAWN_FAKECLIENT; - } -}; - -class CCSPlayerPawn : public CCSPlayerPawnBase -{ -public: - DECLARE_SCHEMA_CLASS(CCSPlayerPawn); - - SCHEMA_FIELD(float, m_flVelocityModifier) - SCHEMA_FIELD(CCSPlayer_ActionTrackingServices*, m_pActionTrackingServices) -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/ccsweaponbase.h b/src/cs2_sdk/entity/ccsweaponbase.h deleted file mode 100644 index 6c7cdd1a..00000000 --- a/src/cs2_sdk/entity/ccsweaponbase.h +++ /dev/null @@ -1,99 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbaseentity.h" - -enum gear_slot_t : uint32_t -{ - GEAR_SLOT_INVALID = 0xffffffff, - GEAR_SLOT_RIFLE = 0x0, - GEAR_SLOT_PISTOL = 0x1, - GEAR_SLOT_KNIFE = 0x2, - GEAR_SLOT_GRENADES = 0x3, - GEAR_SLOT_C4 = 0x4, - GEAR_SLOT_RESERVED_SLOT6 = 0x5, - GEAR_SLOT_RESERVED_SLOT7 = 0x6, - GEAR_SLOT_RESERVED_SLOT8 = 0x7, - GEAR_SLOT_RESERVED_SLOT9 = 0x8, - GEAR_SLOT_RESERVED_SLOT10 = 0x9, - GEAR_SLOT_RESERVED_SLOT11 = 0xa, - GEAR_SLOT_BOOSTS = 0xb, - GEAR_SLOT_UTILITY = 0xc, - GEAR_SLOT_COUNT = 0xd, - GEAR_SLOT_FIRST = 0x0, - GEAR_SLOT_LAST = 0xc, -}; - -class CEconItemView -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CEconItemView); - - SCHEMA_FIELD(uint16_t, m_iItemDefinitionIndex) - SCHEMA_FIELD(bool, m_bInitialized) -}; - -class CAttributeContainer -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CAttributeContainer); - - SCHEMA_FIELD(CEconItemView, m_Item) -}; - -class CEconEntity : public Z_CBaseEntity -{ -public: - DECLARE_SCHEMA_CLASS(CEconEntity) - - SCHEMA_FIELD(CAttributeContainer, m_AttributeManager) -}; - -class CBasePlayerWeaponVData : public CEntitySubclassVDataBase -{ -public: - DECLARE_SCHEMA_CLASS(CBasePlayerWeaponVData) - SCHEMA_FIELD(int, m_iMaxClip1) -}; - -class CCSWeaponBaseVData : public CBasePlayerWeaponVData -{ -public: - DECLARE_SCHEMA_CLASS(CCSWeaponBaseVData) - - SCHEMA_FIELD(gear_slot_t, m_GearSlot) - SCHEMA_FIELD(int, m_nPrice) - SCHEMA_FIELD(int, m_nPrimaryReserveAmmoMax); -}; - -class CBasePlayerWeapon : public CEconEntity -{ -public: - DECLARE_SCHEMA_CLASS(CBasePlayerWeapon) - - CCSWeaponBaseVData* GetWeaponVData() { return (CCSWeaponBaseVData*)GetVData(); } -}; - -class CCSWeaponBase : public CBasePlayerWeapon -{ -public: - DECLARE_SCHEMA_CLASS(CCSWeaponBase) -}; diff --git a/src/cs2_sdk/entity/cenventitymaker.h b/src/cs2_sdk/entity/cenventitymaker.h deleted file mode 100644 index 092c3387..00000000 --- a/src/cs2_sdk/entity/cenventitymaker.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbaseentity.h" -#include"../schema.h" - -#define SF_TRIG_PUSH_ONCE 0x80 - -class CEnvEntityMaker : public Z_CBaseEntity -{ -public: - DECLARE_SCHEMA_CLASS(CEnvEntityMaker); - - SCHEMA_FIELD(CUtlSymbolLarge, m_iszTemplate) -}; diff --git a/src/cs2_sdk/entity/cgameplayerequip.h b/src/cs2_sdk/entity/cgameplayerequip.h deleted file mode 100644 index 4a858923..00000000 --- a/src/cs2_sdk/entity/cgameplayerequip.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "../schema.h" -#include "cbaseentity.h" - -class CGamePlayerEquip : public Z_CBaseEntity -{ - DECLARE_SCHEMA_CLASS(CGamePlayerEquip) -public: - - static constexpr int MAX_EQUIPMENTS_SIZE = 32; - - static constexpr int SF_PLAYEREQUIP_USEONLY = 0x0001; - static constexpr int SF_PLAYEREQUIP_STRIPFIRST = 0x0002; - - // TODO this flag copied from CSGO, and impl on FyS server. but CS2Fixes not support aws currently. - // Add it in the future. - static constexpr int SF_PLAYEREQUIP_ONLYSTRIPSAME = 0x0004; -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/cgamerules.h b/src/cs2_sdk/entity/cgamerules.h deleted file mode 100644 index ec4e174f..00000000 --- a/src/cs2_sdk/entity/cgamerules.h +++ /dev/null @@ -1,85 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once -#include -#include "globaltypes.h" -#include "cbaseentity.h" - -enum CSRoundEndReason -{ - TargetBombed = 1, /**< Target Successfully Bombed! */ - VIPEscaped, /**< The VIP has escaped! - Doesn't exist on CS:GO */ - VIPKilled, /**< VIP has been assassinated! - Doesn't exist on CS:GO */ - TerroristsEscaped, /**< The terrorists have escaped! */ - CTStoppedEscape, /**< The CTs have prevented most of the terrorists from escaping! */ - TerroristsStopped, /**< Escaping terrorists have all been neutralized! */ - BombDefused, /**< The bomb has been defused! */ - CTWin, /**< Counter-Terrorists Win! */ - TerroristWin, /**< Terrorists Win! */ - Draw, /**< Round Draw! */ - HostagesRescued, /**< All Hostages have been rescued! */ - TargetSaved, /**< Target has been saved! */ - HostagesNotRescued, /**< Hostages have not been rescued! */ - TerroristsNotEscaped, /**< Terrorists have not escaped! */ - VIPNotEscaped, /**< VIP has not escaped! - Doesn't exist on CS:GO */ - GameStart, /**< Game Commencing! */ - TerroristsSurrender, /**< Terrorists Surrender */ - CTSurrender, /**< CTs Surrender */ - TerroristsPlanted, /**< Terrorists Planted the bomb */ - CTsReachedHostage, /**< CTs Reached the hostage */ - SurvivalWin, - SurvivalDraw -}; - -class CGameRules -{ -public: - DECLARE_SCHEMA_CLASS(CGameRules) -}; - -class CCSGameRules : public CGameRules -{ -public: - DECLARE_SCHEMA_CLASS(CCSGameRules) - - SCHEMA_FIELD(float, m_fMatchStartTime) - SCHEMA_FIELD(float, m_flGameStartTime) - SCHEMA_FIELD(int, m_totalRoundsPlayed) - SCHEMA_FIELD(GameTime_t, m_fRoundStartTime) - SCHEMA_FIELD(GameTime_t, m_flRestartRoundTime) - SCHEMA_FIELD_POINTER(int, m_nEndMatchMapGroupVoteOptions) - SCHEMA_FIELD(int, m_nEndMatchMapVoteWinner) - SCHEMA_FIELD(int, m_iRoundTime) - SCHEMA_FIELD_POINTER(CUtlVector, m_CTSpawnPoints) - SCHEMA_FIELD_POINTER(CUtlVector, m_TerroristSpawnPoints) - - void TerminateRound(float flDelay, CSRoundEndReason reason) - { - addresses::CGameRules_TerminateRound(this, flDelay, reason, 0, 0); - } -}; - -class CCSGameRulesProxy : public Z_CBaseEntity -{ -public: - DECLARE_SCHEMA_CLASS(CCSGameRulesProxy) - - SCHEMA_FIELD(CCSGameRules *, m_pGameRules) -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/clogiccase.h b/src/cs2_sdk/entity/clogiccase.h deleted file mode 100644 index 8ac85a0d..00000000 --- a/src/cs2_sdk/entity/clogiccase.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "../schema.h" -#include "cbaseentity.h" - -class CLogicCase : public Z_CBaseEntity -{ -public: - DECLARE_SCHEMA_CLASS(CLogicCase) -}; - -class CGameUI : public CLogicCase -{ -public: - static constexpr int SF_GAMEUI_FREEZE_PLAYER = 32; - static constexpr int SF_GAMEUI_JUMP_DEACTIVATE = 256; - - // TODO Hide Weapon requires more RE - static constexpr int SF_GAMEUI_HIDE_WEAPON = 64; - - // TODO subtick problem - static constexpr int SF_GAMEUI_USE_DEACTIVATE = 128; -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/cparticlesystem.h b/src/cs2_sdk/entity/cparticlesystem.h deleted file mode 100644 index 61be9f82..00000000 --- a/src/cs2_sdk/entity/cparticlesystem.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbasemodelentity.h" - -class CParticleSystem : public CBaseModelEntity -{ -public: - DECLARE_SCHEMA_CLASS(CParticleSystem); - - SCHEMA_FIELD(bool, m_bActive) - SCHEMA_FIELD(bool, m_bStartActive) - SCHEMA_FIELD(bool, m_bFrozen) - SCHEMA_FIELD(CUtlSymbolLarge, m_iszEffectName) - SCHEMA_FIELD(int, m_nTintCP) - SCHEMA_FIELD_POINTER(Color, m_clrTint) - SCHEMA_FIELD_POINTER(CHandle, m_hControlPointEnts) // m_hControlPointEnts[64] -}; - -class CEnvParticleGlow : public CParticleSystem -{ -public: - DECLARE_SCHEMA_CLASS(CEnvParticleGlow); - - SCHEMA_FIELD(float, m_flAlphaScale) - SCHEMA_FIELD(float, m_flRadiusScale) - SCHEMA_FIELD(float, m_flSelfIllumScale) - SCHEMA_FIELD_POINTER(Color, m_ColorTint) -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/cphysthruster.h b/src/cs2_sdk/entity/cphysthruster.h deleted file mode 100644 index d90db05b..00000000 --- a/src/cs2_sdk/entity/cphysthruster.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "../schema.h" -#include "cbaseentity.h" - -class CPhysForce : public Z_CBaseEntity -{ - DECLARE_SCHEMA_CLASS(CPhysForce) -public: - SCHEMA_FIELD(float, m_force) -}; - -class CPhysThruster : public CPhysForce -{ -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/ctakedamageinfo.h b/src/cs2_sdk/entity/ctakedamageinfo.h deleted file mode 100644 index cdbc98b9..00000000 --- a/src/cs2_sdk/entity/ctakedamageinfo.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once -#include -#include "ehandle.h" - -enum DamageTypes_t : uint32_t -{ - DMG_GENERIC = 0x0, - DMG_CRUSH = 0x1, - DMG_BULLET = 0x2, - DMG_SLASH = 0x4, - DMG_BURN = 0x8, - DMG_VEHICLE = 0x10, - DMG_FALL = 0x20, - DMG_BLAST = 0x40, - DMG_CLUB = 0x80, - DMG_SHOCK = 0x100, - DMG_SONIC = 0x200, - DMG_ENERGYBEAM = 0x400, - DMG_DROWN = 0x4000, - DMG_POISON = 0x8000, - DMG_RADIATION = 0x10000, - DMG_DROWNRECOVER = 0x20000, - DMG_ACID = 0x40000, - DMG_PHYSGUN = 0x100000, - DMG_DISSOLVE = 0x200000, - DMG_BLAST_SURFACE = 0x400000, - DMG_BUCKSHOT = 0x1000000, - DMG_LASTGENERICFLAG = 0x1000000, - DMG_HEADSHOT = 0x2000000, - DMG_DANGERZONE = 0x4000000, -}; - -enum TakeDamageFlags_t : uint32_t -{ - DFLAG_NONE = 0x0, - DFLAG_SUPPRESS_HEALTH_CHANGES = 0x1, - DFLAG_SUPPRESS_PHYSICS_FORCE = 0x2, - DFLAG_SUPPRESS_EFFECTS = 0x4, - DFLAG_PREVENT_DEATH = 0x8, - DFLAG_FORCE_DEATH = 0x10, - DFLAG_ALWAYS_GIB = 0x20, - DFLAG_NEVER_GIB = 0x40, - DFLAG_REMOVE_NO_RAGDOLL = 0x80, - DFLAG_SUPPRESS_DAMAGE_MODIFICATION = 0x100, - DFLAG_ALWAYS_FIRE_DAMAGE_EVENTS = 0x200, - DFLAG_RADIUS_DMG = 0x400, - DMG_LASTDFLAG = 0x400, - DFLAG_IGNORE_ARMOR = 0x800, -}; - -class CTakeDamageInfo -{ -private: - [[maybe_unused]] uint8_t __pad0000[0x8]; - -public: - CTakeDamageInfo() - { - addresses::CTakeDamageInfo_Constructor(this, nullptr, nullptr, nullptr, &vec3_origin, &vec3_origin, 0.f, 0, 0, nullptr); - } - - CTakeDamageInfo(Z_CBaseEntity *pInflictor, Z_CBaseEntity *pAttacker, Z_CBaseEntity *pAbility, float flDamage, DamageTypes_t bitsDamageType) - { - addresses::CTakeDamageInfo_Constructor(this, pInflictor, pAttacker, pAbility, &vec3_origin, &vec3_origin, flDamage, bitsDamageType, 0, nullptr); - } - - Vector m_vecDamageForce; - Vector m_vecDamagePosition; - Vector m_vecReportedPosition; - Vector m_vecDamageDirection; - CHandle m_hInflictor; - CHandle m_hAttacker; - CHandle m_hAbility; - float m_flDamage; - DamageTypes_t m_bitsDamageType; - int32_t m_iDamageCustom; - uint8_t m_iAmmoType; - -private: - [[maybe_unused]] uint8_t __pad0051[0xf]; - -public: - float m_flOriginalDamage; - bool m_bShouldBleed; - bool m_bShouldSpark; - -private: - [[maybe_unused]] uint8_t __pad0066[0xa]; - -public: - TakeDamageFlags_t m_nDamageFlags; - int32_t m_nNumObjectsPenetrated; - uint64_t m_hScriptInstance; - -private: - [[maybe_unused]] uint8_t __pad0080[0x14]; - -public: - bool m_bInTakeDamageFlow; -}; diff --git a/src/cs2_sdk/entity/cteam.h b/src/cs2_sdk/entity/cteam.h deleted file mode 100644 index b5eec74d..00000000 --- a/src/cs2_sdk/entity/cteam.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - - -#pragma once -#include "cbaseentity.h" -#include "cbaseplayercontroller.h" -#include "cbaseplayerpawn.h" - -class CTeam : public Z_CBaseEntity -{ -public: - DECLARE_SCHEMA_CLASS(CTeam); - - SCHEMA_FIELD_POINTER(CUtlVector>, m_aPlayerControllers) - SCHEMA_FIELD_POINTER(CUtlVector>, m_aPlayers) - - SCHEMA_FIELD(int32_t, m_iScore) -}; diff --git a/src/cs2_sdk/entity/ctriggerpush.h b/src/cs2_sdk/entity/ctriggerpush.h deleted file mode 100644 index 73169bfd..00000000 --- a/src/cs2_sdk/entity/ctriggerpush.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbasetrigger.h" -#include"../schema.h" - -#define SF_TRIG_PUSH_ONCE 0x80 - -class CTriggerPush : public CBaseTrigger -{ -public: - DECLARE_SCHEMA_CLASS(CTriggerPush); - - SCHEMA_FIELD(Vector, m_vecPushDirEntitySpace) - SCHEMA_FIELD(bool, m_bTriggerOnStartTouch) -}; diff --git a/src/cs2_sdk/entity/globaltypes.h b/src/cs2_sdk/entity/globaltypes.h deleted file mode 100644 index 3e8193f0..00000000 --- a/src/cs2_sdk/entity/globaltypes.h +++ /dev/null @@ -1,236 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once -#include -#include "schema.h" -#include "soundflags.h" - -enum InputBitMask_t : uint64_t -{ - // MEnumeratorIsNotAFlag - IN_NONE = 0x0, - // MEnumeratorIsNotAFlag - IN_ALL = 0xffffffffffffffff, - IN_ATTACK = 0x1, - IN_JUMP = 0x2, - IN_DUCK = 0x4, - IN_FORWARD = 0x8, - IN_BACK = 0x10, - IN_USE = 0x20, - IN_TURNLEFT = 0x80, - IN_TURNRIGHT = 0x100, - IN_MOVELEFT = 0x200, - IN_MOVERIGHT = 0x400, - IN_ATTACK2 = 0x800, - IN_RELOAD = 0x2000, - IN_SPEED = 0x10000, - IN_JOYAUTOSPRINT = 0x20000, - // MEnumeratorIsNotAFlag - IN_FIRST_MOD_SPECIFIC_BIT = 0x100000000, - IN_USEORRELOAD = 0x100000000, - IN_SCORE = 0x200000000, - IN_ZOOM = 0x400000000, - IN_LOOK_AT_WEAPON = 0x800000000, -}; - -enum EInButtonState : uint32_t -{ - IN_BUTTON_UP = 0x0, - IN_BUTTON_DOWN = 0x1, - IN_BUTTON_DOWN_UP = 0x2, - IN_BUTTON_UP_DOWN = 0x3, - IN_BUTTON_UP_DOWN_UP = 0x4, - IN_BUTTON_DOWN_UP_DOWN = 0x5, - IN_BUTTON_DOWN_UP_DOWN_UP = 0x6, - IN_BUTTON_UP_DOWN_UP_DOWN = 0x7, - IN_BUTTON_STATE_COUNT = 0x8, -}; - -enum ParticleAttachment_t : uint32_t -{ - PATTACH_INVALID = 0xffffffff, - PATTACH_ABSORIGIN = 0x0, // Spawn at entity origin - PATTACH_ABSORIGIN_FOLLOW = 0x1, // Spawn at and follow entity origin - PATTACH_CUSTOMORIGIN = 0x2, - PATTACH_CUSTOMORIGIN_FOLLOW = 0x3, - PATTACH_POINT = 0x4, // Spawn at attachment point - PATTACH_POINT_FOLLOW = 0x5, // Spawn at and follow attachment point - PATTACH_EYES_FOLLOW = 0x6, - PATTACH_OVERHEAD_FOLLOW = 0x7, - PATTACH_WORLDORIGIN = 0x8, - PATTACH_ROOTBONE_FOLLOW = 0x9, - PATTACH_RENDERORIGIN_FOLLOW = 0xa, - PATTACH_MAIN_VIEW = 0xb, - PATTACH_WATERWAKE = 0xc, - PATTACH_CENTER_FOLLOW = 0xd, - PATTACH_CUSTOM_GAME_STATE_1 = 0xe, - PATTACH_HEALTHBAR = 0xf, - MAX_PATTACH_TYPES = 0x10, -}; - -enum ObserverMode_t : uint8_t -{ - OBS_MODE_NONE = 0x0, - OBS_MODE_FIXED = 0x1, - OBS_MODE_IN_EYE = 0x2, - OBS_MODE_CHASE = 0x3, - OBS_MODE_ROAMING = 0x4, - OBS_MODE_DIRECTED = 0x5, - NUM_OBSERVER_MODES = 0x6, -}; - -typedef uint32 SoundEventGuid_t; -struct SndOpEventGuid_t -{ - SoundEventGuid_t m_nGuid; - uint64 m_hStackHash; -}; - -// used with EmitSound_t -enum gender_t : uint8 -{ - GENDER_NONE = 0x0, - GENDER_MALE = 0x1, - GENDER_FEMALE = 0x2, - GENDER_NAMVET = 0x3, - GENDER_TEENGIRL = 0x4, - GENDER_BIKER = 0x5, - GENDER_MANAGER = 0x6, - GENDER_GAMBLER = 0x7, - GENDER_PRODUCER = 0x8, - GENDER_COACH = 0x9, - GENDER_MECHANIC = 0xA, - GENDER_CEDA = 0xB, - GENDER_CRAWLER = 0xC, - GENDER_UNDISTRACTABLE = 0xD, - GENDER_FALLEN = 0xE, - GENDER_RIOT_CONTROL = 0xF, - GENDER_CLOWN = 0x10, - GENDER_JIMMY = 0x11, - GENDER_HOSPITAL_PATIENT = 0x12, - GENDER_BRIDE = 0x13, - GENDER_LAST = 0x14, -}; - -struct EmitSound_t -{ - EmitSound_t() : - m_nChannel(0), - m_pSoundName(0), - m_flVolume(VOL_NORM), - m_SoundLevel(SNDLVL_NONE), - m_nFlags(0), - m_nPitch(PITCH_NORM), - m_pOrigin(0), - m_flSoundTime(0.0f), - m_pflSoundDuration(0), - m_bEmitCloseCaption(true), - m_bWarnOnMissingCloseCaption(false), - m_bWarnOnDirectWaveReference(false), - m_nSpeakerEntity(-1), - m_UtlVecSoundOrigin(), - m_nForceGuid(0), - m_SpeakerGender(GENDER_NONE) - { - } - int m_nChannel; - const char *m_pSoundName; - float m_flVolume; - soundlevel_t m_SoundLevel; - int m_nFlags; - int m_nPitch; - const Vector *m_pOrigin; - float m_flSoundTime; - float *m_pflSoundDuration; - bool m_bEmitCloseCaption; - bool m_bWarnOnMissingCloseCaption; - bool m_bWarnOnDirectWaveReference; - CEntityIndex m_nSpeakerEntity; - CUtlVector > m_UtlVecSoundOrigin; - SoundEventGuid_t m_nForceGuid; - gender_t m_SpeakerGender; -}; - -struct GameTime_t -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(GameTime_t) - - SCHEMA_FIELD(float, m_Value) -}; - -class CNetworkTransmitComponent -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CNetworkTransmitComponent) -}; - -class CNetworkVelocityVector -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CNetworkVelocityVector) - - SCHEMA_FIELD(float, m_vecX) - SCHEMA_FIELD(float, m_vecY) - SCHEMA_FIELD(float, m_vecZ) -}; - -class CNetworkOriginCellCoordQuantizedVector -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CNetworkOriginCellCoordQuantizedVector) - - SCHEMA_FIELD(uint16, m_cellX) - SCHEMA_FIELD(uint16, m_cellY) - SCHEMA_FIELD(uint16, m_cellZ) - SCHEMA_FIELD(uint16, m_nOutsideWorld) - - // These are actually CNetworkedQuantizedFloat but we don't have the definition for it... - SCHEMA_FIELD(float, m_vecX) - SCHEMA_FIELD(float, m_vecY) - SCHEMA_FIELD(float, m_vecZ) -}; - -class CInButtonState -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CInButtonState) - - // m_pButtonStates[3] - - // m_pButtonStates[0] is the mask of currently pressed buttons - // m_pButtonStates[1] is the mask of buttons that changed in the current frame - SCHEMA_FIELD_POINTER(uint64, m_pButtonStates) -}; - -class CGlowProperty -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CGlowProperty) - - SCHEMA_FIELD(Vector, m_fGlowColor) - SCHEMA_FIELD(int, m_iGlowType) - SCHEMA_FIELD(int, m_iGlowTeam) - SCHEMA_FIELD(int, m_nGlowRange) - SCHEMA_FIELD(int, m_nGlowRangeMin) - SCHEMA_FIELD(Color, m_glowColorOverride) - SCHEMA_FIELD(bool, m_bFlashing) - SCHEMA_FIELD(bool, m_bGlowing) -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/lights.h b/src/cs2_sdk/entity/lights.h deleted file mode 100644 index 52bd5a6e..00000000 --- a/src/cs2_sdk/entity/lights.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#include "cbasemodelentity.h" -#include "globaltypes.h" - -class CLightComponent -{ -public: - DECLARE_SCHEMA_CLASS(CLightComponent) -}; - -class CLightEntity : public CBaseModelEntity -{ -public: - DECLARE_SCHEMA_CLASS(CLightEntity) - - SCHEMA_FIELD(CLightComponent*, m_CLightComponent) -}; - -class CBarnLight : public CBaseModelEntity -{ -public: - DECLARE_SCHEMA_CLASS(CBarnLight) - - SCHEMA_FIELD(bool, m_bEnabled) - SCHEMA_FIELD(int, m_nColorMode) // 0 = color, 1 = color temperature - SCHEMA_FIELD_POINTER(Color, m_Color) - SCHEMA_FIELD(float, m_flColorTemperature) // default 6500 - SCHEMA_FIELD(float, m_flBrightness) - SCHEMA_FIELD(float, m_flBrightnessScale) - SCHEMA_FIELD(int, m_nDirectLight) // Always set to 2 for dynamic - SCHEMA_FIELD(int, m_nCastShadows) // 0 = no, 1 = dynamic (and baked but pointless here) - SCHEMA_FIELD(int, m_nShadowMapSize) // Shadowmap size in pixels (512 is a good starting value) - SCHEMA_FIELD(int, m_nShadowPriority) - SCHEMA_FIELD(bool, m_bContactShadow) - SCHEMA_FIELD(float, m_flRange) - SCHEMA_FIELD(float, m_flSkirt) // Falloff over the range - SCHEMA_FIELD(float, m_flSkirtNear) // Falloff from the source - SCHEMA_FIELD(float, m_flSoftX) - SCHEMA_FIELD(float, m_flSoftY) - SCHEMA_FIELD_POINTER(Vector, m_vSizeParams) - - // Artificially softens direct specular (0.0 to 1.0) - SCHEMA_FIELD(float, m_flMinRoughness) -}; - -class COmniLight : public CBarnLight -{ -public: - DECLARE_SCHEMA_CLASS(COmniLight) - - SCHEMA_FIELD(float, m_flInnerAngle) - SCHEMA_FIELD(float, m_flOuterAngle) - SCHEMA_FIELD(bool, m_bShowLight) -}; \ No newline at end of file diff --git a/src/cs2_sdk/entity/services.h b/src/cs2_sdk/entity/services.h deleted file mode 100644 index c0af3ace..00000000 --- a/src/cs2_sdk/entity/services.h +++ /dev/null @@ -1,213 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once -#include -#include "globaltypes.h" -#include -#include - -class CBaseEntity; - -struct CSPerRoundStats_t -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CSPerRoundStats_t) - - SCHEMA_FIELD(int, m_iKills) - SCHEMA_FIELD(int, m_iDeaths) - SCHEMA_FIELD(int, m_iAssists) - SCHEMA_FIELD(int, m_iDamage) -}; - -struct CSMatchStats_t : public CSPerRoundStats_t -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(CSMatchStats_t) - - SCHEMA_FIELD(int32_t, m_iEntryWins); -}; - -class CCSPlayerController_ActionTrackingServices -{ -public: - DECLARE_SCHEMA_CLASS(CCSPlayerController_ActionTrackingServices) - - SCHEMA_FIELD(CSMatchStats_t, m_matchStats) -}; - -class CPlayerPawnComponent -{ -public: - DECLARE_SCHEMA_CLASS(CPlayerPawnComponent); - - SCHEMA_FIELD(CCSPlayerPawn*, __m_pChainEntity) - - CCSPlayerPawn *GetPawn() { return __m_pChainEntity; } -}; - -class CPlayer_MovementServices : public CPlayerPawnComponent -{ -public: - DECLARE_SCHEMA_CLASS(CPlayer_MovementServices); - - SCHEMA_FIELD(CInButtonState, m_nButtons) - SCHEMA_FIELD(uint64_t, m_nQueuedButtonDownMask) - SCHEMA_FIELD(uint64_t, m_nQueuedButtonChangeMask) - SCHEMA_FIELD(uint64_t, m_nButtonDoublePressed) - - // m_pButtonPressedCmdNumber[64] - SCHEMA_FIELD_POINTER(uint32_t, m_pButtonPressedCmdNumber) - SCHEMA_FIELD(uint32_t, m_nLastCommandNumberProcessed) - SCHEMA_FIELD(uint64_t, m_nToggleButtonDownMask) - SCHEMA_FIELD(float, m_flMaxspeed) -}; - -class CPlayer_MovementServices_Humanoid : public CPlayer_MovementServices -{ -public: - DECLARE_SCHEMA_CLASS(CPlayer_MovementServices_Humanoid); - - SCHEMA_FIELD(float, m_flFallVelocity) - SCHEMA_FIELD(float, m_bInCrouch) - SCHEMA_FIELD(uint32_t, m_nCrouchState) - SCHEMA_FIELD(bool, m_bInDuckJump) - SCHEMA_FIELD(float, m_flSurfaceFriction) -}; - -class CCSPlayer_MovementServices : public CPlayer_MovementServices_Humanoid -{ -public: - DECLARE_SCHEMA_CLASS(CCSPlayer_MovementServices); - - SCHEMA_FIELD(float, m_flMaxFallVelocity) - SCHEMA_FIELD(float, m_flJumpVel) - SCHEMA_FIELD(float, m_flStamina) - SCHEMA_FIELD(float, m_flDuckSpeed) - SCHEMA_FIELD(bool, m_bDuckOverride) -}; - -class CPlayer_WeaponServices : public CPlayerPawnComponent -{ -public: - DECLARE_SCHEMA_CLASS(CPlayer_WeaponServices); - - SCHEMA_FIELD_POINTER(CUtlVector>, m_hMyWeapons) - SCHEMA_FIELD(CHandle, m_hActiveWeapon) -}; - -class CCSPlayer_WeaponServices : public CPlayer_WeaponServices -{ -public: - DECLARE_SCHEMA_CLASS(CCSPlayer_WeaponServices); - - SCHEMA_FIELD(GameTime_t, m_flNextAttack) - SCHEMA_FIELD(bool, m_bIsLookingAtWeapon) - SCHEMA_FIELD(bool, m_bIsHoldingLookAtWeapon) - - SCHEMA_FIELD(CHandle, m_hSavedWeapon) - SCHEMA_FIELD(int32_t, m_nTimeToMelee) - SCHEMA_FIELD(int32_t, m_nTimeToSecondary) - SCHEMA_FIELD(int32_t, m_nTimeToPrimary) - SCHEMA_FIELD(int32_t, m_nTimeToSniperRifle) - SCHEMA_FIELD(bool, m_bIsBeingGivenItem) - SCHEMA_FIELD(bool, m_bIsPickingUpItemWithUse) - SCHEMA_FIELD(bool, m_bPickedUpWeapon) -}; - -class CCSPlayerController_InGameMoneyServices -{ -public: - DECLARE_SCHEMA_CLASS(CCSPlayerController_InGameMoneyServices); - - SCHEMA_FIELD(int, m_iAccount) -}; - -class CCSPlayer_ItemServices -{ -public: - DECLARE_SCHEMA_CLASS(CCSPlayer_ItemServices); - - virtual ~CCSPlayer_ItemServices() = 0; -private: - virtual void unk_01() = 0; - virtual void unk_02() = 0; - virtual void unk_03() = 0; - virtual void unk_04() = 0; - virtual void unk_05() = 0; - virtual void unk_06() = 0; - virtual void unk_07() = 0; - virtual void unk_08() = 0; - virtual void unk_09() = 0; - virtual void unk_10() = 0; - virtual void unk_11() = 0; - virtual void unk_12() = 0; - virtual void unk_13() = 0; - virtual void unk_14() = 0; - virtual CBaseEntity* _GiveNamedItem(const char* pchName) = 0; -public: - virtual bool GiveNamedItemBool(const char* pchName) = 0; - virtual CBaseEntity* GiveNamedItem(const char* pchName) = 0; - virtual void DropPlayerWeapon(CBasePlayerWeapon* weapon) = 0; - virtual void StripPlayerWeapons(bool removeSuit = false) = 0; -}; - -// We need an exactly sized class to be able to iterate the vector, our schema system implementation can't do this -class WeaponPurchaseCount_t -{ -private: - virtual void unk01() {}; - uint64_t unk1 = 0; // 0x8 - uint64_t unk2 = 0; // 0x10 - uint64_t unk3 = 0; // 0x18 - uint64_t unk4 = 0; // 0x20 - uint64_t unk5 = -1; // 0x28 -public: - uint16_t m_nItemDefIndex; // 0x30 - uint16_t m_nCount; // 0x32 -private: - uint32_t unk6 = 0; -}; - -struct WeaponPurchaseTracker_t -{ -public: - DECLARE_SCHEMA_CLASS_INLINE(WeaponPurchaseTracker_t) - - SCHEMA_FIELD_POINTER(CUtlVector, m_weaponPurchases) -}; - -class CCSPlayer_ActionTrackingServices -{ -public: - DECLARE_SCHEMA_CLASS(CCSPlayer_ActionTrackingServices) - - SCHEMA_FIELD(WeaponPurchaseTracker_t, m_weaponPurchasesThisRound) -}; - -class CPlayer_ObserverServices -{ -public: - DECLARE_SCHEMA_CLASS(CPlayer_ObserverServices) - - SCHEMA_FIELD(ObserverMode_t, m_iObserverMode) - SCHEMA_FIELD(CHandle, m_hObserverTarget) - SCHEMA_FIELD(ObserverMode_t, m_iObserverLastMode) - SCHEMA_FIELD(bool, m_bForcedObserverMode) -}; \ No newline at end of file diff --git a/src/cs2_sdk/schema.cpp b/src/cs2_sdk/schema.cpp deleted file mode 100644 index c5e4c763..00000000 --- a/src/cs2_sdk/schema.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#include "schema.h" - -#include "../common.h" -#include "schemasystem/schemasystem.h" -#include "tier1/utlmap.h" -#include "tier0/memdbgon.h" -#include "plat.h" -#include "entity/cbaseentity.h" - -extern CGlobalVars *gpGlobals; - -using SchemaKeyValueMap_t = CUtlMap; -using SchemaTableMap_t = CUtlMap; - - -static bool IsFieldNetworked(SchemaClassFieldData_t& field) -{ - for (int i = 0; i < field.m_nStaticMetadataCount; i++) - { - static auto networkEnabled = hash_32_fnv1a_const("MNetworkEnable"); - if (networkEnabled == hash_32_fnv1a_const(field.m_pStaticMetadata[i].m_pszName)) - return true; - } - - return false; -} - -static bool InitSchemaFieldsForClass(SchemaTableMap_t *tableMap, const char* className, uint32_t classKey) -{ - CSchemaSystemTypeScope* pType = g_pSchemaSystem->FindTypeScopeForModule(MODULE_PREFIX "server" MODULE_EXT); - - if (!pType) - return false; - - SchemaClassInfoData_t *pClassInfo = pType->FindDeclaredClass(className).Get(); - - if (!pClassInfo) - { - SchemaKeyValueMap_t *map = new SchemaKeyValueMap_t(0, 0, DefLessFunc(uint32_t)); - tableMap->Insert(classKey, map); - - Warning("InitSchemaFieldsForClass(): '%s' was not found!\n", className); - return false; - } - - short fieldsSize = pClassInfo->m_nFieldCount; - SchemaClassFieldData_t* pFields = pClassInfo->m_pFields; - - SchemaKeyValueMap_t *keyValueMap = new SchemaKeyValueMap_t(0, 0, DefLessFunc(uint32_t)); - keyValueMap->EnsureCapacity(fieldsSize); - tableMap->Insert(classKey, keyValueMap); - - for (int i = 0; i < fieldsSize; ++i) - { - SchemaClassFieldData_t& field = pFields[i]; - -#ifdef _DEBUG - Message("%s::%s found at -> 0x%X - %llx\n", className, field.m_pszName, field.m_nSingleInheritanceOffset, &field); -#endif - - keyValueMap->Insert(hash_32_fnv1a_const(field.m_pszName), {field.m_nSingleInheritanceOffset, IsFieldNetworked(field)}); - } - - return true; -} - -int16_t schema::FindChainOffset(const char* className) -{ - CSchemaSystemTypeScope* pType = g_pSchemaSystem->FindTypeScopeForModule(MODULE_PREFIX "server" MODULE_EXT); - - if (!pType) - return false; - - SchemaClassInfoData_t* pClassInfo = pType->FindDeclaredClass(className).Get(); - - do - { - SchemaClassFieldData_t* pFields = pClassInfo->m_pFields; - short fieldsSize = pClassInfo->m_nFieldCount; - for (int i = 0; i < fieldsSize; ++i) - { - SchemaClassFieldData_t& field = pFields[i]; - - if (V_strcmp(field.m_pszName, "__m_pChainEntity") == 0) - { - return field.m_nSingleInheritanceOffset; - } - } - } while ((pClassInfo = pClassInfo->m_pBaseClasses ? pClassInfo->m_pBaseClasses->m_pClass : nullptr) != nullptr); - - return 0; -} - -SchemaKey schema::GetOffset(const char* className, uint32_t classKey, const char* memberName, uint32_t memberKey) -{ - static SchemaTableMap_t schemaTableMap(0, 0, DefLessFunc(uint32_t)); - int16_t tableMapIndex = schemaTableMap.Find(classKey); - if (!schemaTableMap.IsValidIndex(tableMapIndex)) - { - if (InitSchemaFieldsForClass(&schemaTableMap, className, classKey)) - return GetOffset(className, classKey, memberName, memberKey); - - return { 0, 0 }; - } - - SchemaKeyValueMap_t *tableMap = schemaTableMap[tableMapIndex]; - int16_t memberIndex = tableMap->Find(memberKey); - if (!tableMap->IsValidIndex(memberIndex)) - { - Warning("schema::GetOffset(): '%s' was not found in '%s'!\n", memberName, className); - return { 0, 0 }; - } - - return tableMap->Element(memberIndex); -} - -void SetStateChanged(Z_CBaseEntity* pEntity, int offset) -{ - addresses::StateChanged(pEntity->m_NetworkTransmitComponent(), pEntity, offset, -1, -1); - - pEntity->m_lastNetworkChange = gpGlobals->curtime; - pEntity->m_isSteadyState().ClearAll(); -}; diff --git a/src/cs2_sdk/schema.h b/src/cs2_sdk/schema.h deleted file mode 100644 index 9efb57a6..00000000 --- a/src/cs2_sdk/schema.h +++ /dev/null @@ -1,165 +0,0 @@ -/** - * ============================================================================= - * CS2Fixes - * Copyright (C) 2023-2024 Source2ZE - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#pragma once - -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable : 4005) -#endif - -#include - -#ifdef _WIN32 -#pragma warning(pop) -#endif - -#include "../addresses.h" -#include "tier0/dbg.h" -#include "const.h" -#include "virtual.h" -#include "stdint.h" -#undef schema - -struct SchemaKey -{ - int32 offset; - bool networked; -}; - -class Z_CBaseEntity; -void SetStateChanged(Z_CBaseEntity* pEntity, int offset); - -constexpr uint32_t val_32_const = 0x811c9dc5; -constexpr uint32_t prime_32_const = 0x1000193; -constexpr uint64_t val_64_const = 0xcbf29ce484222325; -constexpr uint64_t prime_64_const = 0x100000001b3; - -inline constexpr uint32_t hash_32_fnv1a_const(const char *const str, const uint32_t value = val_32_const) noexcept -{ - return (str[0] == '\0') ? value : hash_32_fnv1a_const(&str[1], (value ^ uint32_t(str[0])) * prime_32_const); -} - -inline constexpr uint64_t hash_64_fnv1a_const(const char *const str, const uint64_t value = val_64_const) noexcept -{ - return (str[0] == '\0') ? value : hash_64_fnv1a_const(&str[1], (value ^ uint64_t(str[0])) * prime_64_const); -} - -#define SCHEMA_FIELD_OFFSET(type, varName, extra_offset) \ - class varName##_prop \ - { \ - public: \ - std::add_lvalue_reference_t Get() \ - { \ - static constexpr auto datatable_hash = hash_32_fnv1a_const(ThisClassName); \ - static constexpr auto prop_hash = hash_32_fnv1a_const(#varName); \ - \ - static const auto m_key = \ - schema::GetOffset(ThisClassName, datatable_hash, #varName, prop_hash); \ - \ - static const size_t offset = offsetof(ThisClass, varName); \ - ThisClass *pThisClass = (ThisClass *)((byte *)this - offset); \ - \ - return *reinterpret_cast>( \ - (uintptr_t)(pThisClass) + m_key.offset + extra_offset); \ - } \ - void Set(type val) \ - { \ - static constexpr auto datatable_hash = hash_32_fnv1a_const(ThisClassName); \ - static constexpr auto prop_hash = hash_32_fnv1a_const(#varName); \ - \ - static const auto m_key = \ - schema::GetOffset(ThisClassName, datatable_hash, #varName, prop_hash); \ - \ - static const auto m_chain = \ - schema::FindChainOffset(ThisClassName); \ - \ - static const size_t offset = offsetof(ThisClass, varName); \ - ThisClass *pThisClass = (ThisClass *)((byte *)this - offset); \ - \ - if (m_chain != 0 && m_key.networked) \ - { \ - DevMsg("Found chain offset %d for %s::%s\n", m_chain, ThisClassName, #varName); \ - addresses::NetworkStateChanged((uintptr_t)(pThisClass) + m_chain, m_key.offset + extra_offset, 0xFFFFFFFF); \ - } \ - else if(m_key.networked) \ - { \ - /* WIP: Works fine for most props, but inlined classes in the middle of a class will - need to have their this pointer corrected by the offset .*/ \ - if (!IsStruct) \ - SetStateChanged((Z_CBaseEntity*)pThisClass, m_key.offset + extra_offset); \ - else if (IsPlatformPosix()) /* This is currently broken on windows */ \ - CALL_VIRTUAL(void, 1, pThisClass, m_key.offset + extra_offset, 0xFFFFFFFF, 0xFFFF); \ - } \ - *reinterpret_cast>((uintptr_t)(pThisClass) + m_key.offset + extra_offset) = val; \ - } \ - operator std::add_lvalue_reference_t() { return Get(); } \ - std::add_lvalue_reference_t operator ()() { return Get(); } \ - std::add_lvalue_reference_t operator->() { return Get(); } \ - void operator()(type val) { Set(val); } \ - void operator=(type val) { Set(val); } \ - } varName; - -#define SCHEMA_FIELD_POINTER_OFFSET(type, varName, extra_offset) \ - class varName##_prop \ - { \ - public: \ - type *Get() \ - { \ - static constexpr auto datatable_hash = hash_32_fnv1a_const(ThisClassName); \ - static constexpr auto prop_hash = hash_32_fnv1a_const(#varName); \ - \ - static const auto m_key = \ - schema::GetOffset(ThisClassName, datatable_hash, #varName, prop_hash); \ - \ - static const size_t offset = offsetof(ThisClass, varName); \ - ThisClass *pThisClass = (ThisClass *)((byte *)this - offset); \ - \ - return reinterpret_cast>( \ - (uintptr_t)(pThisClass) + m_key.offset + extra_offset); \ - } \ - operator type*() { return Get(); } \ - type* operator ()() { return Get(); } \ - type* operator->() { return Get(); } \ - } varName; - -// Use this when you want the member's value itself -#define SCHEMA_FIELD(type, varName) \ - SCHEMA_FIELD_OFFSET(type, varName, 0) - -// Use this when you want a pointer to a member -#define SCHEMA_FIELD_POINTER(type, varName) \ - SCHEMA_FIELD_POINTER_OFFSET(type, varName, 0) - -namespace schema -{ - int16_t FindChainOffset(const char *className); - SchemaKey GetOffset(const char *className, uint32_t classKey, const char *memberName, uint32_t memberKey); -} - -#define DECLARE_SCHEMA_CLASS_BASE(className, isStruct) \ - typedef className ThisClass; \ - static constexpr const char *ThisClassName = #className; \ - static constexpr bool IsStruct = isStruct; - -#define DECLARE_SCHEMA_CLASS(className) DECLARE_SCHEMA_CLASS_BASE(className, false) - -// Use this for classes that can be wholly included within other classes (like CCollisionProperty within CBaseModelEntity) -#define DECLARE_SCHEMA_CLASS_INLINE(className) \ - DECLARE_SCHEMA_CLASS_BASE(className, true) \ No newline at end of file diff --git a/src/cs2fixes.cpp b/src/cs2uc.cpp similarity index 71% rename from src/cs2fixes.cpp rename to src/cs2uc.cpp index 99532667..db1f63e8 100644 --- a/src/cs2fixes.cpp +++ b/src/cs2uc.cpp @@ -17,11 +17,8 @@ * this program. If not, see . */ -#include "cs2fixes.h" -#include "iserver.h" +#include "cs2uc.h" -#include "tier0/dbg.h" -#include "tier0/vprof.h" #include "common.h" #include "icvar.h" @@ -58,8 +55,6 @@ void Panic(const char *msg, ...) va_end(args); } -SH_DECL_HOOK3_void(ICvar, DispatchConCommand, SH_NOATTRIB, 0, ConCommandHandle, const CCommandContext&, const CCommand&); - CS2Fixes g_CS2Fixes; PLUGIN_EXPOSE(CS2Fixes, g_CS2Fixes); @@ -67,36 +62,18 @@ bool CS2Fixes::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool { PLUGIN_SAVEVARS(); - // Required to get the IMetamodListener events g_SMAPI->AddListener(this, this); - Message( "Starting plugin.\n" ); - - SH_ADD_HOOK(ICvar, DispatchConCommand, g_pCVar, SH_MEMBER(this, &CS2Fixes::Hook_DispatchConCommand), false); - UnlockConVars(); UnlockConCommands(); - ConVar_Register(FCVAR_RELEASE | FCVAR_CLIENT_CAN_EXECUTE | FCVAR_GAMEDLL); - - Message("Plugin successfully started!\n"); return true; } bool CS2Fixes::Unload(char *error, size_t maxlen) { - SH_REMOVE_HOOK(ICvar, DispatchConCommand, g_pCVar, SH_MEMBER(this, &CS2Fixes::Hook_DispatchConCommand), false); - - ConVar_Unregister(); - return true; } -void CS2Fixes::Hook_DispatchConCommand(ConCommandHandle cmdHandle, const CCommandContext& ctx, const CCommand& args) -{ - VPROF_BUDGET("CS2Fixes::Hook_DispatchConCommand", "ConCommands"); - - SH_CALL(g_pCVar, &ICvar::DispatchConCommand)(cmdHandle, ctx, args); -} bool CS2Fixes::Pause(char *error, size_t maxlen) { @@ -145,5 +122,5 @@ const char *CS2Fixes::GetName() const char *CS2Fixes::GetURL() { - return "https://github.com/Source2ZE/CS2Fixes"; + return "https://github.com/jvnipers/CS2UnlockCvars"; } diff --git a/src/cs2fixes.h b/src/cs2uc.h similarity index 91% rename from src/cs2fixes.h rename to src/cs2uc.h index 63ffa6f1..8148ff17 100644 --- a/src/cs2fixes.h +++ b/src/cs2uc.h @@ -20,7 +20,6 @@ #pragma once #include -#include "igameevents.h" #include class CS2Fixes : public ISmmPlugin, public IMetamodListener @@ -31,10 +30,6 @@ class CS2Fixes : public ISmmPlugin, public IMetamodListener bool Pause(char *error, size_t maxlen); bool Unpause(char *error, size_t maxlen); -public: - void Hook_DispatchConCommand(ConCommandHandle cmd, const CCommandContext& ctx, const CCommand& args); - - public: const char *GetAuthor(); const char *GetName(); diff --git a/src/cvars.cpp b/src/cvars.cpp index bae18327..9de218ac 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -46,7 +46,7 @@ void UnlockConVars() if (!pCvar) continue; - + /* for (int i = 0; i < sizeof(pUnCheatCvars) / sizeof(*pUnCheatCvars); i++) { @@ -92,3 +92,89 @@ void UnlockConCommands() Message("Removed hidden flags from %d commands\n", iUnhiddenConCommands); } + +CON_COMMAND_F(c_dump_cvars, "dump all cvars", FCVAR_SPONLY | FCVAR_LINKED_CONCOMMAND) +{ + ConVar *pCvar = nullptr; + ConVarHandle hCvarHandle; + hCvarHandle.Set(0); + + do + { + pCvar = g_pCVar->GetConVar(hCvarHandle); + + hCvarHandle.Set(hCvarHandle.Get() + 1); + + if (pCvar) + { + switch (pCvar->m_eVarType) + { + case EConVarType_Bool: + Message("%s : bool : %s\n", pCvar->m_pszName, (bool)pCvar->values ? "true" : "false"); + break; + case EConVarType_Int16: + Message("%s : int16 : %i\n", pCvar->m_pszName, *(int16*)&pCvar->values); + break; + case EConVarType_Int32: + Message("%s : int32 : %i\n", pCvar->m_pszName, *(int32*)&pCvar->values); + break; + case EConVarType_Int64: + Message("%s : int64 : %lli\n", pCvar->m_pszName, (int64)pCvar->values); + break; + case EConVarType_UInt16: + Message("%s : uint16 : %i\n", pCvar->m_pszName, *(uint16*)&pCvar->values); + break; + case EConVarType_UInt32: + Message("%s : uint32 : %i\n", pCvar->m_pszName, *(uint32*)&pCvar->values); + break; + case EConVarType_UInt64: + Message("%s : uint64 : %lli\n", pCvar->m_pszName, (uint64)pCvar->values); + break; + case EConVarType_Float32: + Message("%s : float32 : %.2f\n", pCvar->m_pszName, *(float32 *)&pCvar->values); + break; + case EConVarType_Float64: + Message("%s : float64 : %.2f\n", pCvar->m_pszName, *(float64 *)&pCvar->values); + break; + case EConVarType_String: + Message("%s : string : %s\n", pCvar->m_pszName, (char *)pCvar->values); + break; + + case EConVarType_Color: + int color[4]; + V_memcpy(&color, &pCvar->values, sizeof(color)); + Message("%s : color : %.2f %.2f %.2f %.2f\n", pCvar->m_pszName, color[0], color[1], color[2], color[3]); + break; + + case EConVarType_Vector2: + float vec2[2]; + V_memcpy(&vec2, &pCvar->values, sizeof(vec2)); + Message("%s : vector2 : %.2f %.2f\n", pCvar->m_pszName, vec2[0], vec2[1]); + break; + + case EConVarType_Vector3: + float vec3[3]; + V_memcpy(&vec3, &pCvar->values, sizeof(vec3)); + Message("%s : vector3 : %.2f %.2f %.2f\n", pCvar->m_pszName, vec3[0], vec3[1], vec3[2]); + break; + + case EConVarType_Vector4: + float vec4[4]; + V_memcpy(&vec4, &pCvar->values, sizeof(vec4)); + Message("%s : vector4 : %.2f %.2f %.2f %.2f\n", pCvar->m_pszName, vec4[0], vec4[1], vec4[2], vec4[3]); + break; + + case EConVarType_Qangle: + float angle[3]; + V_memcpy(&vec3, &pCvar->values, sizeof(angle)); + Message("%s : qangle : %.2f %.2f %.2f\n", pCvar->m_pszName, angle[0], angle[1], angle[2]); + break; + + default: + Message("%s : unknown type : %p\n", pCvar->m_pszName, (void*)pCvar->values); + break; + }; + } + + } while (pCvar); +} \ No newline at end of file