diff --git a/tools/GSDumpGUI/GSDumpGUI.csproj b/tools/GSDumpGUI/GSDumpGUI.csproj index 4f296fe259..bfeb395e64 100644 --- a/tools/GSDumpGUI/GSDumpGUI.csproj +++ b/tools/GSDumpGUI/GSDumpGUI.csproj @@ -20,29 +20,47 @@ 3.5 - + true - full - false bin\Debug\ DEBUG;TRACE - prompt - 4 - x86 true + full + x64 6 - false + prompt + MinimumRecommendedRules.ruleset - - pdbonly - true + bin\Release\ TRACE - prompt - 4 true + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + + + true + bin\Debug\ + DEBUG;TRACE + true + full x86 - false + 6 + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + true + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset diff --git a/tools/GSDumpGUI/GSDumpGUI.sln b/tools/GSDumpGUI/GSDumpGUI.sln index 46ebfa0fb9..244e2cd59d 100644 --- a/tools/GSDumpGUI/GSDumpGUI.sln +++ b/tools/GSDumpGUI/GSDumpGUI.sln @@ -1,20 +1,31 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28803.352 +MinimumVisualStudioVersion = 10.0.40219.1 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 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 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 + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Debug|x64.ActiveCfg = Debug|x64 + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Debug|x64.Build.0 = Debug|x64 + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Debug|x86.ActiveCfg = Debug|x86 + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Debug|x86.Build.0 = Debug|x86 + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Release|x64.ActiveCfg = Release|x64 + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Release|x64.Build.0 = Release|x64 + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Release|x86.ActiveCfg = Release|x86 + {825E4311-652D-4A1E-8AA1-F6D81B186E33}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {19DB287E-B866-4E97-B0AE-95CF54B00134} + EndGlobalSection EndGlobal diff --git a/tools/GSDumpGUI/Library/GSDXWrapper.cs b/tools/GSDumpGUI/Library/GSDXWrapper.cs index 1ac2f780fc..61f6596ce1 100644 --- a/tools/GSDumpGUI/Library/GSDXWrapper.cs +++ b/tools/GSDumpGUI/Library/GSDXWrapper.cs @@ -212,13 +212,24 @@ namespace GSDumpGUI GSsetGameCRC(dump.CRC, 0); - NativeMethods.SetClassLong(hWnd,/*GCL_HICON*/ -14, (uint)Program.hMainIcon.ToInt32()); + NativeMethods.SetClassLong(hWnd,/*GCL_HICON*/ -14, Program.hMainIcon); fixed (byte* freeze = dump.StateData) { - byte[] GSFreez = new byte[8]; - Array.Copy(BitConverter.GetBytes(dump.StateData.Length), 0, GSFreez, 0, 4); - Array.Copy(BitConverter.GetBytes(new IntPtr(freeze).ToInt32()), 0, GSFreez, 4, 4); + byte[] GSFreez; + + if (IntPtr.Size > 4) + { + GSFreez = new byte[16]; + Array.Copy(BitConverter.GetBytes((Int64)dump.StateData.Length), 0, GSFreez, 0, 8); + Array.Copy(BitConverter.GetBytes(new IntPtr(freeze).ToInt64()), 0, GSFreez, 8, 8); + } + else + { + GSFreez = new byte[8]; + Array.Copy(BitConverter.GetBytes((Int32)dump.StateData.Length), 0, GSFreez, 0, 4); + Array.Copy(BitConverter.GetBytes(new IntPtr(freeze).ToInt32()), 0, GSFreez, 4, 4); + } fixed (byte* fr = GSFreez) { @@ -226,7 +237,7 @@ namespace GSDumpGUI if (ris == -1) { DumpTooOld = true; - return; + Running = false; } GSVSync(1); diff --git a/tools/GSDumpGUI/Library/NativeMethods.cs b/tools/GSDumpGUI/Library/NativeMethods.cs index 7715e581c3..ecea1c5c2a 100644 --- a/tools/GSDumpGUI/Library/NativeMethods.cs +++ b/tools/GSDumpGUI/Library/NativeMethods.cs @@ -33,55 +33,66 @@ namespace GSDumpGUI static public class NativeMethods { [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("kernel32")] + [DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)] public extern static IntPtr LoadLibrary(string lpLibFileName); [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("kernel32")] + [DllImport("kernel32", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] public extern static bool FreeLibrary(IntPtr hLibModule); [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("kernel32", CharSet = CharSet.Ansi)] + [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)] public extern static IntPtr GetProcAddress(IntPtr hModule, string lpProcName); [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("kernel32", CharSet = CharSet.Ansi)] - public extern static int SetErrorMode(int Value); + [DllImport("kernel32")] + public extern static UInt32 SetErrorMode(UInt32 uMode); [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("kernel32", CharSet = CharSet.Ansi)] - public extern static int GetLastError(); + [DllImport("kernel32")] + public extern static UInt32 GetLastError(); [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("kernel32", CharSet = CharSet.Ansi)] - public extern static int WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName); - - [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("user32", CharSet = CharSet.Ansi)] - public extern static short GetAsyncKeyState(int key); - - [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("user32", CharSet = CharSet.Ansi)] - public extern static int SetClassLong(IntPtr HWND, int index, uint newlong); - - [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("user32", CharSet = CharSet.Ansi)] - public extern static bool IsWindowVisible(IntPtr HWND); - - [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] + [DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool PeekMessage(out NativeMessage message, IntPtr hwnd, uint messageFilterMin, uint messageFilterMax, uint flags); + public extern static bool WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName); [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool TranslateMessage(ref NativeMessage message); + [DllImport("user32")] + public extern static UInt16 GetAsyncKeyState(Int32 vKey); [SuppressUnmanagedCodeSecurityAttribute] - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] + [DllImport("user32", CharSet = CharSet.Auto, EntryPoint = "SetClassLong")] + public extern static UInt32 SetClassLong32(IntPtr hWnd, Int32 index, Int32 dwNewLong); + + [SuppressUnmanagedCodeSecurityAttribute] + [DllImport("user32", CharSet = CharSet.Auto, EntryPoint = "SetClassLongPtr")] + public extern static UIntPtr SetClassLong64(IntPtr hWnd, Int32 index, IntPtr dwNewLong); + + [SuppressUnmanagedCodeSecurityAttribute] + [DllImport("user32")] + public extern static bool IsWindowVisible(IntPtr hWnd); + + [SuppressUnmanagedCodeSecurityAttribute] + [DllImport("user32.dll", CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool DispatchMessage(ref NativeMessage message); + public static extern bool PeekMessage(out NativeMessage lpMsg, IntPtr hWnd, UInt32 wMsgFilterMin, UInt32 wMsgFilterMax, UInt32 wRemoveMsg); + + [SuppressUnmanagedCodeSecurityAttribute] + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool TranslateMessage(ref NativeMessage lpMsg); + + [SuppressUnmanagedCodeSecurityAttribute] + [DllImport("user32.dll", CharSet = CharSet.Auto)] + public static extern UInt32 DispatchMessage(ref NativeMessage lpMsg); + + public static UIntPtr SetClassLong(IntPtr hWnd, Int32 index, IntPtr dwNewLong) + { + if (IntPtr.Size > 4) return SetClassLong64(hWnd, index, dwNewLong); + else return new UIntPtr(SetClassLong32(hWnd, index, dwNewLong.ToInt32())); + } } [StructLayout(LayoutKind.Sequential)] @@ -94,5 +105,4 @@ namespace GSDumpGUI public uint time; public Point p; } - }