Repository navigation
Add own start/stop scripts, exact NTSC refresh rate and pointer parking - #173
JarJarShinks wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JeVPVVR2w4PMKBfFjDkiT5
There was a problem hiding this comment.
Important
This PR has behavior gaps in timeout cleanup, custom-app pointer parking, and preserving display mode data during the exact-rate request.
Reviewed changes
Reviewed the initial commit adding session hooks, exact NTSC refresh selection, and pointer parking.
- Session scripts: Adds configurable start and stop commands with hidden execution and a 60-second wait limit.
- Exact refresh rate: Requests the 1000/1001 refresh-rate twin for the focused display through CCD.
- Pointer parking: Adds an option to move the pointer after the launcher is ready, with settings, localization, docs, and tests.
gpt-6-luna | 𝕏
| AppLog.Write($"Script ({label}): não foi possível iniciar"); | ||
| return; | ||
| } | ||
| if (!process.WaitForExit((int)UserCommand.Timeout.TotalMilliseconds)) |
There was a problem hiding this comment.
When this wait times out, disposing the Process only closes the handle; cmd.exe and the script keep running. A timed-out start script can therefore overlap with session teardown and the stop script, leaving user state modified after restoration; stop or track the timed-out command before returning.
Technical details
# Timed-out session commands remain active
## Affected sites
- `src/ConsoleMode/Services/UserHooks.cs:34-37` — returns after timeout without stopping or retaining the child process.
- `src/ConsoleMode/Services/ConsoleEngine.cs:105` — start command runs before session setup continues.
- `src/ConsoleMode/Services/ConsoleEngine.cs:385` — stop command runs during teardown and may race a still-running start command.
## Required outcome
- Ensure a command reported as timed out cannot continue mutating state unnoticed while the session or its matching stop command proceeds.| var now = DateTime.Now; | ||
| var ready = State.FullscreenMode == "xboxMode" | ||
| ? State.LaunchTime is { } launched && now - launched >= PointerParking.XboxDelay | ||
| : State.HasAppeared; |
There was a problem hiding this comment.
Custom-app mode takes an earlier return in Tick and never sets State.HasAppeared; only the fullscreen-window path below sets it. Consequently ready stays false and the pointer is never parked for custom apps, despite the documented behavior; use a readiness signal that custom-app sessions can reach.
| } | ||
| if (!found) return -100; | ||
|
|
||
| var flags = SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_ALLOW_CHANGES; |
There was a problem hiding this comment.
SDC_ALLOW_CHANGES permits Windows to modify supplied source and target mode information, and the same flag is used for the subsequent apply. That means this request can alter the source mode's resolution or desktop position, contrary to the method's preservation guarantee; avoid allowing source-mode changes or verify and preserve those values.
Technical details
# Exact refresh request may change source mode data
## Affected sites
- `src/ConsoleMode/Native/CcdHelper.cs:368-371` — validation and application both include `SDC_ALLOW_CHANGES` while passing the queried `modes` array.
- `src/ConsoleMode/Native/CcdHelper.cs:361-363` — source mode data is retained but its values are not checked after application.
## Required outcome
- Apply the target refresh-rate request without silently changing the display's source resolution or desktop position.
## Suggested approach
- Reject configurations that require source-mode changes, or confirm the applied source mode still has the original dimensions and position.|
Thanks a lot for this, and for the effort you're putting into making Console Mode better! The code is careful and follows the project's conventions well: strings in all six languages, both changelogs, the guides and the TESTING.md checklist. The 553 tests pass and the app builds locally. I'm already working on implementing these ideas, starting with the pointer from #172. Before going further, could you split this into one PR per feature? The project keeps one topic per PR (see AGENTS.md), and these three carry very different risk:
A few small things for each PR:
Thanks again! |

Claude-Session: https://claude.ai/code/session_01JeVPVVR2w4PMKBfFjDkiT5