public static object CallSystemFn(SystemFn fn, params object[] args)
    {
        object result = null;

        if (SteamVR.active)
        {
            result = fn(SteamVR.instance.hmd, args);
        }
        else
        {
            var error   = HmdError.None;
            var pSystem = OpenVR.Init(ref error);
            if (pSystem != System.IntPtr.Zero && error == HmdError.None)
            {
                // Make sure we're using the proper version
                pSystem = OpenVR.GetGenericInterface(OpenVR.IVRSystem_Version, ref error);
                if (pSystem != System.IntPtr.Zero && error == HmdError.None)
                {
                    var system = new CVRSystem(pSystem);
                    result = fn(system, args);
                }
                OpenVR.Shutdown();
            }
        }
        return(result);
    }
 public static object CallSystemFn(SystemFn fn, params object[] args)
 {
     object result = null;
     if (SteamVR.active)
     {
         result = fn(SteamVR.instance.hmd, args);
     }
     else
     {
         var error = HmdError.None;
         var pSystem = OpenVR.Init(ref error);
         if (pSystem != System.IntPtr.Zero && error == HmdError.None)
         {
             // Make sure we're using the proper version
             pSystem = OpenVR.GetGenericInterface(OpenVR.IVRSystem_Version, ref error);
             if (pSystem != System.IntPtr.Zero && error == HmdError.None)
             {
                 var system = new CVRSystem(pSystem);
                 result = fn(system, args);
             }
             OpenVR.Shutdown();
         }
     }
     return result;
 }
Beispiel #3
0
    public static object CallSystemFn(SystemFn fn, params object[] args)
    {
        var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport);
        if (initOpenVR)
        {
            var error = EVRInitError.None;
            OpenVR.Init(ref error, EVRApplicationType.VRApplication_Other);
        }

        var system = OpenVR.System;
        var result = (system != null) ? fn(system, args) : null;

        if (initOpenVR)
            OpenVR.Shutdown();

        return result;
    }
Beispiel #4
0
        public override IProgramPart VisitFunctionCall(FSQLParser.FunctionCallContext context)
        {
            var isInternal = context.fnInt != null && context.fnUsr == null;
            var name       = isInternal ? context.fnInt.GetText() : context.IDENT().GetText();
            var args       = Visit(context.args) as IEnumerable <IExpression>;

            if (isInternal)
            {
                IProgramPart results;
                var          token = context.fnInt.GetChild(0).Payload as IToken;
                var          type  = token?.Type ?? -1;
                switch (type)
                {
                case FSQLLexer.WRITELINE:
                    results = new WriteLine(args);
                    break;

                case FSQLLexer.WRITE:
                    results = new Write(args);
                    break;

                case FSQLLexer.COREDUMP:
                    results = new SystemFn("CoreDump", (ctx, prms) => ctx.Dump(Priority.Verbose));
                    break;

                case FSQLLexer.READLINE:
                    results = new SystemFn("ReadLine", (ctx, prms) => Console.ReadLine());
                    break;

                case FSQLLexer.READ:
                    results = new SystemFn("Read", (ctx, prms) => Console.Read());
                    break;

                //case FSQLLexer.EXISTS:
                //    results = new Exists(args);
                //    break;
                default:
                    results = new Unimplemented(name);
                    break;
                }
                return(results);
            }
            return(new FunctionCall(name, args));
        }
    public static object CallSystemFn(SystemFn fn, params object[] args)
    {
        var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport);

        if (initOpenVR)
        {
            var error = EVRInitError.None;
            OpenVR.Init(ref error, EVRApplicationType.VRApplication_Other);
        }

        var system = OpenVR.System;
        var result = (system != null) ? fn(system, args) : null;

        if (initOpenVR)
        {
            OpenVR.Shutdown();
        }

        return(result);
    }
Beispiel #6
0
        public static object CallSystemFn(SystemFn fn, params object[] args)
        {
            bool initOpenVR = false;// (!SteamVR.active && !SteamVR.usingNativeSupport);

            if (initOpenVR)
            {
                EVRInitError error = EVRInitError.None;
                OpenVR.Init(ref error, EVRApplicationType.VRApplication_Utility);
            }

            CVRSystem system = OpenVR.System;
            object    result = (system != null) ? fn(system, args) : null;

            if (initOpenVR)
            {
                OpenVR.Shutdown();
            }

            return(result);
        }
        public static object CallSystemFn(SystemFn fn, params object[] args)
        {
            var initOpenVR = !Varjo_SteamVR.active;

            if (initOpenVR)
            {
                var error = EVRInitError.None;
                OpenVR.Init(ref error, EVRApplicationType.VRApplication_Background);
            }

            var system = OpenVR.System;
            var result = (system != null) ? fn(system, args) : null;

            if (initOpenVR)
            {
                OpenVR.Shutdown();
            }

            return(result);
        }
    public static object CallSystemFn(SystemFn fn, params object[] args)
    {
        bool initOpenVR = false;         //var initOpenVR = (!SteamVRManager.isConnected && !SteamVR.usingNativeSupport);

        if (initOpenVR)
        {
            var error = EVRInitError.None;
            OpenVR.Init(ref error, EVRApplicationType.VRApplication_Utility);
        }

        var system = OpenVR.System;
        var result = (system != null) ? fn(system, args) : null;

        if (initOpenVR)
        {
            OpenVR.Shutdown();
        }

        return(result);
    }
    public static object CallSystemFn(SystemFn fn, params object[] args)
    {
        Debug.LogError("DONT CALL ME IM BROKEN");
        //var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport);
        bool initOpenVR = false;

        if (initOpenVR)
        {
            var error = EVRInitError.None;
            OpenVR.Init(ref error, EVRApplicationType.VRApplication_Utility);
        }

        var system = OpenVR.System;
        var result = (system != null) ? fn(system, args) : null;

        if (initOpenVR)
        {
            OpenVR.Shutdown();
        }

        return(result);
    }
 private static float _copysign(float sizeval, float signval) => default;                                                     // 0x0000000181D2DC10-0x0000000181D2DD00
 public static object CallSystemFn(SystemFn fn, params /* 0x00000001800D4E50-0x00000001800D4E60 */ object[] args) => default; // 0x0000000181D2BBF0-0x0000000181D2BD40