More C# alignment#63
Conversation
…sing, match int.TryParse semantics
…ck server thread on shutdown
|
Thanks for bringing this all together. I tried to keep each fix isolated and small to make incremental progress. I've been jamming on replacing my Windows cabinet with a linux version this past week and it's looking very promising. |
What hardware do you have? We have a discord channel that would be helpful for feedback. |
I'm running:
|
Follow-ups from reviewing the recent AI-submitted PRs, aligning the port with the C# source and fixing the issues those reviews surfaced:
map::at(), matching the C# dictionary indexer (throws for a missing key, caught inPinball::MainThreadDoItexactly like C#'sKeyNotFoundException).RegisterAlarmnow unregisters same-handler alarms before adding, perAlarmHandler.cs(the parameterized overload already did). Renames the parameter todoNotUnregister(C#DoNotUnregister) and drops the stored flag C# doesn't keep. Closes the staleMaxRunTimeMotorStopaccumulation possible after Fix Motor toy never scheduling its kickstart/max-runtime alarms #55.GetByName's controller+number fast path now falls through to the by-name loop when the numbered output doesn't exist, matching the C# indexer;TryParseIntnow requires full consumption likeint.TryParse("1x" no longer parses as 1).PinOne.csexactly.m_oldOutputValuesinitialized to 255 per C# (Enumerable.Repeat((byte)255, ...)), so the initial all-off sweep actually transmits.{ctrl}\{ctrl}.NNoutput name form in LedWiz, PacLed64, PacUIO, Pinscape, PinscapePico, and DudesCab configurators (safe now that resolution goes throughGetByNameafter Resolve LedWizEquivalent outputs via CabinetOutputList (fixes PinOne + FTDI "0 of N resolved") #60); align FT245R's format string with the C# original. PacDrive stays flat, matching C#.<PacUIO>with a missing Id; outputs are now added viaOutputList::Addso they subscribe to value-changed events.sp_open's result was ignored, so a bad or unopenable port left the server running with a dead handle, silently dropping every write (10.8.1 Linux standalone: DOF not working with PinOne Control Board vpinball#2962). The constructor now throws, makingCreateServerreturn false andConnectToControllerfail the same way C# does whenSerialPort.Open()throws. The server thread previously blocked forever inaccept(), hangingStopServer()'sjoin()on every teardown ("Updater thread did not quit" in 10.8.1 Linux standalone: DOF not working with PinOne Control Board #31);select()with a 200ms timeout bounds bothaccept()and the client read so the thread re-checksm_isRunning— unlike Fix PinOne DOF output silently dropped on Linux (sp_open return ignored) #53'sSO_RCVTIMEO, this also works on macOS, where that option does not affectaccept()(verified empirically). Port close/free is now owned solely byStopServer, removing the pre-existing doublesp_close.Testing: full build clean; teardown behavior of the select-based server loop verified on macOS with a standalone harness (no-client teardown joins in ~110ms where
accept()previously blocked forever; silent-client teardown ~105ms; data path unaffected).