Forum Discussion
robotloveskitty
11 years agoHonored Guest
detect if the normal or DirectToRift.exe is launched?
I added a VR mode to my game (Legend of Dungeon) but I still want to be able to let the majority of my players play in normal mode, as they don't have headsets. Is there a way to detect if the game...
PhilipRamirez
11 years agoHonored Guest
I've looked in a couple of previous threads but it seems like there isn't a quick call to figure out which .exe your user launched with. Though, you can write your own which works really well. Here's a snippet of my code that I got inspired to write after another thread on this matter:
This might not work if you update the drivers, but I don't think the drivers will change the .exe sizes of older versions so I guess it should keep working.
IEnumerator DetectOculus()
{
yield return new WaitForEndOfFrame(); // Let Oculus stuff initialize (I needed it for my project)
long exeSize = 0;
{
FileInfo exeFile = new System.IO.FileInfo(Environment.GetCommandLineArgs()[0]); // Path name of the .exe used to launch
exeSize = exeFile.Length; // exeFile.Length return the file size in bytes. Store it for comparison
}
// Use file to determine which exe was launched. This should be stable even if a user changes the name of the .exe or uses a shortcut! =D
// Direct Rift sizes: 184320 is 64bit size, 32 is 164864 (3rd check is for extended mode(NOT FULLY TESTED))
// (You may want to use Debug.Log(exeSize); to double check the file size is the same on your match)
if ((exeSize == 184320 || exeSize == 164864) || (OVRManager.display.isPresent && !OVRManager.display.isDirectMode))
{
// DirectToRift.exe
}
else
{
// Standard.exe
}
This might not work if you update the drivers, but I don't think the drivers will change the .exe sizes of older versions so I guess it should keep working.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago
- 1 year ago
- 2 years ago