Skip to content

[Agent] feat(pause-menu): dynamic CoreActions & CoreOptions tile integration#3266

Open
github-actions[bot] wants to merge 2 commits intodevelopfrom
agent/issue-3249
Open

[Agent] feat(pause-menu): dynamic CoreActions & CoreOptions tile integration#3266
github-actions[bot] wants to merge 2 commits intodevelopfrom
agent/issue-3249

Conversation

@github-actions
Copy link
Contributor

Summary

Implements dynamic tile integration for CoreActions and CoreOptions in the tile-based pause menu (depends on #3248, now merged).

  • CoreActionTileProvider — maps [CoreAction][PauseMenuTile] (orange bolt icon, ⚠︎ badge when requiresReset)
  • CoreOptionTileProvider — maps boolean CoreOptions → inline ON/OFF toggle tiles; appends a Core Settings tile when any options exist
  • PauseTileMenuView — dynamic coreTiles computed property injects core tiles after primary tiles; handles coreAction_*, coreOption_*, and coreSettings IDs in the dispatcher; shows .confirmationDialog for multi-option actions
  • PVEmulatorViewController+CoreOptions — adds handleCoreAction(_:) helper
  • Unit testsCoreActionTileProviderTests (10 tests) + CoreOptionTileProviderTests (12 tests) using mock CoreOptional conformances

Acceptance Criteria Status

  • CoreActionTileProvider maps [CoreAction][PauseMenuTile]
  • CoreOptionTileProvider maps boolean CoreOptions → toggle tiles
  • Tiles injected into PauseTileMenuView based on active core
  • Reset-required actions show ⚠︎ badge
  • Options-requiring actions present inline confirmationDialog
  • No crash when core exposes no actions/options (nil/empty cases guarded)
  • Unit tests for both providers with mock cores

Test plan

  • Build for iOS simulator and tvOS simulator (no compile errors)
  • Launch emulator with a core that exposes CoreActions (e.g. multi-disc) — verify bolt tiles appear
  • Tap a requiresReset action tile — verify ⚠︎ badge visible and reset occurs
  • Tap a multi-option action tile — verify confirmationDialog appears
  • Verify boolean option tiles show ON/OFF badge and toggle on tap
  • Tap Core Settings tile — verify CoreOptionsDetailView sheet opens
  • Verify no extra tiles appear when core has no actions/options
  • Run swift test in PVUI: CoreActionTileProviderTests and CoreOptionTileProviderTests pass

Part of #3249
Depends on: #3248

🤖 Generated with Claude Code

@github-actions github-actions bot requested a review from JoeMatt as a code owner March 17, 2026 05:32
@github-actions github-actions bot added agent-work PR or issue being worked on by the AI agent ai-reviewing AI code review in progress labels Mar 17, 2026
@github-actions github-actions bot enabled auto-merge (squash) March 17, 2026 05:32
@github-actions
Copy link
Contributor Author

🤖 PR created. AI review starting automatically.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds dynamic CoreAction/CoreOption integration into the tile-based pause menu so emulator cores can surface quick actions and boolean option toggles directly in the grid UI.

Changes:

  • Introduces CoreActionTileProvider / CoreOptionTileProvider to map core-exposed actions/options into PauseMenuTiles.
  • Injects these dynamic tiles into PauseTileMenuView and dispatches taps for core actions, core option toggles, and a “Core Settings” gateway tile.
  • Adds unit tests for both providers and wires PVCoreBridge into the PVUIBase test target.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
PVUI/Sources/PVUIBase/PVEmulatorVC/CoreActionTileProvider.swift New provider(s) that convert CoreAction + boolean CoreOption into pause-menu tiles.
PVUI/Sources/PVUIBase/PVEmulatorVC/PauseTileMenuView.swift Injects dynamic core tiles into the grid and handles their tap behaviors, including a confirmation dialog for multi-option actions.
PVUI/Sources/PVUIBase/PVEmulatorVC/PVEmulatorViewController+CoreOptions.swift Adds a helper for forwarding CoreAction execution and reset behavior.
PVUI/Tests/PVUIBaseTests/CoreActionTileProviderTests.swift Adds provider-focused unit tests with mock cores/options.
PVUI/Package.swift Adds PVCoreBridge dependency to the PVUIBase tests target to compile the new tests.
.changelog/3249.md Adds a changelog fragment describing the new dynamic tiles behavior.

Comment on lines +2 to +5
- **CoreAction Tiles** — CoreActions exposed by the active emulator core now appear as orange bolt-icon tiles in the tile-based pause menu; actions that require a reset show a ⚠︎ warning badge.
- **CoreOption Toggle Tiles** — Boolean `CoreOption`s from the active core appear as inline ON/OFF toggle tiles directly in the pause menu grid.
- **Core Settings Tile** — A "Core Settings" tile is automatically injected when the core exposes any options, opening the full `CoreOptionsDetailView` sheet.
- **Multi-option Action Picker** — Core actions with multiple choices present a `confirmationDialog` inline so users can pick without leaving the pause menu.
Comment on lines +278 to +280
let currentValue = coreClass.storedValueForOption(Bool.self, key) ?? false
coreClass.setValue(!currentValue, forOption: option)

Comment on lines +503 to +512
ForEach(options, id: \.title) { opt in
Button(opt.title) {
pendingCoreAction = nil
dismissAction(false)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
coreWithActions.selected(action: action)
self.emulatorVC.core.setPauseEmulation(false)
if action.requiresReset {
self.emulatorVC.core.resetEmulation()
}
Comment on lines +278 to +279
let currentValue = coreClass.storedValueForOption(Bool.self, key) ?? false
coreClass.setValue(!currentValue, forOption: option)
Comment on lines +105 to +113
case let .bool(display, defaultValue, _):
let current = coreClass.storedValueForOption(Bool.self, display.title) ?? defaultValue
result.append(PauseMenuTile(
id: tileID(forOptionKey: display.title),
icon: current ? "checkmark.square.fill" : "square",
label: display.title,
badge: current ? "ON" : "OFF",
colorKey: current ? .green : .gray,
dismissOnTap: false
Comment on lines +47 to +59
/// Triggers the given ``CoreAction`` on the active core.
///
/// Called from ``PauseTileMenuView`` when a core-action tile is tapped.
/// The menu is responsible for dismissing itself; this method only
/// forwards the action and handles the reset side-effect.
public func handleCoreAction(_ action: CoreAction) {
guard let coreWithActions = core as? CoreActions else { return }
coreWithActions.selected(action: action)
core.setPauseEmulation(false)
if action.requiresReset {
core.resetEmulation()
}
}
@github-actions github-actions bot force-pushed the agent/issue-3249 branch 3 times, most recently from 84437ff to 8972150 Compare March 17, 2026 06:12
@JoeMatt
Copy link
Member

JoeMatt commented Mar 17, 2026

@claude please fix copilot review issues

@github-actions
Copy link
Contributor Author

github-actions bot commented Mar 17, 2026

✅ Fixes Pushed — AI Re-review Queued

Completed

  • 🚀 Agent started
  • 📖 Read PR context + Copilot review comments
  • 🔨 Fixed all 6 Copilot issues
  • 📤 Pushed to agent/issue-3249

Fixes Applied

  1. Changelog — removed trailing periods
  2. CoreActionTileProvider — use valueForOption (MD5-aware) instead of storedValueForOption
  3. PauseTileMenuView toggle — use valueForOption + setValue(andMD5:currentGameMD5)
  4. Toggle re-render — @State coreOptionRefreshToken forces grid re-evaluation after toggle
  5. Multi-option picker — passes CoreAction with selected CoreActionOption.selected = true
  6. Duplicate logic — both dispatch paths use handleCoreAction helper

Completed: 2026-03-17

@github-actions
Copy link
Contributor Author

✅ Fixes pushed — addressed all 6 Copilot review issues:

  1. Changelog — removed trailing periods from all 4 bullet entries
  2. CoreActionTileProvider — replaced storedValueForOption with valueForOption(option) (applies currentGameMD5 fallback + correct default handling)
  3. PauseTileMenuView toggle — same fix for the option-toggle path + scoped setValue with currentGameMD5
  4. Toggle re-render — added @State coreOptionRefreshToken incremented on toggle; coreTiles reads it so SwiftUI re-evaluates tile state immediately after every toggle
  5. Multi-option picker — now builds a new CoreAction with the chosen CoreActionOption marked selected: true, so cores can distinguish which option was picked
  6. Duplicate logic — both action-dispatch paths now call emulatorVC.handleCoreAction(_:), eliminating duplicated selected/setPause/reset inline code

@github-actions github-actions bot force-pushed the agent/issue-3249 branch 13 times, most recently from 390d4c9 to 15f852c Compare March 17, 2026 07:58
github-actions bot and others added 2 commits March 17, 2026 08:08
…3249)

- Add CoreActionTileProvider: maps CoreAction[] → PauseMenuTile[]
  (orange bolt tiles; ⚠︎ badge when requiresReset)
- Add CoreOptionTileProvider: maps boolean CoreOptions → ON/OFF toggle
  tiles plus a "Core Settings" gateway tile
- Inject dynamic core tiles into PauseTileMenuView (after primary tiles)
- Handle coreAction_*, coreOption_*, coreSettings tile IDs in dispatcher
- Show confirmationDialog for multi-option CoreActions inline
- Add handleCoreAction() helper on PVEmulatorViewController
- Add unit tests: CoreActionTileProviderTests, CoreOptionTileProviderTests
- Add PVCoreBridge as direct dep of PVUIBaseTests for mock conformances

Part of #3249

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Drop trailing periods from changelog fragment entries
- Use valueForOption (MD5-aware) instead of storedValueForOption in
  CoreActionTileProvider and the option-toggle handler
- Scope setValue calls with currentGameMD5 so per-game overrides apply
- Add @State coreOptionRefreshToken + reference in coreTiles so the
  tile grid re-renders immediately after a toggle
- Fix confirmationDialog to build a new CoreAction with the selected
  CoreActionOption marked selected:true so cores can distinguish picks
- Switch both action dispatch paths to call handleCoreAction, removing
  duplicated selected/setPause/reset logic from PauseTileMenuView

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-work PR or issue being worked on by the AI agent ai-reviewing AI code review in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants