Compare commits

...

10 Commits

Author SHA1 Message Date
Michael Wilson
3860ca1662 fix: update CNetworkQuantizedFloat to resolve to float
closes #482
2024-07-26 18:28:37 +10:00
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
Yarukon
a87bd25b48 Improve Teleport Function (#513) 2024-06-27 23:51:57 +10:00
Michael Wilson
9c5468e5ba fix: bad vector natives (closes #512) 2024-06-27 03:58:21 +00:00
Michael Wilson
f826be664f [no ci] Add Linux Dev Container (#448) 2024-06-27 13:52:14 +10:00
25 changed files with 4913 additions and 2588 deletions

View File

@@ -0,0 +1,11 @@
{
"name": "SteamRT Sniper SDK",
"image": "registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools"
]
}
}
}

View File

@@ -10,5 +10,5 @@ indent_size = 4
max_line_length = 140
trim_trailing_whitespace = true
[*.json]
[{*.json,*.yaml,*.yml}]
indent_size = 2

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

@@ -8,16 +8,19 @@ namespace CounterStrikeSharp.API.Core;
public partial class CBaseEntity
{
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
/// <exception cref="ArgumentNullException">No valid argument</exception>
public void Teleport(Vector? position = null, QAngle? angles = null, Vector? velocity = null)
{
Guard.IsValidEntity(this);
position ??= AbsOrigin!;
angles ??= AbsRotation!;
velocity ??= AbsVelocity;
VirtualFunction.CreateVoid<IntPtr, IntPtr, IntPtr, IntPtr>(Handle, GameData.GetOffset("CBaseEntity_Teleport"))(
Handle, position.Handle, angles.Handle, velocity.Handle);
if (position == null && angles == null && velocity == null)
throw new ArgumentNullException("No valid argument");
nint _position = position?.Handle ?? 0;
nint _angles = angles?.Handle ?? 0;
nint _velocity = velocity?.Handle ?? 0;
VirtualFunction.CreateVoid<IntPtr, IntPtr, IntPtr, IntPtr>(Handle, GameData.GetOffset("CBaseEntity_Teleport"))(Handle, _position, _angles, _velocity);
}
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
@@ -45,4 +48,4 @@ public partial class CBaseEntity
return (T)Activator.CreateInstance(typeof(T), Marshal.ReadIntPtr(SubclassID.Handle + 4));
}
}
}

View File

@@ -52,7 +52,7 @@ public partial class CBaseAnimGraphController : CSkeletonAnimationController
// m_flPlaybackRate
[SchemaMember("CBaseAnimGraphController", "m_flPlaybackRate")]
public float PlaybackRate => Schema.GetDeclaredClass<float>(this.Handle, "CBaseAnimGraphController", "m_flPlaybackRate");
public ref float PlaybackRate => ref Schema.GetRef<float>(this.Handle, "CBaseAnimGraphController", "m_flPlaybackRate");
// m_nNotifyState
[SchemaMember("CBaseAnimGraphController", "m_nNotifyState")]

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

@@ -36,14 +36,14 @@ public partial class CNetworkOriginCellCoordQuantizedVector : NativeObject
// m_vecX
[SchemaMember("CNetworkOriginCellCoordQuantizedVector", "m_vecX")]
public float X => Schema.GetDeclaredClass<float>(this.Handle, "CNetworkOriginCellCoordQuantizedVector", "m_vecX");
public ref float X => ref Schema.GetRef<float>(this.Handle, "CNetworkOriginCellCoordQuantizedVector", "m_vecX");
// m_vecY
[SchemaMember("CNetworkOriginCellCoordQuantizedVector", "m_vecY")]
public float Y => Schema.GetDeclaredClass<float>(this.Handle, "CNetworkOriginCellCoordQuantizedVector", "m_vecY");
public ref float Y => ref Schema.GetRef<float>(this.Handle, "CNetworkOriginCellCoordQuantizedVector", "m_vecY");
// m_vecZ
[SchemaMember("CNetworkOriginCellCoordQuantizedVector", "m_vecZ")]
public float Z => Schema.GetDeclaredClass<float>(this.Handle, "CNetworkOriginCellCoordQuantizedVector", "m_vecZ");
public ref float Z => ref Schema.GetRef<float>(this.Handle, "CNetworkOriginCellCoordQuantizedVector", "m_vecZ");
}

