ScriptFunctionBinding_t: light cleanup and map out more fields

This commit is contained in:
Kawe Mazidjatari 2022-09-22 17:07:36 +02:00
parent 7818385fa0
commit 4cda4371cb
3 changed files with 24 additions and 5 deletions

View File

@ -21,15 +21,18 @@
// *functor - // *functor -
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
SQRESULT Script_RegisterFunction(CSquirrelVM* s, const SQChar* scriptname, const SQChar* nativename, SQRESULT Script_RegisterFunction(CSquirrelVM* s, const SQChar* scriptname, const SQChar* nativename,
const SQChar* helpstring, const SQChar* returntype, const SQChar* parameters, void* functor) const SQChar* helpstring, const SQChar* returntype, const SQChar* parameters, SQFunctor* functor)
{ {
ScriptFunctionBinding_t* binding = MemAllocSingleton()->Alloc<ScriptFunctionBinding_t>(sizeof(ScriptFunctionBinding_t)); ScriptFunctionBinding_t* binding = MemAllocSingleton()->Alloc<ScriptFunctionBinding_t>(sizeof(ScriptFunctionBinding_t));
memset(binding, '\0', sizeof(ScriptFunctionBinding_t));
binding->_scriptname = scriptname; binding->_scriptname = scriptname;
binding->_nativename = nativename; binding->_nativename = nativename;
binding->_helpstring = helpstring; binding->_helpstring = helpstring;
binding->_returntype = returntype; binding->_returntype = returntype;
binding->_parameters = parameters; binding->_parameters = parameters;
binding->_functor = functor; binding->_functor = functor;
binding->_nparamscheck = 5;
SQRESULT results = v_Script_RegisterFunction(s, binding, 1); SQRESULT results = v_Script_RegisterFunction(s, binding, 1);
MemAllocSingleton()->Free<ScriptFunctionBinding_t>(binding); MemAllocSingleton()->Free<ScriptFunctionBinding_t>(binding);

View File

@ -12,7 +12,7 @@ struct ScriptFunctionBinding_t
std::int16_t unk28; // 28 std::int16_t unk28; // 28
std::int16_t padding1; // 2A std::int16_t padding1; // 2A
std::int32_t unk2c; // 2C std::int32_t unk2c; // 2C
std::int64_t unk30; // 30 const SQChar* _codehook; // 30
std::int32_t unk38; // 38 std::int32_t unk38; // 38
SQInteger _nparamscheck; // 3C SQInteger _nparamscheck; // 3C
std::int64_t unk40; // 40 std::int64_t unk40; // 40
@ -20,12 +20,27 @@ struct ScriptFunctionBinding_t
std::int64_t unk50; // 50 std::int64_t unk50; // 50
std::int32_t unk58; // 58 std::int32_t unk58; // 58
std::int32_t padding3; // 5C std::int32_t padding3; // 5C
void* _functor; // 60 SQFunctor* _functor; // 60
ScriptFunctionBinding_t() ScriptFunctionBinding_t()
{ {
memset(this, '\0', sizeof(ScriptFunctionBinding_t)); _scriptname = nullptr;
this->_nparamscheck = 6; _nativename = nullptr;
_helpstring = nullptr;
_returntype = nullptr;
_parameters = nullptr;
unk28 = 0;
padding1 = 0;
unk2c = 0;
_codehook = nullptr;
unk38 = 0;
_nparamscheck = 6;
unk40 = 0;
unk48 = 0;
unk50 = 0;
unk58 = 0;
padding3 = 0;
_functor = nullptr;
} }
}; };

View File

@ -18,6 +18,7 @@ typedef char SQChar;
typedef float SQFloat; typedef float SQFloat;
typedef long SQInteger; typedef long SQInteger;
typedef unsigned long SQUnsignedInteger; typedef unsigned long SQUnsignedInteger;
typedef void* SQFunctor;
typedef SQUnsignedInteger SQBool; typedef SQUnsignedInteger SQBool;
typedef SQInteger SQRESULT; typedef SQInteger SQRESULT;