Skip to content
Permalink
Browse files

GSDumpGUI: Some changes based on willkuer's review.

  • Loading branch information...
KrossX authored and lightningterror committed Aug 2, 2019
1 parent c8a285d commit 77f52cf04d83333b96b313ac32aa662ebf909f97
@@ -116,7 +116,7 @@ public 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 @@ private void ReloadGsdxDlls()

_dllWatcher.Clear();

for (int i = 0; i < 4; i++)
for (int i = 0; i < paths.Length; i++)
{
try
{
@@ -256,7 +256,7 @@ private void ReloadGsdxDumps()

_dumpWatcher.Clear();

for (int i = 0; i < 3; i++)
for (int i = 0; i < paths.Length; i++)
{
try
{
@@ -294,7 +294,7 @@ private void cmdBrowseGSDX_Click(object sender, EventArgs e)
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 @@ private void cmdBrowseDumps_Click(object sender, EventArgs e)
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 @@ private void txtDumpsDirectory_Enter(object sender, EventArgs e)
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();
}
}
}

@@ -31,22 +31,22 @@

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 @@ public void Load(String DLL)
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 @@ public void Load(String DLL)

public void Unload()
{
System.Diagnostics.Trace.WriteLine("FreeLibrary: " + DLL);
NativeMethods.FreeLibrary(DLLAddr);
Loaded = false;
}
@@ -218,7 +216,7 @@ public unsafe void Run(GSDump dump, int rendererOverride)
{
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 @@ public unsafe void Run(GSDump dump, int rendererOverride)
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:
@@ -101,8 +101,8 @@ static public GSDump LoadDump(String FileName)
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)
@@ -90,7 +90,7 @@ static public class NativeMethods

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

0 comments on commit 77f52cf

Please sign in to comment.
You can’t perform that action at this time.