KerbalVR does not start when clicking "Enable VR"
Closed this issue · 5 comments
I ran this on a minimally reproducible setup.
- KSP v1.4.5
- KerbalVR 3.2.1
- SteamVR beta 1.1.4
- Windows 10 1809
(No mods beside KerbalVR.)
Of note is the following block, right at the beginning:
[LOG 19:05:52.871] Load(Assembly): KerbalVR/KerbalVR
[LOG 19:05:52.872] AssemblyLoader: Loading assembly at C:\Users\Forest\Games\KSP\VR-1.4.5\GameData\KerbalVR\KerbalVR.dll
[LOG 19:05:52.895] Load(Assembly): KerbalVR/openvr/win32/openvr_api
[LOG 19:05:52.895] AssemblyLoader: Loading assembly at C:\Users\Forest\Games\KSP\VR-1.4.5\GameData\KerbalVR\openvr\win32\openvr_api.dll
[ERR 19:05:52.897] Failed to load assembly C:\Users\Forest\Games\KSP\VR-1.4.5\GameData\KerbalVR\openvr\win32\openvr_api.dll:
System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders (System.UInt16& subsystem, System.UInt16& dll_characteristics) [0x00000] in <filename unknown>:0
at Mono.Cecil.PE.ImageReader.ReadImage () [0x00000] in <filename unknown>:0
at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) [0x00000] in <filename unknown>:0
at AssemblyLoader.ScanForBadTypeRefs (System.String file) [0x00000] in <filename unknown>:0
at AssemblyLoader.LoadExternalAssembly (System.String file) [0x00000] in <filename unknown>:0
[LOG 19:05:52.898] Load(Assembly): KerbalVR/openvr/win64/openvr_api
[LOG 19:05:52.898] AssemblyLoader: Loading assembly at C:\Users\Forest\Games\KSP\VR-1.4.5\GameData\KerbalVR\openvr\win64\openvr_api.dll
[ERR 19:05:52.899] Failed to load assembly C:\Users\Forest\Games\KSP\VR-1.4.5\GameData\KerbalVR\openvr\win64\openvr_api.dll:
System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders (System.UInt16& subsystem, System.UInt16& dll_characteristics) [0x00000] in <filename unknown>:0
at Mono.Cecil.PE.ImageReader.ReadImage () [0x00000] in <filename unknown>:0
at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) [0x00000] in <filename unknown>:0
at AssemblyLoader.ScanForBadTypeRefs (System.String file) [0x00000] in <filename unknown>:0
at AssemblyLoader.LoadExternalAssembly (System.String file) [0x00000] in <filename unknown>:0
I don't know the details of Unity's plugin architecture (or that of KerbalVR or KSP for that matter), but a cursory search brought up a similar looking issue.
The "failed to load assembly" errors are a bit misleading, this is "normal" behavior, Unity tries to load the openvr dll but fails because it's not supposed to be trying to load it. But that's fine.
I saw this line in your log:
[ERR 19:05:53.006] [KerbalVR] HMD not found on this system.
for some reason the plugin is not finding your VR set. I'm not sure how else to diagnose this... What VR system are you using? I assume it works fine for other games? SteamVR is running when you launch KSP? (actually if it's not running beforehand, it's supposed to automatically launch SteamVR)
Oh, I forgot to mention I'm using an Oculus Rift CV1 and SteamVR fully detects the headset, both controllers, and all three sensors before I start KSP. And it's been working for all SteamVR games that I've tried so far.
OK, so I've done some digging and found that the SteamVR runtime isn't discovered for some reason:
[ERR 19:53:03.887] [KerbalVR] SteamVR runtime not found on this system.
Which would explain the early shutdown. I'm looking into it now and will update this issue as soon as I find out more.
Oh hey, I solved it. It has to do with running as administrator (which I was doing for an unrelated issue.)
When you run as admin, it looks for the SteamVR vrpath config file in the administrator's AppData
folder. All that vrpath config file does is point to C:\Program Files (x86)\Steam\steamapps\common\SteamVR
, but if that file is not found, I'd guess the OpenVR API just gives up.
So the solution would be to either:
- Install SteamVR as an administrator and run it once, just to create the config file; or
- Don't run as an administrator.
I'll close the issue, as it's been resolved.
thanks for looking into this!