Skip to content

fix(mister): add RA set names to launchers#852

Merged
wizzomafizzo merged 2 commits into
mainfrom
fix/mister-ra-set-name
May 26, 2026
Merged

fix(mister): add RA set names to launchers#852
wizzomafizzo merged 2 commits into
mainfrom
fix/mister-ra-set-name

Conversation

@wizzomafizzo
Copy link
Copy Markdown
Member

@wizzomafizzo wizzomafizzo commented May 26, 2026

Summary

  • add set_name/set_name_same_dir launch option pass-through using go-zapscript v0.9.1
  • generate RA_* setname same_dir=1 for MiSTer RetroAchievements launchers
  • validate MiSTer set_name values and escape generated setname XML

Test

  • go test ./pkg/zapscript/ ./pkg/platforms/mister/...
  • golangci-lint run ./pkg/platforms/mister/... ./pkg/zapscript

Summary by CodeRabbit

  • New Features

    • Added set-name configuration for MiSTer launch profiles with validation and an option to treat set names as same-directory profiles.
    • Set-name arguments from launch commands are now honored and forwarded to launchers.
  • Bug Fixes

    • Properly escape XML-reserved characters when emitting MGL set-name elements.
  • Tests

    • Added tests covering set-name mapping, option handling, XML escaping, and argument pass-through.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 24ce2363-3171-4a2b-8332-495cc99a62b7

📥 Commits

Reviewing files that changed from the base of the PR and between 05927d6 and d2ce2d5.

📒 Files selected for processing (2)
  • pkg/platforms/mister/launchers.go
  • pkg/platforms/mister/launchers_test.go

📝 Walkthrough

Walkthrough

This PR extends MiSTer launch behavior with SetName and SetNameSameDir options to control MGL profile naming. Changes flow from LaunchOptions contract through zapscript input, validation utilities, launcher implementations, RetroAchievements wiring, MGL output escaping, and a go-zapscript dependency bump.

Changes

MiSTer SetName Launch Options Implementation

Layer / File(s) Summary
LaunchOptions Contract Extension
pkg/platforms/platforms.go
LaunchOptions struct extended with SetName and SetNameSameDir fields, enabling user control over MiSTer profile naming with documented platform expectations.
Zapscript Entry Point and Integration
pkg/zapscript/launch.go, pkg/zapscript/launch_test.go
getLaunchClosure reads advanced args setName and setNameSameDir and includes them in LaunchOptions passed to LaunchMedia; test verifies end-to-end propagation without action set.
MGL Output XML Escaping
pkg/platforms/mister/mgls/mgls.go, pkg/platforms/mister/mgls/mgls_test.go
GenerateMgl escapes core.SetName through xmlEscapeAttr when generating <setname> element; test verifies ampersand/reserved-character escaping (e.g., A&BA&amp;B).
Validation Utilities and Alt-Core Factory
pkg/platforms/mister/launchers.go
New validSetName, parseSetNameSameDir, and applySetNameOptions functions validate constraints and apply options; launchAltCoreWithDefaultSetName updated to pre-set defaults then apply overrides.
Generic and Specialized Launcher Updates
pkg/platforms/mister/launchers.go, pkg/platforms/mister/launchers_test.go
Generic, Sinden, and Atari2600 launchers updated to accept LaunchOptions and apply validated SetName options to cloned cores before launching; tests/imports added.
RetroAchievements Launcher Wiring
pkg/platforms/mister/launchers.go
Multiple RA systems switched to launchRetroAchievementsCore(...) so each RA core supplies an appropriate default SetName while allowing overrides.
Tests and Test Imports
pkg/platforms/mister/launchers_test.go, pkg/zapscript/launch_test.go
Adds TestRetroAchievementsSetNameMapping, TestSetNameOptions, and TestCmdLaunch_SetNameArgsPassedThrough; imports mister/cores for test construction.
Go Dependency Version Bump
go.mod
github.com/ZaparooProject/go-zapscript upgraded from v0.8.0 to v0.9.1.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ZaparooProject/zaparoo-core#836: Adds RA alternate launcher definitions wired to _RA_Cores/Cores, overlapping with this PR's RetroAchievements launcher wiring and set-name defaults logic.
  • ZaparooProject/zaparoo-core#671: Modifies MGL generation to XML-escape file path attributes, related to this PR's SetName XML escaping in the same GenerateMgl function.

