Compare commits

...

6 Commits

Author SHA1 Message Date
Michael Wilson
b79fd19c85 chore: update schema (#531) 2024-07-26 18:11:57 +10:00
dependabot[bot]
b7ea025b03 chore(deps): bump libraries/hl2sdk-cs2 from 4b31db7 to a5d9f80 (#522)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-26 18:08:21 +10:00
Michael Wilson
5ac173df51 [no ci] chore: add actionlint (#530) 2024-07-26 16:11:46 +10:00
Michael Wilson
c82a58f5ab feat: update game events (adds bullet_damage event) 2024-07-26 14:47:18 +10:00
Yarukon
1806919559 Fix function hooking on windows (#529) 2024-07-24 16:26:41 +10:00
Levin V
f8451c2818 Update gamedata.json (#521) 2024-07-03 23:37:08 +10:00
16 changed files with 4842 additions and 2539 deletions

21
.github/workflows/actionlint.yaml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: actionlint
on:
workflow_dispatch:
pull_request:
branches: ["main"]
paths:
- ".github/actions/**"
- ".github/workflows/**"
jobs:
actionlint:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v4
- name: actionlint
uses: reviewdog/action-actionlint@v1
with:
reporter: github-pr-review
fail_on_error: true

View File

@@ -36,7 +36,7 @@
"signatures": {
"library": "server",
"windows": "44 88 4C 24 ? 55 56 57 41 54 41 56 48 8D 6C 24 ?",
"linux": "55 48 89 E5 41 57 41 56 41 55 49 89 FD 41 54 45 89 C4"
"linux": "55 48 89 E5 41 57 41 56 41 89 D6 41 55 49 89 FD 41 54 45 89 C4"
}
},
"CCSPlayerPawnBase_PostThink": {

File diff suppressed because it is too large Load Diff

View File

@@ -1,320 +0,0 @@
ActionType_t
AimMatrixBlendMode
AmmoFlags_t
AmmoPosition_t
AnimationProcessingType_t
AnimationSnapshotType_t
AnimationType_t
AnimLoopMode_t
AnimNodeNetworkMode
AnimParamButton_t
AnimParamNetworkSetting
AnimParamType_t
AnimPoseControl
AnimScriptType
AnimValueSource
AnimVectorSource
attributeprovidertypes_t
BaseExplosionTypes_t
BBoxVolumeType_t
BeamClipStyle_t
BeamType_t
BeginDeathLifeStateTransition_t
BinaryNodeChildOption
BinaryNodeTiming
Blend2DMode
BlendKeyType
BloomBlendMode_t
BlurFilterType_t
BoneMaskBlendSpace
BoneTransformSpace_t
BrushSolidities_e
C4LightEffect_t
CAnimationGraphVisualizerPrimitiveType
CanPlaySequence_t
ChatIgnoreType_t
ChickenActivity
ChoiceBlendMethod
ChoiceChangeMethod
ChoiceMethod
Class_T
CLogicBranchList__LogicBranchListenerLastState_t
ClosestPointTestType_t
CNmBoneMask__WeightInfo_t
CommandEntitySpecType_t
CommandExecMode_t
CompMatPropertyMutatorConditionType_t
CompMatPropertyMutatorType_t
CompositeMaterialInputContainerSourceType_t
CompositeMaterialInputLooseVariableType_t
CompositeMaterialInputTextureType_t
CompositeMaterialMatchFilterType_t
CompositeMaterialVarSystemVar_t
CRR_Response__ResponseEnum_t
CSPlayerBlockingUseAction_t
CSPlayerState
CSWeaponCategory
CSWeaponMode
CSWeaponSilencerType
CSWeaponState_t
CSWeaponType
DamageTypes_t
DampingSpeedFunction
DebugOverlayBits_t
Detail2Combo_t
DetailCombo_t
DisableShadows_t
Disposition_t
doorCheck_e
DoorState_t
EDemoBoneSelectionMode
EInButtonState
EKillTypes_t
ELayoutNodeType
EntFinderMethod_t
EntityDisolveType_t
EntityDormancyType_t
EntityIOTargetType_t
EntitySubclassScope_t
EOverrideBlockLOS_t
EStyleNodeType
Explosions
FacingMode
FieldNetworkOption
fieldtype_t
filter_t
FixAngleSet_t
FlexOpCode_t
FootFallTagFoot_t
FootLockSubVisualization
FootPinningTimingSource
FootstepLandedFootSoundType_t
ForcedCrouchState_t
FuncDoorSpawnPos_t
FuseVariableAccess_t
FuseVariableType_t
GameAnimEventIndex_t
gear_slot_t
GrenadeType_t
HierarchyType_t
HitboxLerpType_t
HitGroup_t
HorizJustification_e
Hull_t
IChoreoServices__ChoreoState_t
IChoreoServices__ScriptState_t
IKChannelMode
IkEndEffectorType
IKSolverType
IKTargetCoordinateSystem
IKTargetSource
IkTargetType
InheritableBoolType_t
InputBitMask_t
InputLayoutVariation_t
ItemFlagTypes_t
JiggleBoneSimSpace
JointAxis_t
JointMotion_t
JumpCorrectionMethod
LatchDirtyPermission_t
LayoutPositionType_e
LessonPanelLayoutFileTypes_t
LifeState_t
loadout_slot_t
MaterialProxyType_t
Materials
MatterialAttributeTagType_t
MedalRank_t
MeshDrawPrimitiveFlags_t
MissingParentInheritBehavior_t
ModelBoneFlexComponent_t
ModelConfigAttachmentType_t
ModelSkeletonData_t__BoneFlags_t
ModifyDamageReturn_t
MoodType_t
MorphBundleType_t
MorphFlexControllerRemapType_t
MoveCollide_t
MoveLinearAuthoredPos_t
MovementGait_t
MoveMountingAmount_t
MoveType_t
NavAttributeEnum
NavDirType
navproperties_t
NmFootPhase_t
NmFootPhaseCondition_t
NmFrameSnapEventMode_t
NmTransitionRule_t
NmTransitionRuleCondition_t
NPCFollowFormation_t
NPCLookType_t
ObjectTypeFlags_t
ObserverInterpState_t
ObserverMode_t
OnFrame
ParticleAlphaReferenceType_t
ParticleAttachment_t
ParticleAttrBoxFlags_t
ParticleCollisionMode_t
ParticleColorBlendMode_t
ParticleColorBlendType_t
ParticleControlPointAxis_t
ParticleDepthFeatheringMode_t
ParticleDetailLevel_t
ParticleDirectionNoiseType_t
ParticleEndcapMode_t
ParticleFalloffFunction_t
ParticleFloatBiasType_t
ParticleFloatInputMode_t
ParticleFloatMapType_t
ParticleFloatRandomMode_t
ParticleFloatType_t
ParticleFogType_t
ParticleHitboxBiasType_t
ParticleHitboxDataSelection_t
ParticleImpulseType_t
ParticleLightBehaviorChoiceList_t
ParticleLightFogLightingMode_t
ParticleLightingQuality_t
ParticleLightnintBranchBehavior_t
ParticleLightTypeChoiceList_t
ParticleLightUnitChoiceList_t
ParticleModelType_t
ParticleOmni2LightTypeChoiceList_t
ParticleOrientationChoiceList_t
ParticleOrientationSetMode_t
ParticleOutputBlendMode_t
ParticleParentSetMode_t
ParticlePinDistance_t
ParticlePostProcessPriorityGroup_t
ParticleRotationLockType_t
ParticleSelection_t
ParticleSequenceCropOverride_t
ParticleSetMethod_t
ParticleSortingChoiceList_t
ParticleTextureLayerBlendType_t
ParticleTopology_t
ParticleTraceMissBehavior_t
ParticleTraceSet_t
ParticleTransformType_t
ParticleVecType_t
ParticleVRHandChoiceList_t
PerformanceMode_t
PermModelInfo_t__FlagEnum
PetGroundType_t
PFNoiseModifier_t
PFNoiseTurbulence_t
PFNoiseType_t
PFuncVisualizationType_t
PlayerAnimEvent_t
PlayerConnectedState
PointTemplateClientOnlyEntityBehavior_t
PointTemplateOwnerSpawnGroupType_t
PointWorldTextJustifyHorizontal_t
PointWorldTextJustifyVertical_t
PointWorldTextReorientMode_t
PoseType_t
PreviewCharacterMode
PreviewEOMCelebration
PreviewWeaponState
PropDoorRotatingOpenDirection_e
PropDoorRotatingSpawnPos_t
PulseCursorCancelPriority_t
PulseCursorExecResult_t
PulseInstructionCode_t
PulseMethodCallMode_t
PulseTestEnumColor_t
PulseTestEnumShape_t
PulseValueType_t
QuestProgress__Reason
RagdollPoseControl
RenderBufferFlags_t
RenderFx_t
RenderMode_t
RenderMultisampleType_t
RenderPrimitiveType_t
RenderSlotType_t
ResetCycleOption
RumbleEffect_t
ScalarExpressionType_t
SceneOnPlayerDeath_t
ScriptedConflictResponse_t
ScriptedMoveTo_t
ScriptedMoveType_t
ScriptedOnDeath_t
SelectorTagBehavior_t
SeqCmd_t
SeqPoseSetting_t
SequenceFinishNotifyState_t
ShadowType_t
ShakeCommand_t
ShardSolid_t
ShatterDamageCause
ShatterGlassStressType
ShatterPanelMode
SimpleConstraintSoundProfile__SimpleConstraintsSoundProfileKeypoints_t
SnapshotIndexType_t
SolidType_t
SolveIKChainAnimNodeDebugSetting
SosActionSortType_t
SosActionStopType_t
SosEditItemType_t
SosGroupType_t
SoundEventStartType_t
SoundFlags_t
soundlevel_t
SpawnDebugOverrideState_t
SpawnDebugRestrictionOverrideState_t
SpawnPointCoopEnemy__BotDefaultBehavior_t
SpriteCardPerParticleScale_t
SpriteCardShaderType_t
SpriteCardTextureChannel_t
SpriteCardTextureType_t
StanceOverrideMode
StanceType_t
StandardLightingAttenuationStyle_t
StateActionBehavior
StepPhase
SubclassVDataChangeType_t
SurroundingBoundsType_t
TakeDamageFlags_t
TextureRepetitionMode_t
ThreeState_t
TimelineCompression_t
TOGGLE_STATE
Touch_t
TrackOrientationType_t
TRAIN_CODE
TrainOrientationType_t
TrainVelocityType_t
ValueRemapperHapticsType_t
ValueRemapperInputType_t
ValueRemapperMomentumType_t
ValueRemapperOutputType_t
ValueRemapperRatchetType_t
VectorExpressionType_t
VectorFloatExpressionType_t
VelocityMetricMode
VertJustification_e
ViewFadeMode_t
VMixChannelOperation_t
VMixFilterSlope_t
VMixFilterType_t
VMixLFOShape_t
VMixPannerType_t
VMixProcessorType_t
VMixSubgraphSwitchInterpolationType_t
vote_create_failed_t
VPhysXAggregateData_t__VPhysXFlagEnum_t
VPhysXBodyPart_t__VPhysXFlagEnum_t
VPhysXConstraintParams_t__EnumFlags0_t
VPhysXJoint_t__Flags_t
WaterLevel_t
WeaponAttackType_t
WeaponSound_t
WeaponSwitchReason_t
WorldTextPanelHorizontalAlign_t
WorldTextPanelOrientation_t
WorldTextPanelVerticalAlign_t

View File

@@ -716,6 +716,86 @@ namespace CounterStrikeSharp.API.Core
}
}
[EventName("bullet_damage")]
public class EventBulletDamage : GameEvent
{
public EventBulletDamage(IntPtr pointer) : base(pointer){}
public EventBulletDamage(bool force) : base("bullet_damage", force){}
// player index who was hurt
public CCSPlayerController? Victim
{
get => GetPlayer("victim");
set => SetPlayer("victim", value);
}
// player index who attacked
public CCSPlayerController? Attacker
{
get => GetPlayer("attacker");
set => SetPlayer("attacker", value);
}
// how far the bullet travelled before it hit the player
public float Distance
{
get => Get<float>("distance");
set => Set<float>("distance", value);
}
// direction vector of the bullet
public float DamageDirX
{
get => Get<float>("damage_dir_x");
set => Set<float>("damage_dir_x", value);
}
// direction vector of the bullet
public float DamageDirY
{
get => Get<float>("damage_dir_y");
set => Set<float>("damage_dir_y", value);
}
// direction vector of the bullet
public float DamageDirZ
{
get => Get<float>("damage_dir_z");
set => Set<float>("damage_dir_z", value);
}
// how many surfaces were penetrated
public int NumPenetrations
{
get => Get<int>("num_penetrations");
set => Set<int>("num_penetrations", value);
}
// was the shooter noscoped?
public bool NoScope
{
get => Get<bool>("no_scope");
set => Set<bool>("no_scope", value);
}
// was the shooter jumping?
public bool InAir
{
get => Get<bool>("in_air");
set => Set<bool>("in_air", value);
}
}
[EventName("bullet_flight_resolution")]
public class EventBulletFlightResolution : GameEvent
{

View File

@@ -94,14 +94,6 @@ public partial class CBasePlayerController : CBaseEntity
[SchemaMember("CBasePlayerController", "m_bGamePaused")]
public ref bool GamePaused => ref Schema.GetRef<bool>(this.Handle, "CBasePlayerController", "m_bGamePaused");
// m_nLastRealCommandNumberExecuted
[SchemaMember("CBasePlayerController", "m_nLastRealCommandNumberExecuted")]
public ref Int32 LastRealCommandNumberExecuted => ref Schema.GetRef<Int32>(this.Handle, "CBasePlayerController", "m_nLastRealCommandNumberExecuted");
// m_nLastLateCommandExecuted
[SchemaMember("CBasePlayerController", "m_nLastLateCommandExecuted")]
public ref Int32 LastLateCommandExecuted => ref Schema.GetRef<Int32>(this.Handle, "CBasePlayerController", "m_nLastLateCommandExecuted");
// m_iIgnoreGlobalChat
[SchemaMember("CBasePlayerController", "m_iIgnoreGlobalChat")]
public ref ChatIgnoreType_t IgnoreGlobalChat => ref Schema.GetRef<ChatIgnoreType_t>(this.Handle, "CBasePlayerController", "m_iIgnoreGlobalChat");

View File

@@ -370,10 +370,6 @@ public partial class CCSPlayerPawn : CCSPlayerPawnBase
[SchemaMember("CCSPlayerPawn", "m_ignoreLadderJumpTime")]
public ref float IgnoreLadderJumpTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_ignoreLadderJumpTime");
// m_NumEnemiesKilledThisRound
[SchemaMember("CCSPlayerPawn", "m_NumEnemiesKilledThisRound")]
public ref Int32 NumEnemiesKilledThisRound => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_NumEnemiesKilledThisRound");
// m_bKilledByHeadshot
[SchemaMember("CCSPlayerPawn", "m_bKilledByHeadshot")]
public ref bool KilledByHeadshot => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bKilledByHeadshot");

View File

@@ -94,10 +94,6 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_angEyeAngles")]
public QAngle EyeAngles => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_angEyeAngles");
// m_NumEnemiesAtRoundStart
[SchemaMember("CCSPlayerPawnBase", "m_NumEnemiesAtRoundStart")]
public ref Int32 NumEnemiesAtRoundStart => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_NumEnemiesAtRoundStart");
// m_wasNotKilledNaturally
[SchemaMember("CCSPlayerPawnBase", "m_wasNotKilledNaturally")]
public ref bool WasNotKilledNaturally => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_wasNotKilledNaturally");

View File

@@ -1,21 +0,0 @@
// <auto-generated />
#nullable enable
#pragma warning disable CS1591
using System;
using System.Diagnostics;
using System.Drawing;
using CounterStrikeSharp;
using CounterStrikeSharp.API.Modules.Events;
using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Utils;
using CounterStrikeSharp.API.Core.Attributes;
namespace CounterStrikeSharp.API.Core;
public partial class CCSWeaponBaseVDataAPI : NativeObject
{
public CCSWeaponBaseVDataAPI (IntPtr pointer) : base(pointer) {}
}

View File

@@ -50,4 +50,8 @@ public partial class CSmokeGrenadeProjectile : CBaseCSGrenadeProjectile
[SchemaMember("CSmokeGrenadeProjectile", "m_fllastSimulationTime")]
public ref float FllastSimulationTime => ref Schema.GetRef<float>(this.Handle, "CSmokeGrenadeProjectile", "m_fllastSimulationTime");
// m_bExplodeFromInferno
[SchemaMember("CSmokeGrenadeProjectile", "m_bExplodeFromInferno")]
public ref bool ExplodeFromInferno => ref Schema.GetRef<bool>(this.Handle, "CSmokeGrenadeProjectile", "m_bExplodeFromInferno");
}

View File

@@ -12,15 +12,9 @@ public enum BloodType : uint
ColorRed = 0x0,
ColorYellow = 0x1,
ColorGreen = 0x2,
ColorBrightGreen = 0x3,
EntityMech = 0x4,
EntityAntlion = 0x5,
EntityZombie = 0x6,
EntityBlob = 0x7,
EntityBlobFrozen = 0x8,
ColorRedLVL2 = 0x9,
ColorRedLVL3 = 0xA,
ColorRedLVL4 = 0xB,
ColorRedLVL5 = 0xC,
ColorRedLVL6 = 0xD,
ColorRedLVL2 = 0x3,
ColorRedLVL3 = 0x4,
ColorRedLVL4 = 0x5,
ColorRedLVL5 = 0x6,
ColorRedLVL6 = 0x7,
}

View File

@@ -17,4 +17,5 @@ public enum PreviewCharacterMode : uint
WALKING = 0x6,
TEAM_INTRO = 0x7,
WINGMAN_INTRO = 0x8,
BANNER = 0x9,
}

File diff suppressed because it is too large Load Diff

View File

@@ -35,7 +35,12 @@
#include "pch.h"
#include "dynohook/core.h"
#include "dynohook/manager.h"
#ifdef _WIN32
#include "dynohook/conventions/x64/x64MsFastcall.h"
#else
#include "dynohook/conventions/x64/x64SystemVcall.h"
#endif
namespace counterstrikesharp {
@@ -275,8 +280,11 @@ void ValveFunction::AddHook(CallbackT callable, bool post)
{
dyno::HookManager& manager = dyno::HookManager::Get();
dyno::Hook* hook = manager.hook((void*)m_ulAddr, [this] {
return new dyno::x64SystemVcall(ConvertArgsToDynoHook(m_Args),
static_cast<dyno::DataType>(this->m_eReturnType));
#ifdef _WIN32
return new dyno::x64MsFastcall(ConvertArgsToDynoHook(m_Args), static_cast<dyno::DataType>(this->m_eReturnType));
#else
return new dyno::x64SystemVcall(ConvertArgsToDynoHook(m_Args), static_cast<dyno::DataType>(this->m_eReturnType));
#endif
});
g_HookMap[hook] = this;
hook->addCallback(dyno::HookType::Post, (dyno::HookHandler*)&HookHandler);
@@ -297,8 +305,11 @@ void ValveFunction::AddHook(CallbackT callable, bool post)
void ValveFunction::RemoveHook(CallbackT callable, bool post) {
dyno::HookManager& manager = dyno::HookManager::Get();
dyno::Hook* hook = manager.hook((void*)m_ulAddr, [this] {
return new dyno::x64SystemVcall(ConvertArgsToDynoHook(m_Args),
static_cast<dyno::DataType>(this->m_eReturnType));
#ifdef _WIN32
return new dyno::x64MsFastcall(ConvertArgsToDynoHook(m_Args), static_cast<dyno::DataType>(this->m_eReturnType));
#else
return new dyno::x64SystemVcall(ConvertArgsToDynoHook(m_Args), static_cast<dyno::DataType>(this->m_eReturnType));
#endif
});
g_HookMap[hook] = this;
@@ -313,4 +324,4 @@ void ValveFunction::RemoveHook(CallbackT callable, bool post) {
}
}
} // namespace counterstrikesharp
} // namespace counterstrikesharp

View File

@@ -95,44 +95,47 @@ json WriteTypeJson(json obj, CSchemaType* current_type)
CON_COMMAND(dump_schema, "dump schema symbols")
{
std::vector<std::string> classNames;
std::vector<std::string> enumNames;
// Reading these from a static file since I cannot seem to get the
// CSchemaSystemTypeScope->GetClasses() to return anything on linux.
std::ifstream inputClasses(utils::GamedataDirectory() + "/schema_classes.txt");
std::ifstream inputEnums(utils::GamedataDirectory() + "/schema_enums.txt");
std::ofstream output(utils::GamedataDirectory() + "/schema.json");
std::string line;
while (std::getline(inputClasses, line))
{
if (!line.empty() && line.back() == '\r')
{
line.pop_back();
}
classNames.push_back(line);
}
while (std::getline(inputEnums, line))
{
if (!line.empty() && line.back() == '\r')
{
line.pop_back();
}
enumNames.push_back(line);
}
CSchemaSystemTypeScope* pType = globals::schemaSystem->FindTypeScopeForModule(MODULE_PREFIX "server" MODULE_EXT);
auto index = pType->m_DeclaredClasses.m_Map.FirstInorder();
std::vector<CSchemaClassInfo*> classes;
do
{
classes.push_back(pType->m_DeclaredClasses.m_Map.Element(index)->m_pClassInfo);
index = pType->m_DeclaredClasses.m_Map.NextInorder(index);
} while (index != pType->m_DeclaredClasses.m_Map.InvalidIndex());
index = pType->m_DeclaredEnums.m_Map.FirstInorder();
std::vector<CSchemaEnumInfo*> enums;
do
{
enums.push_back(pType->m_DeclaredEnums.m_Map.Element(index)->m_pEnumInfo);
index = pType->m_DeclaredEnums.m_Map.NextInorder(index);
} while (index != pType->m_DeclaredEnums.m_Map.InvalidIndex());
pType = globals::schemaSystem->GlobalTypeScope();
index = pType->m_DeclaredClasses.m_Map.FirstInorder();
do
{
classes.push_back(pType->m_DeclaredClasses.m_Map.Element(index)->m_pClassInfo);
index = pType->m_DeclaredClasses.m_Map.NextInorder(index);
} while (index != pType->m_DeclaredClasses.m_Map.InvalidIndex());
index = pType->m_DeclaredEnums.m_Map.FirstInorder();
do
{
enums.push_back(pType->m_DeclaredEnums.m_Map.Element(index)->m_pEnumInfo);
index = pType->m_DeclaredEnums.m_Map.NextInorder(index);
} while (index != pType->m_DeclaredEnums.m_Map.InvalidIndex());
json j;
j["classes"] = json::object();
j["enums"] = json::object();
for (const auto& line : classNames)
for (const auto& pClassInfo : classes)
{
auto* pClassInfo = pType->FindDeclaredClass(line.c_str()).Get();
if (!pClassInfo) continue;
short fieldsSize = pClassInfo->m_nFieldCount;
SchemaClassFieldData_t* pFields = pClassInfo->m_pFields;
@@ -155,11 +158,8 @@ CON_COMMAND(dump_schema, "dump schema symbols")
}
}
for (const auto& line : enumNames)
for (const auto& pEnumInfo : enums)
{
auto* pEnumInfo = pType->FindDeclaredEnum(line.c_str()).Get();
if (!pEnumInfo) continue;
j["enums"][pEnumInfo->m_pszName] = json::object();
j["enums"][pEnumInfo->m_pszName]["align"] = pEnumInfo->m_nSize;
j["enums"][pEnumInfo->m_pszName]["items"] = json::array();