working weapon concealment
This commit is contained in:
@@ -6,19 +6,40 @@ namespace SendProxyInterop;
|
||||
|
||||
public sealed class SendProxyNative : IDisposable
|
||||
{
|
||||
private const string RelativeLibraryPath = "addons/sendproxy/bin/linuxsteamrt64/sendproxy.so";
|
||||
|
||||
private readonly IntPtr _library;
|
||||
private readonly SetOverrideDelegate _setOverride;
|
||||
private readonly SetVectorFirstFromFieldDelegate _setVectorFirstFromField;
|
||||
private readonly RemoveOverrideDelegate _removeOverride;
|
||||
private readonly ClearOverridesDelegate _clearOverrides;
|
||||
private readonly MarkDirtyDelegate _markDirty;
|
||||
private readonly DumpSchemaDelegate _dumpSchema;
|
||||
private readonly DumpEnumDelegate _dumpEnum;
|
||||
|
||||
public SendProxyNative(string libraryPath)
|
||||
{
|
||||
_library = NativeLibrary.Load(libraryPath);
|
||||
_setOverride = GetExport<SetOverrideDelegate>("SendProxy_SetOverride");
|
||||
_setVectorFirstFromField = GetExport<SetVectorFirstFromFieldDelegate>("SendProxy_SetVectorFirstFromField");
|
||||
_removeOverride = GetExport<RemoveOverrideDelegate>("SendProxy_RemoveOverride");
|
||||
_clearOverrides = GetExport<ClearOverridesDelegate>("SendProxy_ClearOverrides");
|
||||
_markDirty = GetExport<MarkDirtyDelegate>("SendProxy_MarkDirty");
|
||||
_dumpSchema = GetExport<DumpSchemaDelegate>("SendProxy_DumpSchema");
|
||||
_dumpEnum = GetExport<DumpEnumDelegate>("SendProxy_DumpEnum");
|
||||
}
|
||||
|
||||
public static SendProxyNative FromGameDirectory(string gameDirectory)
|
||||
{
|
||||
string csgoDirectory = Path.GetFileName(gameDirectory).Equals("csgo", StringComparison.OrdinalIgnoreCase)
|
||||
? gameDirectory
|
||||
: Path.Combine(gameDirectory, "csgo");
|
||||
|
||||
string libraryPath = Path.Combine(csgoDirectory, RelativeLibraryPath);
|
||||
if (!File.Exists(libraryPath))
|
||||
throw new FileNotFoundException("SendProxy Metamod addon was not found. Install it under game/csgo/addons/sendproxy.", libraryPath);
|
||||
|
||||
return new SendProxyNative(libraryPath);
|
||||
}
|
||||
|
||||
public int SetBytes(int recipientSlot, int entityIndex, string className, string fieldPath, ReadOnlySpan<byte> value)
|
||||
@@ -61,6 +82,11 @@ public sealed class SendProxyNative : IDisposable
|
||||
return SetBytes(recipientSlot, entityIndex, className, fieldPath, bytes);
|
||||
}
|
||||
|
||||
public int SetVectorFirstFromField(int recipientSlot, int entityIndex, string className, string vectorFieldPath, string sourceFieldPath)
|
||||
{
|
||||
return _setVectorFirstFromField(recipientSlot, entityIndex, className, vectorFieldPath, sourceFieldPath);
|
||||
}
|
||||
|
||||
public bool RemoveOverride(int ruleId)
|
||||
{
|
||||
return _removeOverride(ruleId);
|
||||
@@ -76,6 +102,16 @@ public sealed class SendProxyNative : IDisposable
|
||||
return _markDirty(entityIndex, className, fieldPath);
|
||||
}
|
||||
|
||||
public void DumpSchema(string className, string contains)
|
||||
{
|
||||
_dumpSchema(className, contains);
|
||||
}
|
||||
|
||||
public void DumpEnum(string enumName)
|
||||
{
|
||||
_dumpEnum(enumName);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
NativeLibrary.Free(_library);
|
||||
@@ -89,6 +125,9 @@ public sealed class SendProxyNative : IDisposable
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
private delegate int SetOverrideDelegate(int recipientSlot, int entityIndex, string className, string fieldPath, byte[] value, int valueSize);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
private delegate int SetVectorFirstFromFieldDelegate(int recipientSlot, int entityIndex, string className, string vectorFieldPath, string sourceFieldPath);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private delegate bool RemoveOverrideDelegate(int ruleId);
|
||||
@@ -99,4 +138,10 @@ public sealed class SendProxyNative : IDisposable
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private delegate bool MarkDirtyDelegate(int entityIndex, string className, string fieldPath);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
private delegate void DumpSchemaDelegate(string className, string contains);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
private delegate void DumpEnumDelegate(string enumName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user