mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-14 16:07:39 +00:00
GRIM: LUA: Restore original callhooks
This commit is contained in:
parent
962d676346
commit
0375a44f66
@ -137,15 +137,13 @@ static StkId callC(lua_CFunction f, StkId base) {
|
||||
CS->num = numarg;
|
||||
CS->lua2C = base;
|
||||
CS->base = base + numarg; // == top - stack
|
||||
if (lua_callhook) {
|
||||
TObject *r = lua_state->stack.stack + base - 1;
|
||||
(*lua_callhook)(Ref(r), "(C)", -1);
|
||||
}
|
||||
if (lua_callhook)
|
||||
luaD_callHook(base, nullptr, 0);
|
||||
lua_state->callLevelCounter++;
|
||||
(*f)(); // do the actual call
|
||||
lua_state->callLevelCounter--;
|
||||
// if (lua_callhook) // func may have changed lua_callhook
|
||||
// (*lua_callhook)(LUA_NOOBJECT, "(return)", 0);
|
||||
if (lua_callhook) // func may have changed lua_callhook
|
||||
luaD_callHook(base, nullptr, 1);
|
||||
firstResult = CS->base;
|
||||
*CS = oldCLS;
|
||||
return firstResult;
|
||||
|
@ -243,6 +243,8 @@ static void adjust_varargs(StkId first_extra_arg) {
|
||||
|
||||
StkId luaV_execute(lua_Task *task) {
|
||||
if (!task->executed) {
|
||||
if (lua_callhook)
|
||||
luaD_callHook(task->base, task->tf, 0);
|
||||
luaD_checkstack((*task->pc++) + EXTRA_STACK);
|
||||
if (*task->pc < ZEROVARARG) {
|
||||
luaD_adjusttop(task->base + *(task->pc++));
|
||||
@ -660,6 +662,8 @@ callfunc:
|
||||
task->S->top = task->S->stack + task->base;
|
||||
// fall through
|
||||
case RETCODE:
|
||||
if (lua_callhook)
|
||||
luaD_callHook(task->base, nullptr, 1);
|
||||
lua_state->callLevelCounter--;
|
||||
return (task->base + ((task->aux == RETCODE) ? *task->pc : 0));
|
||||
case SETLINEW:
|
||||
|
Loading…
x
Reference in New Issue
Block a user