Skip to content

Commit

Permalink
feat: add basic valve interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
roflmuffin committed Oct 11, 2023
1 parent aeae59e commit ce9b07b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions managed/CounterStrikeSharp.API/Modules/Memory/ValveInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using CounterStrikeSharp.API.Core;

namespace CounterStrikeSharp.API.Modules.Memory;

public record ValveInterface
{
enum ValveInterfaceType
{
Engine,
Server,
}

private ValveInterface(ValveInterfaceType type, string name)
{
this.Type = type;
this.Name = name;
}

private ValveInterfaceType Type { get; }
public string Name { get; }

public IntPtr Pointer => NativeAPI.GetValveInterface((int)Type, Name);

public override string ToString()
{
return this.Pointer.ToString();
}

public static ValveInterface Engine => new(ValveInterfaceType.Engine, "Source2EngineToServer001");
public static ValveInterface CVars => new(ValveInterfaceType.Engine, "VEngineCvar007");
public static ValveInterface Server => new(ValveInterfaceType.Server, "Source2Server001");
public static ValveInterface ServerGameClients => new(ValveInterfaceType.Server, "Source2GameClients001");
public static ValveInterface NetworkServerService => new(ValveInterfaceType.Engine, "NetworkServerService_001");
public static ValveInterface GameEventSystem => new(ValveInterfaceType.Engine, "GameEventSystemServerV001");
}

0 comments on commit ce9b07b

Please sign in to comment.