13 |
|
|
14 |
namespace RomCheater.Docking.UI |
namespace RomCheater.Docking.UI |
15 |
{ |
{ |
16 |
public partial class UIMemoryViewer : UserControl, IProcessConfig, IAcceptsPlugin<IConfigPlugin>, IAcceptsMemoryRange |
public partial class UIMemoryViewer : UserControl, IProcessConfig, IAcceptsPlugin<IConfigPlugin>//, IAcceptsMemoryRange |
17 |
{ |
{ |
18 |
public UIMemoryViewer() |
public UIMemoryViewer() |
19 |
{ |
{ |
57 |
#region IAcceptsPlugin<IConfigPlugin> Members |
#region IAcceptsPlugin<IConfigPlugin> Members |
58 |
public IConfigPlugin AcceptedPlugin { get; set; } |
public IConfigPlugin AcceptedPlugin { get; set; } |
59 |
#endregion |
#endregion |
60 |
|
#region IAcceptsMemoryRange members |
61 |
|
public uint MemoryStart { get; set; } |
62 |
|
public uint MemorySize { get; set; } |
63 |
|
#endregion |
64 |
public void GotoTop() { this.CURRENT_TOP_ADDR = 0; } |
public void GotoTop() { this.CURRENT_TOP_ADDR = 0; } |
65 |
public void GotoBottom() { uint size = MemorySize; this.CURRENT_TOP_ADDR = (uint)((size - 1) - max_ram_view); } |
public void GotoBottom() { uint size = MemorySize; this.CURRENT_TOP_ADDR = (uint)((size - 1) - max_ram_view); } |
66 |
public void GotoAddress(uint addr) { this.CURRENT_TOP_ADDR = (uint)addr & 0xFFFFFFF0; } |
public void GotoAddress(uint addr) { this.CURRENT_TOP_ADDR = (uint)addr & 0xFFFFFFF0; } |
97 |
static uint small_scroll_change = max_address_width * 1; // scrolls one line (when you clikc the up or down arrows) |
static uint small_scroll_change = max_address_width * 1; // scrolls one line (when you clikc the up or down arrows) |
98 |
static uint medium_scroll_change = max_ram_view / 2; // scrolls half a page |
static uint medium_scroll_change = max_ram_view / 2; // scrolls half a page |
99 |
static uint large_scroll_change = max_ram_view; // scrolls a full page |
static uint large_scroll_change = max_ram_view; // scrolls a full page |
|
|
|
|
#region IAcceptsMemoryRange members |
|
|
public uint MemoryStart { get; set; } |
|
|
public uint MemorySize { get; set; } |
|
|
#endregion |
|
100 |
private uint _CURRENT_TOP_ADDR; |
private uint _CURRENT_TOP_ADDR; |
101 |
uint CURRENT_TOP_ADDR |
uint CURRENT_TOP_ADDR |
102 |
{ |
{ |
175 |
reader.ReadProcess = this.AcceptedProcess; |
reader.ReadProcess = this.AcceptedProcess; |
176 |
reader.OpenProcess(); |
reader.OpenProcess(); |
177 |
int bytesReadSize; |
int bytesReadSize; |
178 |
byte[] data = reader.ReadProcessMemory(MemoryStart, MemorySize, out bytesReadSize); |
byte[] data = reader.ReadProcessMemory(CURRENT_TOP_ADDR, max_ram_view, out bytesReadSize); |
179 |
//this.Logger.LogDebugMessage(string.Format("GetMemory() -> Memory Size: {0}0x{2:X8}{1}", "{", "}", data.Length)); |
//this.Logger.LogDebugMessage(string.Format("GetMemory() -> Memory Size: {0}0x{2:X8}{1}", "{", "}", data.Length)); |
180 |
return data; |
return data; |
181 |
} |
} |
182 |
catch (Exception ex) |
catch (Exception ex) |
183 |
{ |
{ |
184 |
logger.Error.WriteLine("{0}.GetMemory():{1}{2}", this.GetType().Name, System.Environment.NewLine, ex.ToString()); |
logger.Error.WriteLine("{0}.GetMemory():{1}{2}", this.GetType().Name, System.Environment.NewLine, ex.ToString()); |
185 |
byte[] data = new byte[MemorySize]; |
byte[] data = new byte[max_ram_view]; |
186 |
for (int i = 0; i < data.Length; i++) { data[i] = 0x0; } |
for (int i = 0; i < data.Length; i++) { data[i] = 0x0; } |
187 |
return data; |
return data; |
188 |
} |
} |