Skip to content

In-game menus Part A: Everything about the session one press away, the game's settings beside it - #678

Open
davdxpx wants to merge 12 commits into
igawa6:mainfrom
davdxpx:ingame-menus
Open

davdxpx wants to merge 12 commits into
igawa6:mainfrom
davdxpx:ingame-menus

Conversation

@davdxpx

@davdxpx davdxpx commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Today the game has one side panel with five text tabs, and Pause, Stop and Back to the game sit at the bottom of its last tab. This PR gives the game two menus, as a console has them: the game menu at the left for this session (back to the game, pause, back up the save, button mapping, share log, stop), and the quick menu at the right for what tunes the running game (Performance, Display, Cheats, Mods, Controls). The game keeps running behind both, and every live change shows at once.

Builds on #677 (cheats as .mncf), on main 0.1.8.

What players get

  • Home opens the game menu, Home held opens the quick menu. − and + held, Back and a swipe in from the left edge open the game menu too; a swipe in from the right edge and a long press on the on-screen controls' button open the quick menu. Home again closes either.
  • On the AYN Thor, whose Home belongs to Android (it goes to the launcher and closes the game), the controller's Back does what Home does: pressed the game menu, with the selection shown at once, held the quick menu. When a tool of the system's takes Back held for itself (a screen swap), Back still opens the game menu with the selection, and its Quick menu row opens the quick menu.
  • The game menu shows the game's cover, name, version and how long this session has run. Its rows: Back to the game, Pause the game, Quick menu, Back up the save, Button mapping, Share log. Stop the game sits apart at the bottom with the power sign and asks once, inline, with Keep playing first.
  • Back up the save while playing. The save the game runs on is copied where Back up saves puts its copies, checked before and after the copy. The host writes a save only at the game's Commit, by an atomic swap, so a Commit during the copy fails it, and it is tried again.
  • The quick menu has its tabs on a rail of icons at the left: Performance, Display, Cheats, Mods, Controls, and the menu's own settings at the bottom. Cheats and Mods are two tabs now, each only when the game has some: cheats act at once and have values, mods mostly apply at the next start. The selected tab is a block across the rail that slides to the next one. Up and down on the rail switch the tab at once, right goes into the rows, left comes back. A header with Back and the tab's name; B goes back to the game menu when that opened the quick menu.
  • A calmer, clearer look: section heads in capitals, short choices as one segmented control, switches at the row's end, a slider's value at its right, a bolder icon set for the menus (the same icons as the rest of the app, a step heavier, the seed still banana yellow).
  • Made for a controller, like a console's menus: the yellow focus frame keeps clear of the text and shows on every row and choice; the focus lands on the chosen value of a choice, not the nearest one; right from the rail goes into the rows, left from any row back to the tab on the rail; a tab's own action sits in its header with its button (the Cheats tab's X All off) instead of taking a row; a Value cheat's − and + always fit, also in the small menu size.
  • Feel: a fine vibration tick for each step and a firmer one for a choice, through the app's own haptics (it follows the system's touch feedback, battery saver and heat), and optional soft menu sounds. Both in the menu's own settings: Vibrate on each step (on) and Menu sounds (off).
  • Smooth motion: in 240 ms, decelerating, out 180 ms, on hardware layers, so the game's frames are not touched.

Pictures

The game menu (Home) Stop asks once The quick menu (Home held)
01-game-menu 02-stop-question 03-quick-menu
Cheats: All off in the header Mods The menu's own settings
04-cheats 05-mods 06-menu-settings
A choice with the controller's focus Opening and closing (clip)
07-short-choice 08-open-close

How it is built

Upstream's SidePanel stays the quick menu and keeps building its tabs. A few one-line hooks, each marked PEANUTS, hand its sheet to the rail, its tab bar to the rail, its open and close to the new motion, and what it built to the place it moved to. GameActivity gets the game menu and the keys that open it. All new code is Peanuts' own: dev.peanuts.ingame (GameMenu, Rail, Look), dev.peanuts.ui.MenuFeel and InGamePanel in the launcher's package, as ModsPanel. PEANUTS.md and peanuts/UPSTREAM-EDITS.md list every hook.

Tested

  • Thor, test app, Pokémon Legends: Z-A on a copy of the save: the controller's Back opens the game menu with the selection shown, its first D-pad press moves it; Home pressed and held on a controller with Home (BTN_MODE); this session's time in the header; Stop asks inline with Keep playing first; the quick menu over the game, L and R step the tabs, B goes back to the game menu; the focus lands on the chosen choice; each step asks the system for its tick (dumpsys vibrator_manager lists them; the Thor's own Vibration setting was off, so the system dropped them, as it should).
  • Emulator (dual-screen Thor AVD, and at phone size): the game menu opens and moves with the D-pad from the first press; Stop asks inline; the quick menu's rail switches tabs with up and down, right goes into the rows, left comes back; B goes back to the game menu when that opened it; tabs by touch; Back; a swipe in from the left edge opens the game menu (kept out of the system's back gesture); at phone size the header and Stop stay while the rows scroll.
  • peanuts/tests/test_ingame_menus.py (also the feel and the console details), test_cheat_loader.py, test_separators.py; upstream-update.sh --check; check-publish.sh; check-min-api.py on the APK.

Every cheat file a player adds is kept as one Mistel Native Cheat Format
file (.mncf) for all of a game's builds. An Atmosphère, Eden, Yuzu or
Ryujinx file is converted as it is added, with the game's own main from
the pack: each patch names the original code at its place, and its place
is found by a pattern, so a cheat keeps working after a game update and
never writes into code that is not what it was made for. A cheat that
cannot work here says why, in a sentence.

- MncfBuild: a file made ready for the build that runs (Mistel's
  evaluator), kept per build, and written as Atmosphère code for the
  host's cheat engine, so the engine is unchanged.
- MncfConvert: Atmosphère to .mncf with the game, the versions, the
  origin and the authors (the credits, else the player who adds it).
- MncfMain: the game's own main from a pack (main.patched.bin with
  main.orig.bin back at main.changed.tsv's runs).
- .mncf and .mncp files are added as they are; a signature stays good,
  and only a verified one gets a mark.
- A value of an .mncf cheat (a number in an instruction too) gets the
  in-game number field; relations (requires, excludes, radio) apply.
- Export writes .mncf (one source) or .mncp (several), with the cheats
  that are on and the numbers set.
- Mistel's MIT library is copied unchanged under io/github/davdxpx/mistel
  (peanuts/scripts/mncf-vendor.sh, checked by test_mncf_vendor.py).
…it brings

- Export sits in the bar beside Add on the Cheats tab, on the game page's
  Mods & Cheats area and on its own page, while there is a source to
  export.
- The Add dialog of an .mncf opens with a card for the file (its name,
  who made it, who signed it when a trusted key did) and what the file
  brings, counted from it: its cheats and versions, the ones checked
  before they write, the ones that follow game updates, the numbers to
  set, the ones that say what they do.
- An Atmosphère pick says it becomes a Mistel cheat file, and the wait
  while it is converted says what is being done.
- After adding, a sheet says how many of the cheats work on the game's
  version, how many cannot (listed with the reason), and what the file
  brings, in place of a toast.
…owned

upstream-update.sh --check flagged every hunk of the mod menu's
CheatLoaderJvmTest (android/app/src/jvmtest/java/dev/peanuts) and of
ModCheats.java (a Peanuts file in upstream's launcher package) since Part
C. The JVM tests of dev.peanuts join the owned paths, as dev/peanuts does
under main; ModCheats.java goes on the allow-list with its reason.
…hat Peanuts cannot run yet

The copy is of Mistel's branch mncf-1-peanuts-gaps (9280c89), the fixes of the
gaps this PR found; mncf-vendor.sh copies it from Mistel's main once igawa6#11 is merged.

- The evaluator refuses what Peanuts' engine lacks with the spec's
  runtime:unsupported:<part> (run once or for a time, toggle buttons, several
  conditions, ...), and a patch over a run Peanuts' rewriter changed with
  runtime:rewritten, so MncfBuild no longer checks those itself.
- The converter reads notes, EdiZon's sections and two builds of one version
  itself, so MncfConvert passes each Atmosphère file as it is.
- A number set in the game's tab reaches toAtmosphere as the player's value,
  checked: one a cheat cannot take leaves only that cheat out.
…e before the game is built is kept

- A source whose file is not made ready for the build yet, or cannot be read,
  may name no other build: its line said "For another version" with the first
  of none, and the page closed. It now says what it is.
- A file made ready while the pack has no main yet (a game not built) was not
  kept, so the page looked it up again on every redraw and stayed at "Looking
  up its cheats". It is kept now, marked, and made again once the pack has
  its main, so its patterns are searched then.
…ther emulator reads

Export opens one dialog with two ways the cheats leave Peanuts:

- Mistel cheat file, with a Recommended badge and picked: one .mncf (an .mncp
  for several sources) with every cheat for every version, the ones that are
  on and the numbers set, as before.
- ZIP for other emulators: atmosphere/contents/<title ID>/cheats/<build ID>.txt,
  one file for each version, as Atmosphere, Eden, Yuzu and Ryujinx read them
  (MncfExport.zip). Each cheat is lowered with Mistel's toAtmosphere for every
  build its file names, and for the running build from the file made ready
  for it: the code Peanuts runs, else the file's own code for the build, else
  code made from its operations, with the number set in the game's tab. One
  master code a file, the groups between EdiZon's section markers, at most
  127 cheats.

What an Atmosphere file cannot hold (a monitor, toggle buttons, a run once
or for a time, several conditions, a place found by a pattern in a version
whose main Peanuts does not have) and what does not fit the game stay out.
Picking the ZIP shows, before anything is written, how many cheats go in for
which version and which stay out, each with its reason.

CheatLoaderJvmTest: the ZIP's layout, its master, number and sections, what
stays out and why, two builds, and the round trip: the ZIP added again gives
the same cheats with the same code and groups.
…inst the game's main, with stable reasons

The library is now davdxpx/mistel#11 at 797d095: toAtmosphereAll writes
every build of a file, and with a build's main it finds the patterns and
checks every patch and override stub against expect before writing, and
Export.reasons() gives each cheat left out a stable reason (spec section 15).

- MncfExport.zip lowers each source with toAtmosphereAll and gives it the
  game's own main for the build that runs, so a cheat whose place holds other
  code stays out of the ZIP (expect-mismatch); a build the game runs that the
  file does not name is written from the patterns with that main.
- The dialog's list of what stays out words those reasons, never shows them.
- MncfBuild reads the converter's codes instead of its English sentences, and
  maps them to Peanuts' reasons (runtime:unsupported:<part>, ...).
- The dialog's ZIP is the one written, so the game's main is read once.

CheatLoaderJvmTest: a patch made for other code stays out with its reason;
without the game's main a pattern stays out with its own.
… Atmosphère's limits

Mistel's library is copied from its main (76d283c), which has davdxpx/mistel#11 and igawa6#16.

- Each source is lowered in one pass: its own raw code for the build first, code made from its
  operations for a cheat with a number set (the converter's preferCheats).
- With the game's main, the pointer at the base of a pointer path is checked too: one past
  main's end stays out of the ZIP with its reason.
- The ZIP keeps Atmosphère's limits across sources, past which a Switch refuses the whole file:
  one master code of at most 256 words (a master past it stays out, with the cheats of its
  source that need it), at most 127 entries, group entries counted, less than 64 KB, and names
  of at most 63 bytes. What goes past them is named in the dialog.
- Groups are written as the spec writes them: the group's name as an empty entry, and an entry
  of only 20000001 where a cheat in no group follows. Where they would cost cheats, the file has
  no groups.
- Peanuts' own engine is not held to Atmosphère's limits: each master keeps its own code, and a
  source of more than 127 cheats is lowered in parts, so every cheat still runs.
…r names them

The one master entry of a file takes the first master's name, and a group entry its group's
name as it is, cut only to what Atmosphère keeps (spec section 15).
Upstream's one in-game panel with five text tabs becomes two menus, as on a
console: everything about this session at the left, everything that tunes the
running game at the right. The game keeps running behind both.

- The game menu: the game's cover, name, version and this session's time;
  Back to the game, Pause the game, Quick menu, Back up the save (copied while
  the game runs, checked before and after the copy), Button mapping, Share log,
  and Stop the game set apart at the bottom, asked once inline.
- The quick menu: the panel's tabs on a rail of solid icons at the left
  (Performance, Display, Cheats, Mods, Controls, the menu's own settings at the
  bottom). Cheats and Mods are two tabs now. A header with Back and the tab's
  name, section heads in capitals, a slider's value at its right.
- Home pressed, - and + held, Back and a swipe in from the left edge open the
  game menu; Home held opens the quick menu, as do a swipe in from the right
  edge and a long press on the on-screen controls' button.
- Calm motion: in 240 ms decelerating, out 180 ms, on hardware layers.
@davdxpx
davdxpx marked this pull request as ready for review November 25, 2026 07:38
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.

1 participant