linuxgurugamer / ksp-advanced-flybywire

Controller mod for Kerbal Space Program
MIT License
27 stars 11 forks source link

Fix Xml Serialization for KSPv1.8 #20

Closed bhaan closed 4 years ago

bhaan commented 5 years ago

Associated with issue #19

The root problem appeared to be that KeyValuePair<> is no longer supported by System.Xml.Serialization, preventing the configured presets from being persisted after exiting a flight scene.

My solution removes the KeyValuePair<> types from the serialization lists, and replaces them with custom classes that contain the same information. Additionally, I consolidated the ContinuousActionsInv mappings with the ContinuousActions mappings because the custom classes remove the limitation of a 1-to-1 association with KeyValuePair<> types.

Note: This change is not backwards compatible with previous controller presets. Users will have to reconfigure their controllers if these changes are merged. I've tested that an old configuration file will not cause failures for the mod during deserialization, but all the button and axis bindings will be removed.

If backwards compatibility is a concern, I believe I could make that happen, but it likely wont be a trivial task.