Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KSPC >= 1.22.0 breaks SpaceCenter node parsing #167

Closed
89Mods opened this issue Nov 5, 2023 · 5 comments
Closed

KSPC >= 1.22.0 breaks SpaceCenter node parsing #167

89Mods opened this issue Nov 5, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@89Mods
Copy link

89Mods commented Nov 5, 2023

Installing KSPC at or above version 1.22.0 causes Kopernicus to be unable to parse the fields inside any SpaceCenter nodes in custom planetary systems. This issue only occurs if KSPC is installed and at version 1.22.0 or above. The exception thrown is always Input string was not in a correct format. and for the very first line inside the SpaceCenter node, even if it is something as simple as longitude = 315.97

Logs files

@gotmachine
Copy link
Contributor

Could you please provide an example Kopernicus config that reproduce this, or at least the name of a planet pack and body in that planet pack ?

@gotmachine gotmachine added the bug Something isn't working label Nov 6, 2023
@gotmachine
Copy link
Contributor

gotmachine commented Nov 6, 2023

Ok, found it by myself by looking at your logs.
This happens because the configs are using non-quite-standard line endings (CR only instead of the usual CR LF), causing our confignode parser to output essentially garbage.
Exerpt from your MMCache :

	Kopernicus
	{
		name = Kerbol System
		Body
		{
			name = Sun
			identifier = Squad/Sun
			identifier = PJ3/Doe\r\t\tcacheFile = PJ3/KopernicusFiles/0_DoeA/Cache/Doe.bin\r\t\t@Properties

Original file (notice how it is all squished as a single line when viewing it in github)
image

This being said, if the stock parser is treating this case "correctly", KSPCF should definitely behave identically. I will try to push a fix ASAP.

@gotmachine
Copy link
Contributor

Ok, my guess would be that those lines :


need to be if (c == '\n' || c == '\r') to match the stock version (RecurseFormat(PreFormatConfig(s.Split('\n', '\r')))), but I'm unsure if our algorithm will handle that change correctly, and I can't check right now.

@NathanKell Would you mind taking a look at this ?

@NathanKell
Copy link
Contributor

Yep, and in the commented code there it even is already testing for both, it's just not doing it there. Whoops. :]

(Testing for either works because those cases put the parser in SkipToKey mode, which eats all whitespace until a non-whitespace character.)

@89Mods
Copy link
Author

89Mods commented Nov 7, 2023

Thanks for the info already. We were able to fix the issues with the config file on our end. No more crashes for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants