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

Bypass Launcher causing tweakscale error. Cause and workaround within. #269

Closed
anth1256 opened this issue Nov 5, 2022 · 21 comments
Closed

Comments

@anth1256
Copy link

anth1256 commented Nov 5, 2022

@Lisias The issue with the bypass for the launcher in 1.12.4 is that it cant see the dlls in the PluginData (D:\Steam\steamapps\common\Kerbal Space Program\GameData\TweakScale\Plugins\PluginData) folder

Remove all files except for Scale_Redist.dll and put them into the Plugins folder
LauncherBypass
Showing the launch bypass on steam

An additional problem is that while the bypass for the launcher is being used is that that the mod cant see the icons in the \GameData\TweakScale\PluginData\Icons folder and its showing the error as per the screenshot
screenshot0

@anth1256
Copy link
Author

anth1256 commented Nov 5, 2022

I have some bad news. With the
"D:\Steam\steamapps\common\Kerbal Space Program\KSP_x64.exe" %Command%
as the launch option the ksp.log is never generated. I tried restarting the computer. same thing.
Added verbose logging. Same thing. It never gets generated.

However here is the Player.log
Look to line 40398
Player.log

Remember this is with moving the dlls out of D:\Steam\steamapps\common\Kerbal Space Program\GameData\TweakScale\Plugins\PluginData and into Plugins except for Scale_Redist.dll which thinks there's two instances of it if I do so.

@Lisias
Copy link

Lisias commented Nov 5, 2022

Humm… Interesting…

AssemblyLoader: Exception loading 'Scale_Sanitizer': System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException
' was thrown.
  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <9577ac7a62ef43179789031239ba8798>:0
  at AssemblyLoader.LoadAssemblies () [0x000e6] in <0435390348b6470d8166bd1c53b4b100>:0

Additional information about this exception:

 System.TypeLoadException: Could not resolve type with token 01000023 (from typeref, class/assembly TweakScale.Sanitizer.SanityCheck, Scale_Redist, Version=1.1.0.0,
 Culture=neutral, PublicKeyToken=null) assembly:Scale_Redist, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null type:TweakScale.Sanitizer.SanityCheck member:(nu
ll) signature:<none>

 System.TypeLoadException: Could not resolve type with token 01000023 (from typeref, class/assembly TweakScale.Sanitizer.SanityCheck, Scale_Redist, Version=1.1.0.0,
 Culture=neutral, PublicKeyToken=null)
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

The DLLs are not being loaded correctly. You somehow fooled the Assembly Loader/Resolver into loading something, but this something wasn't loaded at all.

Please install TweakScale as it should and run another Player.log. I want to see what's really happening .

@Lisias
Copy link

Lisias commented Nov 5, 2022

Still more weird, found the problem on loading Icons. It's not "file not found", it's really "Invalid Content", as the file were damaged…

Exception handling event onEditorPartPlaced in class ToolbarSupport:System.TypeInitializationException: The type initializer for 'TweakScale.GUI.Icons' threw an exc
eption. ---> KSPe.Util.Image.Error: Invalid content while reading file GameData\TweakScale\PluginData\Icons\Scale_Off
  at KSPe.Util.Image.Texture2D.LoadFromFile (System.String fileNamePath, System.Int32 width, System.Int32 height, System.Boolean mipmap) [0x0012b] in <36f55e6817764
b8cbb675f9c0dfeaf9e>:0
  at KSPe.Util.Image.Texture2D.LoadFromFile (System.String fileNamePath) [0x00000] in <36f55e6817764b8cbb675f9c0dfeaf9e>:0
  at TweakScale.GUI.Icons..cctor () [0x00034] in <b608a5e0fb114a86ba977162d3858879>:0
   --- End of inner exception stack trace ---
  at EventData`1[T].Fire (T data) [0x000b0] in <0435390348b6470d8166bd1c53b4b100>:0
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

Error: Invalid content while reading file GameData\TweakScale\PluginData\Icons\Scale_Off
  at KSPe.Util.Image.Texture2D.LoadFromFile (System.String fileNamePath, System.Int32 width, System.Int32 height, System.Boolean mipmap) [0x0012b] in <36f55e6817764
b8cbb675f9c0dfeaf9e>:0
  at KSPe.Util.Image.Texture2D.LoadFromFile (System.String fileNamePath) [0x00000] in <36f55e6817764b8cbb675f9c0dfeaf9e>:0
  at TweakScale.GUI.Icons..cctor () [0x00034] in <b608a5e0fb114a86ba977162d3858879>:0
Rethrow as TypeInitializationException: The type initializer for 'TweakScale.GUI.Icons' threw an exception.
  at EventData`1[T].Fire (T data) [0x000b0] in <0435390348b6470d8166bd1c53b4b100>:0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
EventData`1:Fire(Part)
EditorLogic:<SetupFSM>b__189_6(KFSMState)
KerbalFSM:RunEvent(KFSMEvent)
EditorLogic:DestroySelectedPart()
EditorLogic:OnPartListBackgroundTap()
KSP.UI.Screens.EditorPartList:TapBackground()
UnityEngine.Events.InvokableCall:Invoke()
UnityEngine.Events.UnityEvent`1:Invoke(BaseEventData)
UnityEngine.EventSystems.EventTrigger:Execute(EventTriggerType, BaseEventData)
UnityEngine.EventSystems.EventTrigger:OnPointerClick(PointerEventData)
UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ReleaseMouse(PointerEventData, GameObject)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMousePress(MouseButtonEventData)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent(Int32)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent()
UnityEngine.EventSystems.StandaloneInputModule:Process()
UnityEngine.EventSystems.EventSystem:Update()

@Lisias
Copy link

Lisias commented Nov 5, 2022

Hunmm… doing some more analysis on the Player.log:

This appears to be alright:

Mono path[0] = 'D:/Steam/steamapps/common/Kerbal Space Program/KSP_x64_Data/Managed'
Mono config path = 'D:/Steam/steamapps/common/Kerbal Space Program/MonoBleedingEdge/etc'
Initialize engine version: 2019.4.18f1 (3310a4d4f880)
[Subsystems] Discovering subsystems at path D:/Steam/steamapps/common/Kerbal Space Program/KSP_x64_Data/UnitySubsystems

But this is where things get weird…

Environment Info
Win32NT 7FFFFFFFFFFFFFFF  Args: KSP_x64.exe D:\Steam\steamapps\common\Kerbal Space Program\PDLauncher\launcherpatcher.exe

The launcherpatcher.exe thingy is being added as a parameter to KSP_x64.exe . It's somthing like a backdoor on the game executable?

I think they are patching the game at runtime….

@anth1256
Copy link
Author

anth1256 commented Nov 5, 2022

(Bypass Launch Option used) Heres the KSP.log from the PDLauncher folder as you suspected it would be (from the KSP forums)
This is with my movements of the DLLs.
KSP.log

@anth1256
Copy link
Author

anth1256 commented Nov 5, 2022

(Bypass Launch Option used) Heres the KSP.log from the PDLauncher folder with tweakscale and the recall mod correctly installed.

KSP.log
Player.log Isn't the same run through. But I did very similar actions to get it. (This is to the request you made before which I missed until now)
Player.log

@anth1256
Copy link
Author

anth1256 commented Nov 5, 2022

(Launcher used as designed) Heres the KSP.log from the KSP main folder with tweakscale and the recall mod installed correctly
KSP.log

@anth1256
Copy link
Author

anth1256 commented Nov 5, 2022

Note the
Win32NT 7FFFFFFFFFFFFFFF Args: KSP_x64.exe D:\Steam\steamapps\common\Kerbal Space Program\PDLauncher\launcherpatcher.exe is missing if the launcher is running as intended.

