Skip to content

Fix saved profile parsing and selection#7

Open
Sean-Kenneth-Doherty wants to merge 1 commit into
TheWhiteGuardian:masterfrom
Sean-Kenneth-Doherty:profile-roundtrip-fixes
Open

Fix saved profile parsing and selection#7
Sean-Kenneth-Doherty wants to merge 1 commit into
TheWhiteGuardian:masterfrom
Sean-Kenneth-Doherty:profile-roundtrip-fixes

Conversation

@Sean-Kenneth-Doherty
Copy link
Copy Markdown

@Sean-Kenneth-Doherty Sean-Kenneth-Doherty commented May 17, 2026

Summary

  • Parse Unity-exported tuple values from saved profiles, including (x, y), (x, y, z), and RGBA(...) strings.
  • Preserve existing plain comma-separated values, hex colors, and byte-style RGB/RGBA input.
  • Apply a newly selected profile immediately when it targets the currently active scene.

Why

Custom profile export writes Unity ToString() values for several color and vector settings. Those strings include wrappers such as RGBA(...) and parentheses, but the parser was attempting to parse the wrapped text directly. That can make saved/custom profiles reload with broken color grading or vignette values.

The active-scene profile selector also updated the scene mapping without replacing the camera profile if one was already assigned, so selecting a different profile for the current scene could appear to do nothing.

This is a focused subset related to the custom preset/profile loading reports in #2 and the older profile-switching fixes proposed in #1.

Validation

  • Built KS3P.dll with mcs -define:UNITY_5_6_OR_NEWER against local KSP 1.12.5 managed assemblies. Result: compilation succeeded with the existing UnityEngine.WWW obsolete warnings in ShaderLoader.cs.
  • Ran a C# reflection probe against the compiled DLL for (0.25, 0.75), (1.10, 0.20, -0.30), RGBA(0.25, 0.50, 0.75, 1.00), and RGBA(128, 64, 255, 255). Result: parsed values matched expectations.
  • Ran a headless KSP 1.12.5 Main Menu proof with the released KS3P V6.1 GameData/KS3P assets from SpaceDock installed, including Configuration.cfg, DefaultConfig.cfg, Plugin/KS3P.dll, and Shaders/postprocessingshaders-linux.unity3d.
    • Baseline origin/master DLL loaded the released Linux shader bundle but parsed the wrapper values incorrectly:
      • center=0.000000,0.000000
      • vignetteColor=0.000000,0.001961,0.000000,1.000000
      • mixerRed=0.000000,0.200000,0.000000
      • gain=0.000000,0.250980,0.000000,1.000000
      • RESULT centerOk=False colorOk=False mixerOk=False byteColorOk=False pass=False
    • Patched DLL loaded the same released assets and parsed the same values correctly:
      • center=0.250000,0.750000
      • vignetteColor=0.250000,0.500000,0.750000,1.000000
      • mixerRed=1.100000,0.200000,-0.300000
      • gain=0.501961,0.250980,1.000000,1.000000
      • RESULT centerOk=True colorOk=True mixerOk=True byteColorOk=True pass=True
  • Ran git -c core.whitespace=blank-at-eol,blank-at-eof,space-before-tab,cr-at-eol diff --check. Result: passed.

Caveat

The runtime proof is headless at Main Menu with the released mod assets loaded; I did not capture an interactive visual post-processing screenshot in flight.

@Sean-Kenneth-Doherty Sean-Kenneth-Doherty marked this pull request as ready for review May 20, 2026 14:40
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