emulators.lichii
Lichii (Nintendo Switch and Switch 2) launcher: ROM resolution, config patching, SIGTERM shutdown.
Lichii (Nintendo Switch and Switch 2) launcher: ROM resolution, config patching, SIGTERM shutdown.
Lichii is a fork of Eden, and this module copies eden rather than sharing
code with it, so a change here cannot move Eden. The two keep separate
config, data and save trees (lichii/ beside eden/) and separate archives.
Lichii is experimental: the image pins one build, and the behaviour below was
read from that build's source (tag build-341).
Lichii has no save states and no external control API. Persistence is the
game's own save data, which the emulated game commits directly to host files
under the virtual NAND (nand/user/save/...). Save paths are keyed by the
Switch profile UUID, so the profile store (nand/system/save/8000000000000010)
ships with the saves; that way a save archive restored into a fresh
container brings its matching profile along and the paths line up. Exit
restamps both so the delta dump takes each save unit whole rather than the
few files the game happened to rewrite (see Lichii.save_and_exit).
Declared imports (import_spec, place_import, validate_import_plan)
take a NAND export as it sat: a save unit at nand/user/save/<space>/<user>/<title>
and, for an account save, the profile store beside it. See
docs/content/docs/api/imports.mdx for the shapes.
Shutdown: Lichii's Qt frontend routes SIGTERM through the event loop into a
normal window close (graceful emulation teardown). SIGINT is _exit(1) in
Lichii, so the broker never sends it. The close path pops a confirmation
dialog unless the confirmStop UI setting is Ask_Never, so that is patched
before every launch.
First launch: Lichii offers to import a legacy profile (Eden, Citron, Sudachi,
Suyu or yuzu) whenever one of their data directories exists beside its own and
it has no import decision on record. In the webstation Eden's always does once
Eden has run, and the prompt is a modal no one in a streamed session can
answer. So every launch first records "start fresh" the way Lichii's own
button does (_mark_import_fresh). Eden's data is never imported.
attributelog= logging.getLogger(__name__)attributeROM_ROOT= Path(os.environ.get('ROM_ROOT', '/romm'))Library root a resolved ROM must live under (env ROM_ROOT, default /romm).
attributeCONFIG_DIR= xdg_config_dir('lichii')Lichii's config directory, holding the qt-config.ini the broker patches.
Not configurable, and deliberately: nothing on Lichii's command line names it, so
an override would move only the copy the broker writes and leave Lichii reading
its own. launch exports the root this resolved to instead.
attributeDATA_DIR= xdg_data_dir('lichii')Lichii's data directory holding the virtual NAND, which is also the save root.
Not configurable, for the same reason as CONFIG_DIR, and with more at stake:
an override here would point the save dump and restore at a tree Lichii does not
write to, which loses saves without reporting anything.
attributeINI_PATH= CONFIG_DIR / 'qt-config.ini'The qt-config.ini patched before every launch.
attributeIMPORT_STATE_DIR= DATA_DIR.parent / 'lichii.migration'Where Lichii records its legacy profile import decision, beside its data directory.
Lichii names it <data dir>.migration. A complete or fresh file there means
the decision is made; pending or journal means an import was interrupted.
attributeLICHII_LOG_PATH= Path(os.environ.get('LICHII_LOG_PATH', '/config/lichii.log'))The emulator log file (env LICHII_LOG_PATH, default /config/lichii.log).
attributeSAVE_DIR= DATA_DIR / 'nand' / 'user' / 'save'The virtual NAND's user save tree, laid out <save space id>/<user id>/<title id>.
Account saves key the middle level by profile UUID; device saves use an all-zero one, and cache and bcat storage use their own names there. Every kind ends in a title id directory, which is the unit a save is dumped as.
attributePROFILE_STORE_DIR= DATA_DIR / 'nand' / 'system' / 'save' / '8000000000000010'The system save holding the Switch profile list.
attributeROM_EXTENSIONS= ('.nup', '.xci', '.nsp', '.nca', '.nro')Formats Lichii's loader boots directly, best first; a folder holding several picks by this order.
A .nup leads: a Lichii NUP package is the base game with its newest update already merged.