// For the case where we already have a native IDirect3D8 object and we want to override some of it's functions. public unsafe IDirect3D8(D3D8.IDirect3D8 *InContext, YggdrasillInterface iface) { Context = InContext; Interface = iface; // Override the functions in the vtable of the context with our own. OverrideFunctions(); }
// For the case where we don't have a native IDirect3D object so we want one created for us. public IDirect3D8(uint SdkVersion, YggdrasillInterface iface) { // Create the real IDirect3D8 object. Context = D3D8.Direct3DCreate8(SdkVersion); Interface = iface; // Override the functions in the vtable of the context with our own. OverrideFunctions(); }
public unsafe int CreateDevice(D3D8.IDirect3D8 *This, uint Adapter, uint DeviceType, IntPtr hFocusWindow, UInt32 BehaviorFlags, D3D8.D3DPRESENT_PARAMETERS *pPresentationParameters, IntPtr ppReturnedDeviceInterface) { DCreateDevice del = (DCreateDevice)Marshal.GetDelegateForFunctionPointer(vtable[15], typeof(DCreateDevice)); /* I want windowed mode, damn you! */ pPresentationParameters->hDeviceWindow = (IntPtr)1; pPresentationParameters->FullScreen_RefreshRateInHz = 0; return(del(This, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface)); }