Example #1
0
 public DXHookD3D11(DirextXGraphicsInterface graphicsInterface) : base(graphicsInterface)
 {
     this.D3D11VirtualTableAddresses         = null;
     this.DXGISwapChainVirtualTableAddresses = null;
     this.DXGISwapChainPresentHook           = null;
     this.DXGISwapChainResizeTargetHook      = null;
     this.SwapChainPointer = IntPtr.Zero;
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DXHookD3D9" /> class
        /// </summary>
        /// <param name="graphicsInterface">An object providing access to control of the DirectX graphics library</param>
        public DXHookD3D9(DirextXGraphicsInterface graphicsInterface) : base(graphicsInterface)
        {
            this.ID3DDeviceFunctionAddresses = new List <IntPtr>();
            this.SupportsDirect3D9Ex         = false;
            this.IsUsingPresent = false;

            this.Direct3DDeviceEndSceneHook    = null;
            this.Direct3DDeviceResetHook       = null;
            this.Direct3DDevicePresentHook     = null;
            this.Direct3DDeviceExPresentExHook = null;
        }
Example #3
0
        /// <summary>
        /// Initializes the directX hook in the process
        /// </summary>
        /// <returns>True if the initialization was successful.</returns>
        private Boolean InitializeDirectXHook()
        {
            DirextXGraphicsInterface dirextXGraphicsInterface = (DirextXGraphicsInterface)this.HookClient.GetGraphicsInterface();

            DirectXFlags.Direct3DVersionEnum version = DirectXFlags.Direct3DVersionEnum.Unknown;

            Dictionary <DirectXFlags.Direct3DVersionEnum, String> directXModules = new Dictionary <DirectXFlags.Direct3DVersionEnum, String>
            {
                { DirectXFlags.Direct3DVersionEnum.Direct3D9, "d3d9.dll" },
                { DirectXFlags.Direct3DVersionEnum.Direct3D10, "d3d10.dll" },
                { DirectXFlags.Direct3DVersionEnum.Direct3D10_1, "d3d10_1.dll" },
                { DirectXFlags.Direct3DVersionEnum.Direct3D11, "d3d11.dll" },
                { DirectXFlags.Direct3DVersionEnum.Direct3D11_1, "d3d11_1.dll" },
            };

            try
            {
                IntPtr handle = IntPtr.Zero;

                foreach (KeyValuePair <DirectXFlags.Direct3DVersionEnum, String> module in directXModules)
                {
                    handle = GetModuleHandle(module.Value);

                    if (handle != IntPtr.Zero)
                    {
                        version = module.Key;
                        break;
                    }
                }

                if (handle == IntPtr.Zero)
                {
                    return(false);
                }

                switch (version)
                {
                case DirectXFlags.Direct3DVersionEnum.Direct3D9:
                    this.DirectXHook = new DXHookD3D9(dirextXGraphicsInterface);
                    break;

                case DirectXFlags.Direct3DVersionEnum.Direct3D10:
                    //// this.DirectXHook = new DXHookD3D10(DirextXGraphicsInterface);
                    break;

                case DirectXFlags.Direct3DVersionEnum.Direct3D10_1:
                    //// this.DirectXHook = new DXHookD3D10_1(DirextXGraphicsInterface);
                    break;

                case DirectXFlags.Direct3DVersionEnum.Direct3D11:
                    this.DirectXHook = new DXHookD3D11(dirextXGraphicsInterface);
                    break;

                //// case Direct3DVersion.Direct3D11_1:
                ////    this.DirectXHook = new DXHookD3D11_1(this.ClientConnection);
                ////    return;
                default:
                    return(false);
                }

                this.DirectXHook.Hook();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DXOverlayEngine" /> class
 /// </summary>
 /// <param name="graphicsInterface">An object providing access to control of the DirectX graphics library</param>
 public DXOverlayEngine(DirextXGraphicsInterface graphicsInterface)
 {
     this.GraphicsInterface = graphicsInterface;
     this.ImageCache        = new Dictionary <Element, Texture>();
     this.FontCache         = new Dictionary <String, Font>();
 }
        public static IGraphicsInterface GetGraphicsInterface(String projectDirectory)
        {
            DirextXGraphicsInterface graphicsInterface = new DirextXGraphicsInterface(projectDirectory);

            return(graphicsInterface);
        }