Пример #1
0
 /// <summary>
 /// Reset the _renderTarget so that we are sure it will have the correct presentation parameters (required to support working across changes to windowed/fullscreen or resolution changes)
 /// </summary>
 /// <param name="devicePtr"></param>
 /// <param name="presentParameters"></param>
 /// <returns></returns>
 int ResetHook(IntPtr devicePtr, ref D3DPRESENT_PARAMETERS presentParameters)
 {
     using (Device device = Device.FromPointer(devicePtr))
     {
         PresentParameters pp = new PresentParameters()
         {
             AutoDepthStencilFormat       = (Format)presentParameters.AutoDepthStencilFormat,
             BackBufferCount              = presentParameters.BackBufferCount,
             BackBufferFormat             = (Format)presentParameters.BackBufferFormat,
             BackBufferHeight             = presentParameters.BackBufferHeight,
             BackBufferWidth              = presentParameters.BackBufferWidth,
             DeviceWindowHandle           = presentParameters.DeviceWindowHandle,
             EnableAutoDepthStencil       = presentParameters.EnableAutoDepthStencil,
             FullScreenRefreshRateInHertz = presentParameters.FullScreen_RefreshRateInHz,
             Multisample          = (MultisampleType)presentParameters.MultiSampleType,
             MultisampleQuality   = presentParameters.MultiSampleQuality,
             PresentationInterval = (PresentInterval)presentParameters.PresentationInterval,
             PresentFlags         = (PresentFlags)presentParameters.Flags,
             SwapEffect           = (SwapEffect)presentParameters.SwapEffect,
             Windowed             = presentParameters.Windowed
         };
         lock (_lockRenderTarget)
         {
             if (_renderTarget != null)
             {
                 _renderTarget.Dispose();
                 _renderTarget = null;
             }
         }
         // EasyHook has already repatched the original Reset so calling it here will not cause an endless recursion to this function
         return(device.Reset(pp).Code);
     }
 }
Пример #2
0
 /// <summary>
 /// Reset the _renderTarget so that we are sure it will have the correct presentation parameters (required to support working across changes to windowed/fullscreen or resolution changes)
 /// </summary>
 /// <param name="devicePtr"></param>
 /// <param name="presentParameters"></param>
 /// <returns></returns>
 int ResetHook(IntPtr devicePtr, ref D3DPRESENT_PARAMETERS presentParameters)
 {
     using (Device device = Device.FromPointer(devicePtr))
     {
         PresentParameters pp = new PresentParameters()
         {
             AutoDepthStencilFormat = (Format)presentParameters.AutoDepthStencilFormat,
             BackBufferCount = presentParameters.BackBufferCount,
             BackBufferFormat = (Format)presentParameters.BackBufferFormat,
             BackBufferHeight = presentParameters.BackBufferHeight,
             BackBufferWidth = presentParameters.BackBufferWidth,
             DeviceWindowHandle = presentParameters.DeviceWindowHandle,
             EnableAutoDepthStencil = presentParameters.EnableAutoDepthStencil,
             FullScreenRefreshRateInHertz = presentParameters.FullScreen_RefreshRateInHz,
             Multisample = (MultisampleType)presentParameters.MultiSampleType,
             MultisampleQuality = presentParameters.MultiSampleQuality,
             PresentationInterval = (PresentInterval)presentParameters.PresentationInterval,
             PresentFlags = (PresentFlags)presentParameters.Flags,
             SwapEffect = (SwapEffect)presentParameters.SwapEffect,
             Windowed = presentParameters.Windowed
         };
         lock (_lockRenderTarget)
         {
             if (_renderTarget != null)
             {
                 _renderTarget.Dispose();
                 _renderTarget = null;
             }
         }
         // EasyHook has already repatched the original Reset so calling it here will not cause an endless recursion to this function
         return device.Reset(pp).Code;
     }
 }