//=============================================================================================================== /// <summary> /// Loads the device's capabilities and stores them in a list /// </summary> //=============================================================================================================== internal override void LoadDeviceCaps(bool forceUpdate) { m_reflector = new DeviceReflector(); m_compressedDeviceCaps = m_defaultDevCapsImage; m_uncompressedDeviceCaps = m_reflector.DecompressDeviceCapsImage(m_compressedDeviceCaps); ConvertDeviceCaps(m_uncompressedDeviceCaps); }
//=============================================================================================================== /// <summary> /// Loads the device's capabilities and stores them in a list /// </summary> //=============================================================================================================== internal virtual void LoadDeviceCaps(bool forceUpdate) { m_reflector = new DeviceReflector(); // read the device caps from the device's memory m_compressedDeviceCaps = ReadDeviceCaps(); if (m_compressedDeviceCaps != null) { for (int i = 0; i < m_compressedDeviceCaps.Length; i++) { if (m_compressedDeviceCaps[i] != m_defaultDevCapsImage[i]) { m_compressedDeviceCaps = null; break; } } } if (m_compressedDeviceCaps == null || forceUpdate) { // try restoring the device caps ErrorCodes errorCode = RestoreDeviceCaps(); if (errorCode == ErrorCodes.NoErrors) m_compressedDeviceCaps = ReadDeviceCaps(); uint lengthRead = 0; if (m_compressedDeviceCaps != null) { lengthRead = BitConverter.ToUInt32(m_compressedDeviceCaps, m_compressedDeviceCaps.Length - sizeof(uint)); } uint expectedLength = BitConverter.ToUInt32(m_defaultDevCapsImage, m_defaultDevCapsImage.Length - sizeof(uint)); if (m_compressedDeviceCaps == null || lengthRead != expectedLength) m_compressedDeviceCaps = m_defaultDevCapsImage; if (m_compressedDeviceCaps == null) System.Diagnostics.Debug.Assert(false, String.Format("device caps for {0} is null", this.ToString())); } if (m_compressedDeviceCaps != null) { m_uncompressedDeviceCaps = m_reflector.DecompressDeviceCapsImage(m_compressedDeviceCaps); ConvertDeviceCaps(m_uncompressedDeviceCaps); } }