2018-05-09 20:17:38 +00:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2009-2011 Ferreri Alessio
|
|
|
|
|
* Copyright (C) 2009-2018 PCSX2 Dev Team
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
* THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
2019-04-15 15:24:25 +00:00
|
|
|
|
using System.Collections;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Diagnostics;
|
2019-04-15 15:24:25 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
|
using GSDumpGUI.Forms.Entities;
|
|
|
|
|
using GSDumpGUI.Forms.Helper;
|
|
|
|
|
using GSDumpGUI.Forms.SettingsProvider;
|
|
|
|
|
using GSDumpGUI.Properties;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
using TCPLibrary.MessageBased.Core;
|
|
|
|
|
|
|
|
|
|
namespace GSDumpGUI
|
|
|
|
|
{
|
|
|
|
|
public partial class GSDumpGUI : Form
|
|
|
|
|
{
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private readonly ILogger _internalLogger;
|
|
|
|
|
private readonly ILogger _gsdxLogger;
|
|
|
|
|
private readonly IGsdxDllFinder _gsdxDllFinder;
|
|
|
|
|
private readonly IGsDumpFinder _gsDumpFinder;
|
|
|
|
|
private readonly IFolderWithFallBackFinder _folderWithFallBackFinder;
|
|
|
|
|
|
2011-03-25 05:06:49 +00:00
|
|
|
|
public List<Process> Processes;
|
|
|
|
|
|
|
|
|
|
private Int32 _selected;
|
|
|
|
|
public Int32 SelectedRad
|
|
|
|
|
{
|
|
|
|
|
get { return _selected; }
|
|
|
|
|
set
|
|
|
|
|
{
|
2018-01-16 17:41:29 +00:00
|
|
|
|
if (value > 6)
|
2011-03-25 05:06:49 +00:00
|
|
|
|
value = 0;
|
|
|
|
|
_selected = value;
|
|
|
|
|
switch (_selected)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
rdaNone.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
rdaDX9HW.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2018-01-16 17:41:29 +00:00
|
|
|
|
rdaDX1011HW.Checked = true;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2018-01-16 17:41:29 +00:00
|
|
|
|
rdaOGLHW.Checked = true;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case 4:
|
2018-01-16 17:41:29 +00:00
|
|
|
|
rdaDX9SW.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
rdaDX1011SW.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
rdaOGLSW.Checked = true;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private readonly Bitmap NoImage;
|
|
|
|
|
|
|
|
|
|
private Settings Settings => Settings.Default;
|
|
|
|
|
|
|
|
|
|
private readonly GsDumps _availableGsDumps;
|
|
|
|
|
private readonly GsDlls _availableGsDlls;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
|
|
|
|
public GSDumpGUI()
|
|
|
|
|
{
|
2019-04-15 15:24:25 +00:00
|
|
|
|
PortableXmlSettingsProvider.ApplyProvider(Settings);
|
|
|
|
|
|
2011-03-25 05:06:49 +00:00
|
|
|
|
InitializeComponent();
|
2019-04-15 15:24:25 +00:00
|
|
|
|
_internalLogger = new RichTextBoxLogger(txtIntLog);
|
|
|
|
|
_gsdxLogger = new RichTextBoxLogger(txtLog);
|
|
|
|
|
_gsdxDllFinder = new GsdxDllFinder(_internalLogger);
|
|
|
|
|
_gsDumpFinder = new GsDumpFinder(_internalLogger);
|
|
|
|
|
_folderWithFallBackFinder = new FolderWithFallBackFinder();
|
|
|
|
|
_availableGsDumps = new GsDumps();
|
|
|
|
|
_availableGsDlls = new GsDlls();
|
|
|
|
|
|
|
|
|
|
_availableGsDumps.OnIndexUpdatedEvent += UpdatePreviewImage;
|
|
|
|
|
|
|
|
|
|
txtGSDXDirectory.DataBindings.Add(nameof(TextBox.Text), Settings, nameof(Settings.GSDXDir));
|
|
|
|
|
txtDumpsDirectory.DataBindings.Add(nameof(TextBox.Text), Settings, nameof(Settings.DumpDir));
|
|
|
|
|
|
|
|
|
|
BindListControl(lstDumps, _availableGsDumps, g => g.Files, f => f.DisplayText, g => g.SelectedFileIndex);
|
|
|
|
|
BindListControl(lstGSDX, _availableGsDlls, g => g.Files, f => f.DisplayText, g => g.SelectedFileIndex);
|
|
|
|
|
|
2011-03-25 05:06:49 +00:00
|
|
|
|
Processes = new List<Process>();
|
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
NoImage = CreateDefaultImage();
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private static void BindListControl<TModel, TElement>(ListControl lb, TModel model, Func<TModel, BindingList<TElement>> collectionAccessor, Expression<Func<TElement, string>> displayTextAccessor, Expression<Func<TModel, int>> selectedIndexAccessor)
|
2011-03-25 05:06:49 +00:00
|
|
|
|
{
|
2019-04-15 15:24:25 +00:00
|
|
|
|
lb.DataSource = new BindingSource
|
|
|
|
|
{
|
|
|
|
|
DataSource = collectionAccessor(model)
|
|
|
|
|
};
|
|
|
|
|
lb.DisplayMember = ((MemberExpression)displayTextAccessor.Body).Member.Name;
|
|
|
|
|
lb.DataBindings.Add(nameof(lb.SelectedIndex), model, ((MemberExpression)selectedIndexAccessor.Body).Member.Name, false, DataSourceUpdateMode.OnPropertyChanged);
|
|
|
|
|
}
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private static Bitmap CreateDefaultImage()
|
|
|
|
|
{
|
|
|
|
|
var defaultImage = new Bitmap(320, 240, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
|
|
|
|
using (var g = Graphics.FromImage(defaultImage))
|
|
|
|
|
{
|
|
|
|
|
g.FillRectangle(new SolidBrush(Color.Black), new Rectangle(0, 0, 320, 240));
|
|
|
|
|
g.DrawString("No Image", new Font(FontFamily.GenericSansSerif, 48, FontStyle.Regular), new SolidBrush(Color.White), new PointF(0, 70));
|
|
|
|
|
}
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
return defaultImage;
|
|
|
|
|
}
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private void ReloadGsdxDlls()
|
|
|
|
|
{
|
|
|
|
|
_internalLogger.Information("Starting GSdx Loading Procedures");
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
var gsdxFolder = _folderWithFallBackFinder.GetViaPatternWithFallback(Settings.GSDXDir, "*.dll", "", "plugins", "dll", "dlls");
|
|
|
|
|
_availableGsDlls.Files.Clear();
|
|
|
|
|
foreach (var file in _gsdxDllFinder.GetEnrichedPathToValidGsdxDlls(gsdxFolder))
|
|
|
|
|
_availableGsDlls.Files.Add(file);
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
Settings.GSDXDir = gsdxFolder.FullName;
|
|
|
|
|
_internalLogger.Information("Completed GSdx Loading Procedures");
|
|
|
|
|
}
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private void ReloadGsdxDumps()
|
|
|
|
|
{
|
|
|
|
|
_internalLogger.Information("Starting GSdx Dump Loading Procedures...");
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
var dumpFolder = _folderWithFallBackFinder.GetViaPatternWithFallback(Settings.DumpDir, "*.gs", "", "dumps", "gsdumps");
|
|
|
|
|
|
|
|
|
|
_availableGsDumps.Files.Clear();
|
|
|
|
|
foreach (var file in _gsDumpFinder.GetValidGsdxDumps(dumpFolder))
|
|
|
|
|
_availableGsDumps.Files.Add(file);
|
|
|
|
|
|
|
|
|
|
Settings.DumpDir = dumpFolder.FullName;
|
|
|
|
|
_internalLogger.Information("...Completed GSdx Dump Loading Procedures");
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GSDumpGUI_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
2019-04-15 15:24:25 +00:00
|
|
|
|
ReloadGsdxDlls();
|
|
|
|
|
ReloadGsdxDumps();
|
2019-02-09 01:06:38 +00:00
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
// Auto select GS dump and GSdx dll
|
|
|
|
|
_availableGsDumps.Selected = _availableGsDumps.Files.FirstOrDefault();
|
|
|
|
|
_availableGsDlls.Selected = _availableGsDlls.Files.FirstOrDefault();
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cmdBrowseGSDX_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
2018-01-16 17:36:17 +00:00
|
|
|
|
fbd.Description = "Select the GSdx DLL Directory";
|
2011-03-25 05:06:49 +00:00
|
|
|
|
fbd.SelectedPath = AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
|
if (fbd.ShowDialog() == DialogResult.OK)
|
2019-04-15 15:24:25 +00:00
|
|
|
|
Settings.GSDXDir = fbd.SelectedPath;
|
|
|
|
|
Settings.Save();
|
|
|
|
|
ReloadGsdxDlls();
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cmdBrowseDumps_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
2018-01-16 17:36:17 +00:00
|
|
|
|
fbd.Description = "Select the GSdx Dumps Directory";
|
2011-03-25 05:06:49 +00:00
|
|
|
|
fbd.SelectedPath = AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
|
if (fbd.ShowDialog() == DialogResult.OK)
|
2019-04-15 15:24:25 +00:00
|
|
|
|
Settings.DumpDir = fbd.SelectedPath;
|
|
|
|
|
Settings.Save();
|
|
|
|
|
ReloadGsdxDumps();
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-16 17:41:29 +00:00
|
|
|
|
private void cmdRun_Click(object sender, EventArgs e)
|
2011-03-25 05:06:49 +00:00
|
|
|
|
{
|
|
|
|
|
// Execute the GSReplay function
|
2019-04-15 15:24:25 +00:00
|
|
|
|
if (!_availableGsDumps.IsSelected)
|
2011-03-25 05:06:49 +00:00
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Select your Dump first", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
2019-04-15 15:24:25 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!_availableGsDlls.IsSelected)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Select your GSdx first", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ExecuteFunction("GSReplay");
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ExecuteFunction(String Function)
|
|
|
|
|
{
|
|
|
|
|
txtLog.Text = "";
|
|
|
|
|
|
2019-02-08 02:58:46 +00:00
|
|
|
|
CreateDirs();
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
|
|
|
|
// Set the Arguments to pass to the child
|
|
|
|
|
String SelectedRenderer = "";
|
|
|
|
|
switch (SelectedRad)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
SelectedRenderer = "-1";
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
SelectedRenderer = "0";
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
SelectedRenderer = "3";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2018-01-16 17:41:29 +00:00
|
|
|
|
SelectedRenderer = "12";
|
2011-03-25 05:06:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case 4:
|
2018-01-16 17:41:29 +00:00
|
|
|
|
SelectedRenderer = "1";
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
2011-03-25 05:06:49 +00:00
|
|
|
|
SelectedRenderer = "4";
|
|
|
|
|
break;
|
2018-01-16 17:41:29 +00:00
|
|
|
|
case 6:
|
|
|
|
|
SelectedRenderer = "13";
|
|
|
|
|
break;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
2019-04-15 15:24:25 +00:00
|
|
|
|
|
2011-03-25 05:06:49 +00:00
|
|
|
|
if (SelectedRenderer != "-1")
|
|
|
|
|
{
|
2019-02-08 02:58:46 +00:00
|
|
|
|
String GSdxIniPath = AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\inis\\gsdx.ini";
|
2018-01-16 17:33:41 +00:00
|
|
|
|
NativeMethods.WritePrivateProfileString("Settings", "Renderer", SelectedRenderer, GSdxIniPath);
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
2019-04-14 10:04:58 +00:00
|
|
|
|
var port = Program.Server.Port;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
var dllPath = _availableGsDlls.Selected.File.FullName;
|
|
|
|
|
var dumpPath = _availableGsDumps.Selected.File.FullName;
|
|
|
|
|
|
|
|
|
|
_gsdxLogger.Information("Start new gsdx instance");
|
|
|
|
|
_gsdxLogger.Information($"\tdll: {dllPath}");
|
|
|
|
|
_gsdxLogger.Information($"\tdump: {dumpPath}");
|
|
|
|
|
|
2011-03-25 05:06:49 +00:00
|
|
|
|
// Start the child and link the events.
|
|
|
|
|
ProcessStartInfo psi = new ProcessStartInfo();
|
|
|
|
|
psi.UseShellExecute = false;
|
|
|
|
|
psi.RedirectStandardOutput = true;
|
|
|
|
|
psi.RedirectStandardError = false;
|
|
|
|
|
psi.CreateNoWindow = true;
|
2016-09-28 22:21:26 +00:00
|
|
|
|
psi.FileName = Process.GetCurrentProcess().ProcessName;
|
2019-04-15 15:24:25 +00:00
|
|
|
|
psi.Arguments = "\"" + dllPath + "\"" + " \"" + dumpPath + "\"" + " \"" + Function + "\"" + " " + SelectedRenderer + " " + port;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
Process p = Process.Start(psi);
|
|
|
|
|
p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
|
|
|
|
|
p.BeginOutputReadLine();
|
|
|
|
|
p.Exited += new EventHandler(p_Exited);
|
|
|
|
|
Processes.Add(p);
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-08 02:58:46 +00:00
|
|
|
|
private static void CreateDirs()
|
2011-03-25 05:06:49 +00:00
|
|
|
|
{
|
|
|
|
|
// Create and set the config directory.
|
|
|
|
|
String Dir = AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\";
|
|
|
|
|
if (!Directory.Exists(Dir))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(Dir);
|
|
|
|
|
}
|
|
|
|
|
Dir += "\\Inis\\";
|
|
|
|
|
if (!Directory.Exists(Dir))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(Dir);
|
|
|
|
|
File.Create(Dir + "\\gsdx.ini").Close();
|
|
|
|
|
}
|
2019-02-08 02:58:46 +00:00
|
|
|
|
Dir = AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs";
|
2011-03-25 05:06:49 +00:00
|
|
|
|
Directory.SetCurrentDirectory(Dir);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private void p_Exited(object sender, EventArgs e)
|
2011-03-25 05:06:49 +00:00
|
|
|
|
{
|
|
|
|
|
// Remove the child if is closed
|
|
|
|
|
Processes.Remove((Process)sender);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
|
2011-03-25 05:06:49 +00:00
|
|
|
|
{
|
2019-04-15 15:24:25 +00:00
|
|
|
|
_gsdxLogger.Information(e.Data);
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cmdConfigGSDX_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Execute the GSconfigure function
|
2019-04-15 15:24:25 +00:00
|
|
|
|
if (!_availableGsDlls.IsSelected)
|
|
|
|
|
{
|
2018-01-16 17:36:17 +00:00
|
|
|
|
MessageBox.Show("Select your GSdx first", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
2019-04-15 15:24:25 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ExecuteFunction("GSconfigure");
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cmdOpenIni_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Execute the GSconfigure function
|
2019-02-09 00:05:47 +00:00
|
|
|
|
CreateDirs();
|
|
|
|
|
Process.Start(AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\inis\\gsdx.ini");
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private void UpdatePreviewImage(object sender, GsFiles<GsDumpFile>.SelectedIndexUpdatedEventArgs args)
|
2011-03-25 05:06:49 +00:00
|
|
|
|
{
|
2019-04-15 15:24:25 +00:00
|
|
|
|
if (pctBox.Image != NoImage)
|
|
|
|
|
pctBox.Image?.Dispose();
|
|
|
|
|
if (_availableGsDumps.Selected?.PreviewFile == null)
|
2011-03-25 05:06:49 +00:00
|
|
|
|
{
|
2015-12-16 19:39:40 +00:00
|
|
|
|
pctBox.Image = NoImage;
|
|
|
|
|
pctBox.Cursor = Cursors.Default;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
2019-04-15 15:24:25 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pctBox.Load(_availableGsDumps.Selected.PreviewFile.FullName);
|
|
|
|
|
pctBox.Cursor = Cursors.Hand;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pctBox.Tag = _availableGsDumps.Selected?.PreviewFile?.FullName;
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-15 15:24:25 +00:00
|
|
|
|
private static void PreviewImageClick(object sender, EventArgs e)
|
2011-03-25 05:06:49 +00:00
|
|
|
|
{
|
2019-04-15 15:24:25 +00:00
|
|
|
|
var previewControl = (PictureBox)sender;
|
|
|
|
|
if (previewControl.Tag == null)
|
|
|
|
|
return;
|
|
|
|
|
Process.Start((string)previewControl.Tag);
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GSDumpGUI_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.KeyCode == Keys.Return)
|
2018-01-16 17:41:29 +00:00
|
|
|
|
cmdRun_Click(sender, e);
|
2011-03-25 05:06:49 +00:00
|
|
|
|
|
|
|
|
|
if (e.KeyCode == Keys.F1)
|
|
|
|
|
cmdConfigGSDX_Click(sender, e);
|
|
|
|
|
|
|
|
|
|
if ((e.KeyCode == Keys.F2))
|
|
|
|
|
SelectedRad++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void rda_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RadioButton itm = ((RadioButton)(sender));
|
|
|
|
|
if (itm.Checked == true)
|
|
|
|
|
SelectedRad = Convert.ToInt32(itm.Tag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtGSDXDirectory_Leave(object sender, EventArgs e)
|
|
|
|
|
{
|
2019-04-15 15:24:25 +00:00
|
|
|
|
Settings.Save();
|
|
|
|
|
ReloadGsdxDlls();
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtDumpsDirectory_Leave(object sender, EventArgs e)
|
|
|
|
|
{
|
2019-04-15 15:24:25 +00:00
|
|
|
|
Settings.Save();
|
|
|
|
|
ReloadGsdxDumps();
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void lstProcesses_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lstProcesses.SelectedIndex != -1)
|
|
|
|
|
{
|
|
|
|
|
chkDebugMode.Enabled = true;
|
|
|
|
|
|
|
|
|
|
TCPMessage msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.GetDebugMode;
|
|
|
|
|
msg.Parameters.Add(chkDebugMode.Checked);
|
|
|
|
|
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
|
|
|
|
|
|
|
|
|
|
msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.SizeDump;
|
|
|
|
|
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
|
|
|
|
|
|
|
|
|
|
msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.Statistics;
|
|
|
|
|
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
chkDebugMode.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void chkDebugMode_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lstProcesses.SelectedIndex != -1)
|
|
|
|
|
{
|
|
|
|
|
TCPMessage msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.SetDebugMode;
|
|
|
|
|
msg.Parameters.Add(chkDebugMode.Checked);
|
|
|
|
|
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnStep_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
TCPMessage msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.Step;
|
|
|
|
|
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnRunToSelection_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (treTreeView.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
TCPMessage msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.RunToCursor;
|
|
|
|
|
msg.Parameters.Add(Convert.ToInt32(treTreeView.SelectedNode.Text.Split(new string[]{" - "}, StringSplitOptions.None)[0]));
|
|
|
|
|
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
MessageBox.Show("You have not selected a node to jump to");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cmdGoToStart_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
TCPMessage msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.RunToCursor;
|
|
|
|
|
msg.Parameters.Add(0);
|
|
|
|
|
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cmdGoToNextVSync_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
TCPMessage msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.RunToNextVSync;
|
|
|
|
|
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void treTreeView_AfterSelect(object sender, TreeViewEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (treTreeView.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
TCPMessage msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.PacketInfo;
|
|
|
|
|
msg.Parameters.Add(Convert.ToInt32(treTreeView.SelectedNode.Text.Split(new string[] { " - " }, StringSplitOptions.None)[0]));
|
|
|
|
|
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
|
|
|
|
|
}
|
|
|
|
|
treTreeView.SelectedNode = e.Node;
|
|
|
|
|
}
|
2019-03-26 22:27:13 +00:00
|
|
|
|
|
|
|
|
|
private void GSDumpGUI_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Make sure all child processes are closed upon closing the main form
|
|
|
|
|
Processes.ForEach(p =>
|
|
|
|
|
{
|
|
|
|
|
try { p.Kill(); } catch { }
|
|
|
|
|
p.Dispose();
|
|
|
|
|
});
|
|
|
|
|
}
|
2011-03-25 05:06:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|