feat(player): remember emulator core per-game#3701
Conversation
Persist the selected EmulatorJS core per-game and fall back to the per-platform default when a game has no saved core. The per-platform key is still written so it acts as the default for new games on that platform. Closes #2042 Generated-By: PostHog Code Task-Id: 6cc47d8f-2bb8-4424-ba58-e595fe947444
There was a problem hiding this comment.
Pull request overview
Adds per-game persistence for the selected EmulatorJS core, while keeping the existing per-platform core as a fallback default, so different games on the same platform can automatically preselect different cores.
Changes:
- Persist chosen core to
localStorageunder both per-game (player:${rom.id}:core) and per-platform (player:${platform_slug}:core) keys when selecting a core in the shared player component. - Update v2 EmulatorJS player view to prefer per-game core, then platform core, then first supported core (with supported-core validation).
- Update console Play view to prefer per-game core over platform core (with supported-core validation).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontend/src/views/Player/EmulatorJS/Player.vue | Writes/removes per-game core key in addition to existing per-platform key. |
| frontend/src/v2/views/Player/EmulatorJS.vue | Reads per-game core first, adds supported-core validation, then falls back. |
| frontend/src/console/views/Play.vue | Adds per-game core storage ref and prefers it over platform core during boot. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR adds per-game emulator core persistence. The main changes are:
Confidence Score: 4/5The per-game core fallback and shared write path need fixes before merging.
frontend/src/v2/views/Player/EmulatorJS.vue, frontend/src/console/views/Play.vue, frontend/src/views/Player/EmulatorJS/Player.vue Important Files Changed
Reviews (1): Last reviewed commit: "feat(player): remember emulator core per..." | Re-trigger Greptile |
Validate the per-game and per-platform cores independently so a stale or unsupported per-game core falls through to a valid per-platform core instead of jumping straight to the first supported core. Generated-By: PostHog Code Task-Id: 6cc47d8f-2bb8-4424-ba58-e595fe947444
Description
Explain the changes or enhancements you are proposing with this pull request.
Just like the selected emulator core is saved in localStorage per-platform, this now also saves the selected core per-game, and falls back to the per-platform core when a game has no saved core.
Fallback chain: per-game core → per-platform core → first supported core.
Closes #2042
Changes:
Player.vue(write, shared by v1 + v2): when a core is chosen, writes bothplayer:${rom.id}:core(per-game) andplayer:${rom.platform_slug}:core(per-platform, kept as the default for new games on that platform). Removal clears both.v2/views/Player/EmulatorJS.vue(read): reads the per-game core first, falls back to the per-platform core, then the first supported core. Added asupportedCoresvalidity check so a stale/unsupported saved core can't stick.console/views/Play.vue(read): added agameCorestorage ref and prefers it over the platform core, both validated against the supported list.The v1
Base.vueread is intentionally left untouched to honor the v1 freeze; it still reads the per-platform key (unchanged behavior). The feature is fully functional in v2 and the console.AI assistance disclosure: This change was implemented with AI assistance (PostHog Code / Claude). All code was reviewed before submission.
Checklist
Please check all that apply.
Screenshots (if applicable)
N/A
Created with PostHog Code