View File

@@ -20,14 +20,14 @@ public partial class CNetworkVelocityVector : NativeObject
// m_vecX
[SchemaMember("CNetworkVelocityVector", "m_vecX")]
public float X => Schema.GetDeclaredClass<float>(this.Handle, "CNetworkVelocityVector", "m_vecX");
public ref float X => ref Schema.GetRef<float>(this.Handle, "CNetworkVelocityVector", "m_vecX");
// m_vecY
[SchemaMember("CNetworkVelocityVector", "m_vecY")]
public float Y => Schema.GetDeclaredClass<float>(this.Handle, "CNetworkVelocityVector", "m_vecY");
public ref float Y => ref Schema.GetRef<float>(this.Handle, "CNetworkVelocityVector", "m_vecY");
// m_vecZ
[SchemaMember("CNetworkVelocityVector", "m_vecZ")]
public float Z => Schema.GetDeclaredClass<float>(this.Handle, "CNetworkVelocityVector", "m_vecZ");
public ref float Z => ref Schema.GetRef<float>(this.Handle, "CNetworkVelocityVector", "m_vecZ");
}

View File

@@ -20,14 +20,14 @@ public partial class CNetworkViewOffsetVector : NativeObject
// m_vecX
[SchemaMember("CNetworkViewOffsetVector", "m_vecX")]
public float X => Schema.GetDeclaredClass<float>(this.Handle, "CNetworkViewOffsetVector", "m_vecX");
public ref float X => ref Schema.GetRef<float>(this.Handle, "CNetworkViewOffsetVector", "m_vecX");
// m_vecY
[SchemaMember("CNetworkViewOffsetVector", "m_vecY")]
public float Y => Schema.GetDeclaredClass<float>(this.Handle, "CNetworkViewOffsetVector", "m_vecY");
public ref float Y => ref Schema.GetRef<float>(this.Handle, "CNetworkViewOffsetVector", "m_vecY");
// m_vecZ
[SchemaMember("CNetworkViewOffsetVector", "m_vecZ")]
public float Z => Schema.GetDeclaredClass<float>(this.Handle, "CNetworkViewOffsetVector", "m_vecZ");
public ref float Z => ref Schema.GetRef<float>(this.Handle, "CNetworkViewOffsetVector", "m_vecZ");
}

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