Poem

🐰 I hop through launch options, parsing names with care,
I nudge zapscript whispers into each MiSTer lair,
RetroAchievements get their sets, escaped and bright,
Profiles named and tidy, ready for the night. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. 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 'fix(mister): add RA set names to launchers' accurately summarizes the main changes: implementing RetroAchievements set name support in MiSTer launchers across multiple files.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mister-ra-set-name

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

@sentry
Copy link
Copy Markdown

sentry Bot commented May 26, 2026

Codecov Report

❌ Patch coverage is 74.00000% with 26 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/platforms/mister/launchers.go 71.73% 19 Missing and 7 partials ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/platforms/mister/launchers_test.go`:
- Around line 548-596: Add a new subtest in TestSetNameOptions that exercises
applySetNameOptions when SetName is omitted but SetNameSameDir is provided:
initialize core := cores.Core{SetName: "ExistingName", SetNameSameDir: false}
(or true) and call applySetNameOptions(&core,
&platforms.LaunchOptions{SetNameSameDir: "yes"/"no"}); assert no error and that
core.SetName remains "ExistingName" while core.SetNameSameDir is updated to the
expected boolean; include a negative variant for invalid SetNameSameDir to
assert an error. Ensure the new subtest uses t.Parallel() and references
applySetNameOptions, cores.Core and platforms.LaunchOptions.

In `@pkg/platforms/mister/launchers.go`:
- Around line 127-133: The branch currently only calls applySetNameOptions when
opts.SetName is non-empty, which drops the set_name_same_dir option; change the
condition to check for either opts.SetName != "" or the boolean/flag field (e.g.
opts.SetNameSameDir) so applySetNameOptions(&sn, opts) runs whenever either
option is provided, keeping the existing sn copy/assignment logic (variables:
opts, SetName, SetNameSameDir, s, sn, applySetNameOptions).
- Around line 285-300: The helper applySetNameOptions early-returns when
opts.SetName is empty which prevents processing opts.SetNameSameDir-only
overrides; change the logic so applySetNameOptions first returns only if opts ==
nil, then if opts.SetNameSameDir != "" call parseSetNameSameDir and apply the
result to core.SetNameSameDir, and only afterwards handle opts.SetName (validate
via validSetName and assign core.SetName and default core.SetNameSameDir=false
before applying any SetNameSameDir override); keep using parseSetNameSameDir,
validSetName, and core.SetName/core.SetNameSameDir to locate the needed changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 724f3cd1-cd5d-4fd1-99e1-aa8c68d180d0

📥 Commits

Reviewing files that changed from the base of the PR and between f411027 and 05927d6.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • go.mod
  • pkg/platforms/mister/launchers.go
  • pkg/platforms/mister/launchers_test.go
  • pkg/platforms/mister/mgls/mgls.go
  • pkg/platforms/mister/mgls/mgls_test.go
  • pkg/platforms/platforms.go
  • pkg/zapscript/launch.go
  • pkg/zapscript/launch_test.go

Comment thread pkg/platforms/mister/launchers_test.go
Comment thread pkg/platforms/mister/launchers.go Outdated
Comment thread pkg/platforms/mister/launchers.go Outdated
@wizzomafizzo wizzomafizzo merged commit 7570989 into main May 26, 2026
12 checks passed
@wizzomafizzo wizzomafizzo deleted the fix/mister-ra-set-name branch May 26, 2026 09:25
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