forked from Vivecraft/VivecraftMod
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c476f46
commit 93cc582
Showing
2 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
common/src/main/java/org/vivecraft/mixin/client_vr/OpenVRMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.vivecraft.mixin.client_vr; | ||
|
||
import org.lwjgl.openvr.OpenVR; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.function.LongFunction; | ||
|
||
import static org.lwjgl.openvr.VR.*; | ||
|
||
@Mixin(value = OpenVR.class, remap = false) | ||
public abstract class OpenVRMixin { | ||
|
||
@Shadow @Nullable public static OpenVR.IVRSystem VRSystem; | ||
@Shadow @Nullable public static OpenVR.IVRChaperone VRChaperone; | ||
@Shadow @Nullable public static OpenVR.IVRChaperoneSetup VRChaperoneSetup; | ||
@Shadow @Nullable public static OpenVR.IVRCompositor VRCompositor; | ||
@Shadow @Nullable public static OpenVR.IVROverlay VROverlay; | ||
@Shadow @Nullable public static OpenVR.IVRResources VRResources; | ||
@Shadow @Nullable public static OpenVR.IVRRenderModels VRRenderModels; | ||
@Shadow @Nullable public static OpenVR.IVRExtendedDisplay VRExtendedDisplay; | ||
@Shadow @Nullable public static OpenVR.IVRSettings VRSettings; | ||
@Shadow @Nullable public static OpenVR.IVRApplications VRApplications; | ||
@Shadow @Nullable public static OpenVR.IVRTrackedCamera VRTrackedCamera; | ||
@Shadow @Nullable public static OpenVR.IVRScreenshots VRScreenshots; | ||
@Shadow @Nullable public static OpenVR.IVRDriverManager VRDriverManager; | ||
@Shadow @Nullable public static OpenVR.IVRInput VRInput; | ||
@Shadow @Nullable public static OpenVR.IVRIOBuffer VRIOBuffer; | ||
@Shadow @Nullable public static OpenVR.IVRSpatialAnchors VRSpatialAnchors; | ||
@Shadow @Nullable public static OpenVR.IVRDebug VRDebug; | ||
@Shadow @Nullable public static OpenVR.IVRNotifications VRNotifications; | ||
@Shadow private static int token; | ||
|
||
@Shadow | ||
@Nullable | ||
private static <T> T getGenericInterface(String interfaceNameVersion, LongFunction<T> supplier) { | ||
return null; | ||
} | ||
|
||
/** | ||
* @author | ||
* @reason | ||
*/ | ||
@Overwrite | ||
public static void create(int tok) { | ||
token = tok; | ||
|
||
VRSystem = getGenericInterface(IVRSystem_Version, OpenVR.IVRSystem::new); | ||
VRChaperone = getGenericInterface(IVRChaperone_Version, OpenVR.IVRChaperone::new); | ||
VRChaperoneSetup = getGenericInterface(IVRChaperoneSetup_Version, OpenVR.IVRChaperoneSetup::new); | ||
VRCompositor = getGenericInterface(IVRCompositor_Version, OpenVR.IVRCompositor::new); | ||
VROverlay = getGenericInterface(IVROverlay_Version, OpenVR.IVROverlay::new); | ||
// VRResources = getGenericInterface(IVRResources_Version, OpenVR.IVRResources::new); | ||
VRRenderModels = getGenericInterface(IVRRenderModels_Version, OpenVR.IVRRenderModels::new); | ||
VRExtendedDisplay = getGenericInterface(IVRExtendedDisplay_Version, OpenVR.IVRExtendedDisplay::new); | ||
VRSettings = getGenericInterface(IVRSettings_Version, OpenVR.IVRSettings::new); | ||
VRApplications = getGenericInterface(IVRApplications_Version, OpenVR.IVRApplications::new); | ||
// VRTrackedCamera = getGenericInterface(IVRTrackedCamera_Version, OpenVR.IVRTrackedCamera::new); | ||
VRScreenshots = getGenericInterface(IVRScreenshots_Version, OpenVR.IVRScreenshots::new); | ||
// VRDriverManager = getGenericInterface(IVRDriverManager_Version, OpenVR.IVRDriverManager::new); | ||
VRInput = getGenericInterface(IVRInput_Version, OpenVR.IVRInput::new); | ||
// VRIOBuffer = getGenericInterface(IVRIOBuffer_Version, OpenVR.IVRIOBuffer::new); | ||
// VRSpatialAnchors = getGenericInterface(IVRSpatialAnchors_Version, OpenVR.IVRSpatialAnchors::new); | ||
// VRDebug = getGenericInterface(IVRDebug_Version, OpenVR.IVRDebug::new); | ||
// VRNotifications = getGenericInterface(IVRNotifications_Version, OpenVR.IVRNotifications::new); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters