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,46 +524,50 @@ 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;
string newpath = txtGSDXDirectory.Text;
if (!String.IsNullOrEmpty(newpath) &&
!_gsdxPathOld.ToLower().Equals(newpath.ToLower()) &&
Directory.Exists(newpath))
if (e.KeyCode == Keys.Return)
{
Settings.GSDXDir = newpath;
Settings.Save();
ReloadGsdxDlls();
_availableGsDlls.Selected = _availableGsDlls.Files.FirstOrDefault();
string newpath = txtGSDXDirectory.Text;
if (!String.IsNullOrEmpty(newpath) &&
!_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;
string newpath = txtDumpsDirectory.Text;
if (!String.IsNullOrEmpty(newpath) &&
!_dumpPathOld.ToLower().Equals(newpath.ToLower()) &&
Directory.Exists(newpath))
if (e.KeyCode == Keys.Return)
{
Settings.DumpDir = newpath;
Settings.Save();
ReloadGsdxDumps();
_availableGsDumps.Selected = _availableGsDumps.Files.FirstOrDefault();
string newpath = txtDumpsDirectory.Text;
if (!String.IsNullOrEmpty(newpath) &&
!_dumpPathOld.Equals(newpath, StringComparison.OrdinalIgnoreCase) &&
Directory.Exists(newpath))
{
_dumpPathOld = newpath;
Settings.DumpDir = newpath;
Settings.Save();
ReloadGsdxDumps();
_availableGsDumps.Selected = _availableGsDumps.Files.FirstOrDefault();
}
}
}

View File

@ -31,22 +31,22 @@ using System.Threading;
namespace GSDumpGUI
{
public delegate void GSgifTransfer(IntPtr data, int size);
public delegate void GSgifTransfer1(IntPtr data, int size);
public delegate void GSgifTransfer2(IntPtr data, int size);
public delegate void GSgifTransfer3(IntPtr data, int size);
public delegate void GSVSync(byte field);
public delegate void GSreset();
public delegate void GSreadFIFO2(IntPtr data, int size);
public delegate void GSsetGameCRC(int crc, int options);
public delegate int GSfreeze(int mode, IntPtr data);
public delegate int GSopen(IntPtr hwnd, String Title, int renderer);
public delegate void GSclose();
public delegate void GSshutdown();
public delegate void GSConfigure();
public delegate void GSsetBaseMem(IntPtr data);
public delegate void GSgifTransfer(IntPtr data, int size);
public delegate void GSgifTransfer1(IntPtr data, int size);
public delegate void GSgifTransfer2(IntPtr data, int size);
public delegate void GSgifTransfer3(IntPtr data, int size);
public delegate void GSVSync(byte field);
public delegate void GSreset();
public delegate void GSreadFIFO2(IntPtr data, int size);
public delegate void GSsetGameCRC(int crc, int options);
public delegate int GSfreeze(int mode, IntPtr data);
public delegate int GSopen(IntPtr hwnd, String Title, int renderer);
public delegate void GSclose();
public delegate void GSshutdown();
public delegate void GSConfigure();
public delegate void GSsetBaseMem(IntPtr data);
public delegate IntPtr PSEgetLibName();
public delegate void GSinit();
public delegate void GSinit();
public delegate UInt32 GSmakeSnapshot(string path);
public class InvalidGSPlugin : Exception
@ -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

@ -101,8 +101,8 @@ namespace GSDumpGUI
dmp.CRC = br.ReadInt32();
Int32 ss = br.ReadInt32();
dmp.StateData = br.ReadBytes(ss);
dmp.StateData = br.ReadBytes(ss);
dmp.Registers = br.ReadBytes(8192);
while (br.PeekChar() != -1)

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()));
}
}