Feature/retro console emulation#622
Open
maxjivi05 wants to merge 25 commits into
Open
Conversation
Import a console ROM from the Library exactly like a PC game and play it on an embedded libretro backend (LibretroDroid GLRetroView), running in parallel to the Wine/Proton emulator instead of replacing it. - feature/retro: RetroSystem registry (NES, SNES, GB/GBC, GBA, Genesis/MD/SMS/GG, N64, PS1), RetroCoreManager, RetroShortcuts, RetroActivity (GLRetroView host), RetroInputView (on-screen gamepad), RetroGameSettingsDialog - Bundle arm64-v8a cores (fceumm, snes9x, gambatte, mgba, genesis_plus_gx, pcsx_rearmed, mupen64plus_next_gles3) in jniLibs - Retro games are CUSTOM shortcuts tagged with retro_system/rom_path so they reuse the whole Library display pipeline - Import: the Add-Custom-Game picker now accepts ROM extensions - Backend-gated launch: launchCustomGame, ShortcutsFragment.runFromShortcut, and a defensive redirect in XServerDisplayActivity all route retro to RetroActivity - Detail dialog hides Wine-only actions for retro games and opens retro settings - Physical controllers and on-screen controls handled inside RetroActivity, isolated from the Wine input stack Emulator sources and credit: - The retro backend embeds LibretroDroid by Filippo Scognamiglio (GPL-3.0) as the libretro frontend host, consumed as the unmodified upstream artifact com.github.Swordfish90:libretrodroid:0.14.0 from https://github.com/Swordfish90/LibretroDroid - The bundled emulator cores are unmodified official arm64-v8a libretro builds obtained from the libretro buildbot (https://buildbot.libretro.com/nightly/android/latest/arm64-v8a/); each core's source, history, and license remain intact at its upstream project: - FCEUmm (NES) https://github.com/libretro/libretro-fceumm - Snes9x (SNES) https://github.com/libretro/snes9x - Gambatte (GB/GBC) https://github.com/libretro/gambatte-libretro - mGBA (GBA) https://github.com/mgba-emu/mgba - Genesis Plus GX (Genesis/MS/GG) https://github.com/ekeeke/Genesis-Plus-GX - Mupen64Plus-Next (N64) https://github.com/libretro/mupen64plus-libretro-nx - PCSX-ReARMed (PS1) https://github.com/libretro/pcsx_rearmed - No emulator source code was copied into this repository; cores ship as prebuilt binaries under their respective upstream licenses, and the libretro/RetroArch project and core authors are credited in README.md
- RetroDrawerMenu: xservermenu-style in-game drawer for retro games (BACK, guide button, or on-screen MENU) with Resume, Save/Load State, Reset, Fast Forward, Video Filter, per-core options, Sound, On-screen Controls, Disc changer (multi-disc PSX), and Exit; touch and controller navigable; changes apply live and persist to the shortcut - RetroCoreOptions: per-system core option registry (NES aspect, SNES NTSC filter, GB colorization, GBA color correction, Genesis sprite limit/NTSC, N64 resolution, PSX enhanced resolution/dithering) driving both the in-game drawer and the shortcut settings dialogs - RetroSettingsContent/RetroSettingsDialog: shared per-system settings UI; ShortcutSettingsComposeDialog.show() now routes retro shortcuts to the retro settings dialog so every settings entry point is backend-gated - Core options persist as retro_var_* shortcut extras and are passed to the libretro core at launch
- RetroDrawerMenu rebuilt in the xservermenu style: left ModalDrawer-style sheet (300dp, rounded, same sheet/rail colors), top rail tabs with animated underline indicator (Menu / Display / <System> / Sound / Controls, gated per system), action-card grid for quick actions, danger-styled bottom Exit tile, and region-based controller navigation (rail / content / bottom) - Retro shortcut settings rebuilt in the PC GameSettings style: same ContentDialog window (dim, blur, sizing), sidebar tabs with icons and Save/Cancel footer, animated section transitions, identical colors and row components, per-system gated sections (General / Graphics / <System> Options / Input / Audio) - Controller navigation reuses the shared GameSettingsNav + bindPaneNav + PaneNavRegistry machinery so tabs, rows, and dropdown overlays navigate exactly like the PC settings dialog - Settings edits are now buffered with explicit Save/Cancel like PC games
- RetroInputView rebuilt with the exact GameHub/Glass paint recipe from the PC overlay renderer: dark translucent glass fill, light white rim, brighter rim and inner fill when pressed, radial glass edge vignette, bold labels - D-pad drawn as the GameHub four-arrow cross via the shared GameHubLayout path builders, with per-direction pressed highlighting - Shoulder buttons and triggers drawn as GameHub slanted glass pills (TRIGGER_LB/RB/LT/RT silhouettes); Start/Select/Menu as glass pills; face buttons as glass circles - Overlay is gated per console: 2-button pads for NES/GB/GBC/SMS/GG, X/Y and shoulders for SNES/Genesis, shoulders for GBA, triggers for PS1, and an analog glass stick plus Z trigger for N64 wired to the libretro left analog
…artwork - Move Start/Select pills above the A/B cluster and the Menu pill above the D-pad so they sit off the game picture (fixes GB narrow-screen overlap); N64 stacks trigger/bumper/menu/dpad/stick down the left edge - Match the in-game drawer to the PC xservermenu sizing: RetroActivity now extends FixedFontScaleAppCompatActivity like the PC session activity, the full-screen dim scrim is gone (transparent tap-to-close catcher like PC), and all drawer chrome scales with the same paneScale rule (height/520, clamped 0.78-1) the PC drawer uses - Record play stats for retro games (play count, last played, playtime) in the same playtime_stats keys PC games use, so the library's most-recently-played-first ordering now covers every backend - Retro settings General tab gains the PC-style Library Artwork section with Game Card / Grid / Carousel / List image pickers backed by the shared LibraryShortcutArtwork slots
…u to the same height
- The Console row in Add Custom Game is now a dropdown listing every supported system, defaulting to the auto-detected one, so ambiguous extensions like .bin can be corrected to PS1 before importing - Detection itself is smarter for .bin: files over 16MB default to PS1 instead of Genesis since Genesis cartridges never reach that size
…metrics - All overlay geometry now derives from the PC formula snap = screenWidth/100 with the GameHub profile scales: face buttons 3*snap radius, d-pad 7*snap*1.07, stick 6*snap*1.17, triggers 8x4*snap*1.3, Start/Select pills 8x4*snap*0.75 - Stroke width now max(2, 0.18*snap) exactly like the PC glass renderer, fixing rims that drew about four times too thick - Labels use the PC text rule: fit-to-width capped at 2*snap*profile scale - Touch hit targets inflate by a snap-based margin so the smaller visuals keep comfortable press areas
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
- Auto-hide the on-screen glass controls whenever a real game controller is connected and bring them back on disconnect, using the shared ExternalController device filter and an InputManager listener - Left analog stick now drives d-pad movement on consoles without a stick (NES, SNES, GB/GBC/GBA, Genesis, PS1) with a proper deadzone, while N64 keeps true analog; hat/d-pad input still works everywhere - Face buttons stay positionally mapped across Xbox, PlayStation, and standard generic pads: the south button acts as Nintendo B and east as Nintendo A (PS5 Cross = B, Circle = A), matching RetroPad layout
…o HUD - Pause now sits bottom-left and Exit bottom-right as a pinned bottom action row styled exactly like the PC drawer's pause/exit buttons, with left/right controller navigation across them - Menu action cards (Save/Load State, Reset, Fast Forward, HUD, Disc) now square off by filling the pane height with the PC ActionCardGrid row-height formula instead of a fixed card height - New performance HUD for retro games, fully separate from the PC HUD but visually identical: same gauges (FPS, GPU, CPU, RAM, frametime, watts and temperature) rendered over the left half of the screen, with the console name (NES, GB, PS1, ...) shown where PC games display DXVK/VKD3D - Stats come from the same sources the PC HUD uses: per-app /proc sampling via CPUStatus, kgsl/mali sysfs GPU load, ActivityManager memory, and BatteryManager wattage and temperature; FPS and frametime derive from the emulator's rendered-frame events - HUD toggles from a new drawer card, persists per game, and is gated entirely inside the retro backend so the PC HUD path is untouched
- Replace the gauge-style overlay with a second instance of the same FrameRating view PC games use: the compact top HUD with the full structure, drag-to-move, tap interactions, anchor and display-mode persistence, and the frametime graph, all self-contained in the existing view - The renderer slot shows the console name (NES, GB, PS1, ...) instead of DXVK/VKD3D; stats (FPS, GPU, CPU, RAM, battery, temperature) come from the view's own collectors, with FPS fed from the emulator's rendered frames - Container hudSettings (transparency, scale, element toggles) are honored exactly like PC sessions; the PC HUD path itself is untouched
FrameRating.onAttachedToWindow calls bringToFront, and creating it during onCreate reordered the root's children in the middle of the window's first attach dispatch, leaving the drawer ComposeView unattached when the first measure pass reached it. HUD creation at launch is now posted until after the first attach completes, matching how PC sessions only ever add the HUD to an already-stable window.
…HUD FPS - Landscape controls sit higher: the bottom gap for the d-pad, face cluster, and stick grew from 6 to 9 screen units so nothing hugs the screen edge; N64 specifically moves the analog stick to the primary bottom-left spot with the d-pad above it and Menu joining the Select/Start pill row - GB, GBC, GBA, and Game Gear now allow portrait play: the game renders in the top half (top-aligned viewport) and the controls fill the bottom half laid out like the real handhelds, with the d-pad left and A/B as the classic diagonal pair on the right at the same row height, Start/Select centered at the bottom, and GBA shoulder pills at the control-zone corners - With the HUD enabled in portrait the emulator viewport is pushed down by exactly the HUD's height (capped) so the picture sits just below it and is never covered; landscape keeps the floating PC-style behavior - HUD FPS now reports the emulator's real frame rate: duplicate GL redraws are skipped so rendered-frame events match actual core video refreshes instead of the display's refresh cadence
- L sits alone at the top-left; Z moves to the top-right above R as a right-side trigger stack - Menu, Select, and Start are centered at the bottom under the game picture - D-pad stays above the joystick on the left; the joystick and the A/B pair drop lower on the screen for a more natural thumb position - A/B now send the correct N64 buttons through the core's RetroPad mapping (A as the south input, B as the west input) and sit in the real controller's arrangement with B upper-left of A
- Four glass C buttons in the real controller's diamond arrangement sit on the right side between the Z/R trigger stack and the A/B pair, tinted the N64's C-button yellow with directional arrow glyphs - They drive the libretro right analog stick, which Mupen64Plus maps to the C buttons, with multi-touch support and full release handling
- C-button diamond shifts slightly right and down into the open space between the R trigger and the face pair, clamped so it never crowds B - B and A move closer together and the pair drops slightly lower; the left joystick drops a touch less so it stays in easy thumb reach
…scaling - LibretroDroid 0.14.0 is now a source module (:libretrodroid) with Oboe and libretro-common as pinned submodules, replacing the JitPack binary so the renderer can be patched and extended; NDK 27 needed explicit <functional> includes, and the module builds arm64-v8a with 16KB page alignment Emulator/renderer sources and credit: - LibretroDroid by Filippo Scognamiglio (GPL-3.0), vendored unmodified from https://github.com/Swordfish90/LibretroDroid at tag 0.14.0 except for the patches described here, with its license and headers intact - google/oboe and libretro/libretro-common submodules pinned to the exact commits the upstream 0.14.0 build used - Snapdragon Game Super Resolution 1.0 by Qualcomm Innovation Center, Inc. (BSD-3-Clause), adapted from sgsr1_shader_mobile.frag at https://github.com/SnapdragonGameStudios/snapdragon-gsr with the license preserved in libretrodroid/src/main/cpp/SGSR_LICENSE Renderer fix: - Video effects on hardware-rendered cores (N64, PSX hardware renderers) blacked out because a shader change rebuilt the framebuffer the core was actively rendering into; the main framebuffer now survives shader-only changes and is recreated solely on resolution changes, with texture filtering updated in place SGSR: - New SHADER_UPSCALE_SGSR chain entry in the shader manager (GLSL ES 3.10 single pass), exposed through ShaderConfig.SGSR and available as an "SGSR" video filter for every retro console in both the in-game drawer and the shortcut settings dialog Drawer: - The Display tab now lays filters out two per row in a scrollable grid, with controller navigation moving through the grid in both axes
- Retro shortcuts show a slim box-spine style badge on the left edge of their artwork with the console name (GB, GBA, GBC, NES, SNES, SEGA, SMS, GG, N64, PS1) read bottom-to-top, in both grid and list cards - Badge labels come from the system registry with Sega systems shortened to SEGA, SMS, and GG; PC games are untouched since the badge map is built only from shortcuts carrying a retro system
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add retro console emulation backend (libretro) alongside the Wine path
Import a console ROM from the Library exactly like a PC game and play it on
an embedded libretro backend (LibretroDroid GLRetroView), running in parallel
to the Wine/Proton emulator instead of replacing it.
N64, PS1), RetroCoreManager, RetroShortcuts, RetroActivity (GLRetroView host),
RetroInputView (on-screen gamepad), RetroGameSettingsDialog
pcsx_rearmed, mupen64plus_next_gles3) in jniLibs
reuse the whole Library display pipeline
a defensive redirect in XServerDisplayActivity all route retro to RetroActivity
isolated from the Wine input stack
Emulator sources and credit:
as the libretro frontend host, consumed as the unmodified upstream
artifact com.github.Swordfish90:libretrodroid:0.14.0 from
https://github.com/Swordfish90/LibretroDroid
builds obtained from the libretro buildbot
(https://buildbot.libretro.com/nightly/android/latest/arm64-v8a/); each
core's source, history, and license remain intact at its upstream
project:
prebuilt binaries under their respective upstream licenses, and the
libretro/RetroArch project and core authors are credited in README.md