示例#1
0
        public DX9Controller(HWSettings settings)
        {
            this._settings = settings;
            this.Name = typeof(DX9Controller).Name;
            IntPtr direct3D = Direct3DCreate9(32);

            try {
                if (direct3D == IntPtr.Zero){
                    MessageBox.Show("error");
                    throw new Exception("Failed to create D3D.");
                }

                IntPtr adapterIdentPtr = Marshal.ReadIntPtr(Marshal.ReadIntPtr(direct3D), 20);

                GetAdapterIdentifierOriginal = (GetAdapterIdentifierDelegate)Marshal.GetDelegateForFunctionPointer(adapterIdentPtr, typeof(GetAdapterIdentifierDelegate));

                _name = string.Format("GetAdapterIdentHook_{0:X}", adapterIdentPtr.ToInt32());
                _hook = LocalHook.Create(adapterIdentPtr, new GetAdapterIdentifierDelegate(GetAdapterIdentifierDetour), this);
                _hook.ThreadACL.SetExclusiveACL(new Int32[] { 1 });

            } catch (Exception ex) {

                HookManager.Log("[DX9Controller] Exception: " + ex.ToString());
                this.Error = true;
            }
        }
示例#2
0
        public DX9Controller(HWSettings settings)
        {
            this._settings = settings;
            this.Name      = typeof(DX9Controller).Name;
            IntPtr direct3D = Direct3DCreate9(32);


            try {
                if (direct3D == IntPtr.Zero)
                {
                    MessageBox.Show("error");
                    throw new Exception("Failed to create D3D.");
                }

                IntPtr adapterIdentPtr = Marshal.ReadIntPtr(Marshal.ReadIntPtr(direct3D), 20);

                GetAdapterIdentifierOriginal = (GetAdapterIdentifierDelegate)Marshal.GetDelegateForFunctionPointer(adapterIdentPtr, typeof(GetAdapterIdentifierDelegate));

                _name = string.Format("GetAdapterIdentHook_{0:X}", adapterIdentPtr.ToInt32());
                _hook = LocalHook.Create(adapterIdentPtr, new GetAdapterIdentifierDelegate(GetAdapterIdentifierDetour), this);
                _hook.ThreadACL.SetExclusiveACL(new Int32[] { 1 });
            } catch (Exception ex) {
                HookManager.Log("[DX9Controller] Exception: " + ex.ToString());
                this.Error = true;
            }
        }
示例#3
0
        public GraphicsCardDX9Hook(Settings settings)
        {
            this._settings = settings;

            IntPtr direct3D = Direct3DCreate9(32);

            if (direct3D == IntPtr.Zero)
            {
                throw new Exception("Failed to create D3D.");
            }

            IntPtr adapterIdentPtr = Marshal.ReadIntPtr(Marshal.ReadIntPtr(direct3D), 20);

            GetAdapterIdentifierOriginal = (GetAdapterIdentifierDelegate)Marshal.GetDelegateForFunctionPointer(adapterIdentPtr, typeof(GetAdapterIdentifierDelegate));

            _name = string.Format("GetAdapterIdentHook_{0:X}", adapterIdentPtr.ToInt32());
            _hook = LocalHook.Create(adapterIdentPtr, new GetAdapterIdentifierDelegate(GetAdapterIdentifierDetour), this);
            _hook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
        }