Updated disassembly output and reference module

This commit is contained in:
x1nixmzeng 2018-01-21 19:18:38 +00:00
parent ed02200d6c
commit cf9a64c31a
4 changed files with 19 additions and 13 deletions

@ -1 +1 @@
Subproject commit e219bde89794b26cd09e116921bc6e9e5a157089 Subproject commit a270e93bd1b4ade2369e5cc17ac00661612424ca

View File

@ -49,10 +49,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="cs_x86, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\build\win32\Debug\cs_x86.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Windows" /> <Reference Include="System.Windows" />
@ -165,6 +161,12 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\import\cs_x86\cs_x86\cs_x86.csproj">
<Project>{9131b025-5019-4dee-84a3-86d2703a81c0}</Project>
<Name>cs_x86</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -208,7 +208,7 @@
// //
// textBox3 // textBox3
// //
this.textBox3.Font = new System.Drawing.Font("Lucida Console", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBox3.Font = new System.Drawing.Font("Lucida Console", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox3.Location = new System.Drawing.Point(218, 6); this.textBox3.Location = new System.Drawing.Point(218, 6);
this.textBox3.Multiline = true; this.textBox3.Multiline = true;
this.textBox3.Name = "textBox3"; this.textBox3.Name = "textBox3";

View File

@ -647,7 +647,7 @@ namespace CxbxDebugger
++i; ++i;
if (i > 0 && (i % 16) == 0) if (i > 0 && (i % 16) == 0)
hexData += "\n"; hexData += "\r\n";
} }
textBox1.Text = hexData; textBox1.Text = hexData;
@ -667,20 +667,24 @@ namespace CxbxDebugger
if (ptr == IntPtr.Zero) if (ptr == IntPtr.Zero)
return; return;
byte[] data = DebugThreads[0].OwningProcess.ReadMemoryBlock(ptr, 32); // Read preceeding bytes for more context
IntPtr OffsetAddr = new IntPtr((uint)ptr - 16);
byte[] data = DebugThreads[0].OwningProcess.ReadMemoryBlock(OffsetAddr, 64);
string disassembly = ""; string disassembly = "";
using (Capstone cs = Capstone.CreateEngine()) using (Capstone cs = Capstone.CreateEngine())
{ {
cs.DisassembleIt(data, (ulong)ptr, delegate (CapstoneInstruction Instruction) cs.DisassembleIt(data, (ulong)OffsetAddr, delegate (CapstoneInstruction Instruction)
{ {
disassembly += string.Format("{0:x8} {1}", Instruction.Address, Instruction.Disassembly) + "\r\n"; string Cursor = (Instruction.Address == (uint)ptr) ? "> " : " ";
disassembly += string.Format("{0}{1:x8} {2}", Cursor, Instruction.Address, Instruction.Disassembly) + "\r\n";
}); });
} }
textBox1.Text = disassembly; textBox3.Text = disassembly;
} }
} }
} }