Skip to content

Fix shift-modifier Extras lost on save and misapplied on load#49

Open
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:fix/shift-extras-roundtrip
Open

Fix shift-modifier Extras lost on save and misapplied on load#49
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:fix/shift-extras-roundtrip

Conversation

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor

Bugs 3 and 4 of #46 — the two halves of the shift-modifier Extras round-trip, found while mutation-testing the profile-serialization code (#37).

Save side: ProfileDTO.MapFrom recomputes hasExtrasValue from dcs.shiftExtras but was missing the trailing add into shiftExtrasSerializer that its non-shift sibling has, so ShiftControl/Extras was never written to the profile XML — shift-mode extras (rumble/lightbar/mouse-sensitivity under a shift trigger) silently vanished on every save. (The old pre-DTO writer in SaveProfileOld appends the node right after the identical recompute, which is how the block lost its tail in the DTO port.)

Load side: MapTo's ShiftControl.Extras block still passed shift=false to UpdateDS4CExtra — unedited from the copied Control.Extras block, while every other ShiftControl sub-block passes true — so shift extras from older profiles loaded into the normal extras slot: firing without the shift trigger held and clobbering the control's normal extras.

The change: add the missing append, pass true for the shift slot, and cover both directions with regression tests (CheckShiftExtrasWrittenOnSave, CheckShiftExtrasReadIntoShiftSlot).

Before / After

Same command on base ba4bdcb and this branch (2cc9bb0), same machine:

dotnet test DS4WindowsTests\DS4WindowsTests.csproj -c Release -p:Platform=x64 --filter "Name~CheckShiftExtras"
Result
Before (base + the two tests) ❌ Failed: 2/2 — ShiftControl.Extras stays null on save; on load the shift value lands in extras and shiftExtras stays null
After (this branch) ✅ Passed: 2/2 — full suite 13/14 (the one failure is the pre-existing en-GB CheckSettingsRead date bug, fixed separately in #42); x64/x86 publishes clean

Full proof manifest + raw test outputs: https://gist.github.com/anagnorisis2peripeteia/3352cb2abb916edab1e6ae5ff7f882f1


Local review history: https://gist.github.com/anagnorisis2peripeteia/651881943f6c1b32d781cad8aa2cc548

MapFrom recomputed hasExtrasValue from dcs.shiftExtras but was missing the
trailing add into shiftExtrasSerializer that its non-shift sibling has, so
ShiftControl/Extras was never written to the profile XML and shift-mode
extras silently vanished on every save (the old pre-DTO writer appended the
node after the same recompute).

MapTo's ShiftControl.Extras block still passed shift=false to
UpdateDS4CExtra (unedited from the copied Control.Extras block; every other
ShiftControl sub-block passes true), so shift extras from older profiles
loaded into the normal extras slot - firing without the shift trigger and
clobbering the control's normal extras.

Add the missing append, pass true for the shift slot, and cover both
directions with regression tests.
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