Bump SourcePawn submodule (#2428)
This commit is contained in:
@@ -446,6 +446,12 @@ int CForward::PushCell(cell_t cell)
|
||||
return SP_ERROR_NONE;
|
||||
}
|
||||
|
||||
int CForward::PushInt64(int64_t value)
|
||||
{
|
||||
// Not supported yet
|
||||
return SetError(SP_ERROR_PARAM);
|
||||
}
|
||||
|
||||
int CForward::PushFloat(float number)
|
||||
{
|
||||
if (m_curparam < m_numparams)
|
||||
|
||||
@@ -49,6 +49,7 @@ public: //ICallable
|
||||
virtual int PushArray(cell_t *inarray, unsigned int cells, int flags);
|
||||
virtual int PushString(const char *string);
|
||||
virtual int PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags);
|
||||
virtual int PushInt64(int64_t value);
|
||||
virtual void Cancel();
|
||||
public: //IForward
|
||||
virtual const char *GetForwardName();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*
|
||||
* Adopted to provide similar features to SourceHook by AlliedModders LLC.
|
||||
*/
|
||||
#include "bandaid.h"
|
||||
|
||||
// ============================================================================
|
||||
// >> INCLUDES
|
||||
@@ -642,8 +643,15 @@ void CHook::CreateBridge()
|
||||
// This will still call post hooks, but will skip the original function.
|
||||
masm.ret(m_pCallingConvention->GetPopSize());
|
||||
|
||||
void* base = smutils->GetScriptingEngine()->AllocatePageMemory(masm.length());
|
||||
masm.emitToExecutableMemory(base);
|
||||
void* base = smutils->GetScriptingEngine()->AllocatePageMemory(masm.total_size());
|
||||
DhookCodeChunk chunk((uint8_t*)base, masm.total_size());
|
||||
|
||||
// Can't let dtor call happen
|
||||
LinkedCode* code = (LinkedCode*)new uint8_t[sizeof(LinkedCode)];
|
||||
*((DhookCodeChunk*)&code->chunk) = chunk;
|
||||
masm.emitToExecutableMemory(code);
|
||||
|
||||
delete[] (uint8_t*)code;
|
||||
m_pBridge = base;
|
||||
}
|
||||
|
||||
@@ -728,8 +736,15 @@ void CHook::CreatePostCallback()
|
||||
masm.jmp(Operand(ExternalAddress(&pRetAddr)));
|
||||
|
||||
// Generate the code
|
||||
void* base = smutils->GetScriptingEngine()->AllocatePageMemory(masm.length());
|
||||
masm.emitToExecutableMemory(base);
|
||||
void* base = smutils->GetScriptingEngine()->AllocatePageMemory(masm.total_size());
|
||||
DhookCodeChunk chunk((uint8_t*)base, masm.total_size());
|
||||
|
||||
// Can't let dtor call happen
|
||||
LinkedCode* code = (LinkedCode*)new uint8_t[sizeof(LinkedCode)];
|
||||
*((DhookCodeChunk*)&code->chunk) = chunk;
|
||||
masm.emitToExecutableMemory(code);
|
||||
|
||||
delete[] (uint8_t*)code;
|
||||
m_pNewRetAddr = base;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
// Yes this is bad, but whatever dhooks will be nuked soon
|
||||
#include <../vm/code-allocator.h>
|
||||
|
||||
class DhookCodePool : public ke::Refcounted<DhookCodePool> {
|
||||
public:
|
||||
uint8_t* start_;
|
||||
uint8_t* ptr_;
|
||||
uint8_t* end_;
|
||||
size_t size_;
|
||||
};
|
||||
|
||||
struct DhookCodeChunk {
|
||||
DhookCodeChunk(uint8_t* addr, size_t bytes)
|
||||
: address(addr)
|
||||
, bytes(bytes) {
|
||||
}
|
||||
|
||||
uint8_t pool[sizeof(ke::RefPtr<DhookCodePool>)];
|
||||
uint8_t* address;
|
||||
size_t bytes;
|
||||
};
|
||||
@@ -29,6 +29,8 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "bandaid.h"
|
||||
|
||||
#include "vhook.h"
|
||||
#include "vfunc_call.h"
|
||||
#include "util.h"
|
||||
@@ -175,8 +177,16 @@ void *GenerateThunk(HookSetup* hook)
|
||||
masm.pop(ebp); // restore ebp
|
||||
masm.ret();
|
||||
|
||||
void *base = g_pSM->GetScriptingEngine()->AllocatePageMemory(masm.length());
|
||||
masm.emitToExecutableMemory(base);
|
||||
void* base = smutils->GetScriptingEngine()->AllocatePageMemory(masm.total_size());
|
||||
DhookCodeChunk chunk((uint8_t*)base, masm.total_size());
|
||||
|
||||
// Can't let dtor call happen
|
||||
LinkedCode* code = (LinkedCode*)new uint8_t[sizeof(LinkedCode)];
|
||||
*((DhookCodeChunk*)&code->chunk) = chunk;
|
||||
masm.emitToExecutableMemory(code);
|
||||
|
||||
delete[] (uint8_t*)code;
|
||||
|
||||
return base;
|
||||
}
|
||||
#else
|
||||
@@ -215,8 +225,15 @@ void *GenerateThunk(HookSetup* hook)
|
||||
masm.addl(esp, ecx); // remove arguments
|
||||
masm.jmp(edx); // return to caller
|
||||
|
||||
void *base = g_pSM->GetScriptingEngine()->AllocatePageMemory(masm.length());
|
||||
masm.emitToExecutableMemory(base);
|
||||
void* base = smutils->GetScriptingEngine()->AllocatePageMemory(masm.total_size());
|
||||
DhookCodeChunk chunk((uint8_t*)base, masm.total_size());
|
||||
|
||||
// Can't let dtor call happen
|
||||
LinkedCode* code = (LinkedCode*)new uint8_t[sizeof(LinkedCode)];
|
||||
*((DhookCodeChunk*)&code->chunk) = chunk;
|
||||
masm.emitToExecutableMemory(code);
|
||||
|
||||
delete[] (uint8_t*)code;
|
||||
return base;
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
Submodule sourcepawn updated: 3793034233...b8a9293064
Reference in New Issue
Block a user