extensions/sdktools/vcallbuilder.h
author David Anderson <dvander@alliedmods.net>
Wed Feb 25 20:07:12 2009 -0500 (2009-02-25)
changeset 2607 f3b8bbe17f85
parent 2289 44045ead61cd
permissions -rw-r--r--
Backed out changeset fa286305bd3f
faluco@1031
     1
/**
faluco@1031
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
dvander@1233
     4
 * SourceMod SDKTools Extension
ds@1947
     5
 * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
ds@1330
     6
 * =============================================================================
faluco@1031
     7
 *
ds@1330
     8
 * This program is free software; you can redistribute it and/or modify it under
ds@1330
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330
    10
 * Free Software Foundation.
dvander@1233
    11
 * 
ds@1330
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1330
    15
 * details.
dvander@1233
    16
 *
ds@1330
    17
 * You should have received a copy of the GNU General Public License along with
ds@1330
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1233
    19
 *
ds@1330
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1330
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1330
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1330
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330
    27
 * or <http://www.sourcemod.net/license.php>.
faluco@1031
    28
 *
faluco@1031
    29
 * Version: $Id$
faluco@1031
    30
 */
faluco@1031
    31
dvander@950
    32
#ifndef _INCLUDE_SOURCEMOD_VALVE_CALLER_H_
dvander@950
    33
#define _INCLUDE_SOURCEMOD_VALVE_CALLER_H_
dvander@950
    34
dvander@950
    35
#include <sh_stack.h>
dvander@950
    36
#include <extensions/IBinTools.h>
dvander@950
    37
#include "vdecoder.h"
dvander@950
    38
dvander@950
    39
using namespace SourceMod;
dvander@950
    40
dvander@950
    41
/**
dvander@950
    42
 * @brief Info necessary to call a Valve function
dvander@950
    43
 */
dvander@950
    44
struct ValveCall
dvander@950
    45
{
faluco@1560
    46
	ICallWrapper *call;							/**< From IBinTools */
faluco@1560
    47
	ValveCallType type;							/**< Call type */
faluco@1560
    48
	ValvePassInfo *vparams;						/**< Valve parameter info */
faluco@1560
    49
	ValvePassInfo *retinfo;						/**< Return buffer info */
faluco@1560
    50
	ValvePassInfo *thisinfo;					/**< Thiscall info */
faluco@1560
    51
	size_t stackSize;							/**< Stack size */
faluco@1560
    52
	size_t stackEnd;							/**< End of the bintools stack */
faluco@1560
    53
	unsigned char *retbuf;						/**< Return buffer */
faluco@1560
    54
	SourceHook::CStack<unsigned char *> stk;	/**< Parameter stack */
dvander@950
    55
dvander@950
    56
	unsigned char *stk_get();
dvander@950
    57
	void stk_put(unsigned char *ptr);
dvander@974
    58
	ValveCall();
dvander@950
    59
	~ValveCall();
dvander@950
    60
};
dvander@950
    61
dvander@950
    62
ValveCall *CreateValveVCall(unsigned int vtableIdx,
dvander@950
    63
							ValveCallType vcalltype,
dvander@950
    64
							const ValvePassInfo *retInfo,
dvander@950
    65
							const ValvePassInfo *params,
dvander@950
    66
							unsigned int numParams);
dvander@950
    67
dvander@953
    68
ValveCall *CreateValveCall(void *addr,
dvander@953
    69
							ValveCallType vcalltype,
dvander@953
    70
							const ValvePassInfo *retInfo,
dvander@953
    71
							const ValvePassInfo *params,
dvander@953
    72
							unsigned int numParams);
dvander@953
    73
dvander@950
    74
#endif //_INCLUDE_SOURCEMOD_VALVE_CALLER_H_