@@ -15,7 +15,7 @@ public record SchemaFieldType
this.Atomic = Atomic;
this.Inner = Inner;
if (this.Name == "GameTime_t")
if (this.Name == "GameTime_t" || this.Name == "CNetworkedQuantizedFloat")
{
this.Category = SchemaTypeCategory.Builtin;
this.Name = "float32";
@@ -99,7 +99,8 @@ public record SchemaFieldType
{
SchemaTypeCategory.Builtin => BuiltinToCsKeyword(Name),
SchemaTypeCategory.Ptr => IsString
? "string" : $"{Inner!.CsTypeName}?",
? "string"
: $"{Inner!.CsTypeName}?",
SchemaTypeCategory.FixedArray => IsString
? "string"
: $"{Inner!.CsTypeName}[]",

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();

View File

@@ -21,55 +21,62 @@
namespace counterstrikesharp {
CREATE_GETTER_FUNCTION(Vector, float, Length, Vector *, obj->Length());
CREATE_GETTER_FUNCTION(Vector, float, Length2D, Vector *, obj->Length2D());
CREATE_GETTER_FUNCTION(Vector, float, LengthSqr, Vector *, obj->LengthSqr());
CREATE_GETTER_FUNCTION(Vector, float, Length2DSqr, Vector *, obj->Length2DSqr());
CREATE_GETTER_FUNCTION(Vector, float, IsZero, Vector *, obj->IsZero());
CREATE_GETTER_FUNCTION(Vector, float, Length, Vector*, obj->Length());
CREATE_GETTER_FUNCTION(Vector, float, Length2D, Vector*, obj->Length2D());
CREATE_GETTER_FUNCTION(Vector, float, LengthSqr, Vector*, obj->LengthSqr());
CREATE_GETTER_FUNCTION(Vector, float, Length2DSqr, Vector*, obj->Length2DSqr());
CREATE_GETTER_FUNCTION(Vector, bool, IsZero, Vector*, obj->IsZero());
CREATE_GETTER_FUNCTION(Vector, float, X, Vector *, obj->x);
CREATE_GETTER_FUNCTION(Vector, float, Y, Vector *, obj->y);
CREATE_GETTER_FUNCTION(Vector, float, Z, Vector *, obj->z);
CREATE_GETTER_FUNCTION(Vector, float, X, Vector*, obj->x);
CREATE_GETTER_FUNCTION(Vector, float, Y, Vector*, obj->y);
CREATE_GETTER_FUNCTION(Vector, float, Z, Vector*, obj->z);
CREATE_SETTER_FUNCTION(Vector, float, X, Vector *, obj->x = value);
CREATE_SETTER_FUNCTION(Vector, float, Y, Vector *, obj->y = value);
CREATE_SETTER_FUNCTION(Vector, float, Z, Vector *, obj->z = value);
CREATE_SETTER_FUNCTION(Vector, float, X, Vector*, obj->x = value);
CREATE_SETTER_FUNCTION(Vector, float, Y, Vector*, obj->y = value);
CREATE_SETTER_FUNCTION(Vector, float, Z, Vector*, obj->z = value);
// TODO: These need to be cleared out somehow
std::vector<Vector *> managed_vectors;
std::vector<Vector*> managed_vectors;
Vector *VectorNew(ScriptContext &script_context) {
Vector* VectorNew(ScriptContext& script_context)
{
auto vec = new Vector();
managed_vectors.push_back(vec);
return vec;
}
// TODO: These need to be cleared out somehow
std::vector<QAngle *> managed_angles;
std::vector<QAngle*> managed_angles;
QAngle *AngleNew(ScriptContext &script_context) {
QAngle* AngleNew(ScriptContext& script_context)
{
auto ang = new QAngle();
managed_angles.push_back(ang);
return ang;
}
void NativeVectorAngles(ScriptContext &script_context) {
auto vec = script_context.GetArgument<Vector *>(0);
auto pseudoUpVector = script_context.GetArgument<Vector *>(1);
auto outAngle = script_context.GetArgument<QAngle *>(2);
void NativeVectorAngles(ScriptContext& script_context)
{
auto vec = script_context.GetArgument<Vector*>(0);
auto pseudoUpVector = script_context.GetArgument<Vector*>(1);
auto outAngle = script_context.GetArgument<QAngle*>(2);
if (!pseudoUpVector) {
if (!pseudoUpVector)
{
VectorAngles(*vec, *outAngle);
} else {
}
else
{
VectorAngles(*vec, *pseudoUpVector, *outAngle);
}
}
void NativeAngleVectors(ScriptContext &script_context) {
auto vec = script_context.GetArgument<QAngle *>(0);
auto fwd = script_context.GetArgument<Vector *>(1);
auto right = script_context.GetArgument<Vector *>(2);
auto up = script_context.GetArgument<Vector *>(3);
void NativeAngleVectors(ScriptContext& script_context)
{
auto vec = script_context.GetArgument<QAngle*>(0);
auto fwd = script_context.GetArgument<Vector*>(1);
auto right = script_context.GetArgument<Vector*>(2);
auto up = script_context.GetArgument<Vector*>(3);
AngleVectors(*vec, fwd, right, up);
}
@@ -92,6 +99,6 @@ REGISTER_NATIVES(vector, {
ScriptEngine::RegisterNativeHandler("VECTOR_LENGTH_2D", VectorGetLength2D);
ScriptEngine::RegisterNativeHandler("VECTOR_LENGTH_SQR", VectorGetLengthSqr);
ScriptEngine::RegisterNativeHandler("VECTOR_LENGTH_2D_SQR", VectorGetLength2DSqr);
ScriptEngine::RegisterNativeHandler("VECTOR_IS_ZERO", VectorGetLengthSqr);
ScriptEngine::RegisterNativeHandler("VECTOR_IS_ZERO", VectorGetIsZero);
})
} // namespace counterstrikesharp
} // namespace counterstrikesharp