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

[Loading hang][Regression] CommunityResourcePack caused loading hang #213

Open
adam900710 opened this issue Oct 28, 2017 · 19 comments
Open

Comments

@adam900710
Copy link

Version: 0.8.0.0
OS: Archlinux
KSP version: 1.3.1
KSP.log:

[LOG 17:51:29.835] Config(TUTORIAL) Squad/Tutorials/FromMun/FromMun
[LOG 17:51:29.835] Config(TUTORIAL) Squad/Tutorials/GoForOrbit/GoForOrbit
[LOG 17:51:29.835] Config(ScienceChecklist) [x] Science!/science/ScienceChecklist
[LOG 17:51:29.837] Resource RESOURCE_DEFINITION added to database
[LOG 17:51:29.837] Resource RESOURCE_DEFINITION added to database
[LOG 17:51:29.837] Resource RESOURCE_DEFINITION added to database
[LOG 17:51:29.837] Resource RESOURCE_DEFINITION added to database
[EXC 17:51:29.840] ArgumentOutOfRangeException: startIndex + length > this.length
Parameter name: length
	System.String.Substring (Int32 startIndex, Int32 length)
	PartResourceDefinition.GetShortName (Int32 length)
	PartResourceDefinition.Load (.ConfigNode node)
	PartResourceDefinitionList.Add (.ConfigNode node)
	PartResourceLibrary.LoadDefinitions ()
	GameDatabase+
	�.MoveNext ()
	UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress)
[LOG 17:51:29.858] CodeAssetLoader: Compiling all code assets

Yes, I have some other small mods, but with only CommunityResourcePack mod, it will cause loading hang.
Other mods are:
[x] Science
MechJeb
Kerbal Alarm Clock

@adam900710 adam900710 changed the title [Loading hang][Linux][KSP 1.3.1] CommunityResourcePack caused loading hang [Loading hang][Regression] CommunityResourcePack caused loading hang Oct 28, 2017
@adam900710
Copy link
Author

It's a regression, version 0.7.2.0 works fine.

@adam900710
Copy link
Author

236c3f0 is the first bad commit

Well, I forgot to mention I'm also using Chinese localisation, so I wonder other language is not affected and no tester exposed it yet.

@adam900710
Copy link
Author

adam900710 commented Oct 28, 2017

difftool shows me some different in lines and whitespace difference (4 spaces vs 1 tab), but even after I manually modified them, it's still triggering the hang.

While copying en-us.cfg to overwrite zh-cn.cfg definitely fixed the problem, it's definitely the problem of zh-cn.cfg.
Very strange here.

@BobPalmer
Copy link
Collaborator

@sswelm - you need to sort this please, as it was introduced in your commit.

@adam900710
Copy link
Author

Extra info, I verified the dict from Squad in GameData/Squad/Localization/dictionary.cfg, which has UTF-8 BOM, with CRLF as change line.

However the en-us.cfg is without BOM, with LF only.
I'll try to convert the translation to the same format as Squad to see if it helps

@xiaoqianWX
Copy link
Contributor

Hi, this file is translated by me, well, in my mind, I think this is because you didn't have KSPFileLocalizer in your GameData.

@adam900710
Copy link
Author

Is that a mod or something else? At least I can't find such mod.

@adam900710
Copy link
Author

@EthanWang706 Any extra info about how to fix it?

@xiaoqianWX
Copy link
Contributor

xiaoqianWX commented Oct 29, 2017

screen shot 2017-10-29 at 1 08 44 pm
Here, it's included inside KPBS or Feline Rover

@adam900710
Copy link
Author

adam900710 commented Oct 29, 2017

Get from https://github.com/Nils277/KSPModFileLocalizer

Tried, no help. Still loading hang.

Also tried KSPModFileLocalizer from KPBS, still no help.

@xiaoqianWX
Copy link
Contributor

It feels like I can't fix it, I tried any way that I could think about, if I change it to English, the game will crash, maybe @sswelm @BobPalmer could fix it

@BobPalmer
Copy link
Collaborator

We will very likely have to just remove the file if @sswelm cannot do a fix, since as noted, this was a file he introduced (and I had assumed tested).

@sswelm
Copy link
Contributor

sswelm commented Oct 30, 2017

I still have a few ideas I would like to test to see if we can identify the problem

@sswelm
Copy link
Contributor

sswelm commented Oct 30, 2017

Alright, there appears to be some translation in the USI and RealFuels section that are causing a crash. I suspect some illegal Chinese character were used, its hard to tell which one, but I will narrow it down

@sswelm
Copy link
Contributor

sswelm commented Oct 30, 2017

I figured out which Chinese localization were causing problems, I made a pull request of a localisation where I commented out the illigal chinese characters that were causing KSP to crash. I kope to fix the missing localisation later on

@xiaoqianWX
Copy link
Contributor

I just contact Squad for fixing this issue, it could be found here: https://forum.kerbalspaceprogram.com/index.php?/topic/167052-simple-translations-illegal/

@xiaoqianWX
Copy link
Contributor

This is pretty much being fixed, for ones that is hard to translate to Chinese, I replaced them with English

@xiaoqianWX
Copy link
Contributor

Submitted in SQUAD BugTracker #16477

@tinygrox
Copy link
Contributor

It's been 7 years, and now there's finally a solution to this!
the problem was actually the missing abbreviation field! not because of some illegal Chinese characters being used.
When the abbreviation is absent, the game will call a method GetShortName(2), which returns displayName.Substring(0, 2). Since the length of displayName is less than 2(the lead's displayName is "铅"), Substring throws an exception!
So, the fix is simply adding the abbreviation field within the RESOURCE_DEFINITION!

For "Lead" example:

RESOURCE_DEFINITION
{
    name = Lead
    displayName = #LOC_CRP_Lead_DisplayName
    abbreviation = #LOC_CRP_Lead_abbreviation   // <== HERE!
    density = 0.01134
    unitCost = 0.067392
    hsp = 128
    flowMode = ALL_VESSEL
    transfer = PUMP
    isTweakable = True
    isVisible = true
    volume = 1
    ksparpicon = RealFuels/Resources/ARPIcons/LeadBallast
}

unfortunately, this happens during the ConfigNode loading phase, so I believe it's not possible to use ModuleManager (MM) to apply a patch.

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

No branches or pull requests

5 participants