Пример #1
0
        private void OverrideFunctions()
        {
            InitVtable();

            // 0:  STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
            // 1:  STDMETHOD_(ULONG,AddRef)(THIS) PURE;
            // 2:  STDMETHOD_(ULONG,Release)(THIS) PURE;
            // 3:  STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE;
            // 4:  STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE;
            // 5:  STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER8* pIdentifier) PURE;
            // 6:  STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter) PURE;
            // 7:  STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,UINT Mode,D3DDISPLAYMODE* pMode) PURE;
            // 8:  STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE;
            // 9:  STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE CheckType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL Windowed) PURE;
            // 10: STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE;
            // 11: STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType) PURE;
            // 12: STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE;
            // 13: STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS8* pCaps) PURE;
            // 14: STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE;
            // 15: STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice8** ppReturnedDeviceInterface) PURE;

            del_cd = new DCreateDevice(CreateDevice);
            IntPtr ptr = Marshal.GetFunctionPointerForDelegate(del_cd);

            Context->vtable[15] = ptr;
        }
Пример #2
0
        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));
        }
Пример #3
0
        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);
        }
Пример #4
0
        private void OverrideFunctions()
        {
            // List of functions in the IDirectInput8 interface:
            // 0:  STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
            // 1:  STDMETHOD_(ULONG,AddRef)(THIS) PURE;
            // 2:  STDMETHOD_(ULONG,Release)(THIS) PURE;
            // 3:  STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE8A *,LPUNKNOWN) PURE;
            // 4:  STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE;
            // 5:  STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE;
            // 6:  STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE;
            // 7:  STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE;
            // 8:  STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE;
            // 9:  STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCSTR,LPDIACTIONFORMATA,LPDIENUMDEVICESBYSEMANTICSCBA,LPVOID,DWORD) PURE;
            // 10: STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSA,DWORD,LPVOID) PURE;

            oldCreate = Context->vtable[3];
            del_cd    = new DCreateDevice(CreateDevice);
            IntPtr ptr = Marshal.GetFunctionPointerForDelegate(del_cd);

            Context->vtable[3] = ptr;
        }