docs: complete reference for pak architecture, capabilities and limits - #13
Merged
Merged
Conversation
PAKS.md was inherited from upstream as an emulator-pak authoring tutorial. It never documented the execution model, the environment paks run in, tool paks, or what paks can and cannot reach — the questions authors actually hit first. Expanded it into a full reference: - the exit-and-handoff launch model, which explains nearly every limitation (the launcher terminates before a pak starts; /tmp/next is consumed and removed by the boot loop, so paks cannot chain-launch through it) - complete environment variable table, PATH/LD_LIBRARY_PATH, CPU governor, and the daemons that stay resident across launches - tool paks: example, visibility rules (dot-prefix, .disabled, map.txt), and renaming via map.txt - emulator pak resolution order, documenting that a user pak in /Emus/<platform>/ overrides a built-in of the same tag - capabilities: helper binaries, settings via minuisettings.txt/nextval.elf, drop-in assets, and the hardcoded Settings/Pak Store/FN integrations - an explicit "what paks cannot do" section - lifecycle: the .system-wiped/.userdata-persists asymmetry and the orphaned-file problem that follows from it - debugging and platform/pixel-format caveats HOOKS.md corrections against run_hooks.sh: - "scripts run in alphabetical order" was misleading; they are *started* in glob order but run concurrently unless named *.sync.sh - documented HOOK_CATEGORY, which run_hooks.sh exports but the doc omitted - HOOK_PHASE does not identify the event: pre-launch.d and pre-sleep.d both report "pre", so HOOK_CATEGORY is the only disambiguator - the HOOK_CMD/TYPE/EMU_PATH/ROM_PATH/LAST variables are set only for the launch phases, not for boot.d or the sleep phases - the runner waits on background hooks, so backgrounding does not make a slow hook free - sleep hooks do not fire on desktop, which has no bin/suspend - pre-sleep.d runs with network up, post-resume.d runs before it returns Also added hook installation guidance, since hooks live in .userdata/ and survive both updates and pak deletion. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2BibaMPDtFk7S3NYywZE
Follows the rebrand in #3 so the pak docs don't stay on the old name once it merges. Renames references to this OS and its behavior, and keeps "NextUI" for the four places it is still the correct name: - a compatibility note up top: nexterUI keeps the pak format unchanged, so paks built for NextUI work here as-is and this document applies to both - IS_NEXT is set by both nexterUI and NextUI, so it detects the lineage rather than the fork; nothing in the environment separates the two - the third-party support caveat, which is true of upstream and MinUI too Also replaced a "NextUI-only features" code comment with "not available on stock MinUI", which is what the IS_NEXT guard actually means. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2BibaMPDtFk7S3NYywZE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation only — no code changes.
PAKS.mdwas inherited from upstream as an emulator-pak authoring tutorial. It used$BIOS_PATH,$CORES_PATHand$LOGS_PATHin its examples without ever defining them, gave tool paks a single sentence, and never described the execution model — which is what actually explains most of what paks can and cannot do.HOOKS.mdwas in better shape but had several claims that don't matchrun_hooks.sh.PAKS.md
Expanded into a full reference. New material:
/tmp/next, sets its quit flag and terminates; the shell loop inMinUI.pak/launch.shruns the pak and re-execs the launcher afterward. Includes the consequence that a pak cannot chain-launch through/tmp/next, since the loop doesrm -f $NEXT_PATHaftereval $CMDreturns — the emulator has to be exec'd directly.HOMEis not exported ondesktop, andDEVICEis only set ontg5050when the model string matches, so it can legitimately be empty.hide(): dot-prefix,.disabledsuffix,map.txt. The.disabledconvention is howRemove Loading.pakself-uninstalls but wasn't written down anywhere.getEmuPath()checks/Emus/<platform>/before the built-in pak, so a user pak overrides a built-in of the same tag. That's the supported way to customize a stock emulator without touching.system/, and it was undocumented.minuisettings.txt/nextval.elf, drop-in assets, and the hardcodedSettings/Pak Store/ FN-button integrations.nextui.c..systemwiped /.userdatapersists asymmetry and the orphaned-file problem that follows from it.Also
default-<device>.cfgprecedence overdefault.cfg, and the-option prefix that sets a value and hides it, both of which were only visible in the source.HOOKS.md
Four corrections against the implementation:
*.sync.shfiles are ordered — a suffix the doc never mentioned, along with--sync-only.HOOK_CATEGORYwas undocumented despite being exported byrun_hooks.sh. This matters becauseHOOK_PHASEdoes not identify the event — it's derived from the directory prefix, sopre-launch.dandpre-sleep.dboth reportpre.HOOK_CATEGORYis the only disambiguator.HOOK_CMD/HOOK_TYPE/HOOK_EMU_PATH/HOOK_ROM_PATH/HOOK_LASTvariables are set only for the launch phases. They're populated byparse_hook_cmd()on the launch path, so they are unset inboot.d,pre-sleep.dandpost-resume.d. The table presented them as universal.waits on everything before returning. The doc said "keep hooks fast" without the reason, which read as advice rather than a constraint.Added: sleep hooks never fire on
desktop(nobin/suspend);pre-sleep.druns with wifi and bluetooth still up whilepost-resume.druns before they're restarted; hook installation guidance, since hooks live in.userdata/and survive both updates and pak deletion with nothing running on uninstall to clean them up.Naming
Second commit renames OS references to nexterUI so these docs don't stay on the old name once #3 merges. "NextUI" is kept in the four places it's still correct:
IS_NEXT, which is set by both, so it detects the lineage rather than the fork — nothing in the environment separates the twoA
# NextUI-only featurescode comment became# not available on stock MinUI, which is what theIS_NEXTguard actually means.Conflicts
None. Test-merged clean against all three open PR heads both before and after the rename; none of them touch
PAKS.mdorHOOKS.md. Based onmainrather than stacked on the others, since it's independent of all of them and shouldn't have to wait on the chain.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hu2BibaMPDtFk7S3NYywZE