Skip to content

fix(mister): identify MGL-observed games by the file they load - #1432

Merged
wizzomafizzo merged 3 commits into
mainfrom
fix/mister-tracker-mgl-id
Sep 9, 2026
Merged

wizzomafizzo merged 3 commits into
mainfrom
fix/mister-tracker-mgl-id

Conversation

@wizzomafizzo

@wizzomafizzo wizzomafizzo commented Sep 5, 2026 •

Copy link
Copy Markdown
Member
  • The Zaparoo Main fork rewrites /tmp/ACTIVEGAME with the MGL it was started from (its user_io_init() hook runs again after the app_restart() re-exec that follows a load_core), so a Zaparoo launch is observed by the tracker twice: once by the game path DoLaunch wrote and once through /media/fat/.LASTLAUNCH.mgl. loadGameLocked already resolved the MGL to its <file> path, but had taken filename from the MGL beforehand, so its dedupe id was Genesis/.LASTLAUNCH.mgl rather than the game's own id.
  • Take the id from the resolved file. A regression test observes a game through an MGL and checks it publishes under Genesis/<game> and compares equal to what DoLaunch publishes for the same launch.
  • Reported against 2.17.1 by a user who polled ACTIVEGAME after a Frontend launch and saw it flip to the MGL path a second later. The file content is fixed on the Main side in feat(zaparoo): coordinate frontend scanout and Core recovery Main_MiSTer#24, which leaves ACTIVEGAME alone for that one MGL. Playtime and history were already correct: the MGL is resolved, and the "ignoring active game from a different core" line that appears while CORENAME still reads MENU is retried by LoadCore once the core name arrives.

Summary by CodeRabbit

  • Bug Fixes
    • MGL launches are now identified by the actual game file they load, rather than the wrapper file.
    • Launches through an MGL and direct launches of the same game now consistently share the same game identity and display information.

The Zaparoo Main fork rewrites /tmp/ACTIVEGAME with the MGL it was
started from, so the tracker sees a Zaparoo launch twice: by the game
path DoLaunch wrote and through /media/fat/.LASTLAUNCH.mgl.
loadGameLocked resolved the MGL to its <file> path but had already taken
filename from the MGL, so its dedupe id was Genesis/.LASTLAUNCH.mgl
instead of the game's own id. Take it from the resolved file.
@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 9b0408f5-236e-4e77-82c3-07655c7bc325

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 21ff360b-9d54-4c3c-81d5-976afc94ffd0

📥 Commits

Reviewing files that changed from the base of the PR and between 5aefeb6 and ed2d6ff.

📒 Files selected for processing (2)
  • pkg/platforms/mister/tracker/tracker.go
  • pkg/platforms/mister/tracker/tracker_test.go

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The tracker now derives MGL launch identity from the loaded game file. A test verifies the system, path, ID, and media match a direct launch.

Changes

MGL game identity

Layer / File(s) Summary
Resolve loaded game identity
pkg/platforms/mister/tracker/tracker.go, pkg/platforms/mister/tracker/tracker_test.go
loadGameLocked uses the loaded file basename for game identity. The Genesis test verifies the published media matches a direct launch of the loaded game.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to ed2d6

MGL launches now identify the loaded game rather than the wrapper file, preventing duplicate game observations. The covered identity and direct-launch matching behavior is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: identifying MGL-observed games by the file loaded by the MGL wrapper.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

.LASTLAUNCH.mgl is one file rewritten on every launch, so identifying a
launch by the wrapper gave every game behind it the id
`<system>/.LASTLAUNCH.mgl`. A second game observed through it matched the
first's id and was skipped, leaving the tracker publishing media that had
already been replaced. The existing test only asserted the id of a single
observation; four of its five assertions pass against the old behaviour.

Reproduced on a MiSTer at 10.0.0.107 with two SNES ROMs behind one wrapper:
without the fix media.active stayed on the first game, with it the second
was published.

Also document loadGameLocked.
@wizzomafizzo
wizzomafizzo merged commit 4d8fd8c into main Sep 9, 2026
16 checks passed
@wizzomafizzo
wizzomafizzo deleted the fix/mister-tracker-mgl-id branch September 9, 2026 08:50
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