public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("supermodel"); string exe = Path.Combine(path, "supermodel.exe"); if (!File.Exists(exe)) { return(null); } List <string> args = new List <string>(); if (resolution != null) { args.Add("-res=" + resolution.Width + "," + resolution.Height); } else { args.Add("-res=" + Screen.PrimaryScreen.Bounds.Width + "," + Screen.PrimaryScreen.Bounds.Height); } _resolution = resolution; if (ReshadeManager.Setup(ReshadeBezelType.opengl, system, rom, path, resolution)) { args.Add("-fullscreen"); } else { _bezelFileInfo = BezelFiles.GetBezelFiles(system, rom, resolution); if (_bezelFileInfo == null) { args.Add("-fullscreen"); if (SystemConfig["ratio"] != "4:3") { args.Add("-wide-screen"); args.Add("-stretch"); } } } if (SystemConfig["VSync"] != "false") { args.Add("-vsync"); } args.Add("\"" + rom + "\""); return(new ProcessStartInfo() { FileName = exe, Arguments = string.Join(" ", args), WorkingDirectory = path, }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("m2emulator"); string exe = Path.Combine(path, "emulator_multicpu.exe"); if (core != null && core.ToLower().Contains("singlecpu")) { exe = Path.Combine(path, "emulator.exe"); } if (!File.Exists(exe)) { return(null); } string pakDir = Path.Combine(path, "roms"); if (!Directory.Exists(pakDir)) { Directory.CreateDirectory(pakDir); } foreach (var file in Directory.GetFiles(pakDir)) { if (Path.GetFileName(file) == Path.GetFileName(rom)) { continue; } File.Delete(file); } _destFile = Path.Combine(pakDir, Path.GetFileName(rom)); if (!File.Exists(_destFile)) { File.Copy(rom, _destFile); try { new FileInfo(_destFile).Attributes &= ~FileAttributes.ReadOnly; } catch { } } string parentRom = null; if (parentRoms.TryGetValue(Path.GetFileNameWithoutExtension(rom).ToLowerInvariant(), out parentRom)) { parentRom = Path.Combine(Path.GetDirectoryName(rom), parentRom + ".zip"); _destParent = Path.Combine(pakDir, Path.GetFileName(parentRom)); if (!File.Exists(_destParent)) { File.Copy(parentRom, _destParent); try { new FileInfo(_destParent).Attributes &= ~FileAttributes.ReadOnly; } catch { } } } _resolution = resolution; if (!ReshadeManager.Setup(ReshadeBezelType.d3d9, system, rom, path, resolution)) { _bezelFileInfo = BezelFiles.GetBezelFiles(system, rom, resolution); } SetupConfig(path, resolution); string arg = Path.GetFileNameWithoutExtension(_destFile); return(new ProcessStartInfo() { FileName = exe, Arguments = arg, WorkingDirectory = path, }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("supermodel"); string exe = Path.Combine(path, "supermodel.exe"); if (!File.Exists(exe)) { return(null); } List <string> args = new List <string>(); bool isWideScreen = false; if (resolution != null) { isWideScreen = ((float)resolution.Width / (float)resolution.Height) > 1.75f; args.Add("-res=" + resolution.Width + "," + resolution.Height); } else { isWideScreen = ((float)Screen.PrimaryScreen.Bounds.Width / (float)Screen.PrimaryScreen.Bounds.Height) >= 1.75f; args.Add("-res=" + Screen.PrimaryScreen.Bounds.Width + "," + Screen.PrimaryScreen.Bounds.Height); } _resolution = resolution; bool wideScreen = SystemConfig["widescreen"] == "1" || SystemConfig["widescreen"] == "2" || (!SystemConfig.isOptSet("widescreen") && isWideScreen); if (wideScreen) { ReshadeManager.Setup(ReshadeBezelType.opengl, null, null, path, resolution); args.Add("-fullscreen"); if (SystemConfig["widescreen"] == "2") { args.Add("-stretch"); } else { args.Add("-wide-screen"); } } else { if (ReshadeManager.Setup(ReshadeBezelType.opengl, system, rom, path, resolution)) { args.Add("-fullscreen"); } else { _bezelFileInfo = BezelFiles.GetBezelFiles(system, rom, resolution); if (_bezelFileInfo == null) { args.Add("-fullscreen"); } } } // quad rendering if (SystemConfig.isOptSet("quadRendering") && SystemConfig.getOptBoolean("quadRendering")) { args.Add("-quad-rendering"); } // crosshairs if (SystemConfig.isOptSet("crosshairs")) { args.Add("-crosshairs=" + SystemConfig["crosshairs"]); } // force feedback if (SystemConfig.isOptSet("forceFeedback") && SystemConfig.getOptBoolean("forceFeedback")) { args.Add("-force-feedback"); } try { string iniPath = Path.Combine(path, "Config", "Supermodel.ini"); if (File.Exists(iniPath)) { using (IniFile ini = new IniFile(iniPath, false)) { ini.WriteValue(" Global ", "FullScreen", _bezelFileInfo == null ? "1" : "0"); ini.WriteValue(" Global ", "WideScreen", wideScreen ? "1" : "0"); ini.Save(); } } } catch { } if (SystemConfig["VSync"] != "false") { args.Add("-vsync"); } args.Add("\"" + rom + "\""); return(new ProcessStartInfo() { FileName = exe, Arguments = string.Join(" ", args), WorkingDirectory = path, }); }