From 40f6aef1d3cf5c6e658baf6dfc54cb36268f72a7 Mon Sep 17 00:00:00 2001 From: "feal87@gmail.com" Date: Sun, 19 Dec 2010 10:48:09 +0000 Subject: [PATCH] Fixing some stuff on the GSDumpGUI (more update to come) to allow me to test decently Gsdx while waiting for DirectX SDK to complete download 1) Change log to "log.txt" 2) Fix a crash when an invalid directory is specified in the textbox. 3) Fix working folder for loading library. Now it searches for dependencies in the same folder as the plugin dll. 4) Fix configuration save/loading git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4102 96395faa-99c1-11dd-bbfe-3dabce05a288 --- tools/GSDumpGUI/Core/Program.cs | 2 ++ tools/GSDumpGUI/Forms/frmMain.cs | 15 +++++++++++++-- tools/GSDumpGUI/GSDumpGUI.sln | 20 ++++++++++++++++++++ tools/GSDumpGUI/Library/GSDXWrapper.cs | 9 +++++++-- 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 tools/GSDumpGUI/GSDumpGUI.sln diff --git a/tools/GSDumpGUI/Core/Program.cs b/tools/GSDumpGUI/Core/Program.cs index 51534124a8..ee7698911f 100644 --- a/tools/GSDumpGUI/Core/Program.cs +++ b/tools/GSDumpGUI/Core/Program.cs @@ -7,6 +7,7 @@ using System.Runtime.InteropServices; using System.Threading; using System.Diagnostics; using GSDumpGUI.Properties; +using System.IO; namespace GSDumpGUI { @@ -51,6 +52,7 @@ namespace GSDumpGUI GSDXWrapper wrap = new GSDXWrapper(); wrap.Load(DLLPath); + Directory.SetCurrentDirectory(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\" + Path.GetFileName(DLLPath) + "\\")); if (Operation == "GSReplay") { ChangeIcon = true; diff --git a/tools/GSDumpGUI/Forms/frmMain.cs b/tools/GSDumpGUI/Forms/frmMain.cs index 103785e130..afff9cf2da 100644 --- a/tools/GSDumpGUI/Forms/frmMain.cs +++ b/tools/GSDumpGUI/Forms/frmMain.cs @@ -124,18 +124,29 @@ namespace GSDumpGUI private void cmdSave_Click(object sender, EventArgs e) { + Boolean Err = false; + if (System.IO.Directory.Exists(txtDumpsDirectory.Text)) Properties.Settings.Default.DumpDir = txtDumpsDirectory.Text; else + { + Err = true; 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 + { + Err = true; MessageBox.Show("Select a correct directory for GSDX", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } - Properties.Settings.Default.Save(); - ReloadGSDXs(); + if (!Err) + { + Properties.Settings.Default.Save(); + ReloadGSDXs(); + } } private void cmdStart_Click(object sender, EventArgs e) diff --git a/tools/GSDumpGUI/GSDumpGUI.sln b/tools/GSDumpGUI/GSDumpGUI.sln new file mode 100644 index 0000000000..bed0a4844e --- /dev/null +++ b/tools/GSDumpGUI/GSDumpGUI.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GSDumpGUI", "GSDumpGUI.csproj", "{825E4311-652D-4A1E-8AA1-F6D81B186E33}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Debug|Any CPU.Build.0 = Debug|Any CPU + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Release|Any CPU.ActiveCfg = Release|Any CPU + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tools/GSDumpGUI/Library/GSDXWrapper.cs b/tools/GSDumpGUI/Library/GSDXWrapper.cs index d1305916c9..a470d8de84 100644 --- a/tools/GSDumpGUI/Library/GSDXWrapper.cs +++ b/tools/GSDumpGUI/Library/GSDXWrapper.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; +using System.IO; namespace GSDumpGUI { @@ -24,6 +25,8 @@ namespace GSDumpGUI { NativeMethods.SetErrorMode(0x8007); Boolean Ris = true; + + Directory.SetCurrentDirectory(Path.GetDirectoryName(DLL)); IntPtr hmod = NativeMethods.LoadLibrary(DLL); if (hmod.ToInt64() > 0) { @@ -35,16 +38,17 @@ namespace GSDumpGUI if (!((funcaddrConfig.ToInt64() > 0) && (funcaddrLibName.ToInt64() > 0) && (funcaddrReplay.ToInt64() > 0))) { Int32 id = NativeMethods.GetLastError(); - System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "test.txt", DLL + " failed to load. Error " + id); + System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "log.txt", DLL + " failed to load. Error " + id + Environment.NewLine); Ris = false; } } else { Int32 id = NativeMethods.GetLastError(); - System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "test.txt", DLL + " failed to load. Error " + id + Environment.NewLine); + System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "log.txt", DLL + " failed to load. Error " + id + Environment.NewLine); Ris = false; } + NativeMethods.SetErrorMode(0x0000); return Ris; } @@ -60,6 +64,7 @@ namespace GSDumpGUI Unload(); Loaded = true; + Directory.SetCurrentDirectory(Path.GetDirectoryName(DLL)); IntPtr hmod = NativeMethods.LoadLibrary(DLL); if (hmod.ToInt64() > 0) {