Skip to content

Add a configurable menu region for dialogs and overlays - #31

Open
mkitza wants to merge 1 commit into
ROCKNIX:masterfrom
mkitza:menu-region
Open

mkitza wants to merge 1 commit into
ROCKNIX:masterfrom
mkitza:menu-region

Conversation

@mkitza

@mkitza mkitza commented Aug 25, 2026

Copy link
Copy Markdown

What

Adds four settings — MenuOffsetX, MenuOffsetY, MenuWidth, MenuHeight — exposed as
Renderer::getMenuRect(), and lays ES's own dialogs out inside that rect instead of the raw
canvas.

All default to 0 = whole canvas, so any device that doesn't set them takes exactly the
current code path.

Why

This is enabling work for dual-screen themes. Every EmulationStation theme today is
single-screen, so nothing currently trips over this — but a dual-screen theme cannot be built
without it.

Dual-screen handhelds have no combined framebuffer. The way a dual-screen theme works is to run
ES as one oversized window spanning both panels and let the panels crop it, then place each
element in whichever slice of the canvas maps to a physical panel. That makes the canvas much
wider than the visible UI area, and ES's own dialogs — sized as fractions of getScreenWidth()
spill outside it.

On an AYN Thor (4400x1080 canvas, UI panel at canvas x 1240..3160) the on-screen keyboard, input
config wizard, file browser, scraper, slider bars and the side-sliding system menu all render
partially off-screen.

A theme can't fix it (ThemeData::ThemeMenu has no pos/size), and neither can a different
canvas: putting the canvas centre on the UI panel while covering both panels forces the width.

Net effect: nothing changes for any existing theme or device, and dual-screen themes become
buildable.

Diff shape

52 files, +288/-217. 41 are dialog classes taking a mechanical substitution:

-float width = Renderer::getScreenWidth() * 0.6f;
+float width = Renderer::getMenuRect().w * 0.6f;

Real logic is in 4 files: Settings.cpp (+9), Renderer.h (+9), Renderer.cpp (+48),
SystemView.cpp (+9/-5).

Themed view geometry is deliberately untouched — the theme positions those and they're already
correct. No CLI flag; no device, driver, boot or emulator code touched.

Validation

Containerised harness (headless sway + grim) runs ES at 4400x1080 and measures dialog extent
from screenshots.

On hardware (AYN Thor, ROCKNIX nightly 20260820, SM8550), same dialog.

Before:
pr-menu-region-before

After:
pr-menu-region-after


AI Usage

Did you use AI tools to help write this code? YES

Claude (Anthropic) did the diagnosis, implementation, harness and cross-build. The final result
was verified by hand on a physical AYN Thor.

ES sizes and anchors its own dialogs as fractions of the whole canvas.
That is right when the window maps 1:1 onto one panel, but dual-screen
handhelds run a single oversized window across two panels and crop it,
so the canvas is much wider than the visible UI area.

On an AYN Thor (4400x1080 canvas, UI panel at canvas x 1240..3160) the
on-screen keyboard is 0.78 * 4400 = 3432px wide: a third of it renders
into a region no panel shows, the rest onto the art panel. The input
config wizard (0.6 * W), file browser (0.65 * W), scraper (0.9 * W) and
the slider bars (0.25 * W) break the same way, and edge-anchored
overlays such as the volume indicator (x = 0.02 * W) land off-screen
entirely.

Add MenuOffsetX/MenuOffsetY/MenuWidth/MenuHeight, exposed through
Renderer::getMenuRect(), and lay dialogs out inside that rect instead
of the raw canvas. All four default to 0, which means "use the whole
canvas" -- so behaviour is unchanged on every device that does not set
them.

Themed view geometry is deliberately untouched: the theme positions
those elements and they are already correct.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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