Conversation
|
I was literally about to start on this, great timing! |
|
Some quick thoughts:
|
|
Should probably just handle auto.sh and have that be an |
|
I've implemented the suggestions and vibed a little demo app: I had it generate the documentation based on my changes so that I can at least show off where I'm going with it. The demo pakz is functional but need the updated scripts to function. Open to suggestions. The hooks themselves are not vibed, but I still need to validate further and do a lot of testing. |
|
I have updated the README on https://github.com/Helaas/nextui-hooks-examples with details on all 20 tests. All 20 tests look fine on tg5040 & tg5050. |
|
Do we have any paks today that would profit? Syncthing I guess? Theres a handful of PRs that would make a good alpha build to collect some feedback on. I'm thinking this one, the governor changes and maybe the new color selection sliders. Potentially offline achievements, too. |
|
Shortcuts needs it to enable X to resume from main menu, branch with a working implementation already exists here: https://github.com/Helaas/nextui-shortcuts-pak/tree/resume-hooks K-Wall expressed interest in incorporating in into Grout on Discord yesterday or the day before. I know Savant wanted a Hook system too but unsure for what exactly |
Launch Hooks
This has been suggested a few times in the Discord so I thought I would do a more formal pitch.
I'm currently adding a feature the Shortcuts pak that allow X to Resume to work. What this basically does is sync the states to proper location so that the existing NextUI code picks this up.
The idea
Hooks are platform-specific, just like paks. The launcher reads them from:
On device,
USERDATA_PATHresolves to:So the actual hook directories on device are:
Example installed hook path:
If these directories don't exist, nothing happens and there is no overhead.
Environment variables
Hook scripts inherit all standard NextUI environment variables (
SDCARD_PATH,PLATFORM,USERDATA_PATH,SHARED_USERDATA_PATH, etc.) plus these launch-specific ones:HOOK_PHASEpreorpostHOOK_TYPEromorpakHOOK_CMDHOOK_EMU_PATHlaunch.shHOOK_ROM_PATHHOOK_LAST/tmp/last.txt(the last selected menu entry)These can then be used by the underlying Pak to ingest information about the hook that just occurred.
Writing a hook script
A hook script is any executable
.shfile in one of the hook directories. Scripts run in alphabetical order.Rules
Example: sync after ROM exit
See also my resume-hook branch within Shortcuts for an example implementation that uses this system.
Other thoughts