diff --git a/InputSystems/ANX.InputDevices.Windows.XInput/GamePad.cs b/InputSystems/ANX.InputDevices.Windows.XInput/GamePad.cs index 18aa67ed..40ffc454 100644 --- a/InputSystems/ANX.InputDevices.Windows.XInput/GamePad.cs +++ b/InputSystems/ANX.InputDevices.Windows.XInput/GamePad.cs @@ -32,8 +32,20 @@ namespace ANX.InputDevices.Windows.XInput public GamePad() { controller = new Controller[4]; - for (int index = 0; index < controller.Length; index++) - controller[index] = new Controller((UserIndex)index); + for (int index = 0; index < controller.Length; index++) + { + controller[index] = new Controller((UserIndex)index); + + try + { + bool isConnected = controller[index].IsConnected; + } + catch (System.DllNotFoundException ex) + { + controller[index] = null; + Logger.Warning("couldn't initialize GamePad " + index + " because " + ex.Message); + } + } } #endregion @@ -41,7 +53,7 @@ namespace ANX.InputDevices.Windows.XInput public GamePadCapabilities GetCapabilities(PlayerIndex playerIndex) { var gamepad = controller[(int)playerIndex]; - if (gamepad.IsConnected == false) + if (gamepad == null || gamepad.IsConnected == false) return emptyCaps; try @@ -95,11 +107,14 @@ namespace ANX.InputDevices.Windows.XInput public GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone deadZoneMode) { - bool isConnected = controller[(int)playerIndex].IsConnected; + var controller = this.controller[(int)playerIndex]; + if (controller == null) return new GamePadState(); + + bool isConnected = controller.IsConnected; if (isConnected == false) return emptyState; - State nativeState = controller[(int)playerIndex].GetState(); + State nativeState = controller.GetState(); Vector2 leftThumb = ApplyDeadZone(nativeState.Gamepad.LeftThumbX, nativeState.Gamepad.LeftThumbY, LeftThumbDeadZoneSquare, deadZoneMode); Vector2 rightThumb = ApplyDeadZone(nativeState.Gamepad.RightThumbX, nativeState.Gamepad.RightThumbY, @@ -117,7 +132,7 @@ namespace ANX.InputDevices.Windows.XInput #region SetVibration public bool SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor) { - if (controller[(int)playerIndex].IsConnected == false) + if (controller[(int)playerIndex] == null || controller[(int)playerIndex].IsConnected == false) return false; var vib = new Vibration() diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX10/ANX.RenderSystem.Windows.DX10.csproj b/RenderSystems/ANX.RenderSystem.Windows.DX10/ANX.RenderSystem.Windows.DX10.csproj index 4c6914b7..37091d00 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX10/ANX.RenderSystem.Windows.DX10.csproj +++ b/RenderSystems/ANX.RenderSystem.Windows.DX10/ANX.RenderSystem.Windows.DX10.csproj @@ -20,7 +20,7 @@ ..\..\bin\Debug\ TRACE;DEBUG;XNAEXT DX10 prompt - 4 + 0 AnyCPU true diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX10/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.DX10/Creator.cs index a0563bf9..5d469b85 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX10/Creator.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX10/Creator.cs @@ -172,47 +172,50 @@ namespace ANX.RenderSystem.Windows.DX10 { PreventSystemChange(); - var factory = new Factory(); - var adapterList = new List(); var resultingModes = new List(); - for (int i = 0; i < factory.GetAdapterCount(); i++) - { - using (Adapter adapter = factory.GetAdapter(i)) - { - var ga = new GraphicsAdapter(); - //ga.CurrentDisplayMode = ; - //ga.Description = ; - ga.DeviceId = adapter.Description.DeviceId; - ga.DeviceName = adapter.Description.Description; - ga.IsDefaultAdapter = i == 0; //TODO: how to set default adapter? - //ga.IsWideScreen = ; - //ga.MonitorHandle = ; - ga.Revision = adapter.Description.Revision; - ga.SubSystemId = adapter.Description.SubsystemId; - //ga.SupportedDisplayModes = ; - ga.VendorId = adapter.Description.VendorId; + using (Factory factory = new Factory()) + { + for (int i = 0; i < factory.GetAdapterCount(); i++) + { + using (Adapter adapter = factory.GetAdapter(i)) + { + var ga = new GraphicsAdapter(); + //ga.CurrentDisplayMode = ; + //ga.Description = ; + ga.DeviceId = adapter.Description.DeviceId; + ga.DeviceName = adapter.Description.Description; + ga.IsDefaultAdapter = i == 0; //TODO: how to set default adapter? + //ga.IsWideScreen = ; + //ga.MonitorHandle = ; + ga.Revision = adapter.Description.Revision; + ga.SubSystemId = adapter.Description.SubsystemId; + //ga.SupportedDisplayModes = ; + ga.VendorId = adapter.Description.VendorId; - using (Output adapterOutput = adapter.Outputs[0]) - { - var modeList = adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, - DisplayModeEnumerationFlags.Interlaced); - foreach (ModeDescription modeDescription in modeList) - { - var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height, - DxFormatConverter.Translate(modeDescription.Format)); - resultingModes.Add(displayMode); - } - } + resultingModes.Clear(); - ga.SupportedDisplayModes = new DisplayModeCollection(resultingModes); + if (adapter.Outputs.Length >= 1) + { + using (Output adapterOutput = adapter.Outputs[0]) + { + var modeList = adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, DisplayModeEnumerationFlags.Interlaced); - adapterList.Add(ga); - } - } + foreach (ModeDescription modeDescription in modeList) + { + var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height, DxFormatConverter.Translate(modeDescription.Format)); + resultingModes.Add(displayMode); + } + } + } - factory.Dispose(); + ga.SupportedDisplayModes = new DisplayModeCollection(resultingModes); + + adapterList.Add(ga); + } + } + } return new ReadOnlyCollection(adapterList); } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX10/Properties/AssemblyInfo.cs b/RenderSystems/ANX.RenderSystem.Windows.DX10/Properties/AssemblyInfo.cs index 86bca458..d64aa6ef 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX10/Properties/AssemblyInfo.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX10/Properties/AssemblyInfo.cs @@ -32,7 +32,7 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.7.24.*")] -[assembly: AssemblyFileVersion("0.7.24.0")] +[assembly: AssemblyVersion("0.7.25.*")] +[assembly: AssemblyFileVersion("0.7.25.0")] [assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")] diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX10/SupportedPlatformsImpl.cs b/RenderSystems/ANX.RenderSystem.Windows.DX10/SupportedPlatformsImpl.cs index 74c44027..5a9383d7 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX10/SupportedPlatformsImpl.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX10/SupportedPlatformsImpl.cs @@ -17,6 +17,7 @@ namespace ANX.RenderSystem.Windows.DX10 { PlatformName.WindowsVista, PlatformName.Windows7, + PlatformName.Windows8, }; } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs index d2aa489e..58105ff1 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs @@ -165,48 +165,50 @@ namespace ANX.RenderSystem.Windows.DX11 { PreventSystemChange(); - var factory = new Factory(); - var adapterList = new List(); var resultingModes = new List(); - for (int i = 0; i < factory.GetAdapterCount(); i++) - { - using (Adapter adapter = factory.GetAdapter(i)) - { - GraphicsAdapter ga = new GraphicsAdapter(); - //ga.CurrentDisplayMode = ; - //ga.Description = ; - ga.DeviceId = adapter.Description.DeviceId; - ga.DeviceName = adapter.Description.Description; - ga.IsDefaultAdapter = i == 0; //TODO: how to set default adapter? - //ga.IsWideScreen = ; - //ga.MonitorHandle = ; - ga.Revision = adapter.Description.Revision; - ga.SubSystemId = adapter.Description.SubsystemId; - //ga.SupportedDisplayModes = ; - ga.VendorId = adapter.Description.VendorId; - - foreach (Output adapterOutput in adapter.Outputs) + using (Factory factory = new Factory()) + { + for (int i = 0; i < factory.GetAdapterCount(); i++) + { + using (Adapter adapter = factory.GetAdapter(i)) { - foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, - DisplayModeEnumerationFlags.Interlaced)) + GraphicsAdapter ga = new GraphicsAdapter(); + //ga.CurrentDisplayMode = ; + //ga.Description = ; + ga.DeviceId = adapter.Description.DeviceId; + ga.DeviceName = adapter.Description.Description; + ga.IsDefaultAdapter = i == 0; //TODO: how to set default adapter? + //ga.IsWideScreen = ; + //ga.MonitorHandle = ; + ga.Revision = adapter.Description.Revision; + ga.SubSystemId = adapter.Description.SubsystemId; + //ga.SupportedDisplayModes = ; + ga.VendorId = adapter.Description.VendorId; + + resultingModes.Clear(); + + if (adapter.Outputs.Length >= 1) { - var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height, - DxFormatConverter.Translate(modeDescription.Format)); - resultingModes.Add(displayMode); + using (Output adapterOutput = adapter.Outputs[0]) + { + var modeList = adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, DisplayModeEnumerationFlags.Interlaced); + + foreach (ModeDescription modeDescription in modeList) + { + var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height, DxFormatConverter.Translate(modeDescription.Format)); + resultingModes.Add(displayMode); + } + } } - break; //TODO: for the moment only adapter output 0 is interesting... + ga.SupportedDisplayModes = new DisplayModeCollection(resultingModes); + + adapterList.Add(ga); } - - ga.SupportedDisplayModes = new DisplayModeCollection(resultingModes); - - adapterList.Add(ga); - } - } - - factory.Dispose(); + } + } return new System.Collections.ObjectModel.ReadOnlyCollection(adapterList); } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/EffectDX.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/EffectDX.cs index 068a1345..71a3c6d9 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/EffectDX.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/EffectDX.cs @@ -1,4 +1,5 @@ #region Using Statements +using System; using System.Collections.Generic; using System.IO; using ANX.Framework.Graphics; @@ -66,7 +67,15 @@ namespace ANX.RenderSystem.Windows.DX11 : this(managedEffect) { var device = ((GraphicsDeviceDX)graphicsDevice.NativeDevice).NativeDevice.Device; - NativeEffect = new Dx11.Effect(device, GetByteCode(effectStream)); + + try + { + NativeEffect = new Dx11.Effect(device, GetByteCode(effectStream)); + } + catch (Exception ex) + { + System.Diagnostics.Debugger.Break(); + } } #endregion diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs index 80955d3d..70c6baa6 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Buildnummer // Revision // -[assembly: AssemblyVersion("0.7.16.*")] -[assembly: AssemblyFileVersion("0.7.16.0")] +[assembly: AssemblyVersion("0.7.17.*")] +[assembly: AssemblyFileVersion("0.7.17.0")] diff --git a/Samples/SimpleNoContent/SimpleNoContent.csproj b/Samples/SimpleNoContent/SimpleNoContent.csproj index dab63547..d9dece04 100644 --- a/Samples/SimpleNoContent/SimpleNoContent.csproj +++ b/Samples/SimpleNoContent/SimpleNoContent.csproj @@ -71,9 +71,9 @@ {068eb2e9-963c-4e1b-8831-e25011f11ffe} ANX.PlatformSystem.Windows - - {b30de9c2-0926-46b6-8351-9af276c472d5} - ANX.RenderSystem.Windows.DX11 + + {5be49183-2f6f-4527-ac90-d816911fcf90} + ANX.RenderSystem.Windows.DX10 {6a582788-c4d2-410c-96cd-177f75712d65} diff --git a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs index 347be162..8662df51 100644 --- a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs +++ b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs @@ -84,11 +84,12 @@ namespace ANX.SoundSystem.Windows.XAudio distanceScale = 1f; dopplerScale = 1f; speedOfSound = 343.5f; + try { - device = new XAudio2(); + device = new XAudio2(XAudio2Flags.DebugEngine, ProcessorSpecifier.AnyProcessor); } - catch (Exception) + catch (Exception ex) { device = null; //TODO: error handling