That might be what is redirecting the ksp.log to D:\Steam\steamapps\common\Kerbal Space Program\PDLauncher\ when the launcher isnt actually running. I wonder what would happen if the folder was completely removed.

Oh. Interesting. I removed the PDLauncher folder. Ran it with the bypass and it came up with an error that a necessary executable is missing being D:\Steam\steamapps\common\Kerbal Space Program\PDLauncher\launcherpatcher.exe
Then I tried to start KSP again and it downloaded the missing PDLauncher folder automatically before saying KSP was ready to be started.

@anth1256
Copy link
Author

anth1256 commented Nov 5, 2022

Then I removed the bypass and deleted PDLauncher and then ran and it did the same thing.

KSP_x64.exe D:\Steam\steamapps\common\Kerbal Space Program\PDLauncher\launcherpatcher.exe
Could this be KSP asking if D:\Steam\steamapps\common\Kerbal Space Program\PDLauncher\launcherpatcher.exe exists?

@Lisias
Copy link

Lisias commented Nov 5, 2022

On REDDIT, it was found that moving the GameData into PDLauncher will "fix" the problems.

https://www.reddit.com/r/KerbalSpaceProgram/comments/ym04gx/solution_for_broken_mods_caused_by_the_launcher/

I didn't tested it, I will have a Windows machine available soon and then I will double check the stunt.

I'm working on the new KSP.logs now.

@Lisias
Copy link

Lisias commented Nov 5, 2022

Oukey, here we go:

(Bypass Launch Option used) This is with my movements of the DLLs.

[EXC 21:35:38.854] [ModuleManager] Post run call threw an exception in loading Scale_Sanitizer, Version=1.0.8229.11235, Culture=neutral, PublicKeyToken=n
ull: System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <9577ac7a62ef43179789031239ba8798>:0
  at ModuleManager.PostPatchLoader+<Run>d__16.MoveNext () [0x00538] in <ac37db06097f4706b70066f555f86981>:0

<…>

 System.TypeLoadException: Could not resolve type with token 01000023 (from typeref, class/assembly TweakScale.Sanitizer.SanityCheck, Scale_Redist, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null) assembly:Scale_Redist, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null type:TweakScale.Sanitizer.
SanityCheck member:(null) signature:<none>

 System.TypeLoadException: Could not resolve type with token 01000023 (from typeref, class/assembly TweakScale.Sanitizer.SanityCheck, Scale_Redist, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null)

<…>

[EXC 21:36:32.001] Error: Invalid content while reading file GameData\TweakScale\PluginData\Icons\Scale_Off
        KSPe.Util.Image.Texture2D.LoadFromFile (System.String fileNamePath, System.Int32 width, System.Int32 height, System.Boolean mipmap) (at <36f55e6817764b8cbb675f9c0dfeaf9e>:0)

(Bypass Launch Option used) Heres the KSP.log from the PDLauncher folder with tweakscale and the recall mod correctly installed.

[LOG 21:45:04.721] [KSPe.Binder] Looking for Scale.PartDB.19x.dll on GameData\TweakScale\Plugins\PluginData\...
[LOG 21:45:04.727] [TweakScale] ERROR: System.IO.FileNotFoundException: Could not load file or assembly 'Scale.PartDB.19x' or one of its dependencies
File name: 'Scale.PartDB.19x'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, System.Boolean refonly) [0x00016] in <9577ac7
a62ef43179789031239ba8798>:0
  at System.AppDomain.Load (System.String assemblyString) [0x00000] in <9577ac7a62ef43179789031239ba8798>:0
  at (wrapper remoting-invoke-with-check) System.AppDomain.Load(string)
  at KSPe.Util.SystemTools+Assembly.LoadAndStartup (System.String assemblyName) [0x00005] in <36f55e6817764b8cbb675f9c0dfeaf9e>:0
  at KSPe.Util.SystemTools+Assembly+Loader.LoadAndStartup (System.String assemblyName) [0x00000] in <36f55e6817764b8cbb675f9c0dfeaf9e>:0
  at TweakScale.Startup.Start () [0x0008b] in <b608a5e0fb114a86ba977162d3858879>:0  at error:0

