CollapseLauncher / Collapse

An Advanced Launcher for miHoYo/HoYoverse Games
MIT License
1.41k stars 65 forks source link

[Bug]: Failure in parsing HSR settings #255

Closed akayukipierrot closed 1 year ago

akayukipierrot commented 1 year ago

Affected Version

Collapse 1.71.9

Bug Behavior

When trying to change settings for Star Rail, I encounter this error and it doesn't let me change anything. The settings page in game is also bugged for me as I had 120 fps option on. The error shown is here:

System.Exception: Failed when reading game settings GraphicsSettings_PCResolution_h431323223
Please open the game and change any graphics settings, then safely close the game. If the problem persist, report the issue on our GitHub
System.Text.Json.JsonException: '0' is an invalid end of a number. Expected a delimiter. Path: $.width | LineNumber: 0 | BytePositionInLine: 47.
 ---> System.Text.Json.JsonReaderException: '0' is an invalid end of a number. Expected a delimiter. LineNumber: 0 | BytePositionInLine: 47.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader&, ExceptionResource, Byte , ReadOnlySpan`1 )
   at System.Text.Json.Utf8JsonReader.ConsumeNumber()
   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader&, Type, JsonSerializerOptions, ReadStack& , T& )
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader&, Type, JsonSerializerOptions, ReadStack& , T& )
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader&, JsonSerializerOptions, ReadStack& )
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& , JsonReaderException)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader&, JsonSerializerOptions, ReadStack& )
   at System.Text.Json.Serialization.JsonConverter`1.ReadCoreAsObject(Utf8JsonReader&, JsonSerializerOptions, ReadStack& )
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1, JsonTypeInfo, Nullable`1 )
   at System.Text.Json.JsonSerializer.Deserialize(ReadOnlySpan`1 , Type, JsonSerializerContext)
   at CollapseLauncher.GameSettings.StarRail.PCResolution.Load()
 ---> System.Text.Json.JsonException: '0' is an invalid end of a number. Expected a delimiter. Path: $.width | LineNumber: 0 | BytePositionInLine: 47.
 ---> System.Text.Json.JsonReaderException: '0' is an invalid end of a number. Expected a delimiter. LineNumber: 0 | BytePositionInLine: 47.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader&, ExceptionResource, Byte , ReadOnlySpan`1 )
   at System.Text.Json.Utf8JsonReader.ConsumeNumber()
   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader&, Type, JsonSerializerOptions, ReadStack& , T& )
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader&, Type, JsonSerializerOptions, ReadStack& , T& )
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader&, JsonSerializerOptions, ReadStack& )
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& , JsonReaderException)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader&, JsonSerializerOptions, ReadStack& )
   at System.Text.Json.Serialization.JsonConverter`1.ReadCoreAsObject(Utf8JsonReader&, JsonSerializerOptions, ReadStack& )
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1, JsonTypeInfo, Nullable`1 )
   at System.Text.Json.JsonSerializer.Deserialize(ReadOnlySpan`1 , Type, JsonSerializerContext)
   at CollapseLauncher.GameSettings.StarRail.PCResolution.Load()
   --- End of inner exception stack trace ---

This is also attached here: DxDiag.txt

Expected Behavior

Collapse should have allowed me to open the settings page.

Steps to reproduce

  1. Open the launcher
  2. Click the settings tab from Star Rail
  3. Error occurs

Related Issues

No response

Screenshot(s)

No response

Additional Information

No response

Cryotechnic commented 1 year ago

Hello! Thanks for reporting the issue. We are currently aware that this is a problem for some users and are looking into trying to resolve the issue on our end.

This happens when you force close the game while it is still writing to the settings registry file. There currently is no "easy" way to resolve this issue, so you're going to have to go into the registry and delete the associated key so that the game can recreate it during the next startup. Here are the steps to resolve the issue presently (note that you may need Administrator privileges to proceed):

  1. Open your start menu and search for "Registry Editor". If nothing shows up, do WinKey + R, then type regedit and hit Enter.
  2. Navigate to the following path: Computer\HKEY_CURRENT_USER\Software\Cognosphere\Star Rail
  3. Delete the associated key (in your case, this would be GraphicsSettings_PCResolution_h431323223)
  4. Restart Collapse and attempt to relaunch the game

Please let us know if following the steps above resolve your issue. We apologize for any inconvenience caused. While we are currently working on resolving, the fix may take some time to ship due to the complexity of the issue. Thanks again for reporting the issue!

bagusnl commented 1 year ago

Hi, I have made a fix in commit https://github.com/neon-nyan/Collapse/commit/196739a6314ccb8dbaf33677dbb1e0cbd43f868d

you can test the debug build in https://r2-render.bagelnl.my.id/misc-stuff/net7.0-windows10.0.22000.0.7z Just extract and run the CollapseLauncher.exe

As a note, since this is a debug build, it will be a bit slower than release, and you might need to install some dependencies that it asks (mainly .net7)

Let us know how it goes