示例#1
0
文件: MyDirect3D.cs 项目: uvbs/babbot
        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);
        }
示例#2
0
文件: MyDirect3D.cs 项目: uvbs/babbot
        private void OverrideFunctions()
        {
            //Backup original table and replace with a copy that we will tweak
            InitializeVFTable();

            //Get and set new delegate for creating the device
            MyCreateDevice = CreateDevice;
            IntPtr PointerToMyCreateDevice = Marshal.GetFunctionPointerForDelegate(MyCreateDevice);

            NativeIDirect3D9->VFTable[16] = PointerToMyCreateDevice;
        }
示例#3
0
        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;
        }
示例#4
0
        private void OverrideFunctions()
        {
            //Backup original table and replace with a copy that we will tweak
            InitializeVFTable();

            //Get and set new delegate for creating the device
            MyCreateDevice = CreateDevice;
            IntPtr PointerToMyCreateDevice = Marshal.GetFunctionPointerForDelegate(MyCreateDevice);
            NativeIDirect3D9->VFTable[16] = PointerToMyCreateDevice;
        }