ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater/Docking/UI/UIMemoryViewer.cs
(Generate patch)

Comparing trunk/RomCheater/Docking/UI/UIMemoryViewer.cs (file contents):
Revision 199 by william, Thu May 31 07:20:43 2012 UTC vs.
Revision 200 by william, Thu May 31 07:29:44 2012 UTC

--- trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/05/31 07:20:43	199
+++ trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/05/31 07:29:44	200
@@ -13,7 +13,7 @@ using System.Diagnostics;
 
 namespace RomCheater.Docking.UI
 {
-    public partial class UIMemoryViewer : UserControl, IProcessConfig, IAcceptsPlugin<IConfigPlugin>, IAcceptsMemoryRange
+    public partial class UIMemoryViewer : UserControl, IProcessConfig, IAcceptsPlugin<IConfigPlugin>//, IAcceptsMemoryRange
     {
         public UIMemoryViewer()
         {
@@ -57,6 +57,10 @@ namespace RomCheater.Docking.UI
         #region IAcceptsPlugin<IConfigPlugin> Members
         public IConfigPlugin AcceptedPlugin { get; set; }
         #endregion
+        #region IAcceptsMemoryRange members
+        public uint MemoryStart { get; set; }
+        public uint MemorySize { get; set; }
+        #endregion
         public void GotoTop() { this.CURRENT_TOP_ADDR = 0; }
         public void GotoBottom() { uint size = MemorySize; this.CURRENT_TOP_ADDR = (uint)((size - 1) - max_ram_view); }
         public void GotoAddress(uint addr) { this.CURRENT_TOP_ADDR = (uint)addr & 0xFFFFFFF0; }
@@ -93,11 +97,6 @@ namespace RomCheater.Docking.UI
         static uint small_scroll_change = max_address_width * 1; // scrolls one line (when you clikc the up or down arrows)
         static uint medium_scroll_change = max_ram_view / 2; // scrolls half a 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
         private uint _CURRENT_TOP_ADDR;
         uint CURRENT_TOP_ADDR
         {
@@ -176,14 +175,14 @@ namespace RomCheater.Docking.UI
                 reader.ReadProcess = this.AcceptedProcess;
                 reader.OpenProcess();
                 int bytesReadSize;
-                byte[] data = reader.ReadProcessMemory(MemoryStart, MemorySize, out bytesReadSize);
+                byte[] data = reader.ReadProcessMemory(CURRENT_TOP_ADDR, max_ram_view, out bytesReadSize);
                 //this.Logger.LogDebugMessage(string.Format("GetMemory() -> Memory Size: {0}0x{2:X8}{1}", "{", "}", data.Length));
                 return data;
             }
             catch (Exception ex)
             {
                 logger.Error.WriteLine("{0}.GetMemory():{1}{2}", this.GetType().Name, System.Environment.NewLine, ex.ToString());
-                byte[] data = new byte[MemorySize];
+                byte[] data = new byte[max_ram_view];
                 for (int i = 0; i < data.Length; i++) { data[i] = 0x0; }
                 return data;
             }