More linux changes.
This commit is contained in:
parent
394f21e1a4
commit
b2288d7333
13
Makefile
13
Makefile
@ -106,24 +106,25 @@ ifneq (,$(filter original orangebox,$(ENGINE)))
|
||||
LIB_SUFFIX = _i486.$(LIB_EXT)
|
||||
else
|
||||
LIB_PREFIX = lib
|
||||
LIB_SUFFIX = .$(LIB_EXT)
|
||||
LIB_SUFFIX = _srv.$(LIB_EXT)
|
||||
endif
|
||||
|
||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions -I$(SMSDK)/public/jit/x86 -I$(SMSDK)/public/jit
|
||||
|
||||
ifeq "$(USEMETA)" "true"
|
||||
LINK_HL2 = $(HL2LIB)/tier1_i486.a $(HL2LIB)/$(LIB_PREFIX)vstdlib_srv$(LIB_SUFFIX) $(HL2LIB)/$(LIB_PREFIX)tier0_srv$(LIB_SUFFIX)
|
||||
LINK_HL2 = $(HL2LIB)/tier1_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) $(LIB_PREFIX)tier0$(LIB_SUFFIX)
|
||||
ifeq "$(ENGINE)" "csgo"
|
||||
LINK_HL2 += $(HL2LIB)/interfaces_i486.a
|
||||
endif
|
||||
|
||||
LINK += $(LINK_HL2)
|
||||
|
||||
INCLUDE += -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(HL2SDK)/game/shared -I$(METAMOD) \
|
||||
-I$(METAMOD)/sourcehook
|
||||
INCLUDE += -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(HL2SDK)/game/shared\
|
||||
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/extensions \
|
||||
-I$(SMSDK)/public/sourcepawn
|
||||
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \
|
||||
-DSE_CSS=6 -DSE_ORANGEBOXVALVE=7 -DSE_LEFT4DEAD=8 -DSE_LEFT4DEAD2=9 -DSE_ALIENSWARM=10 \
|
||||
-DSE_PORTAL2=11 -DSE_CSGO=12
|
||||
-DSE_ORANGEBOXVALVE=6 -DSE_LEFT4DEAD=7 -DSE_LEFT4DEAD2=8 -DSE_ALIENSWARM=9 \
|
||||
-DSE_PORTAL2=10 -DSE_CSGO=11 -DSE_CSS=12
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
28
vhook.h
28
vhook.h
@ -165,7 +165,7 @@ Vector *Callback_vector(DHooksCallback *dg, void **stack, size_t *argsizep);
|
||||
#else
|
||||
void *Callback(DHooksCallback *dg, void **stack);
|
||||
float Callback_float(DHooksCallback *dg, void **stack);
|
||||
Vector Callback_vector(DHooksCallback *dg, void **stack, size_t *argsizep);
|
||||
Vector *Callback_vector(DHooksCallback *dg, void **stack);
|
||||
#endif
|
||||
bool SetupHookManager(ISmmAPI *ismm);
|
||||
void CleanupHooks(IPluginContext *pContext);
|
||||
@ -176,20 +176,32 @@ SourceHook::PassInfo::PassType GetParamTypePassType(HookParamType type);
|
||||
static void *GenerateThunk(ReturnType type)
|
||||
{
|
||||
MacroAssemblerX86 masm;
|
||||
|
||||
static const size_t kStackNeeded = (2) * 4; // 2 args max
|
||||
static const size_t kReserve = ke::Align(kStackNeeded+8, 16)-8;
|
||||
|
||||
masm.push(ebp);
|
||||
masm.movl(ebp, esp);
|
||||
masm.lea(eax, Operand(ebp, 12));
|
||||
masm.push(eax);
|
||||
masm.push(Operand(ebp, 8));
|
||||
masm.subl(esp, kReserve);
|
||||
masm.lea(eax, Operand(ebp, 12)); // grab the incoming caller argument vector
|
||||
masm.movl(Operand(esp, 1 * 4), eax); // set that as the 2nd argument
|
||||
masm.lea(eax, Operand(ebp, 8)); // grab the |this|
|
||||
masm.movl(Operand(esp, 0 * 4), eax); // set |this| as the 1st argument
|
||||
if(type == ReturnType_Float)
|
||||
{
|
||||
masm.call(ExternalAddress((void *)Callback_float));
|
||||
}
|
||||
else if(type == ReturnType_Vector)
|
||||
{
|
||||
masm.call(ExternalAddress((void *)Callback_vector));
|
||||
}
|
||||
else
|
||||
{
|
||||
masm.call(ExternalAddress((void *)Callback));
|
||||
masm.addl(esp, 8);
|
||||
masm.pop(ebp);
|
||||
}
|
||||
masm.addl(esp, kReserve);
|
||||
masm.pop(ebp); // restore ebp
|
||||
masm.ret();
|
||||
|
||||
|
||||
void *base = g_pSM->GetScriptingEngine()->AllocatePageMemory(masm.length());
|
||||
masm.emitToExecutableMemory(base);
|
||||
return base;
|
||||
|
Loading…
Reference in New Issue
Block a user