private static bool TryRegisterSoftwareRenderer(Direct3D d3D) { var library = new IntPtr(); foreach (string suffix in new[] { "", "_1", "_2" }) { string lpFileName = Path.Combine(Environment.SystemDirectory, "rgb9rast" + suffix + ".dll"); library = LoadLibrary(lpFileName); if (library.ToInt32() != 0) { break; } } if (library.ToInt32() == 0) { return(false); } var procedure = unchecked ((IntPtr)(long)(ulong)GetProcAddress(library, "D3D9GetSWInfo")); d3D.RegisterSoftwareDevice(procedure); return(true); }
private static bool TryRegisterSoftwareRenderer(Direct3D d3D) { var library = new IntPtr(); foreach(string suffix in new[] {"", "_1", "_2"}) { string lpFileName = Path.Combine(Environment.SystemDirectory, "rgb9rast" + suffix + ".dll"); library = LoadLibrary(lpFileName); if(library.ToInt32() != 0) break; } if(library.ToInt32() == 0) return false; var procedure = unchecked((IntPtr)(long)(ulong)GetProcAddress(library, "D3D9GetSWInfo")); d3D.RegisterSoftwareDevice(procedure); return true; }