Skip to content

Lua cannot unpause when user presses frame advance key #4591

@SuuperW

Description

@SuuperW

Summary

The frame advance key pauses, and this happens after Lua has run for the frame that was advanced.

Repro

Run this Lua script:

while true do
	client.unpause()
	emu.frameadvance()
end

Observe that the frame advance key still causes emulation to pause, and this is true even when already paused: Lua cannot unpause on frame advance. A user frame advancing through a movie will want their Lua script to be able to conditionally unpause (e.g. to enable Lua-based seeking).

This is a unexpected behavior that has existed for a long time, but was unreported and perhaps unknown until #4347.

Related to this, is the question of whether the above Lua script should keep emulation unpaused when the user presses the pause button. After all, it would make sense if client.unpause(); emu.frameadvance(); always triggered a frame advance.

An alternative solution for the particular use case that uncovered this issue might be to introduce a new Lua method that does what emu.frameadvance suggests in its name: actually trigger a frame advance. This would still need to be done in a way that does not pause emulation. And regardless of if we do that, I think Lua should be able to unpause after a frame advance.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions