Result IFModSystem.Init(int maxChannels, InitFlags flags, IntPtr extraDriverData)
		{
			CheckMemberOnlyCall();
			
			var result = NativeFModSystem.Init(Self, maxChannels, flags, extraDriverData);
			
			return result;
		}
Example #2
0
        public static void GlobalInit(string libPath, InitFlags initFlags)
        {
            if (NativeMethods.Loaded)
            {
                throw new InvalidOperationException(NativeMethods.MsgAlreadyInit);
            }
            {
                NativeMethods.UseUtf16    = true;
                NativeMethods.LongBitType = NativeMethods.LongBits.Long32;

                if (libPath == null)
                {
                    throw new ArgumentNullException(nameof(libPath));
                }

                libPath = Path.GetFullPath(libPath);
                if (!File.Exists(libPath))
                {
                    throw new ArgumentException("Specified .dll file does not exist");
                }

                string libDir = Path.GetDirectoryName(libPath);
                if (libDir != null && !libDir.Equals(AppDomain.CurrentDomain.BaseDirectory))
                {
                    NativeMethods.Win32.SetDllDirectory(libDir);
                }

                NativeMethods.hModule = NativeMethods.Win32.LoadLibrary(libPath);
                if (NativeMethods.hModule == IntPtr.Zero)
                {
                    throw new ArgumentException($"Unable to load [{libPath}]", new Win32Exception());
                }

                NativeMethods.Win32.SetDllDirectory(null);
                if (NativeMethods.Win32.GetProcAddress(NativeMethods.hModule, nameof(NativeMethods.Utf16.wimlib_open_wim)) == IntPtr.Zero)
                {
                    GlobalCleanup();
                    throw new ArgumentException($"[{libPath}] is not a valid wimlib-15.dll");
                }
            }


            try
            {
                NativeMethods.LoadFunctions();
                NativeMethods.ErrorFile = Path.GetTempFileName();
                WimLibException.CheckWimLibError(NativeMethods.SetErrorFile(NativeMethods.ErrorFile));
                SetPrintErrors(true);
                ErrorCode ret = NativeMethods.GlobalInit(initFlags);
                WimLibException.CheckWimLibError(ret);
            }
            catch (Exception)
            {
                GlobalCleanup(); throw;
            }
        }
Example #3
0
        public static void InitSubSystem(InitFlags flags)
        {
            bool disableDrop = ShouldDisableDropAfterInit(flags);

            ErrorIfNegative(SDL_InitSubSystem(flags));
            if (disableDrop)
            {
                DisableDropEvents();
            }
        }
Example #4
0
        public static void Init(InitFlags flags = InitFlags.Nothing)
        {
            bool disableDrop = ShouldDisableDropAfterInit(flags);

            ErrorIfNegative(SDL_Init(flags));
            if (disableDrop)
            {
                DisableDropEvents();
            }
        }
Example #5
0
        private GraphicsLoop(InitFlags initFlags, RenderForm form, IGraphicsFacade graphicsFacade, RenderContext renderer)
        {
            _initFlags = initFlags;

            Form           = form;
            GraphicsFacade = graphicsFacade;
            Renderer       = renderer;
            RenderLoop     = new RenderLoop(Form);
            Statistics     = new GraphicsLoopStatistics();
            Input          = new InputSomethingOSDJFH(Form);
        }
Example #6
0
        /// <summary>
        /// Initializes the ODE library.
        /// </summary>
        /// <param name="initFlags">Specifies ODE library initialization options.</param>
        public static void Init(InitFlags initFlags)
        {
            var result = NativeMethods.dInitODE2(initFlags);

            if (result == 0)
            {
                throw new InvalidOperationException("Failed to initialize ODE library.");
            }

            NativeMethods.dSetErrorHandler(ErrorHandler);
            NativeMethods.dSetMessageHandler(MessageHandler);
            NativeMethods.dSetDebugHandler(ErrorHandler);
        }
Example #7
0
        public static GraphicsLoop CreateWithNewWindow(Size clientSize, InitFlags flags = 0)
        {
            var renderForm = new RenderForm {
                ClientSize = clientSize, StartPosition = FormStartPosition.CenterScreen
            };
            var graphicsFacade = Direct3DGraphicsFacade.Create(renderForm);
            var renderer       = new RenderContext(graphicsFacade);

            if (!flags.HasFlag(InitFlags.HiddenWindow))
            {
                renderForm.Show();
            }

            graphicsFacade.Device.ImmediateContext.SetVsyncEnabled(
                !flags.HasFlag(InitFlags.DisableVerticalSync));

            return(new GraphicsLoop(flags, renderForm, graphicsFacade, renderer));
        }
Example #8
0
        static internal bool ShouldDisableDropAfterInit(InitFlags flags)
        {
            var initsEvent
                = InitFlags.Video
                  | InitFlags.Joystick
                  | InitFlags.GameController
                  | InitFlags.Events
                ;

            if (SDL_WasInit(InitFlags.Events) != 0)
            {
                return(false);
            }

            if ((flags & initsEvent) != InitFlags.Nothing)
            {
                return(false);
            }

            return(true);
        }
Example #9
0
        public BASSWASAPIOutput(uint freq, uint chans, BASS.StreamProc proc, InitFlags flag, int device = -1, uint bufferLen = 0)
        {
            bool success = false;

            this.userStreamProc = proc;
            this.streamProc     = WrapperStreamProc;

            // Init前から走っていたスレッドのIdを保持
            var ids = GetThreadIdsArray();

            // 初期化実行
            success = BASS_WASAPI_Init(device, freq, chans, (uint)flag, (bufferLen / 1000.0F), 0.0F, streamProc, IntPtr.Zero);

            // 新しく生成されたスレッドを保持
            bassThreadIDs.Union(ids.Except(GetThreadIdsArray()));

            if (!success)
            {
                throw new BASSWASAPIException();
            }
            disposed = false;
        }
Example #10
0
        public System(int maxChannels = 1024, InitFlags flags = InitFlags.LiveUpdate, LowLevelInitFlags lowLevelFlags = LowLevelInitFlags.Normal, AdvancedInitializationSettings advancedSettings = default(AdvancedInitializationSettings), Action<IPreInitilizeLowLevelSystem> preInit = null)
        {
            //Load native dependencies
            Native.Load();

            //Create studio system
            FMOD.Studio.System.create(out _system).Check();

            //Create low level system
            FMOD.System lowLevel;
            _system.getLowLevelSystem(out lowLevel).Check();
            LowLevelSystem = new LowLevelSystem(lowLevel);

            if (preInit != null)
                preInit(LowLevelSystem);

            //Set advanced settings
            LowLevelSystem.SetAdvancedSettings(advancedSettings);

            //Initialize
            _system.initialize(maxChannels, (INITFLAGS)flags, (FMOD.INITFLAGS)lowLevelFlags, IntPtr.Zero).Check();
        }
Example #11
0
        public System(int maxChannels = 1024, InitFlags flags = InitFlags.LiveUpdate, LowLevelInitFlags lowLevelFlags = LowLevelInitFlags.Normal, AdvancedInitializationSettings advancedSettings = default(AdvancedInitializationSettings), Action <IPreInitilizeLowLevelSystem> preInit = null)
        {
            //Load native dependencies
            Native.Load();

            //Create studio system
            FMOD.Studio.System.create(out _system).Check();

            //Create low level system
            FMOD.System lowLevel;
            _system.getLowLevelSystem(out lowLevel).Check();
            LowLevelSystem = new LowLevelSystem(lowLevel);

            if (preInit != null)
            {
                preInit(LowLevelSystem);
            }

            //Set advanced settings
            LowLevelSystem.SetAdvancedSettings(advancedSettings);

            //Initialize
            _system.initialize(maxChannels, (INITFLAGS)flags, (FMOD.INITFLAGS)lowLevelFlags, IntPtr.Zero).Check();
        }
Example #12
0
 public void Init(int Maxchannels = 32, InitFlags Flags = InitFlags.Normal | InitFlags.RightHanded3D)
 {
     Init(Maxchannels, Flags, IntPtr.Zero);
 }
Example #13
0
 private static extern Result FMOD_System_Init(IntPtr system, int maxchannels, InitFlags flags, IntPtr extradriverdata);
Example #14
0
 public void Init(int maxchannels, InitFlags flags, IntPtr extradriverdata)
 {
     Code returnCode = Init(handle, maxchannels, flags, extradriverdata);
     Errors.ThrowError(returnCode);
 }
Example #15
0
 public static extern int SDL_Init(InitFlags flags);
Example #16
0
 public static extern void SDL_QuitSubSystem(InitFlags flags);
Example #17
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="flags">InitFlags</param>
 /// <param name="requestedMinorVersion">uint</param>
 public InitParams(InitFlags flags, uint requestedMinorVersion)
 {
     Flags = flags;
     RequestedMinorVersion = requestedMinorVersion;
 }
Example #18
0
 public static extern InitFlags WasInit(InitFlags flags);
Example #19
0
 FMOD_System_Init(IntPtr system, int maxchannels, InitFlags flags, IntPtr extradriverdata);
Example #20
0
        //only register the handlers we need so we don't bog down the network processing
        public void Init()
        {
            foreach (var item in PluginSettings.Instance.ProtectionItems)
            {
                if (item.StopRemoveBlock && !_initFlags.HasFlag(InitFlags.BlockRemove))
                {
                    _initFlags |= InitFlags.BlockRemove;
                    ServerNetworkManager.Instance.RegisterNetworkHandlers(new RemoveBlockHandler());
                    NoGrief.Log.Info("Init RemoveBlock");
                }
                if (item.StopBuild && !_initFlags.HasFlag(InitFlags.BlockAdd))
                {
                    _initFlags |= InitFlags.BlockAdd;
                    ServerNetworkManager.Instance.RegisterNetworkHandlers(new BuildBlockHandler(), new SpawnGridHandler());
                    NoGrief.Log.Info("Init BuildBlock");
                }
                if (item.StopPaint && !_initFlags.HasFlag(InitFlags.BlockPaint))
                {
                    _initFlags |= InitFlags.BlockPaint;
                    ServerNetworkManager.Instance.RegisterNetworkHandlers(new ColorBlockHandler());
                    NoGrief.Log.Info("Init ColorBlock");
                }
                if (item.StopDeleteGrid && !_initFlags.HasFlag(InitFlags.GridDelete))
                {
                    _initFlags |= InitFlags.GridDelete;
                    ServerNetworkManager.Instance.RegisterNetworkHandlers(new GridDeleteHandler());
                    NoGrief.Log.Info("Init GridDelete");
                }
            }

            if (PluginSettings.Instance.LimitPasteSize && !_initFlags.HasFlag(InitFlags.PasteLimit))
            {
                _initFlags |= InitFlags.PasteLimit;
                ServerNetworkManager.Instance.RegisterNetworkHandlers(new GridPasteHandler());
                NoGrief.Log.Info("Init GridPaste");
            }

            if (PluginSettings.Instance.LimitProjectionSize && !_initFlags.HasFlag(InitFlags.ProjectionLimit))
            {
                _initFlags |= InitFlags.ProjectionLimit;
                ServerNetworkManager.Instance.RegisterNetworkHandlers(new ProjectionHandler());
                NoGrief.Log.Info("Init ProjectionHandler");
            }

            if (PluginSettings.Instance.StopPlanetPaste && !_initFlags.HasFlag(InitFlags.PlanetPaste))
            {
                _initFlags |= InitFlags.PlanetPaste;
                ServerNetworkManager.Instance.RegisterNetworkHandlers(new SpawnPlanetHandler());
                NoGrief.Log.Info("Init Planet");
            }

            if (PluginSettings.Instance.StopAsteroidPaste && !_initFlags.HasFlag(InitFlags.AsteroidPaste))
            {
                _initFlags |= InitFlags.AsteroidPaste;
                ServerNetworkManager.Instance.RegisterNetworkHandlers(new SpawnAsteroidHandler());
                NoGrief.Log.Info("Init Asteroid");
            }

            if (PluginSettings.Instance.StopVoxelHands && !_initFlags.HasFlag(InitFlags.VoxelHand))
            {
                _initFlags |= InitFlags.VoxelHand;
                ServerNetworkManager.Instance.RegisterNetworkHandlers(new VoxelOperationHandler());
                NoGrief.Log.Info("Init VoxelOperation");
            }
        }
Example #21
0
 public static void QuitSubSystem(InitFlags flags)
 {
     SDL_QuitSubSystem(flags);
 }
Example #22
0
 private static extern ErrorCode Init(IntPtr system, int Maxchannels, InitFlags Flags, IntPtr Extradriverdata);
Example #23
0
        public void InitializePackage( InitFlags initFlags = InitFlags.All )
        {
            if( (initFlags & InitFlags.RegisterClasses) != 0 )
            {
                RegisterAllClasses();
            }

            if( (initFlags & InitFlags.Construct) == 0 )
            {
                return;
            }

            ConstructObjects();
            if( (initFlags & InitFlags.Deserialize) == 0 )
                return;

            try
            {
                DeserializeObjects();
            }
            catch
            {
                throw new DeserializingObjectsException();
            }

            try
            {
                if( (initFlags & InitFlags.Import) != 0 )
                {
                    ImportObjects();
                }
            }
            catch( Exception e )
            {
                //can be treat with as a warning!
                throw new Exception( "An exception occurred while importing objects", e );
            }

            try
            {
                if( (initFlags & InitFlags.Link) != 0 )
                {
                    LinkObjects();
                }
            }
            catch
            {
                throw new LinkingObjectsException();
            }
            DisposeStream();
        }
Example #24
0
 public void Init(int Maxchannels, InitFlags Flags)
 {
     Init(Maxchannels, Flags, IntPtr.Zero);
 }
Example #25
0
 public static extern int SDL_InitSubSystem(InitFlags flags);
Example #26
0
 public void Init(int Maxchannels, InitFlags Flags, IntPtr Extradriverdata)
 {
     Error.Code ReturnCode = Init(this.handle, Maxchannels, Flags, Extradriverdata);
     Error.Errors.ThrowError(ReturnCode);
 }
Example #27
0
 public static extern uint SDL_WasInit(InitFlags flags);
Example #28
0
 private static extern Error.Code Init(IntPtr system, int Maxchannels, InitFlags Flags, IntPtr Extradriverdata);
Example #29
0
 public void Init(int MaxChannels, InitFlags flags = InitFlags.Normal, IntPtr ExtraDriverData = default) //default(IntPtr) == IntPtr.Zero
 {
     library.System_Init(Handle, MaxChannels, flags, ExtraDriverData).CheckResult();
 }
Example #30
0
 public static bool InitSubSystem(InitFlags initFlag)
 {
     return((SDL.SDL_InitSubSystem((uint)initFlag) == 0) ? true : false);
 }
Example #31
0
 internal static extern int dInitODE2(InitFlags uiInitFlags);
		public static extern Result Init(
			Handle self, 
			int maxChannels, 
			InitFlags flags, 
			IntPtr extraDriverData);
Example #33
0
 /// <summary>
 /// Initializes the system object, and the sound device. This has to be called at the start of the user's program.
 /// </summary>
 /// <param name="maxChannels">
 /// The maximum number of channels to be used in FMOD. They are also called 'virtual channels' as you can play as
 /// many of these as you want, even if you only have a small number of hardware or software voices. See remarks for more.
 /// </param>
 /// <param name="flags">
 /// See InitFlags. This can be a selection of flags bitwise OR'ed together to change the behaviour
 /// of FMOD at initialization time.
 /// </param>
 /// <param name="extraDriverData">
 /// Driver specific data that can be passed to the output plugin. For example, the filename for the wav writer plugin.
 /// See OutputType for what each output mode might take here. Optional. Specify 0 or null to ignore.
 /// </param>
 /// <remarks>
 /// <para>
 /// Virtual voices are the types you work with using the FMOD Channel API.
 /// The advantage of virtual channels are, unlike older versions of FMOD, you can now play as many sounds as you like
 /// without fear of ever running out of voices, or playsound failing. You can also avoid 'channel stealing' if you
 /// specify enough virtual voices.
 /// </para>
 /// <para>
 /// As an example, you can play 1000 sounds at once, even on a 32 channel soundcard. FMOD will only play the most
 /// important/closest/loudest (determined by volume/distance/geometry and priority settings) voices, and the other
 /// 968 voices will be virtualized without expense to the CPU. The voice's cursor positions are updated. When the
 /// priority of sounds change or emulated sounds get louder than audible ones, they will swap the actual voice
 /// resource over (ie hardware or software buffer) and play the voice from its correct position in time as it should
 /// be heard. What this means is you can play all 1000 sounds, if they are scattered around the game world, and as
 /// you move around the world you will hear the closest or most important 32, and they will automatically swap in and
 /// out as you move.
 /// </para>
 /// <para>Currently the maximum channel limit is 4093.</para>
 /// </remarks>
 /// <returns></returns>
 public Result Initialize(int maxChannels, InitFlags flags, IntPtr extraDriverData)
 {
     return(FMOD_System_Init(rawPtr, maxChannels, flags, extraDriverData));
 }
Example #34
0
 public static GraphicsLoop CreateWithNewWindow(int clientWidth, int clientHeight, InitFlags flags = 0)
 {
     return(CreateWithNewWindow(new Size(clientWidth, clientHeight), flags));
 }
Example #35
0
 public static void Init(InitFlags flags)
 {
     LogOnError(InitNative((int)flags));
 }
Example #36
0
 public void Init(int maxchannels, InitFlags flags)
 {
     Init(maxchannels, flags, IntPtr.Zero);
 }
Example #37
0
 public void Init(int Maxchannels, InitFlags Flags, IntPtr Extradriverdata)
 {
     Errors.ThrowIfError(Init(handle, Maxchannels, Flags, Extradriverdata));
 }
Example #38
0
        public void InitializeExportObjects( InitFlags initFlags = InitFlags.All )
        {
            Objects = new List<UObject>( Exports.Count );
            foreach( var exp in Exports )
            {
                CreateObjectForTable( exp );
            }

            if( (initFlags & InitFlags.Deserialize) == 0 )
                return;

            DeserializeObjects();
            if( (initFlags & InitFlags.Link) != 0 )
            {
                LinkObjects();
            }
        }
Example #39
0
 public void Init(int Maxchannels, InitFlags Flags)
 {
     Init (Maxchannels, Flags, IntPtr.Zero);
 }
Example #40
0
 public static void Init(InitFlags flags)
 {
     GetError(SDL_Init(flags));
 }
Example #41
0
 public void Init(int Maxchannels, InitFlags Flags, IntPtr Extradriverdata)
 {
     Error.Code ReturnCode = Init (this.handle, Maxchannels, Flags, Extradriverdata);
     Error.Errors.ThrowError (ReturnCode);
 }
Example #42
0
 private static extern Code Init(IntPtr system, int maxchannels, InitFlags flags, IntPtr extradriverdata);