Fix autotracker reload lockup, stale state, and NWA address map detection (#93)#95
Merged
Merged
Conversation
…tion (#93) - AutoTrackerExtension.OnAnyPackageLoadStarting: fully stop autotracking on pack reload instead of preserving the connection. Previously the extension was left in an "active/running" state that didn't actually refresh after reload — user had to manually stop+start. Now the reload drains the in-flight poll, disconnects the active provider, fires AutoTrackerStopped, and emits property-change for Active / StatusBarControl so bindings reflect the stopped state immediately. - LuaMemorySegment.OnSegmentDataUpdated: re-read mCallback inside the dispatched lambda and check ScriptManager.IsLuaLoaded before invoking SafeCall. A Dispatch.BeginInvoke posted from an in-flight poll just before reload would otherwise land after ScriptManager.Reset closed the Lua state, hanging the UI thread inside NLua — issue #93. - NwaDevice.ReadRawDomainAsync: replace stray space with the protocol's ';' separator in the CORE_READ command used by the SNES address-map initializer. The malformed command was rejected by snes9x-nwa as a protocol error, causing ROM-header reads to throw and SNES layout detection to silently fall back to LoROM regardless of the actual cartridge mapping. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #93 (UI lockup when reloading pack with autotracker connected) plus two related issues uncovered while investigating it.
AutoTrackerExtension.OnAnyPackageLoadStarting— fully stop autotracking on pack reload (drain in-flight poll, disconnect active provider, fireAutoTrackerStopped, raiseActive/StatusBarControlnotifications). Previously the connection was preserved across reload, leaving the extension stuck in an "active/running" state that didn't actually refresh until the user manually stopped and restarted.LuaMemorySegment.OnSegmentDataUpdated— re-readmCallbackinside the dispatched lambda and checkScriptManager.IsLuaLoadedbefore callingSafeCall. ADispatch.BeginInvokeposted from an in-flight poll just before reload would otherwise land afterScriptManager.Resetclosed the Lua state and invoke aLuaFunctionagainst a closed state — which hangs the UI thread inside NLua. This is the root-cause hang from Emotracker locks up if reloading while autotracker is connected/started #93; the null-check is defense-in-depth in case any dispatched callback slips past the new full-stop.NwaDevice.ReadRawDomainAsync— replace stray space with the protocol's;separator in theCORE_READcommand used by the SNES address-map initializer. The malformed command was rejected by snes9x-nwa as a protocol error, causing ROM-header reads to throw and SNES layout detection to silently fall back to LoROM regardless of cartridge mapping.The reload-handler change is scoped to the state being reloaded — multi-tab/multi-window setups continue polling on their other tabs undisturbed (the existing
ReferenceEquals(e.Target, mState)guard).Test plan
Detected ROM layout: HiROMinstead ofLoROM; pack reads land on the correct ROM offsets.🤖 Generated with Claude Code