private void SetupConfig(string path, ScreenResolution resolution) { string iniFile = Path.Combine(path, "Emulator.ini"); try { using (var ini = new IniFile(iniFile, true)) { ini.WriteValue("Renderer", "FullMode", "4"); ini.WriteValue("Renderer", "AutoFull", "1"); ini.WriteValue("Renderer", "FullScreenWidth", (resolution == null ? Screen.PrimaryScreen.Bounds.Width : resolution.Width).ToString()); ini.WriteValue("Renderer", "FullScreenHeight", (resolution == null ? Screen.PrimaryScreen.Bounds.Height : resolution.Height).ToString()); ini.WriteValue("Renderer", "ForceSync", SystemConfig["VSync"] != "false" ? "1" : "0"); } } catch { } }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { _path = AppConfig.GetFullPath("pcsx2"); _resolution = resolution; string exe = Path.Combine(_path, "pcsx2.exe"); if (!File.Exists(exe)) { return(null); } SetupPaths(); SetupVM(); SetupLilyPad(); SetupGSDx(resolution); if (SystemConfig["ratio"] == "4:3") { _bezelFileInfo = BezelFiles.GetBezelFiles(system, rom, resolution); } _resolution = resolution; List <string> commandArray = new List <string>(); commandArray.Add("--portable"); commandArray.Add("--fullscreen"); commandArray.Add("--nogui"); if (SystemConfig.isOptSet("fullboot") && SystemConfig.getOptBoolean("fullboot")) { commandArray.Add("--fullboot"); } string args = string.Join(" ", commandArray); return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = _path, Arguments = args + " \"" + rom + "\"", }); }
public FakeBezelFrm ShowFakeBezel(ScreenResolution resolution) { int resX = (resolution == null ? Screen.PrimaryScreen.Bounds.Width : resolution.Width); int resY = (resolution == null ? Screen.PrimaryScreen.Bounds.Height : resolution.Height); var bezel = new FakeBezelFrm(); bezel.TopMost = true; var file = GetStretchedBezel(PngFile, resX, resY); if (!bezel.SelectBezel(file, resX, resY)) { bezel.Dispose(); return(null); } bezel.Show(); return(bezel); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("applewin"); string exe = Path.Combine(path, "applewin.exe"); if (!File.Exists(exe)) { return(null); } _bezelFileInfo = BezelFiles.GetBezelFiles(system, rom, resolution); _resolution = resolution; return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path, Arguments = "-f -no-printscreen-dlg -d1 \"" + rom + "\"", }); }
private static void SetupOptions(string path, string romPath, ScreenResolution resolution) { //HKEY_CURRENT_USER\Software\Visual Pinball\VP10\Player RegistryKey regKeyc = Registry.CurrentUser.OpenSubKey(@"Software", true); RegistryKey vp10 = regKeyc.CreateSubKey("Visual Pinball").CreateSubKey("VP10"); if (vp10 != null) { regKeyc = vp10.CreateSubKey("Player"); if (regKeyc != null) { SetOption(regKeyc, "DisableESC", 1); SetOption(regKeyc, "Width", resolution == null ? Screen.PrimaryScreen.Bounds.Width : resolution.Width); SetOption(regKeyc, "Height", resolution == null ? Screen.PrimaryScreen.Bounds.Height : resolution.Height); SetOption(regKeyc, "FullScreen", resolution == null ? 0 : 1); regKeyc.Close(); } regKeyc = vp10.CreateSubKey("Editor"); if (regKeyc != null) { SetOption(regKeyc, "WindowTop", Screen.PrimaryScreen.Bounds.Height / 2 - 300); SetOption(regKeyc, "WindowBottom", Screen.PrimaryScreen.Bounds.Height / 2 + 300); SetOption(regKeyc, "WindowLeft", Screen.PrimaryScreen.Bounds.Width / 2 - 400); SetOption(regKeyc, "WindowRight", Screen.PrimaryScreen.Bounds.Width / 2 + 400); SetOption(regKeyc, "WindowMaximized", 0); regKeyc.Close(); } vp10.Close(); } SetupVPinMameOptions(path, romPath); }
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) { _path = AppConfig.GetFullPath("raine"); _resolution = resolution; string exe = Path.Combine(_path, "raine.exe"); if (!File.Exists(exe) || !Environment.Is64BitOperatingSystem) { exe = Path.Combine(_path, "raine32.exe"); } if (!File.Exists(exe)) { return(null); } if (Path.GetExtension(rom).ToLowerInvariant() == ".zip") { rom = Path.GetFileNameWithoutExtension(rom); } SetupSettings(); if (SystemConfig["ratio"] == "ON") { _bezelFileInfo = BezelFiles.GetBezelFiles(system, rom, resolution); } _resolution = resolution; return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = _path, Arguments = "-n -fs 1 \"" + rom + "\"", }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string folderName = (emulator == "demul-old" || core == "demul-old") ? "demul-old" : "demul"; if (folderName == "demul-old") { _oldVersion = true; } string path = AppConfig.GetFullPath(folderName); if (string.IsNullOrEmpty(path)) { path = AppConfig.GetFullPath("demul"); } string exe = Path.Combine(path, "demul.exe"); if (!File.Exists(exe)) { return(null); } SetupGeneralConfig(path, rom, system, core); SetupDx11Config(path, rom, system); string demulCore = "dreamcast"; if (emulator == "demul-hikaru" || core == "hikaru") { demulCore = "hikaru"; } else if (emulator == "demul-gaelco" || core == "gaelco") { demulCore = "gaelco"; } else if (emulator == "demul-atomiswave" || core == "atomiswave") { demulCore = "awave"; } else if (emulator == "demul-naomi" || emulator == "demul-naomi2" || core == "naomi") { demulCore = "naomi"; } else { switch (system) { case "hikaru": demulCore = "hikaru"; break; case "gaelco": demulCore = "gaelco"; break; case "naomi": case "naomi2": demulCore = "naomi"; break; case "atomiswave": demulCore = "awave"; break; } } return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path, Arguments = "-run=" + demulCore + " -rom=\"" + Path.GetFileNameWithoutExtension(rom).ToLower() + "\"", }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("winuae"); string exe = Path.Combine(path, "winuae64.exe"); if (!File.Exists(exe)) { return(null); } var disks = DetectDiscs(rom); if (disks.Count == 0) { return(null); } StringBuilder sb = new StringBuilder(); sb.AppendLine("use_gui=no"); sb.AppendLine("gfx_fullscreen_amiga=fullwindow"); sb.AppendLine("gfx_width_fullscreen=1920"); sb.AppendLine("gfx_height_fullscreen=1080"); sb.AppendLine("gfx_filter_aspect_ratio=16:9"); string disk = rom; if (system == "amigacd32" || core == "cd32") { disk = disks.First(); sb.AppendLine("kickstart_rom_file=" + Path.Combine(AppConfig.GetFullPath("bios"), "kick40060.CD32")); sb.AppendLine("kickstart_ext_rom_file=" + Path.Combine(AppConfig.GetFullPath("bios"), "kick40060.CD32.ext")); sb.AppendLine("flash_file=.\\cd32.nvr"); sb.AppendLine("cdimage0=" + disk); sb.AppendLine("cd_speed=0"); sb.AppendLine("chipset_compatible=CD32"); sb.AppendLine("chipset=aga"); sb.AppendLine("chipset_refreshrate=49.920410"); sb.AppendLine("bogomem_size=2"); sb.AppendLine("chipmem_size=4"); sb.AppendLine("floppy0type=-1"); sb.AppendLine("floppy1type=-1"); sb.AppendLine("cd32cd=true"); sb.AppendLine("cd32c2p=true"); sb.AppendLine("cd32nvram=true"); sb.AppendLine("nr_floppies=0"); sb.AppendLine("cpu_type=68ec020"); sb.AppendLine("cpu_model=68020"); sb.AppendLine("cpu_compatible=true"); sb.AppendLine("cpu_24bit_addressing=true"); } else if (Path.GetExtension(disk).ToLower() == ".lha") { string bios = Path.Combine(AppConfig.GetFullPath("bios"), "Kickstart v3.1 r40.68 (1993)(Commodore)(A1200)[!].rom"); sb.AppendLine("kickstart_rom_file=" + bios); string WHDLoad = Path.Combine(path, "WHDLoad"); sb.AppendLine("cpu_type=68ec020"); sb.AppendLine("cpu_model=68020"); sb.AppendLine(@"filesystem2=ro,DH0:boot:" + WHDLoad + @"\DH0,0"); sb.AppendLine(@"uaehf0=dir,ro,DH0:boot:" + WHDLoad + @"\DH0,0"); sb.AppendLine(@"filesystem2=ro,DH1:" + Path.GetFileName(disk) + ":" + disk + ",0"); sb.AppendLine(@"uaehf1=dir,ro,DH1:" + Path.GetFileName(disk) + ":" + disk + ",0"); sb.AppendLine(@"filesystem2=rw,DH2:boot:" + WHDLoad + @"\DH2,0"); sb.AppendLine(@"uaehf2=dir,rw,DH2:boot:" + WHDLoad + @"\DH2,0"); sb.AppendLine("cpu_compatible=true"); sb.AppendLine("cpu_24bit_addressing=true"); } else { string bios = Path.Combine(AppConfig.GetFullPath("bios"), "Kickstart v1.3 r34.5 (1987)(Commodore)(A500-A1000-A2000-CDTV)[!].rom"); if (!File.Exists(bios)) { bios = Path.Combine(AppConfig.GetFullPath("bios"), "Kickstart v1.3 r34.5 (1987)(Commodore)(A500-A1000-A2000-CDTV)[o].rom"); } if (!File.Exists(bios)) { bios = Path.Combine(AppConfig.GetFullPath("bios"), "KICK13.ROM"); } sb.AppendLine("kickstart_rom_file=" + bios); for (int i = 0; i < disks.Count; i++) { sb.AppendLine("floppy" + i + "=" + disks[i]); sb.AppendLine("floppy" + i + "type=0"); } sb.AppendLine("nr_floppies=" + disks.Count); sb.AppendLine("floppy_speed=0"); } sb.AppendLine("cpu_speed=max"); string fn = Path.Combine(path, "game.uae"); File.WriteAllText(fn, sb.ToString()); return(new ProcessStartInfo() { FileName = exe, Arguments = fn, WorkingDirectory = path, }); }
private void SetupOptions(ScreenResolution resolution) { RegistryKey regKeyc = Registry.CurrentUser.OpenSubKey(@"Software", true); if (regKeyc != null) { regKeyc = regKeyc.CreateSubKey("Future Pinball").CreateSubKey("GamePlayer"); } if (regKeyc != null) { regKeyc.SetValue("FullScreen", 1); //regKeyc.SetValue("FullScreen", 0); if (SystemConfig.isOptSet("arcademode") && SystemConfig["arcademode"] == "1") { regKeyc.SetValue("ArcadeMode", 1); } else { regKeyc.SetValue("ArcadeMode", 0); } if (SystemConfig.isOptSet("ratio")) { if (SystemConfig["ratio"] == "4/3") { regKeyc.SetValue("AspectRatio", 43); } else if (SystemConfig["ratio"] == "16/9") { regKeyc.SetValue("AspectRatio", 169); } } else { regKeyc.SetValue("AspectRatio", 169); } if (resolution != null) { regKeyc.SetValue("Width", resolution.Width); regKeyc.SetValue("Height", resolution.Height); regKeyc.SetValue("BitsPerPixel", resolution.BitsPerPel); } else { regKeyc.SetValue("Height", Screen.PrimaryScreen.Bounds.Height); regKeyc.SetValue("Width", Screen.PrimaryScreen.Bounds.Width); regKeyc.SetValue("BitsPerPixel", Screen.PrimaryScreen.BitsPerPixel); } if (regKeyc.GetValue("DefaultCamera") == null) { regKeyc.SetValue("DefaultCamera", 0); } if (regKeyc.GetValue("CameraFollowsTheBall") == null) { regKeyc.SetValue("CameraFollowsTheBall", 0); } if (SystemConfig.isOptSet("preset") && SystemConfig["preset"] == "medium") { regKeyc.SetValue("RenderGameRoom", 1); regKeyc.SetValue("RenderOrnaments", 1); regKeyc.SetValue("GlassOverlay", 1); regKeyc.SetValue("LightFacets", 0x20); regKeyc.SetValue("GlassReflections", 0); regKeyc.SetValue("PlayfieldReflections", 1); regKeyc.SetValue("RenderBallMirrors", 0); regKeyc.SetValue("SuperNiceCrystal", 0); regKeyc.SetValue("HighQualityPinballs", 1); regKeyc.SetValue("BallDirt", 1); regKeyc.SetValue("DisableShaders", 0); regKeyc.SetValue("ModelRenderQuality", 1); regKeyc.SetValue("RubberFacets", 0x10); regKeyc.SetValue("RubberSides", 0x0c); regKeyc.SetValue("WireGuideSides", 0x0c); regKeyc.SetValue("HighQualityTextures", 1); } else if (SystemConfig.isOptSet("preset") && SystemConfig["preset"] == "min") { regKeyc.SetValue("RenderGameRoom", 0); regKeyc.SetValue("RenderOrnaments", 0); regKeyc.SetValue("GlassOverlay", 0); regKeyc.SetValue("LightFacets", 0x10); regKeyc.SetValue("GlassReflections", 0); regKeyc.SetValue("PlayfieldReflections", 0); regKeyc.SetValue("RenderBallMirrors", 0); regKeyc.SetValue("SuperNiceCrystal", 0); regKeyc.SetValue("HighQualityPinballs", 0); regKeyc.SetValue("BallDirt", 0); regKeyc.SetValue("DisableShaders", 1); regKeyc.SetValue("ModelRenderQuality", 0); regKeyc.SetValue("RubberFacets", 0x08); regKeyc.SetValue("RubberSides", 0x06); regKeyc.SetValue("WireGuideSides", 0x06); regKeyc.SetValue("HighQualityTextures", 0); } else { regKeyc.SetValue("RenderGameRoom", 1); regKeyc.SetValue("RenderOrnaments", 1); regKeyc.SetValue("GlassOverlay", 1); regKeyc.SetValue("LightFacets", 0x40); regKeyc.SetValue("GlassReflections", 1); regKeyc.SetValue("PlayfieldReflections", 1); regKeyc.SetValue("RenderBallMirrors", 1); regKeyc.SetValue("SuperNiceCrystal", 1); regKeyc.SetValue("HighQualityPinballs", 1); regKeyc.SetValue("BallDirt", 1); regKeyc.SetValue("DisableShaders", 0); regKeyc.SetValue("ModelRenderQuality", 2); regKeyc.SetValue("RubberFacets", 0x40); regKeyc.SetValue("RubberSides", 0x14); regKeyc.SetValue("WireGuideSides", 0x14); regKeyc.SetValue("HighQualityTextures", 1); } regKeyc.Close(); } regKeyc = Registry.CurrentUser.OpenSubKey(@"Software", true); if (regKeyc != null) { regKeyc = regKeyc.CreateSubKey("Future Pinball").CreateSubKey("Editor"); } if (regKeyc != null) { regKeyc.SetValue("LoadImagesIntoEditor", 0); regKeyc.Close(); } }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("TeknoParrot"); string exe = Path.Combine(path, "TeknoParrotUi.exe"); if (!File.Exists(exe)) { return(null); } // ExtractUserProfiles("h:\\"); string gameName = Path.GetFileNameWithoutExtension(rom); GameProfile profile = FindGameProfile(path, rom, gameName); if (profile == null) { SimpleLogger.Instance.Error("Unable to find gameprofile for " + rom); return(new ProcessStartInfo() { FileName = "WARNING", Arguments = "Unable to find game profile.\r\nPlease make sure the game folder is named like the xml file in emulators/teknoparrot/GameProfiles folder or like the <GameName> element in the xml" }); } GameProfile userProfile = null; var userProfilePath = Path.Combine(Path.Combine(path, "UserProfiles", Path.GetFileName(profile.FileName))); if (File.Exists(userProfilePath)) { userProfile = JoystickHelper.DeSerializeGameProfile(userProfilePath, true); } else { JoystickHelper.SerializeGameProfile(profile, userProfilePath); userProfile = JoystickHelper.DeSerializeGameProfile(userProfilePath, true); } if (userProfile == null) { SimpleLogger.Instance.Error("Unable create userprofile for " + rom); return(new ProcessStartInfo() { FileName = "WARNING", Arguments = "Unable to create userprofile" }); } if (userProfile.GamePath == null || !File.Exists(userProfile.GamePath)) { userProfile.GamePath = FindExecutable(rom, Path.GetFileNameWithoutExtension(userProfile.FileName)); if (userProfile.GamePath == null) { userProfile.GamePath = FindBestExecutable(rom, userProfile.ExecutableName); } if (userProfile.GamePath == null) { SimpleLogger.Instance.Error("Unable to find Game executable for " + rom); return(new ProcessStartInfo() { FileName = "WARNING", Arguments = "Unable to find game executable" }); } } var windowed = userProfile.ConfigValues.FirstOrDefault(c => c.FieldName == "Windowed"); if (windowed != null) { windowed.FieldValue = "0"; } var hideCursor = userProfile.ConfigValues.FirstOrDefault(c => c.FieldName == "HideCursor"); if (hideCursor != null) { hideCursor.FieldValue = "1"; } var customResolution = userProfile.ConfigValues.FirstOrDefault(c => c.FieldName == "CustomResolution"); var resolutionWidth = userProfile.ConfigValues.FirstOrDefault(c => c.FieldName == "ResolutionWidth"); var resolutionHeight = userProfile.ConfigValues.FirstOrDefault(c => c.FieldName == "ResolutionHeight"); if (customResolution != null && resolutionWidth != null && resolutionHeight != null) { int resX = (resolution == null ? Screen.PrimaryScreen.Bounds.Width : resolution.Width); int resY = (resolution == null ? Screen.PrimaryScreen.Bounds.Height : resolution.Height); customResolution.FieldValue = "1"; resolutionWidth.FieldValue = resX.ToString(); resolutionHeight.FieldValue = resY.ToString(); } ConfigureControllers(userProfile); JoystickHelper.SerializeGameProfile(userProfile, userProfilePath); string profileName = Path.GetFileName(userProfile.FileName); _exename = Path.GetFileNameWithoutExtension(userProfile.GamePath); _gameProfile = userProfile; return(new ProcessStartInfo() { FileName = exe, Verb = userProfile.RequiresAdmin ? "runas" : null, WorkingDirectory = path, Arguments = "--profile=" + profileName // + " --startMinimized", }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { _systemName = system; string path = Path.GetDirectoryName(rom); string arguments = null; if (Directory.Exists(rom)) // If rom is a directory ( .pc .win .windows, .wine ) { path = rom; if (File.Exists(Path.Combine(rom, "autorun.cmd"))) { rom = Path.Combine(rom, "autorun.cmd"); } else if (File.Exists(Path.Combine(rom, "autorun.bat"))) { rom = Path.Combine(rom, "autorun.bat"); } else if (File.Exists(Path.Combine(rom, "autoexec.cmd"))) { rom = Path.Combine(rom, "autoexec.cmd"); } else if (File.Exists(Path.Combine(rom, "autoexec.bat"))) { rom = Path.Combine(rom, "autoexec.bat"); } else { rom = Directory.GetFiles(path, "*.exe").FirstOrDefault(); } if (Path.GetFileName(rom) == "autorun.cmd") { var wineCommand = File.ReadAllText(rom); int idx = wineCommand.IndexOf("CMD="); if (idx >= 0) { wineCommand = wineCommand.Substring(idx + 4).Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); } var args = SplitCommandLine(wineCommand); if (args.Length > 0) { string exe = Path.Combine(path, args[0]); if (File.Exists(exe)) { rom = exe; if (args.Length > 1) { arguments = string.Join(" ", args.Skip(1).ToArray()); } } } } } if (!File.Exists(rom)) { return(null); } if (Path.GetExtension(rom).ToLower() == ".m3u") { rom = File.ReadAllText(rom); if (rom.StartsWith(".\\") || rom.StartsWith("./")) { rom = Path.Combine(path, rom.Substring(2)); } else if (rom.StartsWith("\\") || rom.StartsWith("/")) { rom = Path.Combine(path, rom.Substring(1)); } } UpdateMugenConfig(path); var ret = new ProcessStartInfo() { FileName = rom, WorkingDirectory = path }; if (arguments != null) { ret.Arguments = arguments; } string ext = Path.GetExtension(rom).ToLower(); if (ext == ".bat" || ext == ".cmd") { ret.WindowStyle = ProcessWindowStyle.Hidden; ret.UseShellExecute = true; } else { _exename = Path.GetFileNameWithoutExtension(rom); } return(ret); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { _resolution = resolution; _bezelFileInfo = BezelFiles.GetBezelFiles(system, rom, resolution); string path = AppConfig.GetFullPath("tsugaru"); string exe = Path.Combine(path, "Tsugaru_CUI.exe"); if (!File.Exists(exe)) { return(null); } List <string> commandArray = new List <string>(); string biosPath = null; if (!string.IsNullOrEmpty(AppConfig["bios"])) { if (Directory.Exists(Path.Combine(AppConfig.GetFullPath("bios"), "fmtownsux"))) { biosPath = Path.Combine(AppConfig.GetFullPath("bios"), "fmtownsux"); } else if (Directory.Exists(Path.Combine(AppConfig.GetFullPath("bios"), "fmtowns"))) { biosPath = Path.Combine(AppConfig.GetFullPath("bios"), "fmtowns"); } else if (Directory.Exists(Path.Combine(path, "roms"))) { biosPath = Path.Combine(path, "roms"); } else if (Directory.Exists(Path.Combine(path, "fmtownsux"))) { biosPath = Path.Combine(path, "fmtownsux"); } } if (string.IsNullOrEmpty(biosPath) || !File.Exists(Path.Combine(biosPath, "FMT_SYS.ROM"))) { SimpleLogger.Instance.Info("TsugaruGenerator : Bios path not found"); return(null); } commandArray.Add(biosPath); commandArray.Add("-CMOS"); commandArray.Add(Path.Combine(biosPath, "CMOS.DAT")); commandArray.Add("-WINDOWSHIFT"); if (Directory.Exists(rom)) { var cueFile = Directory.GetFiles(rom, "*.cue").FirstOrDefault(); if (!string.IsNullOrEmpty(cueFile)) { commandArray.Add("-CD"); commandArray.Add(cueFile); } else { SimpleLogger.Instance.Info("TsugaruGenerator : Cue file not found"); return(null); } } else { string ext = Path.GetExtension(rom).ToLowerInvariant(); if (ext == ".cue" || ext == ".iso") { commandArray.Add("-CD"); commandArray.Add(rom); } else { commandArray.Add("-FD0"); commandArray.Add(rom); } } commandArray.Add("-GAMEPORT0"); int joyIndex = -1; int joys = WinMM.joyGetNumDevs(); for (int i = 0; i < joys; i++) { WinMM.JOYCAPS caps = new WinMM.JOYCAPS(); int ret = WinMM.joyGetDevCapsA(i, ref caps, Marshal.SizeOf(caps)); if (ret == 0) { joyIndex = i; break; } } if (joyIndex >= 0) { commandArray.Add("PHYS" + joyIndex.ToString()); } else { commandArray.Add("KEY"); } commandArray.Add("-GAMEPORT1"); commandArray.Add("MOUSE"); commandArray.Add("-AUTOSCALE"); commandArray.Add("-MAXIMIZE"); commandArray.Add("-FREQ"); commandArray.Add("33"); commandArray.Add("-MEMSIZE"); commandArray.Add("8"); // commandArray.Add("-NOCATCHUPREALTIME"); commandArray.Add("-MOUSEINTEGSPD"); commandArray.Add("32"); for (int i = 0; i < commandArray.Count; i++) { commandArray[i] = "\"" + commandArray[i] + "\""; } string args = string.Join(" ", commandArray); return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path, WindowStyle = ProcessWindowStyle.Minimized, Arguments = args, }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { _path = AppConfig.GetFullPath("pcsx2"); string exe = Path.Combine(_path, "pcsx2.exe"); if (!File.Exists(exe)) { return(null); } SetupPaths(); SetupVM(); SetupLilyPad(); SetupGSDx(resolution); /* * romName = Path.GetFileNameWithoutExtension(rom); * * RestoreIni(path, null, "GSdx.ini", true); * RestoreIni(path, null, "PCSX2_vm.ini", true); * * SaveIni(path, romName, "GSdx.ini"); * SaveIni(path, romName, "PCSX2_vm.ini"); */ List <string> commandArray = new List <string>(); commandArray.Add("--portable"); commandArray.Add("--fullscreen"); commandArray.Add("--nogui"); if (SystemConfig.isOptSet("fullboot") && SystemConfig.getOptBoolean("fullboot")) { commandArray.Add("--fullboot"); } string args = string.Join(" ", commandArray); return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = _path, Arguments = args + " \"" + rom + "\"", }); }
public abstract ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution);
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("cemu"); string exe = Path.Combine(path, "cemu.exe"); if (!File.Exists(exe)) { return(null); } if (Path.GetExtension(rom).ToLower() == ".m3u") { string romPath = Path.GetDirectoryName(rom); rom = File.ReadAllText(rom); if (rom.StartsWith(".\\") || rom.StartsWith("./")) { rom = Path.Combine(romPath, rom.Substring(2)); } else if (rom.StartsWith("\\") || rom.StartsWith("/")) { rom = Path.Combine(path, rom.Substring(1)); } } string settingsFile = Path.Combine(path, "settings.xml"); if (File.Exists(settingsFile)) { try { XDocument settings = XDocument.Load(settingsFile); var fps = settings.Descendants().FirstOrDefault(d => d.Name == "FPS"); if (fps != null) { bool showFPS = SystemConfig.isOptSet("showFPS") && SystemConfig.getOptBoolean("showFPS"); if (showFPS.ToString().ToLower() != fps.Value) { fps.SetValue(showFPS); settings.Save(settingsFile); } } } catch { } } CreateControllerConfiguration(path); string romdir = Path.GetDirectoryName(rom); if (Path.GetExtension(rom).ToLower() == ".m3u") { rom = File.ReadAllText(rom); rom = Path.Combine(romdir, rom.Substring(1)); } return(new ProcessStartInfo() { FileName = exe, Arguments = "-f -g \"" + rom + "\"", WorkingDirectory = path, }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("rpcs3"); string exe = Path.Combine(path, "rpcs3.exe"); if (!File.Exists(exe)) { return(null); } if (Path.GetExtension(rom).ToLower() == ".ps3") { string eboot = Path.Combine(rom, "PS3_GAME\\USRDIR\\EBOOT.BIN"); if (!File.Exists(eboot)) { eboot = Path.Combine(rom, "USRDIR\\EBOOT.BIN"); } rom = eboot; } else if (Path.GetExtension(rom).ToLower() == ".m3u") { string romPath = Path.GetDirectoryName(rom); rom = File.ReadAllText(rom); if (rom.StartsWith(".\\") || rom.StartsWith("./")) { rom = Path.Combine(romPath, rom.Substring(2)); } else if (rom.StartsWith("\\") || rom.StartsWith("/")) { rom = Path.Combine(path, rom.Substring(1)); } } List <string> commandArray = new List <string>(); commandArray.Add("\"" + rom + "\""); if (SystemConfig.isOptSet("gui") && !SystemConfig.getOptBoolean("gui")) { commandArray.Add("--no-gui"); } string args = string.Join(" ", commandArray); return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path, Arguments = args, WindowStyle = ProcessWindowStyle.Minimized }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("snes9x"); string exe = Path.Combine(path, "snes9x-x64.exe"); if (!File.Exists(exe) || !Environment.Is64BitOperatingSystem) { exe = Path.Combine(path, "snes9x.exe"); } if (!File.Exists(exe)) { return(null); } return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path, Arguments = "-fullscreen \"" + rom + "\"", }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = Path.GetDirectoryName(rom); var ret = new ProcessStartInfo() { FileName = rom, WorkingDirectory = path }; string ext = Path.GetExtension(rom).ToLower(); if (ext == ".bat" || ext == ".cmd") { ret.WindowStyle = ProcessWindowStyle.Hidden; ret.UseShellExecute = true; } return(ret); }
static void Main(string[] args) { SimpleLogger.Instance.Info("--------------------------------------------------------------"); SimpleLogger.Instance.Info(Environment.CommandLine); try { SetProcessDPIAware(); } catch { } LocalPath = Path.GetDirectoryName(typeof(Program).Assembly.Location); AppConfig = ConfigFile.FromFile(Path.Combine(LocalPath, "emulatorLauncher.cfg")); AppConfig.ImportOverrides(ConfigFile.FromArguments(args)); SystemConfig = ConfigFile.LoadEmulationStationSettings(Path.Combine(Program.AppConfig.GetFullPath("home"), "es_settings.cfg")); SystemConfig.ImportOverrides(ConfigFile.FromArguments(args)); SystemConfig.ImportOverrides(SystemConfig.LoadAll("global")); SystemConfig.ImportOverrides(SystemConfig.LoadAll(SystemConfig["system"])); SystemConfig.ImportOverrides(SystemConfig.LoadAll(SystemConfig["system"] + "[\"" + Path.GetFileName(SystemConfig["rom"]) + "\"]")); SystemConfig.ImportOverrides(ConfigFile.FromArguments(args)); LoadControllerConfiguration(args); ImportShaderOverrides(); if (!SystemConfig.isOptSet("rom")) { SimpleLogger.Instance.Error("rom not set"); return; } if (!File.Exists(SystemConfig.GetFullPath("rom")) && !Directory.Exists(SystemConfig.GetFullPath("rom"))) { SimpleLogger.Instance.Error("rom does not exist"); return; } if (!SystemConfig.isOptSet("system")) { SimpleLogger.Instance.Error("system not set"); return; } if (string.IsNullOrEmpty(SystemConfig["emulator"])) { SystemConfig["emulator"] = SystemDefaults.GetDefaultEmulator(SystemConfig["system"]); } if (string.IsNullOrEmpty(SystemConfig["core"])) { SystemConfig["core"] = SystemDefaults.GetDefaultCore(SystemConfig["system"]); } if (string.IsNullOrEmpty(SystemConfig["emulator"])) { SystemConfig["emulator"] = SystemConfig["system"]; } Generator generator = generators.Where(g => g.Key == SystemConfig["emulator"]).Select(g => g.Value()).FirstOrDefault(); if (generator == null && !string.IsNullOrEmpty(SystemConfig["emulator"]) && SystemConfig["emulator"].StartsWith("lr-")) { generator = new LibRetroGenerator(); } if (generator == null) { generator = generators.Where(g => g.Key == SystemConfig["system"]).Select(g => g.Value()).FirstOrDefault(); } if (generator != null) { using (var screenResolution = ScreenResolution.Parse(SystemConfig["videomode"])) { ProcessStartInfo path = generator.Generate(SystemConfig["system"], SystemConfig["emulator"], SystemConfig["core"], SystemConfig["rom"], null, screenResolution); if (path != null) { if (path.Arguments != null) { SimpleLogger.Instance.Info("-> " + path.FileName + " " + path.Arguments); } else { SimpleLogger.Instance.Info("-> " + path.FileName); } path.UseShellExecute = true; if (screenResolution != null && generator.DependsOnDesktopResolution) { screenResolution.Apply(); } Cursor.Position = new System.Drawing.Point(Screen.PrimaryScreen.Bounds.Right, Screen.PrimaryScreen.Bounds.Bottom / 2); PadToKey mapping = null; if (generator.UsePadToKey) { mapping = PadToKey.Load(Path.Combine(Program.AppConfig.GetFullPath("home"), "es_padtokey.cfg")); } mapping = LoadGamePadToKeyMapping(path, mapping); mapping = generator.SetupCustomPadToKeyMapping(mapping); using (new HighPerformancePowerScheme()) using (new JoystickListener(Controllers.Where(c => c.Config.DeviceName != "Keyboard").ToArray(), mapping)) generator.RunAndWait(path); } else { SimpleLogger.Instance.Error("generator failed"); } } generator.Cleanup(); } else { SimpleLogger.Instance.Error("Can't find generator"); } }
private void SetupGSDx(ScreenResolution resolution) { string iniFile = Path.Combine(_path, "inis", "GSdx.ini"); if (File.Exists(iniFile)) { try { using (var ini = new IniFile(iniFile)) { ini.WriteValue("Settings", "UserHacks", "1"); if (!string.IsNullOrEmpty(SystemConfig["internalresolution"])) { ini.WriteValue("Settings", "upscale_multiplier", SystemConfig["internalresolution"]); } else { ini.WriteValue("Settings", "upscale_multiplier", "0"); } if (string.IsNullOrEmpty(SystemConfig["internalresolution"]) || SystemConfig["internalresolution"] == "0") { if (resolution != null) { ini.WriteValue("Settings", "resx", resolution.Width.ToString()); ini.WriteValue("Settings", "resy", (resolution.Height * 2).ToString()); } else { ini.WriteValue("Settings", "resx", Screen.PrimaryScreen.Bounds.Width.ToString()); ini.WriteValue("Settings", "resy", (Screen.PrimaryScreen.Bounds.Height * 2).ToString()); } } if (SystemConfig.isOptSet("interlace") && !string.IsNullOrEmpty(SystemConfig["interlace"])) { ini.WriteValue("Settings", "interlace", SystemConfig["interlace"]); } else { ini.WriteValue("Settings", "interlace", "7"); } if (SystemConfig.isOptSet("anisotropic_filtering") && !string.IsNullOrEmpty(SystemConfig["anisotropic_filtering"])) { ini.WriteValue("Settings", "MaxAnisotropy", SystemConfig["anisotropic_filtering"]); } else { ini.WriteValue("Settings", "MaxAnisotropy", "0"); } if (SystemConfig.isOptSet("align_sprite") && !string.IsNullOrEmpty(SystemConfig["align_sprite"])) { ini.WriteValue("Settings", "UserHacks_align_sprite_X", SystemConfig["align_sprite"]); } else { ini.WriteValue("Settings", "UserHacks_align_sprite_X", "0"); } if (SystemConfig.isOptSet("skipdraw") && !string.IsNullOrEmpty(SystemConfig["skipdraw"])) { ini.WriteValue("Settings", "UserHacks_SkipDraw", SystemConfig["skipdraw"]); } else { ini.WriteValue("Settings", "UserHacks_SkipDraw", "0"); } if (SystemConfig.isOptSet("DrawFramerate") && SystemConfig.getOptBoolean("DrawFramerate")) { ini.WriteValue("Settings", "osd_monitor_enabled", "1"); ini.WriteValue("Settings", "osd_indicator_enabled", "1"); } else { ini.WriteValue("Settings", "osd_monitor_enabled", "0"); ini.WriteValue("Settings", "osd_indicator_enabled", "0"); } } } catch { } } }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("openbor"); string exe = Path.Combine(path, "OpenBOR.exe"); if (!File.Exists(exe)) { return(null); } string build = GetBuildToUse(rom); if (!string.IsNullOrEmpty(build)) { path = Path.Combine(path, build); exe = Path.Combine(path, "OpenBOR.exe"); } if (setupConfigIni(path)) { UsePadToKey = false; return(new ProcessStartInfo() { FileName = exe, Arguments = "\"" + rom + "\"", WorkingDirectory = path }); } if (build == "4432") { setupConfigBor4432Cfg(path); } else { setupConfigBorCfg(path); } string pakDir = Path.Combine(path, "Paks"); 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); } return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { string path = AppConfig.GetFullPath("simcoupe"); string exe = Path.Combine(path, "simcoupe.exe"); if (!File.Exists(exe)) { return(null); } return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path, Arguments = "\"" + rom + "\" -fullscreen yes -autoboot yes", }); }
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 { } } } 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 = null; if ((core != null && core == "chihiro") || (emulator != null && emulator == "chihiro")) { path = AppConfig.GetFullPath("chihiro"); } if (string.IsNullOrEmpty(path)) { path = AppConfig.GetFullPath("cxbx-r"); } if (string.IsNullOrEmpty(path)) { path = AppConfig.GetFullPath("cxbx-reloaded"); } string exe = Path.Combine(path, "cxbx.exe"); if (!File.Exists(exe)) { return(null); } return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path, Arguments = "\"" + rom + "\"", }); }
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); } args.Add("-fullscreen"); args.Add("-wide-screen"); if (!SystemConfig.isOptSet("ratio") || SystemConfig["ratio"] != "4/3") { args.Add("-stretch"); } if (SystemConfig["VSync"] != "false") { args.Add("-vsync"); } args.Add("\"" + rom + "\""); // -res=1920,1080 -fullscreen -wide-screen -stretch -vsync %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("epsxe"); string exe = Path.Combine(path, "epsxe.exe"); if (!File.Exists(exe)) { return(null); } return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path, Arguments = biosFile(core) + " -nogui -loadbin \"" + rom + "\"", }); }
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 folderName = (emulator == "dolphin-triforce" || core == "dolphin-triforce" || emulator == "triforce" || core == "triforce") ? "dolphin-triforce" : "dolphin"; string path = AppConfig.GetFullPath(folderName); if (string.IsNullOrEmpty(path)) { path = AppConfig.GetFullPath("dolphin"); } if (string.IsNullOrEmpty(path)) { path = AppConfig.GetFullPath("dolphin-emu"); } string exe = Path.Combine(path, "Dolphin.exe"); if (!File.Exists(exe)) { _triforce = true; exe = Path.Combine(path, "DolphinWX.exe"); } if (!File.Exists(exe)) { return(null); } string portableFile = Path.Combine(path, "portable.txt"); if (!File.Exists(portableFile)) { File.WriteAllText(portableFile, ""); } SetupGeneralConfig(path, system); SetupGfxConfig(path); DolphinControllers.WriteControllersConfig(path, system, rom); return(new ProcessStartInfo() { FileName = exe, Arguments = "-b -e \"" + rom + "\"", WorkingDirectory = path, }); }
public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { path = AppConfig.GetFullPath("pcsx2"); string exe = Path.Combine(path, "pcsx2.exe"); if (!File.Exists(exe)) { return(null); } SetupPaths(); romName = Path.GetFileNameWithoutExtension(rom); RestoreIni(path, null, "GSdx.ini", true); RestoreIni(path, null, "PCSX2_vm.ini", true); SaveIni(path, romName, "GSdx.ini"); SaveIni(path, romName, "PCSX2_vm.ini"); return(new ProcessStartInfo() { FileName = exe, WorkingDirectory = path, Arguments = "--portable --fullscreen --nogui \"" + rom + "\"", }); }