// For the case where we already have a native IDirectInput8 object and we want to override some of it's functions. public unsafe IDirectInput8(DirectInput8.IDirectInput8 *InNativeIDirectInput8, YggdrasillInterface iface) { Context = InNativeIDirectInput8; Interface = iface; /* Hook up any functions we care about */ OverrideFunctions(); }
// For the case where we don't have a native IDirectInput8 object so we want one created for us. public unsafe IDirectInput8(IntPtr hInst, UInt32 dwVersion, IntPtr riidltf, DirectInput8.IDirectInput8 **ppvOut, IntPtr punkOuter, YggdrasillInterface iface, out int rv) { // Create the real IDirectInput8 object. rv = DirectInput8.DirectInput8Create(hInst, dwVersion, riidltf, ppvOut, punkOuter); Context = *ppvOut; Interface = iface; /* Hook up any functions we care about */ OverrideFunctions(); }
public unsafe int CreateDevice(DirectInput8.IDirectInput8 *This, DirectInput8.GUID *rguid, IntPtr *lplpDirectInputDevice, IntPtr pUnkOuter) { DCreateDevice del = (DCreateDevice)Marshal.GetDelegateForFunctionPointer(oldCreate, typeof(DCreateDevice)); int rv = del(This, rguid, lplpDirectInputDevice, pUnkOuter); IDirectInputDevice8 dev = new IDirectInputDevice8((DirectInput8.IDirectInputDevice8 *) * lplpDirectInputDevice, Interface); devices.Add(dev); return(rv); }