Beispiel #1
0
 private void Setup()
 {
     g         = (Legacy.Game)base.Tag;
     pcsx2_ini = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, g.FileSafeTitle) + @"\PCSX2Bonus.ini");
     lbVersions.Items.Add(Path.GetFileNameWithoutExtension(pcsx2_ini.Read("Additional Executables", "Default")));
     original = pcsx2_ini.Read("Additional Executables", "Default");
 }
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     if (!Extensions.IsEmpty(tbCardPath.Text))
     {
         if (lvMemCards.SelectedItems.Count == 0)
         {
             Legacy.Tools.ShowMessage("You must select a card to assign", Legacy.MessageType.Error);
         }
         else
         {
             _pcsx2Ui.Write("Folders", "UseDefaultMemoryCards", "disabled");
             var iNIPath      = Legacy.UserSettings.ConfigDir + @"\" + g.FileSafeTitle + @"\PCSX2_ui.ini";
             var selectedItem = (Legacy.MemoryCard)lvMemCards.SelectedItem;
             var file         = new Legacy.IniFile(iNIPath);
             file.Write("MemoryCards", "Slot1_Enable", "enabled");
             file.Write("MemoryCards", "Slot1_Filename", selectedItem.Name);
             file.Write("Folders", "MemoryCards", Extensions.Escape(tbCardPath.Text));
             Legacy.Tools.ShowMessage("Successfully assigned and enabled " + selectedItem.Name + " to slot 1\n for the game " + g.Title, Legacy.MessageType.Info);
             Close();
         }
     }
     else
     {
         Legacy.Tools.ShowMessage("The selected memory card cannot be null", Legacy.MessageType.Error);
     }
 }
 private void Setup()
 {
     g        = (Legacy.Game)Tag;
     Title    = "Memory Card Management [" + g.Title + "]";
     _pcsx2Ui = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, Path.Combine(g.FileSafeTitle, "PCSX2_ui.ini")));
     LoadInitialCard();
 }
Beispiel #4
0
 private void Setup()
 {
     g          = (Legacy.Game)base.Tag;
     pcsx2_ini  = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, g.FileSafeTitle) + @"\PCSX2Bonus.ini");
     pcsx2_vm   = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, Path.Combine(g.FileSafeTitle, "PCSX2_vm.ini")));
     pcsx2_ui   = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, Path.Combine(g.FileSafeTitle, "PCSX2_ui.ini")));
     base.Title = "Viewing configuration for " + g.Title;
     UpdateSettings();
     LoadBios();
 }
		private void Setup() {
			g = (Legacy.Game)Tag;
			lbShaders.DisplayMemberPath = "Text";
			pcsx2_ini = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, g.FileSafeTitle) + @"\PCSX2Bonus.ini");
			foreach (var newItem in Directory.GetFiles(Legacy.UserSettings.ShadersDir).Select(str => new ListViewItem {
				Content = Extensions.FileNameNoExt(str),
				Tag = str
			})){
				lbShaders.Items.Add(newItem);
			}
		}
