From d9280f6608400b44605d0f5d9e4bcd400c74f88e Mon Sep 17 00:00:00 2001 From: stefanx111 Date: Tue, 5 Aug 2025 00:58:38 +0300 Subject: [PATCH 1/5] update css version --- WeaponPaints.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WeaponPaints.csproj b/WeaponPaints.csproj index 1bb9a6a1..823df70e 100644 --- a/WeaponPaints.csproj +++ b/WeaponPaints.csproj @@ -9,7 +9,7 @@ - + From 95d53f421691000e46415ad0f219d902371610b5 Mon Sep 17 00:00:00 2001 From: stefanx111 Date: Tue, 5 Aug 2025 00:59:22 +0300 Subject: [PATCH 2/5] CBaseViewModel removed --- WeaponAction.cs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/WeaponAction.cs b/WeaponAction.cs index a22e392f..48a7b89d 100644 --- a/WeaponAction.cs +++ b/WeaponAction.cs @@ -285,7 +285,6 @@ namespace WeaponPaints if (!weapon.Value.OwnerEntity.IsValid) continue; if (gun.Entity == null) continue; if (!gun.IsValid) continue; - if (!gun.VisibleinPVS) continue; try { @@ -454,13 +453,6 @@ namespace WeaponPaints private static void UpdatePlayerWeaponMeshGroupMask(CCSPlayerController player, CBasePlayerWeapon weapon, bool isLegacy) { UpdateWeaponMeshGroupMask(weapon, isLegacy); - - var viewModel = GetPlayerViewModel(player); - if (viewModel == null || viewModel.Weapon.Value == null || - viewModel.Weapon.Value.Index != weapon.Index) return; - - UpdateWeaponMeshGroupMask(viewModel, isLegacy); - Utilities.SetStateChanged(viewModel, "CBaseEntity", "m_CBodyComponent"); } private static void GivePlayerAgent(CCSPlayerController player) @@ -558,16 +550,6 @@ namespace WeaponPaints return !Utility.IsPlayerValid(player) ? null : player; } - private static unsafe CBaseViewModel? GetPlayerViewModel(CCSPlayerController player) - { - if (player.PlayerPawn.Value == null || player.PlayerPawn.Value.ViewModelServices == null) return null; - CCSPlayer_ViewModelServices viewModelServices = new(player.PlayerPawn.Value.ViewModelServices!.Handle); - var ptr = viewModelServices.Handle + Schema.GetSchemaOffset("CCSPlayer_ViewModelServices", "m_hViewModel"); - var references = MemoryMarshal.CreateSpan(ref ptr, 3); - var viewModel = (CHandle)Activator.CreateInstance(typeof(CHandle), references[0])!; - return viewModel.Value == null ? null : viewModel.Value; - } - private static bool HasChangedKnife(CCSPlayerController player, out string? knifeValue) { knifeValue = null; From bde066631331be99c22c2777be123f7297d94287 Mon Sep 17 00:00:00 2001 From: stefanx111 Date: Tue, 5 Aug 2025 01:08:43 +0300 Subject: [PATCH 3/5] bodygroup and subclass change method to use AcceptInput --- Variables.cs | 7 ++++--- WeaponAction.cs | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Variables.cs b/Variables.cs index 3ee7bd06..9648ba27 100644 --- a/Variables.cs +++ b/Variables.cs @@ -93,10 +93,11 @@ public partial class WeaponPaints private static readonly MemoryFunctionVoid CAttributeListSetOrAddAttributeValueByName = new(GameData.GetSignature("CAttributeList_SetOrAddAttributeValueByName")); - private static readonly MemoryFunctionWithReturn SetBodygroupFunc = new( - GameData.GetSignature("CBaseModelEntity_SetBodygroup")); + //we dont need anymore because we use AcceptInput + //private static readonly MemoryFunctionWithReturn SetBodygroupFunc = new( + // GameData.GetSignature("CBaseModelEntity_SetBodygroup")); - private static readonly Func SetBodygroup = SetBodygroupFunc.Invoke; + //private static readonly Func SetBodygroup = SetBodygroupFunc.Invoke; private static Dictionary WeaponDefindex { get; } = new() { diff --git a/WeaponAction.cs b/WeaponAction.cs index 48a7b89d..6b52ed27 100644 --- a/WeaponAction.cs +++ b/WeaponAction.cs @@ -405,7 +405,7 @@ namespace WeaponPaints item.Initialized = true; - SetBodygroup(pawn.Handle, "default_gloves", 1); + SetBodygroup(pawn, "default_gloves", 1); } catch (Exception) { } }, TimerFlags.STOP_ON_MAPCHANGE); @@ -429,13 +429,15 @@ namespace WeaponPaints return int.TryParse(randomWeapon["paint"]?.ToString(), out var paintValue) ? paintValue : 0; } - private static void SubclassChange(CBasePlayerWeapon weapon, ushort itemD) + //xstage idea on css discord + public static void SubclassChange(CBasePlayerWeapon weapon, ushort itemD) { - var subclassChangeFunc = VirtualFunction.Create( - GameData.GetSignature("ChangeSubclass") - ); + weapon.AcceptInput("ChangeSubclass", value: itemD.ToString()); + } - subclassChangeFunc(weapon.Handle, itemD.ToString()); + public static void SetBodygroup(CCSPlayerPawn pawn, string group, int value) + { + pawn.AcceptInput("SetBodygroup", value:$"{group},{value}"); } private static void UpdateWeaponMeshGroupMask(CBaseEntity weapon, bool isLegacy = false) From f345a4609061529cd07e84ef2f4d78f5e2fb698c Mon Sep 17 00:00:00 2001 From: stefanx111 Date: Tue, 5 Aug 2025 01:09:31 +0300 Subject: [PATCH 4/5] removed unused signatures --- gamedata/weaponpaints.json | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/gamedata/weaponpaints.json b/gamedata/weaponpaints.json index caa58f2c..e204cfe8 100644 --- a/gamedata/weaponpaints.json +++ b/gamedata/weaponpaints.json @@ -1,23 +1,9 @@ { - "ChangeSubclass": { - "signatures": { - "library": "server", - "windows": "48 89 6C 24 ? 56 48 83 EC ? 48 8B EA 48 8B F1 E8 ? ? ? ? 84 C0 0F 84", - "linux": "55 48 89 E5 41 55 41 54 49 89 F4 53 48 89 FB 48 83 EC ? E8 ? ? ? ? 84 C0 74" - } - }, "CAttributeList_SetOrAddAttributeValueByName": { "signatures": { "library": "server", "windows": "40 53 41 56 41 57 48 81 EC 90 00 00 00 0F 29 74 24 70", "linux": "55 48 89 E5 41 57 41 56 49 89 FE 41 55 41 54 49 89 F4 53 48 83 EC 78" } - }, - "CBaseModelEntity_SetBodygroup": { - "signatures": { - "library": "server", - "windows": "48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 41 8B F8 48 8B F2 48 8B D9 E8 ? ? ? ?", - "linux": "55 48 89 E5 41 55 49 89 F5 41 54 41 89 D4 53 48 89 FB 48 83 EC 08 E8 ? ? ? ? 48 85 C0" - } } } From 634d0e4c1d158e199f6ed06aee0a20823c8f6ef4 Mon Sep 17 00:00:00 2001 From: stefanx111 Date: Tue, 5 Aug 2025 01:18:43 +0300 Subject: [PATCH 5/5] fix sigs --- gamedata/weaponpaints.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamedata/weaponpaints.json b/gamedata/weaponpaints.json index e204cfe8..bdeec3c9 100644 --- a/gamedata/weaponpaints.json +++ b/gamedata/weaponpaints.json @@ -2,8 +2,8 @@ "CAttributeList_SetOrAddAttributeValueByName": { "signatures": { "library": "server", - "windows": "40 53 41 56 41 57 48 81 EC 90 00 00 00 0F 29 74 24 70", - "linux": "55 48 89 E5 41 57 41 56 49 89 FE 41 55 41 54 49 89 F4 53 48 83 EC 78" + "windows": "40 53 55 41 56 48 81 EC 90 00 00 00", + "linux": "55 48 89 E5 41 57 41 56 49 89 FE 41 55 41 54 53 48 89 F3 48 83 EC ? F3 0F 11 85" } } }