This commit is contained in:
lenheart
2024-08-03 10:17:08 +08:00
parent 0f744352cb
commit 92943e89c8
4 changed files with 376 additions and 94 deletions

View File

@@ -287,6 +287,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
else if (packet_id == 255)
{
std::lock_guard<std::recursive_mutex> lock(SqMtx);
SQBool R = true;
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
sq_pushroottable(v); // pushes the global table
@@ -296,9 +297,12 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
sq_pushroottable(v); // push the 'this' (in this case is the global table)
sq_pushuserpointer(v, user);
sq_pushinteger(v, int(*(int *)(packet_src + 0x0D)));
sq_call(v, 3, SQFalse, SQTrue); // calls the function
sq_call(v, 3, SQTrue, SQTrue); // calls the function
sq_getbool(v, -1, &R);
}
sq_settop(v, top); // restores the original stack size
if (!R)
return 0;
}
// 返回选择角色
else if (packet_id == 7)