Skip to content

feat(player): remember emulator core per-game#3701

Merged
gantoine merged 2 commits into
masterfrom
posthog-code/save-core-per-game
Jul 7, 2026
Merged

feat(player): remember emulator core per-game#3701
gantoine merged 2 commits into
masterfrom
posthog-code/save-core-per-game

Conversation

@gantoine

@gantoine gantoine commented Jul 7, 2026

Copy link
Copy Markdown
Member

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 both player:${rom.id}:core (per-game) and player:${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 a supportedCores validity check so a stale/unsupported saved core can't stick.
  • console/views/Play.vue (read): added a gameCore storage ref and prefers it over the platform core, both validated against the supported list.

The v1 Base.vue read 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.

  • I've tested the changes locally
  • I've updated relevant comments
  • I've assigned reviewers for this PR
  • I've added unit tests that cover the changes

Screenshots (if applicable)

N/A


Created with PostHog Code

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
Copilot AI review requested due to automatic review settings July 7, 2026 02:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 localStorage under 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.

Comment thread frontend/src/v2/views/Player/EmulatorJS.vue Outdated
Comment thread frontend/src/console/views/Play.vue Outdated
@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds per-game emulator core persistence. The main changes are:

  • Per-game core storage in the shared player writer.
  • Per-game-first core selection in the v2 player view.
  • Per-game-first core selection in the console player path.
  • Validation of saved cores against supported core lists.

Confidence Score: 4/5

The per-game core fallback and shared write path need fixes before merging.

  • Unsupported per-game storage can skip a valid platform fallback.
  • The shared player writer can overwrite game-specific storage when launched from the v1 path.
  • The emulator still falls back to supported cores, so the issue is incorrect preference behavior rather than a boot failure.

frontend/src/v2/views/Player/EmulatorJS.vue, frontend/src/console/views/Play.vue, frontend/src/views/Player/EmulatorJS/Player.vue

Important Files Changed

Filename Overview
frontend/src/console/views/Play.vue Adds a per-game core storage ref and prefers it during console boot, but stale per-game values can bypass a valid platform fallback.
frontend/src/v2/views/Player/EmulatorJS.vue Adds per-game-first core selection with validation, but the fallback chain skips platform validation when the game key is present and unsupported.
frontend/src/views/Player/EmulatorJS/Player.vue Writes selected cores to both per-game and per-platform keys, which can overwrite game-specific storage from the v1 launch path.

Fix All in Claude Code

Reviews (1): Last reviewed commit: "feat(player): remember emulator core per..." | Re-trigger Greptile

Comment thread frontend/src/v2/views/Player/EmulatorJS.vue Outdated
Comment thread frontend/src/console/views/Play.vue Outdated
Comment thread frontend/src/views/Player/EmulatorJS/Player.vue
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
@gantoine gantoine merged commit 3d817b1 into master Jul 7, 2026
11 checks passed
@gantoine gantoine deleted the posthog-code/save-core-per-game branch July 7, 2026 02:48
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.

[Feature] Save the core used for each game title

2 participants