Skip to content

Hard-block external emulator binding for in-app consoles (GB/GBC/GBA launch only in PKForge) - #4

Merged
Varonal merged 2 commits into
mainfrom
vibe/embedded-mgba-core
Oct 30, 2026
Merged

Varonal merged 2 commits into
mainfrom
vibe/embedded-mgba-core

Conversation

@Varonal

@Varonal Varonal commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes "lancer un jeu GBA depuis la liste ouvre encore RetroArch" and "RetroArch still selectable in the Emulators tab".

Root cause: the previous fix removed GB/GBC/GBA rows and made EmulatorsFor return [Embedded], but the guard lived only at call sites — a stale persisted binding (JsonConsoleEmulatorStore) could still be read and sent the ROM to RetroArch, and the picker could still list external emulators.

Now centralized and enforced:

  • ConsoleRules.RunsInApp(console) — single source of truth for consoles PKForge runs itself.
  • RomLibraryPage.LaunchAsync, EmulatorsPage (row list + ChooseConsoleEmulatorAsync), and SaveIdentitySheet.LinkRomAsync all branch on RunsInApp before touching IConsoleEmulatorStore or any installed external emulator.
  • ChooseConsoleEmulatorAsync filters EmulatorKind.Embedded out of candidates — even a hand-edited binding can't offer it.
  • Builds on the earlier commits: libpkforge_mgba.so packed in the APK (native GB/GBC/GBA play), live PokéDaisy companion, trophies column fix.

Verification

  • dotnet build PKForge.sln → 0 warnings / 0 errors
  • dotnet build src/PKForge.App/PKForge.App.csproj -f net10.0-android -p:DiagnosticBuild=true → succeeded; APK contains lib/arm64-v8a/libpkforge_mgba.so
  • New tests: InAppConsolesNeverOfferAnExternalEmulator (GB/GBC/GBA → exactly [Embedded]), ExternalConsolesAreNotMarkedInApp, GenOneToThreeRomsHaveEmbeddedAsTheirOnlyRoute — 79/79 targeted tests pass
  • Full Domain + Engine suites: only the 2 pre-existing failures that also fail on main in an ICU-less sandbox (green on CI)

mistral-vibe and others added 2 commits October 30, 2026 17:15
…ved for those consoles

Root cause of 'lancer un jeu GBA ouvre RetroArch': the embedded path was a
fallback tried *after* the bound/installed external emulator, and the
Emulators tab still offered RetroArch/Linkboy/PizzaBoy for GB/GBC/GBA.

- EmulatorKind.Embedded = 10 (new, appended — persisted values never renumbered):
  PKForge itself, 'installed' when libpkforge_mgba.so is packed
  (EmulatorCatalog.EmbeddedCoreAvailable, probed once at startup in MauiProgram).
- ConsoleRules.EmulatorsFor + RomLinkRules.EmulatorsForRom: GB/GBC/GBA (Gen 1-3)
  now return [Embedded] only. DS/3DS/GC/Switch unchanged.
- RomLibraryPage.LaunchAsync: GB/GBC/GBA go embedded first and only; the external
  path is unreachable for them (clear message if the .so is missing).
- SaveIdentitySheet: Play on a linked Gen 1-3 ROM opens EmbeddedGamePage;
  linking a Gen 1-3 ROM stores EmulatorKind.Embedded; texts updated.
- EmulatorsPage: GB/GBC/GBA console rows removed (no external binding offered).
- RetroArch's advertised systems now 'DS' only; Embedded advertises GB/GBC/GBA.
- Tests updated (RomLinkTests, ConsoleRulesTests): Gen 1-3 prefer Embedded,
  GB counts as installed with no packages.

Verified: dotnet build PKForge.sln 0 warnings 0 errors; DiagnosticBuild APK
still packs libpkforge_mgba.so; targeted tests pass (68/69 before the melonDS
package-id fix, then full suite = only the 2 pre-existing ICU-less failures).

Co-authored-by: Varonal <[email protected]>
…/GBA)

The previous commit removed GB/GBC/GBA rows and made EmulatorsFor return
[Embedded], but the guard lived only at call sites and a stale persisted
binding could still be read. Now the rule is centralized and enforced:

- ConsoleRules.RunsInApp(console): single source of truth for consoles PKForge
  runs itself. RomLibraryPage.LaunchAsync, EmulatorsPage (row list + picker),
  and SaveIdentitySheet.LinkRomAsync all branch on it before ever touching
  IConsoleEmulatorStore or an installed external emulator.
- EmulatorsPage.ChooseConsoleEmulatorAsync filters out EmulatorKind.Embedded
  from candidates, so even a hand-edited binding cannot offer it.
- New tests: InAppConsolesNeverOfferAnExternalEmulator (GB/GBC/GBA candidates
  are exactly [Embedded]), ExternalConsolesAreNotMarkedInApp, and
  GenOneToThreeRomsHaveEmbeddedAsTheirOnlyRoute.

Verified: build PKForge.sln 0 warnings 0 errors; DiagnosticBuild APK packs
libpkforge_mgba.so; 79/79 targeted tests pass; full suites show only the 2
pre-existing ICU-less sandbox failures (green on CI).

Co-authored-by: Varonal <[email protected]>
@Varonal
Varonal merged commit e15f650 into main Oct 30, 2026
1 check passed

Varonal commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

Review note

Merged. Final state verified on main (e15f650):

  • ConsoleRules.RunsInApp is the single guard for in-app consoles; RomLibraryPage:296, EmulatorsPage:202 and EmulatorsPage:323, SaveIdentitySheet all branch on it before any persisted binding (JsonConsoleEmulatorStore) or installed external emulator is read — so a stale "GBA → RetroArch" binding can no longer route a launch.
  • Emulators tab: GB/GBC/GBA rows are gone entirely; the picker also filters EmulatorKind.Embedded from candidates.
  • Library tap on a GB/GBC/GBA ROM → EmbeddedGameSession.TryStart → EmbeddedGamePage, no external emulator consulted. APK packs libpkforge_mgba.so (verified in the local DiagnosticBuild APK and the CI artifact).
  • CI: PR run 41115166550 pass (1024 Domain + 992 Engine tests, APK build succeeded); post-merge main push run 41115892496 success.

@Varonal
Varonal deleted the vibe/embedded-mgba-core branch November 9, 2026 12:21
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.

2 participants