<…>

[EXC 21:46:27.646] Error: Invalid content while reading file GameData\TweakScale\PluginData\Icons\Scale_Off
        KSPe.Util.Image.Texture2D.LoadFromFile (System.String fileNamePath, System.Int32 width, System.Int32 height, System.Boolean mipmap) (at <36f55e68
17764b8cbb675f9c0dfeaf9e>:0)
        KSPe.Util.Image.Texture2D.LoadFromFile (System.String fileNamePath) (at <36f55e6817764b8cbb675f9c0dfeaf9e>:0)
        TweakScale.GUI.Icons..cctor () (at <b608a5e0fb114a86ba977162d3858879>:0)
        Rethrow as TypeInitializationException: The type initializer for 'TweakScale.GUI.Icons' threw an exception.
        UnityEngine.DebugLogHandler:LogException(Exception, Object)
        ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
        UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)

<…>

[LOG 21:46:33.989] [KSP-Recall.Refunding] TRACE: OnAwake <NO VESSEL>-mk2Cockpit.Standard(Clone):FFF93C82
[EXC 21:46:34.006] DllNotFoundException: An Add'On Support DLL was not loaded. Missing type : TweakScale.PartDB.StandardPartScaler
        KSPe.Util.SystemTools+Type+Finder.FindByQualifiedName (System.String qn) (at <36f55e6817764b8cbb675f9c0dfeaf9e>:0)
        KSPe.Util.SystemTools+TypeFinder.FindByQualifiedName (System.String qn) (at <36f55e6817764b8cbb675f9c0dfeaf9e>:0)
        TweakScale.PartDB.Scaler.FindAndCreate (System.String name, Part prefab, Part part, TweakScale.ScaleType scaleType, TweakScale.TweakScale ts) (at
 <b608a5e0fb114a86ba977162d3858879>:0)
        TweakScale.PartDB.Scaler.Create (Part prefab, Part part, TweakScale.ScaleType scaleType, TweakScale.TweakScale ts) (at <b608a5e0fb114a86ba977162d
3858879>:0)
        TweakScale.TweakScale.Setup (Part part) (at <b608a5e0fb114a86ba977162d3858879>:0)
        TweakScale.TweakScale.OnAwake () (at <b608a5e0fb114a86ba977162d3858879>:0)
        PartModule.Awake () (at <0435390348b6470d8166bd1c53b4b100>:0)
        UnityEngine.DebugLogHandler:LogException(Exception, Object)
        ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
        UnityEngine.GameObject:SetActive(Boolean)
        EditorLogic:OnPodSpawn(AvailablePart)
        EditorLogic:SpawnPart(AvailablePart)
        EditorLogic:OnPartListIconTap(AvailablePart)
        KSP.UI.Screens.EditorPartList:TapIcon(AvailablePart)
        KSP.UI.Screens.EditorPartIcon:MouseInput_SpawnPart()
        UnityEngine.EventSystems.EventSystem:Update()

(Launcher used as designed)

This one shows not problems, TweakScale was fine. I think you switched some KSP.log!

************************************************************************

Environment Info
Win32NT 7FFFFFFFFFFFFFFF  Args: KSP_x64.exe

In a way or another, the message passed trough.

PD apparently is going to lockdown KSP 1 too, they are virtually locking everything out by using a new GameData subsystem.

@Lisias
Copy link

Lisias commented Nov 5, 2022

Then I removed the bypass and deleted PDLauncher and then ran and it did the same thing.

KSP_x64.exe D:\Steam\steamapps\common\Kerbal Space Program\PDLauncher\launcherpatcher.exe Could this be KSP asking if D:\Steam\steamapps\common\Kerbal Space Program\PDLauncher\launcherpatcher.exe exists?