Beispiel #6
0
 private void Setup()
 {
     g = (Legacy.Game)Tag;
     lbShaders.DisplayMemberPath = "Text";
     pcsx2_ini = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, g.FileSafeTitle) + @"\PCSX2Bonus.ini");
     foreach (var newItem in Directory.GetFiles(Legacy.UserSettings.ShadersDir).Select(str => new ListViewItem {
         Content = Extensions.FileNameNoExt(str),
         Tag = str
     }))
     {
         lbShaders.Items.Add(newItem);
     }
 }
		private void btnOk_Click(object sender, RoutedEventArgs e) {
			if (!Extensions.IsEmpty(tbCardPath.Text)) {
				if (lvMemCards.SelectedItems.Count == 0) {
					Legacy.Tools.ShowMessage("You must select a card to assign", Legacy.MessageType.Error);
				}
				else {
					_pcsx2Ui.Write("Folders", "UseDefaultMemoryCards", "disabled");
					var iNIPath = Legacy.UserSettings.ConfigDir + @"\" + g.FileSafeTitle + @"\PCSX2_ui.ini";
					var selectedItem = (Legacy.MemoryCard)lvMemCards.SelectedItem;
					var file = new Legacy.IniFile(iNIPath);
					file.Write("MemoryCards", "Slot1_Enable", "enabled");
					file.Write("MemoryCards", "Slot1_Filename", selectedItem.Name);
					file.Write("Folders", "MemoryCards", Extensions.Escape(tbCardPath.Text));
					Legacy.Tools.ShowMessage("Successfully assigned and enabled " + selectedItem.Name + " to slot 1\n for the game " + g.Title, Legacy.MessageType.Info);
					Close();
				}
			}
			else {
				Legacy.Tools.ShowMessage("The selected memory card cannot be null", Legacy.MessageType.Error);
			}
		}
		private void Setup() {
			g = (Legacy.Game)Tag;
			Title = "Memory Card Management [" + g.Title + "]";
			_pcsx2Ui = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, Path.Combine(g.FileSafeTitle, "PCSX2_ui.ini")));
			LoadInitialCard();
		}
		private void btnOk_Click(object sender, RoutedEventArgs e) {
			if (Extensions.IsEmpty(tbOutputPath.Text))
				Legacy.Tools.ShowMessage("Output path cannot be empty!", Legacy.MessageType.Error);
			else {
				var path = string.Empty;
				try {
					var stopwatch = new Stopwatch();
					stopwatch.Start();
					var location = g.Location;
					var newValue = cbNoHacks.IsChecked.Value ? "--nohacks" : string.Empty;
					var str4 = cbNoGui.IsChecked.Value ? "--nogui" : string.Empty;
					var str5 = cbNoDisc.IsChecked.Value ? "--nodisc" : string.Empty;
					var str6 = cbFullBoot.IsChecked.Value ? "--fullboot" : string.Empty;
					var str7 = cbUseDefault.IsChecked.Value
						? ("--cfgpath=\"\"" + Legacy.UserSettings.ConfigDir + @"\" + g.FileSafeTitle + "\"\"")
						: string.Empty;
					var outputName = tbOutputPath.Text + @"\" + g.FileSafeTitle + ".exe";
					var providerOptions = new Dictionary<string, string>();
					providerOptions.Add("CompilerVersion", "v4.0");
					var provider = new CSharpCodeProvider(providerOptions);
					var options = new CompilerParameters(new string[] { "mscorlib.dll", "System.Core.dll" }, outputName, true) {
						GenerateExecutable = true
					};
					if (cbUseDefaultIcon.IsChecked != null && cbUseDefaultIcon.IsChecked.Value) {
						path = Legacy.UserSettings.ImageDir + @"\" + g.FileSafeTitle + ".ico";
						CreateIcon(path, true);
						options.CompilerOptions = string.Format("/target:winexe /optimize /win32icon:{1}{0}{1}", path, "\"");
					}
					else if (!cbUseDefault.IsChecked.Value) {
						path = tbIconPath.Text;
						options.CompilerOptions = string.Format("/target:winexe /optimize /win32icon:{1}{0}{1}", path, "\"");
					}
					if (string.IsNullOrWhiteSpace(path)) {
						options.CompilerOptions = string.Format("/target:winexe /optimize", new object[0]);
					}
					options.ReferencedAssemblies.Add("System.dll");
					options.IncludeDebugInformation = false;
					var str9 = Settings.Default.pcsx2Exe;
					var file = new Legacy.IniFile(Legacy.UserSettings.ConfigDir + @"\" + g.Title + @"\Settings.ini");
					if (!string.IsNullOrWhiteSpace(file.Read("Additional Executables", "Default"))) {
						str9 = file.Read("Additional Executables", "Default");
					}
					var process = new Process {
						StartInfo = { WorkingDirectory = "" }
					};
					var directoryName = Path.GetDirectoryName(str9);
					var str11 =
						Properties.Resources.executableTemplate.Replace("{1}", str9)
							.Replace("{2}", newValue)
							.Replace("{3}", str4)
							.Replace("{4}", str5)
							.Replace("{5}", str6)
							.Replace("{6}", location)
							.Replace("{7}", "\"\"")
							.Replace("{8}", str7)
							.Replace("{9}", directoryName);
					provider.CompileAssemblyFromSource(options, new string[] { str11 })
						.Errors.Cast<CompilerError>()
						.ToList<CompilerError>()
						.ForEach(error => Console.WriteLine(error.ErrorText));
					stopwatch.Stop();
					System.Windows.MessageBox.Show(
						string.Concat(new object[] { "Successfully compiled the executable at ", outputName, "\n[", stopwatch.ElapsedMilliseconds, "ms]" }),
						"PCSX2Bonus", MessageBoxButton.OK, MessageBoxImage.Asterisk);
				}
				catch (Exception exception) {
					Legacy.Tools.ShowMessage("There was an error building the executable.\nReason: " + exception.Message,
						Legacy.MessageType.Error);
				}
				if (File.Exists(path) && Path.GetDirectoryName(path).Contains("PCSX2Bonus"))
					File.Delete(path);
			}
		}
 public void LaunchGame(Legacy.Game g, bool tvMode = false)
 {
     if (File.Exists(g.Location) == false)
     {
         Legacy.Tools.ShowMessage("Unable to find image file!", Legacy.MessageType.Error);
         if (tvMode == false)
         {
             return;
         }
         var window = System.Windows.Application.Current.Windows.Cast <Window>().FirstOrDefault(w => w.Title == "wndFullScreen");
         if (window != null)
         {
             window.ShowDialog();
         }
     }
     else
     {
         var pcsxProcess = new Process();
         var path        = Legacy.UserSettings.RootDir + string.Format(@"\Configs\{0}", g.FileSafeTitle);
         var str         = Directory.Exists(path) ? string.Format(" --cfgpath={0}{2}{0} {0}{1}{0}", "\"", g.Location, path) : string.Format(" {0}{1}{0}", "\"", g.Location);
         str = str.Replace(@"\\", @"\");
         var src  = string.Empty;
         var str4 = Settings.Default.pcsx2Dir;
         if (File.Exists(path + @"\PCSX2Bonus.ini"))
         {
             var file = new Legacy.IniFile(path + @"\PCSX2Bonus.ini");
             var str5 = file.Read("Additional Executables", "Default");
             var str6 = Extensions.IsEmpty(str5) ? Settings.Default.pcsx2Exe : str5;
             str4 = Extensions.IsEmpty(str5) ? Settings.Default.pcsx2Dir : Path.GetDirectoryName(str5);
             var str7  = file.Read("Boot", "NoGUI");
             var str8  = file.Read("Boot", "UseCD");
             var str9  = file.Read("Boot", "NoHacks");
             var str10 = file.Read("Boot", "FullBoot");
             src = file.Read("Shader", "Default");
             pcsxProcess.StartInfo.FileName = str6;
             if (str7 == "true")
             {
                 str = str.Insert(0, " --nogui");
             }
             if (str8 == "true")
             {
                 str = str.Insert(0, " --usecd");
             }
             if (str9 == "true")
             {
                 str = str.Insert(0, " --nohacks");
             }
             if (str10 == "true")
             {
                 str = str.Insert(0, " --fullboot");
             }
         }
         else
         {
             pcsxProcess.StartInfo.FileName = Settings.Default.pcsx2Exe;
         }
         pcsxProcess.EnableRaisingEvents = true;
         if (str4 != null)
         {
             pcsxProcess.StartInfo.WorkingDirectory = str4;
             pcsxProcess.StartInfo.Arguments        = str;
             if (Extensions.IsEmpty(src) == false)
             {
                 try {
                     File.Copy(src, Path.Combine(str4, "shader.fx"), true);
                 }
                 catch (Exception exception) {
                     Legacy.Tools.ShowMessage("Could not save shader file! Details: " + exception.Message, Legacy.MessageType.Error);
                 }
             }
         }
         var timeOpened = DateTime.Now;
         pcsxProcess.Exited += delegate {
             pcsxProcess.Dispose();
             System.Windows.Application.Current.Dispatcher.Invoke(delegate {
                 var now      = DateTime.Now;
                 g.TimePlayed = g.TimePlayed.Add(now.Subtract(timeOpened));
                 var element  = Legacy.UserSettings.xGames.Descendants("Game").FirstOrDefault(x => {
                     var xElement1 = x.Element("Name");
                     return(xElement1 != null && xElement1.Value == g.Title);
                 });
                 if ((element != null) && (element.Element("Time") != null))
                 {
                     var xElement = element.Element("Time");
                     if (xElement != null)
                     {
                         xElement.Value = g.TimePlayed.ToString();
                     }
                 }
                 if (tvMode)
                 {
                     var window = System.Windows.Application.Current.Windows.Cast <Window>().FirstOrDefault(w => w.Title == "wndFullScreen");
                     if (window != null)
                     {
                         window.ShowDialog();
                     }
                 }
                 _notifyIcon.Visible = false;
                 Show();
                 Activate();
             });
         };
         Hide();
         if (Settings.Default.enableGameToast)
         {
             new wndGameNotify {
                 Tag = g
             }
         }
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     if (Extensions.IsEmpty(tbOutputPath.Text))
     {
         Legacy.Tools.ShowMessage("Output path cannot be empty!", Legacy.MessageType.Error);
     }
     else
     {
         var path = string.Empty;
         try {
             var stopwatch = new Stopwatch();
             stopwatch.Start();
             var location = g.Location;
             var newValue = cbNoHacks.IsChecked == true ? "--nohacks" : string.Empty;
             var str4     = cbNoGui.IsChecked == true ? "--nogui" : string.Empty;
             var str5     = cbNoDisc.IsChecked == true ? "--nodisc" : string.Empty;
             var str6     = cbFullBoot.IsChecked == true ? "--fullboot" : string.Empty;
             var str7     = cbUseDefault.IsChecked == true
                                         ? "--cfgpath=\"\"" + Legacy.UserSettings.ConfigDir + @"\" + g.FileSafeTitle + "\"\""
                                         : string.Empty;
             var outputName      = tbOutputPath.Text + @"\" + g.FileSafeTitle + ".exe";
             var providerOptions = new Dictionary <string, string> {
                 { "CompilerVersion", "v4.0" }
             };
             var provider = new CSharpCodeProvider(providerOptions);
             var options  = new CompilerParameters(new[] { "mscorlib.dll", "System.Core.dll" }, outputName, true)
             {
                 GenerateExecutable = true
             };
             if (cbUseDefaultIcon.IsChecked != null && cbUseDefaultIcon.IsChecked.Value)
             {
                 path = Legacy.UserSettings.ImageDir + @"\" + g.FileSafeTitle + ".ico";
                 CreateIcon(path);
                 options.CompilerOptions = string.Format("/target:winexe /optimize /win32icon:{1}{0}{1}", path, "\"");
             }
             else if (!cbUseDefault.IsChecked == true)
             {
                 path = tbIconPath.Text;
                 options.CompilerOptions = string.Format("/target:winexe /optimize /win32icon:{1}{0}{1}", path, "\"");
             }
             if (string.IsNullOrWhiteSpace(path))
             {
                 options.CompilerOptions = "/target:winexe /optimize";
             }
             options.ReferencedAssemblies.Add("System.dll");
             options.IncludeDebugInformation = false;
             var str9 = Settings.Default.pcsx2Exe;
             var file = new Legacy.IniFile(Legacy.UserSettings.ConfigDir + @"\" + g.Title + @"\Settings.ini");
             if (!string.IsNullOrWhiteSpace(file.Read("Additional Executables", "Default")))
             {
                 str9 = file.Read("Additional Executables", "Default");
             }
             var directoryName = Path.GetDirectoryName(str9);
             var str11         =
                 Properties.Resources.executableTemplate.Replace("{1}", str9)
                 .Replace("{2}", newValue)
                 .Replace("{3}", str4)
                 .Replace("{4}", str5)
                 .Replace("{5}", str6)
                 .Replace("{6}", location)
                 .Replace("{7}", "\"\"")
                 .Replace("{8}", str7)
                 .Replace("{9}", directoryName);
             provider.CompileAssemblyFromSource(options, str11)
             .Errors.Cast <CompilerError>()
             .ToList()
             .ForEach(error => Console.WriteLine(error.ErrorText));
             stopwatch.Stop();
             System.Windows.MessageBox.Show(
                 string.Concat("Successfully compiled the executable at ", outputName, "\n[", stopwatch.ElapsedMilliseconds, "ms]"),
                 "PCSX2Bonus", MessageBoxButton.OK, MessageBoxImage.Asterisk);
         }
         catch (Exception exception) {
             Legacy.Tools.ShowMessage("There was an error building the executable.\nReason: " + exception.Message,
                                      Legacy.MessageType.Error);
         }
         var name = Path.GetDirectoryName(path);
         if (name != null && File.Exists(path) && name.Contains("PCSX2Bonus"))
         {
             File.Delete(path);
         }
     }
 }
		private void Setup() {
			g = (Legacy.Game)base.Tag;
			pcsx2_ini = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, g.FileSafeTitle) + @"\PCSX2Bonus.ini");
			pcsx2_vm = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, Path.Combine(g.FileSafeTitle, "PCSX2_vm.ini")));
			pcsx2_ui = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, Path.Combine(g.FileSafeTitle, "PCSX2_ui.ini")));
			base.Title = "Viewing configuration for " + g.Title;
			UpdateSettings();
			LoadBios();
		}
		public void LaunchGame(Legacy.Game g, bool tvMode = false) {
			if (File.Exists(g.Location) == false) {
				Legacy.Tools.ShowMessage("Unable to find image file!", Legacy.MessageType.Error);
				if (tvMode == false) return;
				var window = System.Windows.Application.Current.Windows.Cast<Window>().FirstOrDefault(w => w.Title == "wndFullScreen");
				if (window != null)
					window.ShowDialog();
			}
			else {
				var pcsxProcess = new Process();
				var path = Legacy.UserSettings.RootDir + string.Format(@"\Configs\{0}", g.FileSafeTitle);
				var str = Directory.Exists(path) ? string.Format(" --cfgpath={0}{2}{0} {0}{1}{0}", "\"", g.Location, path) : string.Format(" {0}{1}{0}", "\"", g.Location);
				str = str.Replace(@"\\", @"\");
				var src = string.Empty;
				var str4 = Settings.Default.pcsx2Dir;
				if (File.Exists(path + @"\PCSX2Bonus.ini")){
					var file = new Legacy.IniFile(path + @"\PCSX2Bonus.ini");
					var str5 = file.Read("Additional Executables", "Default");
					var str6 = Extensions.IsEmpty(str5) ? Settings.Default.pcsx2Exe : str5;
					str4 = Extensions.IsEmpty(str5) ? Settings.Default.pcsx2Dir : Path.GetDirectoryName(str5);
					var str7 = file.Read("Boot", "NoGUI");
					var str8 = file.Read("Boot", "UseCD");
					var str9 = file.Read("Boot", "NoHacks");
					var str10 = file.Read("Boot", "FullBoot");
					src = file.Read("Shader", "Default");
					pcsxProcess.StartInfo.FileName = str6;
					if (str7 == "true") str = str.Insert(0, " --nogui");
					if (str8 == "true") str = str.Insert(0, " --usecd");
					if (str9 == "true") str = str.Insert(0, " --nohacks");
					if (str10 == "true") str = str.Insert(0, " --fullboot");
				}
				else
					pcsxProcess.StartInfo.FileName = Settings.Default.pcsx2Exe;
				pcsxProcess.EnableRaisingEvents = true;
				if (str4 != null) {
					pcsxProcess.StartInfo.WorkingDirectory = str4;
					pcsxProcess.StartInfo.Arguments = str;
					if (Extensions.IsEmpty(src) == false) {
						try {
							File.Copy(src, Path.Combine(str4, "shader.fx"), true);
						}
						catch (Exception exception) {
							Legacy.Tools.ShowMessage("Could not save shader file! Details: " + exception.Message, Legacy.MessageType.Error);
						}
					}
				}
				var timeOpened = DateTime.Now;
				pcsxProcess.Exited += delegate{
					pcsxProcess.Dispose();
					System.Windows.Application.Current.Dispatcher.Invoke(delegate {
						var now = DateTime.Now;
						g.TimePlayed = g.TimePlayed.Add(now.Subtract(timeOpened));
						var element = Legacy.UserSettings.xGames.Descendants("Game").FirstOrDefault(x => {
							var xElement1 = x.Element("Name");
							return xElement1 != null && xElement1.Value == g.Title;
						});
						if ((element != null) && (element.Element("Time") != null)) {
							var xElement = element.Element("Time");
							if (xElement != null) xElement.Value = g.TimePlayed.ToString();
						}
						if (tvMode) {
							var window = System.Windows.Application.Current.Windows.Cast<Window>().FirstOrDefault(w => w.Title == "wndFullScreen");
							if (window != null)
								window.ShowDialog();
						}
						_notifyIcon.Visible = false;
						Show();
						Activate();
					});
				};
				Hide();
				if (Settings.Default.enableGameToast)
					new wndGameNotify{Tag = g}.Show();
				_notifyIcon.Text = string.Format("Currently playing [{0}]", Extensions.Truncate(g.Title, 40));
				_notifyIcon.Visible = true;
				pcsxProcess.Start();
			}
		}
		private void Setup() {
			g = (Legacy.Game)base.Tag;
			pcsx2_ini = new Legacy.IniFile(Path.Combine(Legacy.UserSettings.ConfigDir, g.FileSafeTitle) + @"\PCSX2Bonus.ini");
			lbVersions.Items.Add(Path.GetFileNameWithoutExtension(pcsx2_ini.Read("Additional Executables", "Default")));
			original = pcsx2_ini.Read("Additional Executables", "Default");
		}