QuestCraftPlusPlus / QuestCraft

QuestCraft - A port of Minecraft: Java Edition to the Meta Quest Platform. With the power of Pojlib.
https://discord.gg/questcraft
706 stars 199 forks source link

[BUG] Vivecraft: Error reading origin info: InvalidHandle if one or more controllers are asleep #596

Open thejudge156 opened 4 months ago

thejudge156 commented 4 months ago

🤔 Current Behavior

If a controller is asleep, the following error is thrown and the game crashes.

[13:30:16] [Render thread/ERROR]: Unreported exception thrown! java.lang.RuntimeException: Error reading origin info: InvalidHandle at org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR.readOriginInfo(MCOpenVR.java:1094) ~[Vivecraft.jar:?] at org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR.getOriginControllerType(MCOpenVR.java:1275) ~[Vivecraft.jar:?] at org.vivecraft.client_vr.provider.openvr_lwjgl.VRInputAction.isEnabled(VRInputAction.java:226) ~[Vivecraft.jar:?] at org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR.processInputAction(MCOpenVR.java:1007) ~[Vivecraft.jar:?] at org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR.processInputs(MCOpenVR.java:379) ~[Vivecraft.jar:?] at org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR.poll(MCOpenVR.java:363) ~[Vivecraft.jar:?] at net.minecraft.client.MinecraftClient.handler$bjm000$vivecraft$toggleVRState(MinecraftClient.java:11036) ~[client-intermediary.jar:?] at net.minecraft.class_310.method_1523(class_310.java) ~[client-intermediary.jar:?] at net.minecraft.client.MinecraftClient.run(MinecraftClient.java:888) ~[client-intermediary.jar:?] at net.minecraft.client.main.Main.main(Main.java:265) ~[1.20.4.jar:?] at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.15.11.jar:?]

✅ Expected Behavior

No crash, handle gracefully.

🥽 Headset Details

Quest 2, 3, Pro QuestCraft Version: 5.0

ℹ️ Anything else?

Unsure if changes should be made to OC to prevent invalid handle being passed back, might be in violation of OpenVR default behavior?

Could also patch Vivecraft to not crash if a invalid handle error is passed back.