GSDumpGUI: Some changes based on willkuer's review.

This commit is contained in:
KrossX 2019-08-02 19:05:57 -03:00 committed by lightningterror
parent c8a285dee6
commit 77f52cf04d
4 changed files with 56 additions and 51 deletions

View File

@ -116,7 +116,7 @@ namespace GSDumpGUI
_availableGsDumps.OnIndexUpdatedEvent += UpdatePreviewImage;
this.Text += " " + (IntPtr.Size * 8).ToString() + "bits";
this.Text += Environment.Is64BitProcess ? " 64bits" : " 32bits";
if (String.IsNullOrEmpty(Settings.GSDXDir) || !Directory.Exists(Settings.GSDXDir))
Settings.GSDXDir = AppDomain.CurrentDomain.BaseDirectory;
@ -217,7 +217,7 @@ namespace GSDumpGUI
_dllWatcher.Clear();
for (int i = 0; i < 4; i++)
for (int i = 0; i < paths.Length; i++)
{
try
{
@ -256,7 +256,7 @@ namespace GSDumpGUI
_dumpWatcher.Clear();
for (int i = 0; i < 3; i++)
for (int i = 0; i < paths.Length; i++)
{
try
{
@ -294,7 +294,7 @@ namespace GSDumpGUI
if(ofd.ShowDialog() == DialogResult.OK)
{
string newpath = Path.GetDirectoryName(ofd.FileName);
if (!Settings.GSDXDir.ToLower().Equals(newpath.ToLower()))
if (!Settings.GSDXDir.Equals(newpath, StringComparison.OrdinalIgnoreCase))
{
txtGSDXDirectory.Text = newpath;
Settings.GSDXDir = newpath;
@ -317,7 +317,7 @@ namespace GSDumpGUI
if (ofd.ShowDialog() == DialogResult.OK)
{
string newpath = Path.GetDirectoryName(ofd.FileName);
if (!Settings.DumpDir.ToLower().Equals(newpath.ToLower()))
if (!Settings.DumpDir.Equals(newpath, StringComparison.OrdinalIgnoreCase))
{
txtDumpsDirectory.Text = newpath;
Settings.DumpDir = newpath;
@ -524,48 +524,52 @@ namespace GSDumpGUI
private void txtGSDXDirectory_Leave(object sender, EventArgs e)
{
string newpath = txtGSDXDirectory.Text;
if (!_gsdxPathOld.ToLower().Equals(newpath.ToLower()))
if (!_gsdxPathOld.Equals(newpath, StringComparison.OrdinalIgnoreCase))
txtGSDXDirectory.Text = _gsdxPathOld;
}
private void txtDumpsDirectory_Leave(object sender, EventArgs e)
{
string newpath = txtDumpsDirectory.Text;
if(!_dumpPathOld.ToLower().Equals(newpath.ToLower()))
if(!_dumpPathOld.Equals(newpath, StringComparison.OrdinalIgnoreCase))
txtDumpsDirectory.Text = _dumpPathOld;
}
private void txtGSDXDirectory_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode != Keys.Return) return;
if (e.KeyCode == Keys.Return)
{
string newpath = txtGSDXDirectory.Text;
if (!String.IsNullOrEmpty(newpath) &&
!_gsdxPathOld.ToLower().Equals(newpath.ToLower()) &&
!_gsdxPathOld.Equals(newpath, StringComparison.OrdinalIgnoreCase) &&
Directory.Exists(newpath))
{
_gsdxPathOld = newpath;
Settings.GSDXDir = newpath;
Settings.Save();
ReloadGsdxDlls();
_availableGsDlls.Selected = _availableGsDlls.Files.FirstOrDefault();
}
}
}
private void txtDumpsDirectory_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode != Keys.Return) return;
if (e.KeyCode == Keys.Return)
{
string newpath = txtDumpsDirectory.Text;
if (!String.IsNullOrEmpty(newpath) &&
!_dumpPathOld.ToLower().Equals(newpath.ToLower()) &&
!_dumpPathOld.Equals(newpath, StringComparison.OrdinalIgnoreCase) &&
Directory.Exists(newpath))
{
_dumpPathOld = newpath;
Settings.DumpDir = newpath;
Settings.Save();
ReloadGsdxDumps();
_availableGsDumps.Selected = _availableGsDumps.Files.FirstOrDefault();
}
}
}
private void lstProcesses_SelectedIndexChanged(object sender, EventArgs e)
{

View File

@ -105,7 +105,6 @@ namespace GSDumpGUI
if (dir == null) return;
Directory.SetCurrentDirectory(dir);
System.Diagnostics.Trace.WriteLine("LoadLibrary: " + DLL);
IntPtr hmod = NativeMethods.LoadLibrary(DLL);
if (hmod != IntPtr.Zero)
{
@ -174,7 +173,6 @@ namespace GSDumpGUI
public void Unload()
{
System.Diagnostics.Trace.WriteLine("FreeLibrary: " + DLL);
NativeMethods.FreeLibrary(DLLAddr);
Loaded = false;
}
@ -218,7 +216,7 @@ namespace GSDumpGUI
{
byte[] GSFreez;
if (IntPtr.Size > 4)
if (Environment.Is64BitProcess)
{
GSFreez = new byte[16];
Array.Copy(BitConverter.GetBytes((Int64)dump.StateData.Length), 0, GSFreez, 0, 8);
@ -281,15 +279,18 @@ namespace GSDumpGUI
switch (Mess.MessageType)
{
case MessageType.Step:
if (debug_idx >= dump.Data.Count) debug_idx = 0;
if (debug_idx >= dump.Data.Count)
debug_idx = 0;
RunTo = debug_idx;
break;
case MessageType.RunToCursor:
RunTo = (int)Mess.Parameters[0];
if(debug_idx > RunTo) debug_idx = 0;
if(debug_idx > RunTo)
debug_idx = 0;
break;
case MessageType.RunToNextVSync:
if (debug_idx >= dump.Data.Count) debug_idx = 1;
if (debug_idx >= dump.Data.Count)
debug_idx = 1;
RunTo = dump.Data.FindIndex(debug_idx, a => a.id == GSType.VSync);
break;
default:

View File

@ -90,7 +90,7 @@ namespace GSDumpGUI
public static UIntPtr SetClassLong(IntPtr hWnd, Int32 index, IntPtr dwNewLong)
{
if (IntPtr.Size > 4) return SetClassLong64(hWnd, index, dwNewLong);
if (Environment.Is64BitProcess) return SetClassLong64(hWnd, index, dwNewLong);
else return new UIntPtr(SetClassLong32(hWnd, index, dwNewLong.ToInt32()));
}
}