Skip to content

Native games: programs built for the console, started without an emulator - #14

Open
KurdtNervanna wants to merge 2 commits into
PaddleStroke:mainfrom
KurdtNervanna:native-games-upstream
Open

KurdtNervanna wants to merge 2 commits into
PaddleStroke:mainfrom
KurdtNervanna:native-games-upstream

Conversation

@KurdtNervanna

@KurdtNervanna KurdtNervanna commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

One feature, as asked in #11: Native games, programs built for the console that run without an emulator.

What it adds

A new system, Native games (roms/native). Each game is one launch script (.sh) next to its own folder. The menu runs the script with /bin/sh in the script's folder, in its own process group (host_launch_native() in host/launch.c). It hands over the display, sound and pads the same way it does for a libretro game.

The game's environment

  • HOME=/data/rsos/native-home, because the root file system is read-only. XDG_CONFIG_HOME and XDG_DATA_HOME sit under it.
  • SDL_VIDEODRIVER=kmsdrm and SDL_AUDIODRIVER=alsa.
  • RSOS_GAME_DIR and RSOS_LANG.
  • Its output goes to game.log.

What the menu does around it

  • Select + Start held for one second quits the game: SIGTERM to its process group, then SIGKILL after HANG_KILL_MS.
  • Sleep stops the group (SIGSTOP) and turns the backlight off.
  • Power-off sends SIGTERM.
  • The idle power-off waits while the game runs, since there is no save state to fall back on.
  • An exit code other than 0 shows "The game ended with an error" with the code. A stop by Select+Start or the menu doesn't count as an error.

Build: SDL2 (KMS/DRM, GLES2, ALSA) is added to the two RetroStone2 configs.

Docs: docs/native-games.md covers the folder layout, the launch script and the environment.

Tests

  • check-frontend steps 2a to 2c cover the launch and its environment, an error exit, and the menu stopping a running game (the whole process group goes).
  • On this branch (rebased on main, 0.1.5): check-frontend, check-host, check-input, check-i18n and check-transfer pass. sysmap.c knows the new folder too (alias nativegames, deliberately not ports: RetroPie's port scripts start RetroPie's own emulators).
  • po/rsos.pot is regenerated (make pot).

On hardware

Tested on a RetroStone2 Pro with a fork build based on 0.1.4.

  • Two SDL2 games launch, run and come back to the menu: a Super Mario 64 port and a Star Fox 64 port (libultraship on GLES2). Neither game nor any game data is part of this PR; users build them on a PC from their own ROM.
  • An error exit showed its code (127 for a missing library, 135 for a crash). A power-off during a game shut the console down normally. Sleep wasn't tried on hardware.
  • Open question: on that unit, holding Select + Start for a second did not end the game. frontend.log doesn't show the "Select+Start held" line, so the menu never saw both buttons together. I couldn't find the cause in the code. The same log has a button the kernel reported held for 30 s, so it may be the lost-release problem that 0.1.5 fixes (issue with keys acting as if they are constantly being pressed #10). That still needs to be checked on 0.1.5. For now the two ports quit by themselves on Select+Start.

Next

rsos-gamepad (it merges the RetroStone2's three input devices into one virtual SDL gamepad, via uinput) will be a separate PR once this one is in.

🤖 Generated with Claude Code

KurdtNervanna and others added 2 commits October 28, 2026 01:34
…ator

The system "native" (Native games, roms/native): one launch script per
game (.sh), run by /bin/sh in its own folder and its own process group
(host_launch_native), with the display, sound and pads handed over as for
a libretro game. HOME on /data (the root is read-only), SDL_VIDEODRIVER
kmsdrm, SDL_AUDIODRIVER alsa, RSOS_GAME_DIR, RSOS_LANG; output to
game.log. Select+Start held 1 s quits it (SIGTERM to the group, SIGKILL
after HANG_KILL_MS); sleep stops the group and turns the backlight off;
a power-off sends SIGTERM; the idle power-off waits while it runs (no
save state); an error exit is shown.

SDL2 (KMS/DRM, GLES2, ALSA) in the RetroStone2 configs.
docs/native-games.md; check-frontend 2a-2c (the launch and environment,
an error exit, the menu stopping: the group goes too).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
check-transfer: sysmap.c lists every system of systems.c. Its alias is
"nativegames", not "ports": RetroPie's port scripts start RetroPie's own
emulators.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KurdtNervanna

Copy link
Copy Markdown
Contributor Author

An update on the open question in the description (holding Select + Start didn't end a native game).

On the same RetroStone2 Pro, now on 0.1.5 (a fork build of 0.1.5 with this PR), holding Select + Start for a second did end a native game. It was a game that has no Select + Start quit of its own, so the menu's check was the only one that could have closed it. frontend.log:

[     3.328] host I: native game 304 started: /data/roms/native/Ocarina of Time.sh
[   66.471] frontend: Select+Start held: asking the native game to quit

On 0.1.4 that line never appeared, and the same logs had buttons the kernel reported held for 30 s. So the earlier failure was most likely the lost button releases that 0.1.5 fixes (#10), not this PR's code.

This branch has not been deployed

No deployments
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