This is a dump of the commandline arguments passed to the executable. This clearly demonstrates that they are using a feature already present on KSP since 1.12.3 at least (as I have a report of KSP 1.12.3 with the same problem).

In a way or another, the move is clear. Or someone at PD made a marvelous screw up, or they are going to lockdown the KSP1 ecosystem the same way they said they are doing with KSP2.

@anth1256
Copy link
Author

anth1256 commented Nov 5, 2022

I have gone to some wrong conclusions in the past. Lets wait to see.

So... "D:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Steam" %Command% -popupwindow
This worked. GotMachine's suggestion on the tweakscale KSP Forum Post seems to have countered the issue with doing a shortcut first.

Log Files for the test (all tests before and this one were just loading KSP and going into the SPH and increasing/decreasing the size of a MK2 cockpit and leaving to the main menu and exiting)

KSP.log
Player.log

@Lisias
Copy link

Lisias commented Nov 5, 2022

I have gone to some wrong conclusions in the past. Lets wait to see.

So do I.

So... "D:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Steam" %Command% -popupwindow This worked. GotMachine's suggestion on the tweakscale KSP Forum Post seems to have countered the issue with doing a shortcut first.

Of course it works, we had already diagnosed the problem, being it the PWD being wrongly set.

That remains to be understood is WHY the problem happened at first place. Not to mention that only a minority of the users will be going to the extra step of creating a shortcut and then using it to launch the game.

Who configured Steam to misbehave like this at first place?

@anth1256
Copy link
Author

anth1256 commented Nov 5, 2022

Yeah True. Could have been done on purpose to stop people from bypassing the launcher in steam?

@Lisias
Copy link

Lisias commented Nov 5, 2022

Yeah True. Could have been done on purpose to stop people from bypassing the launcher in steam?

I doubt it, but can't rule out neither.

I have experienced some asinine moves from Squad in the past, but they are really uncommon - most of the time is an unfinished attempt to fix something that were hurried up into production without proper testings. Squad had done some really bad decision making in the past, and right now we have our "friend" GT reproducing some of these bad decision making on the modding scene.

I didn't bashed him on Forum just because. If you care to search our past interactions (including here on github) you will see why I completely despise (most of) his interventions (besides agreeing that he is able to accomplish good things - what's end up contributing to my lack of patience with him: he can contribute positively if it's what he wants, so the logical conclusion is that he does what he does on purpose).

@anth1256
Copy link
Author

anth1256 commented Nov 5, 2022

I am not touching the topic of your interaction with him haha.

Just talking about how to bypass the launcher could be pissing off people at Intercept Games/PD/Squad which I really didn't want to do.

I just added the shortcut technique to a bug report someone did talking about the lack of ability to use -popupwindow with the new launcher....They are going to haaattteeee me now.

@Lisias
Copy link

Lisias commented Nov 6, 2022

I am not touching the topic of your interaction with him haha.

Ouch! :D Ok!

Just talking about how to bypass the launcher could be pissing off people at Intercept Games/PD/Squad which I really didn't want to do.

Your guess is so good as mine at this point.

If we imagine that our friend GT works for them somehow, then we can assume they are not happy at least to me.

In a way or another, the only way to know is by doing it.

I just added the shortcut technique to a bug report someone did talking about the lack of ability to use -popupwindow with the new launcher....They are going to haaattteeee me now.

And, to tell you the true, I think the Steam Overlay will also be lost - but I will check it later.

Can I close this issue so?

@anth1256
Copy link
Author

anth1256 commented Nov 6, 2022

Closing sure. We have gone as far as we can with this right?

@Lisias
Copy link

Lisias commented Nov 7, 2022

My nose thinks we had! :D

Cheers!

@Lisias Lisias closed this as completed Nov 7, 2022
@Lisias
Copy link

Lisias commented Nov 7, 2022

In a way or another, this is a follow up from what will be done about:

KSP-ModularManagement/KSPe#35

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

2 participants