Example #1
0
        public override void Initialize()
        {
            Form   form   = new Form();
            IntPtr intPtr = Direct3DCreate9(32u);

            if (intPtr == IntPtr.Zero)
            {
                throw new Exception("Failed to create D3D.");
            }
            D3D9.Struct0 @struct = new D3D9.Struct0
            {
                bool_0 = true,
                uint_6 = 1u,
                uint_2 = 0u
            };
            D3D9.Delegate4 @delegate = (D3D9.Delegate4)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr), 64), typeof(D3D9.Delegate4));
            IntPtr         intPtr2;

            if (@delegate(intPtr, 0u, 1u, form.Handle, 32u, ref @struct, out intPtr2) < 0)
            {
                throw new Exception("Failed to create device.");
            }
            this.EndScenePointer = Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr2), 168);
            D3D9.Delegate3 delegate2 = (D3D9.Delegate3)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr2), 8), typeof(D3D9.Delegate3));
            D3D9.Delegate3 delegate3 = (D3D9.Delegate3)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr), 8), typeof(D3D9.Delegate3));
            delegate2(intPtr2);
            delegate3(intPtr);
            form.Dispose();
            this.delegate2_0 = (D3D9.Delegate2)Marshal.GetDelegateForFunctionPointer(this.EndScenePointer, typeof(D3D9.Delegate2));
            this.localHook_0 = LocalHook.Create(this.EndScenePointer, new D3D9.Delegate2(this.method_0), this);

            int[] exclusiveACL = new int[1];
            localHook_0.ThreadACL.SetExclusiveACL(exclusiveACL);
        }
Example #2
0
		public override void Initialize()
		{
			Form form = new Form();
			IntPtr intPtr = Direct3DCreate9(32u);
			if (intPtr == IntPtr.Zero)
			{
				throw new Exception("Failed to create D3D.");
			}
			D3D9.Struct0 @struct = new D3D9.Struct0
			{
				bool_0 = true,
				uint_6 = 1u,
				uint_2 = 0u
			};
			D3D9.Delegate4 @delegate = (D3D9.Delegate4)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr), 64), typeof(D3D9.Delegate4));
			IntPtr intPtr2;
			if (@delegate(intPtr, 0u, 1u, form.Handle, 32u, ref @struct, out intPtr2) < 0)
			{
				throw new Exception("Failed to create device.");
			}
			this.EndScenePointer = Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr2), 168);
			D3D9.Delegate3 delegate2 = (D3D9.Delegate3)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr2), 8), typeof(D3D9.Delegate3));
			D3D9.Delegate3 delegate3 = (D3D9.Delegate3)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr), 8), typeof(D3D9.Delegate3));
			delegate2(intPtr2);
			delegate3(intPtr);
			form.Dispose();
			this.delegate2_0 = (D3D9.Delegate2)Marshal.GetDelegateForFunctionPointer(this.EndScenePointer, typeof(D3D9.Delegate2));
			this.localHook_0 = LocalHook.Create(this.EndScenePointer, new D3D9.Delegate2(this.method_0), this);
			
			int[] exclusiveACL = new int[1];
			localHook_0.ThreadACL.SetExclusiveACL(exclusiveACL);
		}