Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ From https://github.com/darkerz7/CS2-CustomIO
1. Adds a custom Input-Output as in CSS/CS:GO: [From cs2fixes](https://github.com/Source2ZE/CS2Fixes/blob/main/src/customio.cpp)

## Required packages:
1. [SwiftlyS2](https://github.com/swiftly-solution/swiftlys2/releases) (Min version: v1.2.0, just use beta pls)
1. [SwiftlyS2](https://github.com/swiftly-solution/swiftlys2/releases) (Compatible: v1.3.5 up to v1.4.0-beta.22)

## Installation:
1. Compile and copy cs2-CustomIO to `swiftlys2/plugins/cs2-CustomIO` folder
Expand Down
36 changes: 31 additions & 5 deletions cs2-CustomIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace CustomIO;

[PluginMetadata(Id = "CS2 CustomIO For SW2", Version = "1.5", Name = "CustomIO SW2", Author = "DarkerZ & LynchMus", Description = "Fixes missing keyvalues from CSS/CS:GO", Website = "https://github.com/himenekocn/CS2-CustomIO-For-SW2")]
[PluginMetadata(Id = "CS2 CustomIO For SW2", Version = "1.6", Name = "CustomIO SW2", Author = "DarkerZ & LynchMus", Description = "Fixes missing keyvalues from CSS/CS:GO", Website = "https://github.com/himenekocn/CS2-CustomIO-For-SW2")]
public partial class CustomIO(ISwiftlyCore core) : BasePlugin(core)
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
Expand All @@ -39,10 +39,36 @@ public override void Load(bool hotReload)
{
sw_iodebug = Core.ConVar.CreateOrFind("sw_iodebug", "Enable IO Debug", false);

CEntityIdentity_SetEntityName_Func = Core.Memory.GetUnmanagedFunctionByAddress<CEntityIdentity_SetEntityName_Delegate>(Core.GameData.GetSignature("CEntityInstance::SetEntityName"));
CBaseEntity_SetGravityScale_Func = Core.Memory.GetUnmanagedFunctionByAddress<CBaseEntity_SetGravityScale_Delegate>(Core.GameData.GetSignature("CBaseEntity::SetGravityScale"));
ProcessMovement_Func = Core.Memory.GetUnmanagedFunctionByAddress<ProcessMovement_Delegate>(Core.GameData.GetSignature("ProcessMovement"));
ProcessMovement_HookId = ProcessMovement_Func.AddHook(ProcessMovementHook);
var setEntityNamePtr = Core.GameData.GetSignature("CEntityInstance::SetEntityName");
if (setEntityNamePtr != 0)
{
CEntityIdentity_SetEntityName_Func = Core.Memory.GetUnmanagedFunctionByAddress<CEntityIdentity_SetEntityName_Delegate>(setEntityNamePtr);
}
else
{
Core.Logger.LogError("Failed to resolve signature CEntityInstance::SetEntityName");
}

var setGravityScalePtr = Core.GameData.GetSignature("CBaseEntity::SetGravityScale");
if (setGravityScalePtr != 0)
{
CBaseEntity_SetGravityScale_Func = Core.Memory.GetUnmanagedFunctionByAddress<CBaseEntity_SetGravityScale_Delegate>(setGravityScalePtr);
}
else
{
Core.Logger.LogError("Failed to resolve signature CBaseEntity::SetGravityScale");
}

var processMovementPtr = Core.GameData.GetSignature("ProcessMovement");
if (processMovementPtr != 0)
{
ProcessMovement_Func = Core.Memory.GetUnmanagedFunctionByAddress<ProcessMovement_Delegate>(processMovementPtr);
ProcessMovement_HookId = ProcessMovement_Func.AddHook(ProcessMovementHook);
}
else
{
Core.Logger.LogError("Failed to resolve signature ProcessMovement");
}

Core.Event.OnEntityIdentityAcceptInputHook += OnEntityIdentityAcceptInputHook;
Core.Event.OnClientPutInServer += OnClientPutInServer;
Expand Down
2 changes: 1 addition & 1 deletion cs2-CustomIO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" />
<PackageReference Include="SwiftlyS2.CS2" Version="1.2.0" ExcludeAssets="runtime" />
<PackageReference Include="SwiftlyS2.CS2" Version="[1.3.5,1.4.0-beta.22]" ExcludeAssets="runtime" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion resources/gamedata/signatures.jsonc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"CEntityInstance::SetEntityName": {
"lib": "server",
"windows": "48 89 5C 24 10 57 48 83 EC ? 48 8B D9 4C 8B C2",
"windows": "48 89 5C 24 10 57 48 83 EC 20 48 8B D9 4C 8B C2",
"linux": "55 48 89 F2 48 89 E5 41 55 41 54 53"
},
"CBaseEntity::SetGravityScale": {
Expand Down