Example #1
0
        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
            });
        }