mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
VScript: add CSquirrelVM::ExecuteFunction()
Executes script code by function handle.
This commit is contained in:
parent
42a8edc4cd
commit
183a6e9c35
@ -106,9 +106,24 @@ SQRESULT CSquirrelVM::RegisterConstant(const SQChar* name, SQInteger value)
|
||||
// Input : *name -
|
||||
// Output : true on success, false otherwise
|
||||
//---------------------------------------------------------------------------------
|
||||
bool CSquirrelVM::ExecuteCodeCallback(const SQChar* const callbackName)
|
||||
bool CSquirrelVM::ExecuteCodeCallback(const SQChar* const name)
|
||||
{
|
||||
return CSquirrelVM__ExecuteCodeCallback(this, callbackName);
|
||||
return CSquirrelVM__ExecuteCodeCallback(this, name);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: executes a function by handle
|
||||
// Input : hFunction -
|
||||
// *pArgs -
|
||||
// nArgs -
|
||||
// *pReturn -
|
||||
// hScope -
|
||||
// Output : SCRIPT_DONE on success, SCRIPT_ERROR otherwise
|
||||
//---------------------------------------------------------------------------------
|
||||
ScriptStatus_t CSquirrelVM::ExecuteFunction(HSCRIPT hFunction, void** pArgs, unsigned int nArgs, void* pReturn, HSCRIPT hScope)
|
||||
{
|
||||
// NOTE: pArgs and pReturn are most likely of type 'ScriptVariant_t', needs to be reversed.
|
||||
return CSquirrelVM__ExecuteFunction(this, hFunction, pArgs, nArgs, pReturn, hScope);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
|
@ -25,12 +25,14 @@ public:
|
||||
SQRESULT RegisterFunction(const SQChar* scriptname, const SQChar* nativename, const SQChar* helpstring, const SQChar* returntype, const SQChar* parameters, void* functor);
|
||||
SQRESULT RegisterConstant(const SQChar* name, SQInteger value);
|
||||
|
||||
bool ExecuteCodeCallback(const SQChar* const callbackName);
|
||||
bool ExecuteCodeCallback(const SQChar* const name);
|
||||
|
||||
FORCEINLINE HSQUIRRELVM GetVM() const { return m_hVM; }
|
||||
FORCEINLINE SQCONTEXT GetContext() const { return m_iContext; }
|
||||
FORCEINLINE eDLL_T GetNativeContext() const { return (eDLL_T)GetContext(); }
|
||||
|
||||
ScriptStatus_t ExecuteFunction(HSCRIPT hFunction, void** pArgs, unsigned int nArgs, void* pReturn, HSCRIPT hScope);
|
||||
|
||||
private:
|
||||
bool unk_00;
|
||||
SQChar pad0[7];
|
||||
@ -78,7 +80,9 @@ inline bool(*CSquirrelVM__PrecompileClientScripts)(CSquirrelVM* vm, SQCONTEXT co
|
||||
#ifndef CLIENT_DLL
|
||||
inline bool(*CSquirrelVM__PrecompileServerScripts)(CSquirrelVM* vm, SQCONTEXT context, char** scriptArray, int scriptCount);
|
||||
#endif
|
||||
inline ScriptStatus_t(*CSquirrelVM__ExecuteFunction)(CSquirrelVM* s, HSCRIPT hFunction, void** pArgs, unsigned int nArgs, void* pReturn, HSCRIPT hScope);
|
||||
inline bool(*CSquirrelVM__ExecuteCodeCallback)(CSquirrelVM* s, const SQChar* callbackName);
|
||||
|
||||
inline bool(*CSquirrelVM__ThrowError)(CSquirrelVM* vm, HSQUIRRELVM v);
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
@ -136,6 +140,7 @@ class VSquirrel : public IDetour
|
||||
#ifndef DEDICATED
|
||||
LogFunAdr("CSquirrelVM::PrecompileClientScripts", CSquirrelVM__PrecompileClientScripts);
|
||||
#endif // !DEDICATED
|
||||
LogFunAdr("CSquirrelVM::ExecuteFunction", CSquirrelVM__ExecuteFunction);
|
||||
LogFunAdr("CSquirrelVM::ExecuteCodeCallback", CSquirrelVM__ExecuteCodeCallback);
|
||||
LogFunAdr("CSquirrelVM::ThrowError", CSquirrelVM__ThrowError);
|
||||
}
|
||||
@ -155,6 +160,7 @@ class VSquirrel : public IDetour
|
||||
// cl/ui scripts.rson compiling
|
||||
g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? 44 0F B6 F0 48 85 DB").FollowNearCallSelf().GetPtr(CSquirrelVM__PrecompileClientScripts);
|
||||
#endif
|
||||
g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? 83 FB 5C").FollowNearCallSelf().GetPtr(CSquirrelVM__ExecuteFunction);
|
||||
g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? C6 47 1C 01").FollowNearCallSelf().GetPtr(CSquirrelVM__ExecuteCodeCallback);
|
||||
g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? BB ?? ?? ?? ?? 8B C3").FollowNearCallSelf().GetPtr(CSquirrelVM__ThrowError);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user