Skip to content

Frontend folder: every game you build shows up in Cocoon and other frontends (#475) - #681

Draft
davdxpx wants to merge 1 commit into
igawa6:mainfrom
davdxpx:frontend-folder
Draft

davdxpx wants to merge 1 commit into
igawa6:mainfrom
davdxpx:frontend-folder

Conversation

@davdxpx

@davdxpx davdxpx commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

What and why

Closes #475.

A frontend such as Cocoon lists files. A game you built in Peanuts often has no file of its own it could list: it is a dump folder, or a .nup kept inside the app. Until now, the only way into a frontend's list was one pinned shortcut per game.

Settings › Library › Frontend folder fixes that. Pick a folder once, and every game that is ready to play shows up in the frontend on its next rescan. The frontend finds the cover and details by the game's name, and starting it there starts the game in this app.

1. The entries

  • One small file per game: <game name> [<title ID>].nutshell, for example Pokémon Legends Z-A [0100F43008C44000].nutshell. Characters a file name cannot hold on shared storage are left out.
  • The text has two lines: Peanuts Native <application ID> and the title ID. The first line is how the app knows the file is its own. The second still starts the game after someone renamed the file.

2. When they change

  • A game gets its entry once its build is finished and it is ready to play.
  • The entry goes when the game leaves Home, and it is renamed when the game's name changes.
  • Picking the folder adds every game at once. Picking another folder moves the entries.
  • While the game is on Home, its entry stays, even when the game needs something again (shaders after an app update). So the frontend keeps the entry and its play time. Starting it then opens Home with the game.

3. Only its own files

  • The app changes only files whose text carries its marker and its application ID. It never touches another app's file, another Peanuts app's entries, a file of the same name, or anything in a subfolder.
  • Turn off in the row's sheet asks first, then takes the app's entries out of the folder. Games, builds and saves stay.

4. Starting an entry

  • The frontend sends an entry like any game file: by the extra game with its path, or as ACTION_VIEW with its URI. Both aliases take it, upstream's Launch and dev.peanuts.launch.LaunchActivity.
  • FrontendLaunch reads the title ID from the name, or from the text if the name has none, and then does what a home screen shortcut does. A ready game starts at once. Anything else opens Home with the game.
adb shell am start -n dev.nxnative.android.peanuts/dev.nxnative.android.peanuts.Launch -e game "/storage/emulated/0/ROMs/switch/Pokémon Legends Z-A [0100F43008C44000].nutshell"
  • For a frontend's player, nutshell goes beside nup in its file extensions.

5. The row

  • It sits in Library › Folders, after Build folders. Its value is the folder and the number of games in it.
  • When something is wrong, the row says what: waiting for All files access, the folder is gone, or a game could not be written.
  • The app writes entries by their path, so it needs All files access, as it does for the games. A folder that is not on the phone (a cloud provider) is refused with a hint to pick one on the phone or its SD card.

Code

  • New dev.peanuts.launch.FrontendEntry, plain Java: the names, the text, and the title ID from a name or a text.
  • New dev.peanuts.launch.FrontendFolder: the sync runs on one thread, after Home's list is saved (through its games preferences), after Home is first drawn, after a scan, after a build, and when a folder is picked. It also gives FrontendLaunch an entry's title ID.
  • LibrarySettings, SettingsSections, SettingsHelp: the row, its sheet and its explanation (request code 74). PeanutsPrefs.frontendDir.
  • Library and BuildService: one call each to bring the folder up to date.
  • Upstream: one marked line in FrontendLaunch.onCreate (PEANUTS.md, peanuts/UPSTREAM-EDITS.md Round 66).
  • peanuts/docs/LAUNCHERS.md: a "Frontend folder" section.
  • Support for multiple game folders #546 reworks Library › Folders into one folder list. Whichever of the two lands second moves this row into the other's shape.

Tested

  • peanuts/tests/test_frontend_folder.py, with the new FrontendEntryJvmTest: the names (characters taken out, long names cut but never the title ID), the title ID from a name or from a renamed entry's text, and another app's text left alone.
  • Its source checks: the hook's place, the places that run the sync, that only the app's own files are deleted or renamed, and the row. The settings tests pass.
  • check-min-api.py on the APK: nothing newer than API 33.
  • check-publish.sh and upstream-update.sh --check pass.

…ontends

Settings › Library › Frontend folder: pick a folder, and the app keeps one
small entry per game that is ready to play, named
"<game name> [<title ID>].nutshell". A frontend such as Cocoon lists the
entries as games on its next rescan and starts them through the launch alias,
as it does a .nup. A game Peanuts built often has no file of its own to list
(a dump folder, a .nup inside the app), so a pinned shortcut per game was the
only way into a frontend's list until now.

- An entry appears once a build has made the game ready to play, goes when
  the game leaves Home, and is renamed when the game's name changes. Picking
  the folder adds every game at once.
- The app changes only its own entries (their text carries its marker and
  application ID), never another file in the folder or a subfolder. Turn off
  takes its entries out again.
- Starting an entry is a title-ID launch (one marked line in FrontendLaunch),
  so it behaves as a home screen shortcut: a ready game starts at once,
  anything else opens Home with the game.

Closes igawa6#475
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Game Shortcuts saved to Folder for Automatic Detection for Frontends like Cocoon Shell

1 participant