diff --git a/tools/GSDumpGUI/Core/Program.cs b/tools/GSDumpGUI/Core/Program.cs
new file mode 100644
index 0000000000..8b80ec98cf
--- /dev/null
+++ b/tools/GSDumpGUI/Core/Program.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using Specialized = System.Collections.Specialized;
+using Reflection = System.Reflection;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Diagnostics;
+
+namespace GSDumpGUI
+{
+ static class Program
+ {
+ static public GSDumpGUI frmMain;
+
+ [STAThread]
+ static void Main(String[] args)
+ {
+ if (args.Length == 3)
+ {
+ Thread thd = new Thread(new ThreadStart(delegate
+ {
+ while (true)
+ {
+ Int32 tmp = NativeMethods.GetAsyncKeyState(0x1b) & 0xf;
+ if (tmp != 0)
+ Process.GetCurrentProcess().Kill();
+ Thread.Sleep(16);
+ }
+ }));
+ thd.IsBackground = true;
+ thd.Start();
+
+ // Retrieve parameters
+ String DLLPath = args[0];
+ String DumpPath = args[1];
+ String Operation = args[2];
+
+ // Try to load the DLL in memory
+ IntPtr hmod = NativeMethods.LoadLibrary(DLLPath);
+ if (hmod.ToInt64() > 0)
+ {
+ // Search if the DLL has the requested operation
+ IntPtr funcaddr = NativeMethods.GetProcAddress(hmod, Operation);
+ if (funcaddr.ToInt64() > 0)
+ {
+ // Execute the appropriate function pointer by casting it to a delegate.
+ if (Operation == "GSReplay")
+ {
+ GSDXImport.GSReplay dg = (GSDXImport.GSReplay)Marshal.GetDelegateForFunctionPointer(funcaddr, typeof(GSDXImport.GSReplay));
+ dg.Invoke(new IntPtr(0), new IntPtr(0), DumpPath, false);
+ }
+ else
+ {
+ GSDXImport.GSConfigure dg = (GSDXImport.GSConfigure)Marshal.GetDelegateForFunctionPointer(funcaddr, typeof(GSDXImport.GSConfigure));
+ dg.Invoke();
+ }
+ }
+ // Unload the library.
+ NativeMethods.FreeLibrary(hmod);
+ }
+ }
+ else
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ frmMain = new GSDumpGUI();
+ Application.Run(frmMain);
+ }
+ }
+ }
+}
diff --git a/tools/GSDumpGUI/Forms/frmMain.Designer.cs b/tools/GSDumpGUI/Forms/frmMain.Designer.cs
new file mode 100644
index 0000000000..e48f61f748
--- /dev/null
+++ b/tools/GSDumpGUI/Forms/frmMain.Designer.cs
@@ -0,0 +1,276 @@
+namespace GSDumpGUI
+{
+ partial class GSDumpGUI
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GSDumpGUI));
+ this.txtGSDXDirectory = new System.Windows.Forms.TextBox();
+ this.lblDirectory = new System.Windows.Forms.Label();
+ this.cmdBrowseGSDX = new System.Windows.Forms.Button();
+ this.cmdBrowseDumps = new System.Windows.Forms.Button();
+ this.lblDumpDirectory = new System.Windows.Forms.Label();
+ this.txtDumpsDirectory = new System.Windows.Forms.TextBox();
+ this.cmdSaveAndReload = new System.Windows.Forms.Button();
+ this.lstGSDX = new System.Windows.Forms.ListBox();
+ this.lstDumps = new System.Windows.Forms.ListBox();
+ this.lblDumps = new System.Windows.Forms.Label();
+ this.GsdxList = new System.Windows.Forms.Label();
+ this.cmdStart = new System.Windows.Forms.Button();
+ this.cmdConfigGSDX = new System.Windows.Forms.Button();
+ this.txtLog = new System.Windows.Forms.TextBox();
+ this.lblLog = new System.Windows.Forms.Label();
+ this.cmdOpenIni = new System.Windows.Forms.Button();
+ this.pctBox = new System.Windows.Forms.PictureBox();
+ ((System.ComponentModel.ISupportInitialize)(this.pctBox)).BeginInit();
+ this.SuspendLayout();
+ //
+ // txtGSDXDirectory
+ //
+ this.txtGSDXDirectory.Location = new System.Drawing.Point(705, 25);
+ this.txtGSDXDirectory.Name = "txtGSDXDirectory";
+ this.txtGSDXDirectory.Size = new System.Drawing.Size(165, 20);
+ this.txtGSDXDirectory.TabIndex = 0;
+ this.txtGSDXDirectory.TabStop = false;
+ //
+ // lblDirectory
+ //
+ this.lblDirectory.AutoSize = true;
+ this.lblDirectory.Location = new System.Drawing.Point(702, 9);
+ this.lblDirectory.Name = "lblDirectory";
+ this.lblDirectory.Size = new System.Drawing.Size(82, 13);
+ this.lblDirectory.TabIndex = 1;
+ this.lblDirectory.Text = "GSDX Directory";
+ //
+ // cmdBrowseGSDX
+ //
+ this.cmdBrowseGSDX.Location = new System.Drawing.Point(876, 22);
+ this.cmdBrowseGSDX.Name = "cmdBrowseGSDX";
+ this.cmdBrowseGSDX.Size = new System.Drawing.Size(35, 23);
+ this.cmdBrowseGSDX.TabIndex = 2;
+ this.cmdBrowseGSDX.TabStop = false;
+ this.cmdBrowseGSDX.Text = "...";
+ this.cmdBrowseGSDX.UseVisualStyleBackColor = true;
+ this.cmdBrowseGSDX.Click += new System.EventHandler(this.cmdBrowseGSDX_Click);
+ //
+ // cmdBrowseDumps
+ //
+ this.cmdBrowseDumps.Location = new System.Drawing.Point(876, 67);
+ this.cmdBrowseDumps.Name = "cmdBrowseDumps";
+ this.cmdBrowseDumps.Size = new System.Drawing.Size(35, 23);
+ this.cmdBrowseDumps.TabIndex = 5;
+ this.cmdBrowseDumps.TabStop = false;
+ this.cmdBrowseDumps.Text = "...";
+ this.cmdBrowseDumps.UseVisualStyleBackColor = true;
+ this.cmdBrowseDumps.Click += new System.EventHandler(this.cmdBrowseDumps_Click);
+ //
+ // lblDumpDirectory
+ //
+ this.lblDumpDirectory.AutoSize = true;
+ this.lblDumpDirectory.Location = new System.Drawing.Point(702, 54);
+ this.lblDumpDirectory.Name = "lblDumpDirectory";
+ this.lblDumpDirectory.Size = new System.Drawing.Size(85, 13);
+ this.lblDumpDirectory.TabIndex = 4;
+ this.lblDumpDirectory.Text = "Dumps Directory";
+ //
+ // txtDumpsDirectory
+ //
+ this.txtDumpsDirectory.Location = new System.Drawing.Point(705, 70);
+ this.txtDumpsDirectory.Name = "txtDumpsDirectory";
+ this.txtDumpsDirectory.Size = new System.Drawing.Size(165, 20);
+ this.txtDumpsDirectory.TabIndex = 3;
+ this.txtDumpsDirectory.TabStop = false;
+ //
+ // cmdSaveAndReload
+ //
+ this.cmdSaveAndReload.Location = new System.Drawing.Point(705, 96);
+ this.cmdSaveAndReload.Name = "cmdSaveAndReload";
+ this.cmdSaveAndReload.Size = new System.Drawing.Size(206, 23);
+ this.cmdSaveAndReload.TabIndex = 6;
+ this.cmdSaveAndReload.TabStop = false;
+ this.cmdSaveAndReload.Text = "Save And Reload";
+ this.cmdSaveAndReload.UseVisualStyleBackColor = true;
+ this.cmdSaveAndReload.Click += new System.EventHandler(this.cmdSave_Click);
+ //
+ // lstGSDX
+ //
+ this.lstGSDX.FormattingEnabled = true;
+ this.lstGSDX.Location = new System.Drawing.Point(393, 25);
+ this.lstGSDX.Name = "lstGSDX";
+ this.lstGSDX.Size = new System.Drawing.Size(299, 225);
+ this.lstGSDX.TabIndex = 1;
+ this.lstGSDX.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lstGSDX_KeyDown);
+ //
+ // lstDumps
+ //
+ this.lstDumps.FormattingEnabled = true;
+ this.lstDumps.Location = new System.Drawing.Point(12, 25);
+ this.lstDumps.Name = "lstDumps";
+ this.lstDumps.Size = new System.Drawing.Size(155, 225);
+ this.lstDumps.TabIndex = 0;
+ this.lstDumps.SelectedIndexChanged += new System.EventHandler(this.lstDumps_SelectedIndexChanged);
+ this.lstDumps.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lstDumps_KeyDown);
+ //
+ // lblDumps
+ //
+ this.lblDumps.AutoSize = true;
+ this.lblDumps.Location = new System.Drawing.Point(9, 8);
+ this.lblDumps.Name = "lblDumps";
+ this.lblDumps.Size = new System.Drawing.Size(59, 13);
+ this.lblDumps.TabIndex = 9;
+ this.lblDumps.Text = "Dumps List";
+ //
+ // GsdxList
+ //
+ this.GsdxList.AutoSize = true;
+ this.GsdxList.Location = new System.Drawing.Point(390, 9);
+ this.GsdxList.Name = "GsdxList";
+ this.GsdxList.Size = new System.Drawing.Size(56, 13);
+ this.GsdxList.TabIndex = 10;
+ this.GsdxList.Text = "GSDX List";
+ //
+ // cmdStart
+ //
+ this.cmdStart.Location = new System.Drawing.Point(705, 187);
+ this.cmdStart.Name = "cmdStart";
+ this.cmdStart.Size = new System.Drawing.Size(206, 58);
+ this.cmdStart.TabIndex = 11;
+ this.cmdStart.TabStop = false;
+ this.cmdStart.Text = "Start";
+ this.cmdStart.UseVisualStyleBackColor = true;
+ this.cmdStart.Click += new System.EventHandler(this.cmdStart_Click);
+ //
+ // cmdConfigGSDX
+ //
+ this.cmdConfigGSDX.Location = new System.Drawing.Point(705, 125);
+ this.cmdConfigGSDX.Name = "cmdConfigGSDX";
+ this.cmdConfigGSDX.Size = new System.Drawing.Size(100, 56);
+ this.cmdConfigGSDX.TabIndex = 12;
+ this.cmdConfigGSDX.TabStop = false;
+ this.cmdConfigGSDX.Text = "Configure Current GSDX";
+ this.cmdConfigGSDX.UseVisualStyleBackColor = true;
+ this.cmdConfigGSDX.Click += new System.EventHandler(this.cmdConfigGSDX_Click);
+ //
+ // txtLog
+ //
+ this.txtLog.Location = new System.Drawing.Point(12, 275);
+ this.txtLog.Multiline = true;
+ this.txtLog.Name = "txtLog";
+ this.txtLog.ReadOnly = true;
+ this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
+ this.txtLog.Size = new System.Drawing.Size(899, 133);
+ this.txtLog.TabIndex = 13;
+ this.txtLog.TabStop = false;
+ //
+ // lblLog
+ //
+ this.lblLog.AutoSize = true;
+ this.lblLog.Location = new System.Drawing.Point(12, 259);
+ this.lblLog.Name = "lblLog";
+ this.lblLog.Size = new System.Drawing.Size(25, 13);
+ this.lblLog.TabIndex = 14;
+ this.lblLog.Text = "Log";
+ //
+ // cmdOpenIni
+ //
+ this.cmdOpenIni.Location = new System.Drawing.Point(811, 125);
+ this.cmdOpenIni.Name = "cmdOpenIni";
+ this.cmdOpenIni.Size = new System.Drawing.Size(102, 56);
+ this.cmdOpenIni.TabIndex = 15;
+ this.cmdOpenIni.TabStop = false;
+ this.cmdOpenIni.Text = "Open GSDX.ini";
+ this.cmdOpenIni.UseVisualStyleBackColor = true;
+ this.cmdOpenIni.Click += new System.EventHandler(this.cmdOpenIni_Click);
+ //
+ // pctBox
+ //
+ this.pctBox.Location = new System.Drawing.Point(173, 28);
+ this.pctBox.Name = "pctBox";
+ this.pctBox.Size = new System.Drawing.Size(208, 221);
+ this.pctBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+ this.pctBox.TabIndex = 17;
+ this.pctBox.TabStop = false;
+ this.pctBox.Click += new System.EventHandler(this.pctBox_Click);
+ //
+ // GSDumpGUI
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(920, 420);
+ this.Controls.Add(this.pctBox);
+ this.Controls.Add(this.cmdOpenIni);
+ this.Controls.Add(this.lblLog);
+ this.Controls.Add(this.txtLog);
+ this.Controls.Add(this.cmdConfigGSDX);
+ this.Controls.Add(this.cmdStart);
+ this.Controls.Add(this.GsdxList);
+ this.Controls.Add(this.lblDumps);
+ this.Controls.Add(this.lstDumps);
+ this.Controls.Add(this.lstGSDX);
+ this.Controls.Add(this.cmdSaveAndReload);
+ this.Controls.Add(this.cmdBrowseDumps);
+ this.Controls.Add(this.lblDumpDirectory);
+ this.Controls.Add(this.txtDumpsDirectory);
+ this.Controls.Add(this.cmdBrowseGSDX);
+ this.Controls.Add(this.lblDirectory);
+ this.Controls.Add(this.txtGSDXDirectory);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.KeyPreview = true;
+ this.MaximizeBox = false;
+ this.Name = "GSDumpGUI";
+ this.Text = "GSDumpGUI";
+ this.Load += new System.EventHandler(this.GSDumpGUI_Load);
+ this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GSDumpGUI_KeyDown);
+ ((System.ComponentModel.ISupportInitialize)(this.pctBox)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox txtGSDXDirectory;
+ private System.Windows.Forms.Label lblDirectory;
+ private System.Windows.Forms.Button cmdBrowseGSDX;
+ private System.Windows.Forms.Button cmdBrowseDumps;
+ private System.Windows.Forms.Label lblDumpDirectory;
+ private System.Windows.Forms.TextBox txtDumpsDirectory;
+ private System.Windows.Forms.Button cmdSaveAndReload;
+ private System.Windows.Forms.ListBox lstGSDX;
+ private System.Windows.Forms.ListBox lstDumps;
+ private System.Windows.Forms.Label lblDumps;
+ private System.Windows.Forms.Label GsdxList;
+ private System.Windows.Forms.Button cmdStart;
+ private System.Windows.Forms.Button cmdConfigGSDX;
+ private System.Windows.Forms.TextBox txtLog;
+ private System.Windows.Forms.Label lblLog;
+ private System.Windows.Forms.Button cmdOpenIni;
+ private System.Windows.Forms.PictureBox pctBox;
+ }
+}
+
diff --git a/tools/GSDumpGUI/Forms/frmMain.cs b/tools/GSDumpGUI/Forms/frmMain.cs
new file mode 100644
index 0000000000..931bd389d6
--- /dev/null
+++ b/tools/GSDumpGUI/Forms/frmMain.cs
@@ -0,0 +1,280 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Diagnostics;
+using System.Security;
+
+namespace GSDumpGUI
+{
+ public partial class GSDumpGUI : Form
+ {
+ public List Processes;
+
+ public GSDumpGUI()
+ {
+ InitializeComponent();
+ Processes = new List();
+ }
+
+ public void ReloadGSDXs()
+ {
+ txtGSDXDirectory.Text = Properties.Settings.Default.GSDXDir;
+ txtDumpsDirectory.Text = Properties.Settings.Default.DumpDir;
+
+ lstGSDX.Items.Clear();
+ lstDumps.Items.Clear();
+
+ if (Directory.Exists(txtGSDXDirectory.Text))
+ {
+ String[] File = Directory.GetFiles(txtGSDXDirectory.Text, "*.dll", SearchOption.TopDirectoryOnly);
+
+ NativeMethods.SetErrorMode(0x8007);
+ foreach (var itm in File)
+ {
+ IntPtr hmod = NativeMethods.LoadLibrary(itm);
+ if (hmod.ToInt64() > 0)
+ {
+ IntPtr funcaddr = NativeMethods.GetProcAddress(hmod, "GSReplay");
+ if (funcaddr.ToInt64() > 0)
+ {
+ IntPtr funcaddrN = NativeMethods.GetProcAddress(hmod, "PSEgetLibName");
+ if (funcaddrN.ToInt64() > 0)
+ {
+ GSDXImport.PSEgetLibName ps = (GSDXImport.PSEgetLibName)Marshal.GetDelegateForFunctionPointer(funcaddrN, typeof(GSDXImport.PSEgetLibName));
+ lstGSDX.Items.Add(Path.GetFileName(itm) + " | " + Marshal.PtrToStringAnsi(ps.Invoke()));
+ }
+ }
+ else
+ {
+ Int32 id = NativeMethods.GetLastError();
+ System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "test.txt", itm + " failed to load. Error " + id + Environment.NewLine);
+ }
+ NativeMethods.FreeLibrary(hmod);
+ }
+ else
+ {
+ Int32 id = NativeMethods.GetLastError();
+ System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "test.txt", itm + " failed to load. Error " + id);
+ }
+ }
+ NativeMethods.SetErrorMode(0x0000);
+
+ String[] Dumps = Directory.GetFiles(txtDumpsDirectory.Text, "*.gs", SearchOption.TopDirectoryOnly);
+
+ foreach (var itm in Dumps)
+ lstDumps.Items.Add(Path.GetFileName(itm));
+ }
+ }
+
+ private void GSDumpGUI_Load(object sender, EventArgs e)
+ {
+ ReloadGSDXs();
+ lstDumps.Focus();
+ if (lstDumps.Items.Count > 0)
+ lstDumps.SelectedIndex = 0;
+ }
+
+ private void cmdBrowseGSDX_Click(object sender, EventArgs e)
+ {
+ FolderBrowserDialog fbd = new FolderBrowserDialog();
+ fbd.Description = "Select the GSDX DLL Directory";
+ fbd.SelectedPath = AppDomain.CurrentDomain.BaseDirectory;
+ if (fbd.ShowDialog() == DialogResult.OK)
+ txtGSDXDirectory.Text = fbd.SelectedPath;
+ }
+
+ private void cmdBrowseDumps_Click(object sender, EventArgs e)
+ {
+ FolderBrowserDialog fbd = new FolderBrowserDialog();
+ fbd.Description = "Select the GSDX Dumps Directory";
+ fbd.SelectedPath = AppDomain.CurrentDomain.BaseDirectory;
+ if (fbd.ShowDialog() == DialogResult.OK)
+ txtDumpsDirectory.Text = fbd.SelectedPath;
+ }
+
+ private void cmdSave_Click(object sender, EventArgs e)
+ {
+ if (System.IO.Directory.Exists(txtDumpsDirectory.Text))
+ Properties.Settings.Default.DumpDir = txtDumpsDirectory.Text;
+ else
+ MessageBox.Show("Select a correct directory for dumps", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+
+ if (System.IO.Directory.Exists(txtGSDXDirectory.Text))
+ Properties.Settings.Default.GSDXDir = txtGSDXDirectory.Text;
+ else
+ MessageBox.Show("Select a correct directory for GSDX", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+
+ Properties.Settings.Default.Save();
+ ReloadGSDXs();
+ }
+
+ private void cmdStart_Click(object sender, EventArgs e)
+ {
+ // Execute the GSReplay function
+ if (lstDumps.SelectedIndex != -1)
+ {
+ if (lstGSDX.SelectedIndex != -1)
+ ExecuteFunction("GSReplay");
+ else
+ MessageBox.Show("Select your GSDX first", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ MessageBox.Show("Select your Dump first", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+
+ private void ExecuteFunction(String Function)
+ {
+ String GSDXName = lstGSDX.SelectedItem.ToString().Split(new char[] { '|' })[0];
+
+ CreateDirs(GSDXName);
+
+ // Set the Arguments to pass to the child
+ String DLLPath = Properties.Settings.Default.GSDXDir + "\\" + GSDXName;
+ String DumpPath = "";
+ if (lstDumps.SelectedItem != null)
+ DumpPath = Properties.Settings.Default.DumpDir + "\\" + lstDumps.SelectedItem.ToString();
+
+ // Start the child and link the events.
+ ProcessStartInfo psi = new ProcessStartInfo();
+ psi.UseShellExecute = false;
+ psi.RedirectStandardOutput = true;
+ psi.RedirectStandardError = false;
+ psi.CreateNoWindow = true;
+ psi.FileName = AppDomain.CurrentDomain.BaseDirectory + "GsDumpGUI.exe";
+ psi.Arguments = "\"" + DLLPath + "\"" + " \"" + DumpPath + "\"" + " \"" + Function + "\"";
+ Process p = Process.Start(psi);
+ p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
+ p.BeginOutputReadLine();
+ p.Exited += new EventHandler(p_Exited);
+ Processes.Add(p);
+ }
+
+ private static void CreateDirs(String GSDXName)
+ {
+ // Create and set the config directory.
+ String Dir = AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\";
+ if (!Directory.Exists(Dir))
+ {
+ Directory.CreateDirectory(Dir);
+ }
+ Dir += GSDXName;
+ if (!Directory.Exists(Dir))
+ {
+ Directory.CreateDirectory(Dir);
+ }
+ Dir += "\\Inis\\";
+ if (!Directory.Exists(Dir))
+ {
+ Directory.CreateDirectory(Dir);
+ File.Create(Dir + "\\gsdx.ini").Close();
+ }
+ Dir = AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\" + GSDXName;
+ Directory.SetCurrentDirectory(Dir);
+ }
+
+ void p_Exited(object sender, EventArgs e)
+ {
+ // Remove the child if is closed
+ Processes.Remove((Process)sender);
+ }
+
+ void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
+ {
+ // Write the log.
+ txtLog.Invoke(new Action