Bump SourcePawn submodule (#2428)

This commit is contained in:
Benoist
2026-03-31 23:28:34 +02:00
committed by GitHub
parent b697537378
commit 59ecab555b
6 changed files with 71 additions and 9 deletions
+6
View File
@@ -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)
+1
View File
@@ -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();
+19 -4
View File
@@ -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;
}
+23
View File
@@ -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;
};
+21 -4
View File
@@ -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