TASEmulators / TASEmulators/BizHawk
Allow Lua scripts to control TAStudio state capture
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 468
- PR merge metrics
- No merged PRs in 30d
Description
I think it would be useful if Lua scripts could control when savestates are captured in TAStudio. My immediate use case is poking RAM to disable rendering in melonDS while doing long auto-restore seeks, and preventing TAStudio from capturing states where rendering is disabled. (Yes I know this has potential to cause desyncs if used in certain situations.)
Although my particular use case only requires a way for Lua to prevent state capture, it may be worthwhile to give Lua full control to enable other possible use cases as well. This could take the form of a pair of callbacks:
bool? CaptureOverride(frame)If return value istrue, force capture. Iffalse, do not capture. Ifnil, run regular capture logic.int RemoveState()Similar toPagedStateManager.FreePage, but returns a frame number. The state on the given frame will be removed. If there is no state on that frame, regular state removal logic will be used.
As-is, support for CaptureOverride returning true will only be useful when used in combination with RemoveState because force-captured states are quickly removed once more states are force-captured. We could also address this by making Lua-forced captures go in the "new states" group.
Support will be limited to PagedStateManager. ZwinderStateManager cannot accept out-of-order states, so it is not always possible to force capture.
Other potential use cases could be not capturing during loading screens, capturing based on in-game events, or making it easier for users to manage states for cores that don't automatically capture states.
Thoughts?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading PagedStateManager and ZwinderStateManager, then trace how TAStudio decides when to capture and remove states and how Lua callbacks are exposed. Done requires a settled callback/API design that respects PagedStateManager's ordering constraints and covers the requested capture and removal behavior; the issue names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, lua
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100