Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public override void Hook()
- {
- this.DebugMessage("Hook: Begin");
- // First we need to determine the function address for IDirect3DDevice9
- Device device;
- List<IntPtr> id3dDeviceFunctionAddresses = new List<IntPtr>();
- List<IntPtr> id3dSwapChainFunctionAddresses = new List<IntPtr>();
- using (Direct3D d3d = new Direct3D())
- {
- this.DebugMessage("Hook: Before device creation");
- using (device = new Device(d3d, 0, DeviceType.NullReference, IntPtr.Zero, CreateFlags.HardwareVertexProcessing, new PresentParameters() { BackBufferWidth = 1, BackBufferHeight = 1 }))
- {
- this.DebugMessage("Hook: Device created");
- id3dDeviceFunctionAddresses.AddRange(GetVTblAddresses(device.ComPointer, D3D9_DEVICE_METHOD_COUNT));
- try
- {
- using (SwapChain sc = new SwapChain(device, new PresentParameters()))
- {
- this.DebugMessage("Hook: SC created");
- id3dSwapChainFunctionAddresses.AddRange(GetVTblAddresses(sc.ComPointer, D3D9_SWAPCHAIN_METHOD_COUNT));
- }
- }
- catch (Exception e)
- {
- this.DebugMessage("Hook Exception: " + e.GetType().FullName + ": " + e.Message);
- }
- }
- }
- [...]
- this.DebugMessage("Hook: End");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement