Skip to content

feat(displays): native display backend behind a config flag (#91) - #98

Merged
lippdev merged 2 commits into
mainfrom
feat/native-displays
Sep 28, 2026
Merged

lippdev merged 2 commits into
mainfrom
feat/native-displays

Conversation

@lippdev

@lippdev lippdev commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

Second step of #91: replaces MultiMonitorTool with Windows' own display APIs, behind "NativeDisplays": true in config.json (off by default; the log shows displays=native).

MultiMonitorTool Native
/scomma listing QueryDisplayConfig (all paths) + target names; monitor ID and EDID from the registry
/enable, /disable SetDisplayConfig attaching/detaching paths (refuses to detach every screen)
/SetPrimary existing CcdHelper.SetPrimary
/SetMonitors (mode, position) ChangeDisplaySettingsEx
/SaveConfig, /LoadConfig same .cfg format, written and applied natively
/TurnOn, /TurnOff DDC/CI VCP 0xD6 via dxva2
/MoveWindow SetWindowPos on the process windows

Structure

  • MonitorService keeps all its orchestration (retries, waits, CCD fallbacks). Only the single commands moved behind IDisplayBackend, with MmtDisplayBackend (the old calls, unchanged) and NativeDisplayBackend.
  • Identity is preserved. The stable monitor ID saved in config.json is rebuilt in MultiMonitorTool's format (MONITOR\{hwid}\{driver key}), and name/serial come from the EDID, so the saved game screen and hidden screens keep matching.
  • Renumbering. A detached monitor can come back as another \\.\DISPLAYn. Re-enabling prefers the source it had before, and restore follows monitors by MonitorID in the backup.
  • Pure parts in DisplayIdentity (EDID, device path, monitor ID, source assignment, layout file) with unit tests.

Not verified yet

Written on macOS; CI builds it on Windows, but none of it has run on real hardware. The manual checklist is in docs/TESTING.md ("Telas nativas"). Draft until it passes.

Riskiest parts, in order: attaching an inactive monitor through SetDisplayConfig (TV that starts off), whether the rebuilt monitor ID matches what MultiMonitorTool saved, and restoring positions/primary.

Conflicts with #97 (native audio) in Models.cs, MainViewModel.BuildConfig, ConsoleEngine and the startup log line: both add a flag next to each other. Trivial; whichever merges second gets rebased.

🤖 Generated with Claude Code

Second step of replacing the bundled NirSoft tools: every MultiMonitorTool
command now goes through a display backend. The native one uses Windows' own
APIs: CCD (QueryDisplayConfig/SetDisplayConfig) to list, attach and detach
monitors and set the primary, ChangeDisplaySettingsEx for modes and positions,
DDC/CI (dxva2) for the turnOff strategy, and SetWindowPos to move windows.

- Off by default: "NativeDisplays": true in config.json turns it on.
- Same identity as MultiMonitorTool: the monitor ID saved in config.json is
  rebuilt from the device instance and its driver key, and name/serial come
  from the EDID, so saved screens keep matching.
- Same layout backup format; restoring follows monitors by MonitorID when a
  re-enabled monitor comes back as another \\.\DISPLAYn, and re-enabling
  prefers the video source a monitor had before.
- MonitorService keeps its retries, waits and fallbacks; only the single
  commands moved into MmtDisplayBackend / NativeDisplayBackend.
- Pure parts (EDID, device path, monitor ID, source assignment, layout file)
  in DisplayIdentity with tests; manual checklist in docs/TESTING.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lippdev
lippdev force-pushed the feat/native-displays branch from 0b1bd5e to a987f5e Compare September 28, 2026 13:31
@lippdev
lippdev marked this pull request as ready for review September 28, 2026 13:31

@pullfrog pullfrog Bot 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.

Important

The test project cannot be loaded until its unresolved merge conflict is fixed.

Reviewed changes This review covers the opt-in native Windows display backend and its integration with monitor identity, layout backups, and session orchestration.

  • Native display operations. Adds CCD-based monitor enumeration and enable/disable, native mode changes, DDC/CI power control, and process-window movement behind NativeDisplays.
  • Identity and layout compatibility. Adds EDID/monitor identity mapping, source assignment, and MultiMonitorTool-compatible layout save/restore.
  • Validation. Adds pure identity/layout tests and manual hardware checks; hardware behavior remains unverified.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

Comment thread tests/ConsoleMode.Tests/ConsoleMode.Tests.csproj

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes This run reviewed the test-project merge-conflict resolution since the prior Pullfrog review.

  • Resolved test source links. Removed the conflict markers while retaining the AudioNaming.cs and DisplayIdentity.cs compile entries.

Pullfrog  | View workflow run | Using GPT Luna | 𝕏

@lippdev
lippdev merged commit 581a02e into main Sep 28, 2026
5 checks passed
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