SHARE
TWEET

Untitled

a guest Nov 20th, 2011 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public override void Hook()
  2.         {
  3.             this.DebugMessage("Hook: Begin");
  4.             // First we need to determine the function address for IDirect3DDevice9
  5.             Device device;
  6.             List<IntPtr> id3dDeviceFunctionAddresses = new List<IntPtr>();
  7.             List<IntPtr> id3dSwapChainFunctionAddresses = new List<IntPtr>();
  8.            
  9.             using (Direct3D d3d = new Direct3D())
  10.             {
  11.                 this.DebugMessage("Hook: Before device creation");
  12.                 using (device = new Device(d3d, 0, DeviceType.NullReference, IntPtr.Zero, CreateFlags.HardwareVertexProcessing, new PresentParameters() { BackBufferWidth = 1, BackBufferHeight = 1 }))
  13.                 {
  14.                     this.DebugMessage("Hook: Device created");
  15.                     id3dDeviceFunctionAddresses.AddRange(GetVTblAddresses(device.ComPointer, D3D9_DEVICE_METHOD_COUNT));
  16.                     try
  17.                     {
  18.                         using (SwapChain sc = new SwapChain(device, new PresentParameters()))
  19.                         {
  20.                             this.DebugMessage("Hook: SC created");
  21.                             id3dSwapChainFunctionAddresses.AddRange(GetVTblAddresses(sc.ComPointer, D3D9_SWAPCHAIN_METHOD_COUNT));
  22.                         }
  23.                     }
  24.                     catch (Exception e)
  25.                     {
  26.                         this.DebugMessage("Hook Exception: " + e.GetType().FullName + ": " + e.Message);
  27.                     }
  28.                 }
  29.             }
  30.  
  31.             [...]
  32.  
  33.             this.DebugMessage("Hook: End");
  34.         }
  35.  
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top