Skip to content

Instantly share code, notes, and snippets.

@iFlake
Created August 26, 2018 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iFlake/d0bd57a293d92790480535483de84e74 to your computer and use it in GitHub Desktop.
Save iFlake/d0bd57a293d92790480535483de84e74 to your computer and use it in GitHub Desktop.
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace Fleka.DotnetVcmp.Interop {
public delegate uint GetServerVersionDelegate();
public delegate VcmpError GetServerSettingsDelegate(ref ServerSettings serverSettings);
public delegate VcmpError ExportFunctionsDelegate(int pluginId, ref IntPtr functionList, IntPtr size);
public delegate uint GetNumberOfPluginsDelegate();
public delegate VcmpError GetPluginInfoDelegate(int pluginId, ref PluginInfo pluginInfo);
public delegate int FindPluginDelegate([MarshalAs(UnmanagedType.LPStr)] string pluginName);
public unsafe delegate IntPtr* GetPluginExportsDelegate(int pluginId, ref IntPtr size);
public delegate VcmpError SendPluginCommandDelegate(uint commandIdentifier, [MarshalAs(UnmanagedType.LPStr)] string format, [MarshalAs(UnmanagedType.LPStr)] string formatFirstParameter);
public delegate ulong GetTimeDelegate();
public delegate VcmpError LogMessageDelegate([MarshalAs(UnmanagedType.LPStr)] string format, [MarshalAs(UnmanagedType.LPStr)] string formatFirstParameter);
public delegate VcmpError GetLastErrorDelegate();
public delegate VcmpError SendClientScriptDataDelegate(int playerId, IntPtr data, IntPtr size);
public delegate VcmpError SendClientMessageDelegate(int playerId, uint color, [MarshalAs(UnmanagedType.LPStr)] string format, [MarshalAs(UnmanagedType.LPStr)] string formatFirstParameter);
public delegate VcmpError SendGameMessageDelegate(int playerId, [MarshalAs(UnmanagedType.LPStr)] string format, [MarshalAs(UnmanagedType.LPStr)] string formatFirstParameter);
public delegate VcmpError SetServerNameDelegate([MarshalAs(UnmanagedType.LPStr)] string text);
public delegate VcmpError GetServerNameDelegate([MarshalAs(UnmanagedType.LPStr)] StringBuilder buffer, IntPtr size);
public delegate VcmpError SetMaxPlayersDelegate(uint maxPlayers);
public delegate uint GetMaxPlayersDelegate();
public delegate VcmpError SetServerPasswordDelegate([MarshalAs(UnmanagedType.LPStr)] string password);
public delegate VcmpError GetServerPasswordDelegate([MarshalAs(UnmanagedType.LPStr)] StringBuilder buffer, IntPtr size);
public delegate VcmpError SetGameModeTextDelegate([MarshalAs(UnmanagedType.LPStr)] string gameMode);
public delegate VcmpError GetGameModeTextDelegate([MarshalAs(UnmanagedType.LPStr)] StringBuilder buffer, IntPtr size);
public delegate void ShutdownServerDelegate();
}
using System;
using System.Runtime.InteropServices;
namespace Fleka.DotnetVcmp.Interop {
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct PluginFunctions {
public uint StructSize;
public GetServerVersionDelegate GetServerVersion;
public GetServerSettingsDelegate GetServerSettings;
public ExportFunctionsDelegate ExportFunctions;
public GetNumberOfPluginsDelegate GetNumberOfPlugins;
public GetPluginInfoDelegate GetPluginInfo;
public FindPluginDelegate FindPlugin;
public GetPluginExportsDelegate GetPluginExports;
public SendPluginCommandDelegate SendPluginCommand;
public GetTimeDelegate GetTime;
public LogMessageDelegate LogMessage;
public GetLastErrorDelegate GetLastError;
public SendClientMessageDelegate SendClientScriptDataDelegate;
public SendClientMessageDelegate SendClientMessage;
public SendGameMessageDelegate SendGameMessage;
public SetServerNameDelegate SetServerName;
public GetServerNameDelegate GetServerName;
public SetMaxPlayersDelegate SetMaxPlayers;
public GetMaxPlayersDelegate GetMaxPlayers;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment