コード例 #1
0
        unsafe int PresentHook(IntPtr devicePtr, SharpDX.Rectangle *pSourceRect, SharpDX.Rectangle *pDestRect, IntPtr hDestWindowOverride, IntPtr pDirtyRegion)
        {
            // Example of using delegate to original function pointer to call original method
            //var original = (Direct3D9Device_PresentDelegate)(Object)Marshal.GetDelegateForFunctionPointer(id3dDeviceFunctionAddresses[(int)Direct3DDevice9FunctionOrdinals.Present], typeof(Direct3D9Device_PresentDelegate));
            //try
            //{
            //    unsafe
            //    {
            //        return original(devicePtr, ref pSourceRect, ref pDestRect, hDestWindowOverride, pDirtyRegion);
            //    }
            //}
            //catch { }
            _isUsingPresent = true;

            Device device = (Device)devicePtr;

            DoCaptureRenderTarget(device, "PresentHook");

            if (pSourceRect == null || *pSourceRect == SharpDX.Rectangle.Empty)
            {
                device.Present();
            }
            else
            {
                if (hDestWindowOverride != IntPtr.Zero)
                {
                    device.Present(*pSourceRect, *pDestRect, hDestWindowOverride);
                }
                else
                {
                    device.Present(*pSourceRect, *pDestRect);
                }
            }
            return(SharpDX.Result.Ok.Code);
        }
コード例 #2
0
        // Used in the overlay
        unsafe int PresentExHook(IntPtr devicePtr, SharpDX.Rectangle *pSourceRect, SharpDX.Rectangle *pDestRect, IntPtr hDestWindowOverride, IntPtr pDirtyRegion, Present dwFlags)
        {
            _isUsingPresent = true;
            DeviceEx device = (DeviceEx)devicePtr;

            DoCaptureRenderTarget(device, "PresentEx");

            //    Region region = new Region(pDirtyRegion);
            if (pSourceRect == null || *pSourceRect == SharpDX.Rectangle.Empty)
            {
                device.PresentEx(dwFlags);
            }
            else
            {
                if (hDestWindowOverride != IntPtr.Zero)
                {
                    device.PresentEx(dwFlags, *pSourceRect, *pDestRect, hDestWindowOverride);
                }
                else
                {
                    device.PresentEx(dwFlags, *pSourceRect, *pDestRect);
                }
            }
            return(SharpDX.Result.Ok.Code);
        }
コード例 #3
0
 private unsafe int PresentHook(
     IntPtr devicePtr,
     SharpDX.Rectangle *pSourceRect,
     SharpDX.Rectangle *pDestRect,
     IntPtr hDestWindowOverride,
     IntPtr pDirtyRegion)
 {
     try
     {
         Device device = (Device)devicePtr;
         if (presentHookRecurse == 0 && hooksStarted)
         {
             this.DoCaptureRenderTarget(device, "PresentHook");
         }
         this.presentHookRecurse++;
         var original = (Direct3D9Device_PresentDelegate)Marshal.GetDelegateForFunctionPointer(this.id3dDeviceFunctionAddresses[(int)Direct3DDevice9FunctionOrdinals.Present], typeof(Direct3D9Device_PresentDelegate));
         original(devicePtr, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
     }
     catch (Exception ex)
     {
         DebugMessage(ex.ToString());
     }
     finally
     {
         this.presentHookRecurse--;
     }
     return(Result.Ok.Code);
 }
コード例 #4
0
        unsafe int PresentHook(IntPtr devicePtr, SharpDX.Rectangle *pSourceRect, SharpDX.Rectangle *pDestRect,
                               IntPtr hDestWindowOverride, IntPtr pDirtyRegion)
        {
            _isUsingPresent = true;

            Device device = (Device)devicePtr;

            DoCaptureRenderTarget(device, "PresentHook");

            if (pSourceRect == null || *pSourceRect == SharpDX.Rectangle.Empty)
            {
                device.Present();
            }
            else
            {
                if (hDestWindowOverride != IntPtr.Zero)
                {
                    device.Present(*pSourceRect, *pDestRect, hDestWindowOverride);
                }
                else
                {
                    device.Present(*pSourceRect, *pDestRect);
                }
            }
            return(SharpDX.Result.Ok.Code);
        }
コード例 #5
0
        unsafe int PresentHook(IntPtr devicePtr, SharpDX.Rectangle *pSourceRect, SharpDX.Rectangle *pDestRect, IntPtr hDestWindowOverride, IntPtr pDirtyRegion)
        {
            _isUsingPresent = true;

            Device device = (Device)devicePtr;

            DoCaptureRenderTarget(device, "PresentHook");

            DoVblankWait();

            int result = Direct3DDevice_PresentHook.Original(devicePtr, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);

            return(result);
        }
コード例 #6
0
        // Used in the overlay
        unsafe int PresentExHook(IntPtr devicePtr, SharpDX.Rectangle *pSourceRect, SharpDX.Rectangle *pDestRect, IntPtr hDestWindowOverride, IntPtr pDirtyRegion, Present dwFlags)
        {
            _isUsingPresent = true;
            DeviceEx device = (DeviceEx)devicePtr;

            DoCaptureRenderTarget(device, "PresentEx");

            //shantae half genie hero uses Direct3D9Ex
            DoVblankWait();

            int result = Direct3DDeviceEx_PresentExHook.Original(devicePtr, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);

            return(result);
        }
コード例 #7
0
        private unsafe int SwapChainPresentHook(
            IntPtr swapChainPtr,
            SharpDX.Rectangle *pSourceRect,
            SharpDX.Rectangle *pDestRect,
            IntPtr hDestWindowOverride,
            IntPtr pDirtyRegion,
            Present dwFlags)
        {
            SwapChain swapchain = (SwapChain)swapChainPtr;

            if (presentHookRecurse == 0 && hooksStarted)
            {
                DoCaptureRenderTarget(currentDevice, "SwapChainPresentHook");
            }

            presentHookRecurse++;
            var original = (SwapChain_PresentDelegate)Marshal.GetDelegateForFunctionPointer(this.id3dDeviceFunctionAddresses[(int)Direct3DSwapChain9Ordinals.Present], typeof(SwapChain_PresentDelegate));

            original(swapChainPtr, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
            presentHookRecurse--;
            return(Result.Ok.Code);
        }