GSDumpGUI: Make it 64bit friendly.

This commit is contained in:
KrossX 2019-08-02 00:23:07 -03:00 committed by lightningterror
parent c6b944753b
commit 7b6c2be067
4 changed files with 107 additions and 57 deletions

View File

@ -20,29 +20,47 @@
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>6</LangVersion>
<Prefer32Bit>false</Prefer32Bit>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>6</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

View File

@ -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

View File

@ -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);

View File

@ -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;
}
}