public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("fpinball"); _rom = rom; _splash = ShowSplash(rom); if ("bam".Equals(emulator, StringComparison.InvariantCultureIgnoreCase) || "bam".Equals(core, StringComparison.InvariantCultureIgnoreCase)) { _bam = Path.Combine(path, "BAM", "FPLoader.exe"); } string exe = Path.Combine(path, "Future Pinball.exe"); if (!File.Exists(exe)) { exe = Path.Combine(path, "FuturePinball.exe"); if (!File.Exists(exe)) { return(null); } } if (_bam != null && File.Exists(_bam)) { ScreenResolution.SetHighDpiAware(_bam); } ScreenResolution.SetHighDpiAware(exe); SetupOptions(resolution); return(new ProcessStartInfo() { FileName = _bam != null && File.Exists(_bam) ? _bam : exe, Arguments = "/open \"" + rom + "\" /play /exit", }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("fpinball"); _rom = rom; _splash = ShowSplash(rom); if ("bam".Equals(emulator, StringComparison.InvariantCultureIgnoreCase) || "bam".Equals(core, StringComparison.InvariantCultureIgnoreCase)) { _bam = Path.Combine(path, "BAM", "FPLoader.exe"); } string exe = Path.Combine(path, "Future Pinball.exe"); if (!File.Exists(exe)) { exe = Path.Combine(path, "FuturePinball.exe"); if (!File.Exists(exe)) { return(null); } } if (_bam != null && File.Exists(_bam)) { ScreenResolution.SetHighDpiAware(_bam); } ScreenResolution.SetHighDpiAware(exe); SetupOptions(resolution); var ret = new ProcessStartInfo() { FileName = _bam != null && File.Exists(_bam) ? _bam : exe, Arguments = "/open \"" + rom + "\" /play /exit", }; // Check If COM components are well registered. If not : run elevated to register them. bool runAs = false; var key = Registry.ClassesRoot.OpenSubKey("TypeLib\\{FB22A459-4AD0-4CB3-B959-15158F7139F5}\\1.0\\0\\win32", false); if (key != null) { object registeredPath = key.GetValue(null); if (registeredPath == null) { runAs = true; } var rp = registeredPath.ToString(); if (rp != exe) { runAs = true; } key.Close(); } else { runAs = true; } if (runAs) { ret.Verb = "runas"; } return(ret); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("vpinball"); if (path == null) { return(null); } string exe = Path.Combine(path, "VPinballX.exe"); if (!File.Exists(exe)) { return(null); } _rom = rom; _splash = ShowSplash(rom); ScreenResolution.SetHighDpiAware(exe); EnsureUltraDMDRegistered(path); EnsureBackglassServerRegistered(path); EnsureVPinMameRegistered(path); string romPath = Path.Combine(Path.GetDirectoryName(rom), "roms"); if (!Directory.Exists(romPath)) { romPath = null; } ScreenRes sr = ScreenRes.Load(Path.GetDirectoryName(rom)); if (sr != null) { if (Screen.AllScreens.Length == 1 || SystemInformation.TerminalServerSession) { sr.Delete(); } else { sr.ScreenResX = resolution == null ? Screen.PrimaryScreen.Bounds.Width : resolution.Width; sr.ScreenResY = resolution == null ? Screen.PrimaryScreen.Bounds.Height : resolution.Height; Screen secondary = Screen.AllScreens.FirstOrDefault(s => !s.Primary); sr.Screen2ResX = secondary.Bounds.Width; sr.Screen2ResY = secondary.Bounds.Height; sr.Monitor = 2; sr.Save(); } } SetupOptions(path, romPath, resolution); return(new ProcessStartInfo() { FileName = exe, Arguments = "-play \"" + rom + "\"", WindowStyle = _splash != null ? ProcessWindowStyle.Minimized : ProcessWindowStyle.Normal, UseShellExecute = true }); }