Code:
signed int __cdecl ConsoleCommandRegister(char *pszCommandName, int pCallback, int category, int unk)
So; the actual register command would be:
public delegate int ConsoleCommandRegisterDelegate(string commandName, IntPtr callback, int category, int unk);
And the actual callback prototype:
public delegate int ConsoleCommandCallbackDelegate();
Though; the callback can take arguments as well. So you can do it the easier way and just make sure the callback returns an int, and takes an arbitrary number of params.
public delegate int ConsoleCommandCallbackDelegate(int arg1, string arg2);
Etc.
Code:
public static bool HasReturnType(Delegate d, Type returnType)
{
return d.Method.ReturnType == returnType;
}
Code:
if (HasReturnType(callback, typeof(int))
RegisterCommand(commandName, Marshal.GetFunctionPointerForDelegate(callback), category, 0);