public uint CreateDevice(D3D9.IDirect3D9 *This, uint adapter, uint deviceType, IntPtr focusWindow, uint behaviorFlags, IntPtr presentationParameters, D3D9.IDirect3DDevice9 *deviceInterface) { LuaInterface.LoggingInterface.Log("CreateDevice Start..."); RealCreateDevice = (DelegateCreateDevice) Marshal.GetDelegateForFunctionPointer(OriginalVFTable[16], typeof(DelegateCreateDevice)); //Call the function to create the device. The pointer to the device is stored in deviceInterface // The result code is saved to CreateDevice (0 means Good) LuaInterface.LoggingInterface.Log("RealCreateDevice Start..."); uint CreateDevice = RealCreateDevice(This, adapter, deviceType, focusWindow, behaviorFlags, presentationParameters, deviceInterface); // if creation was successful, then remap appopriate function pointers for EndScene if (CreateDevice == 0) { LuaInterface.LoggingInterface.Log(String.Format("CreateDevice = {0}", CreateDevice)); var device = new IDirect3DDevice9(This, deviceInterface); } LuaInterface.LoggingInterface.Log("Returning CreateDevice"); return(CreateDevice); }
public IDirect3DDevice9(D3D9.IDirect3D9 *InNativeIDirect3D9, D3D9.IDirect3DDevice9 *InNativeIDirect3DDevice9) { NativeIDirect3D9 = InNativeIDirect3D9; NativeIDirect3DDevice9 = InNativeIDirect3DDevice9; // Override the functions in NativeIDirect3DDevice9 with our own. OverrideFunctions(); }