/[RomCheater]/trunk/RomCheater/Docking/UI/UIMemoryViewer.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/UI/UIMemoryViewer.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/05/31 08:38:16	202
+++ trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/05/31 09:03:53	203
@@ -15,6 +15,7 @@
 {
     public partial class UIMemoryViewer : UserControl, IProcessConfig, IAcceptsPlugin<IConfigPlugin>//, IAcceptsMemoryRange
     {
+        private bool first_load = true;
         public UIMemoryViewer()
         {
             InitializeComponent();
@@ -43,7 +44,21 @@
 
             txtAddresses.MouseWheel += new MouseEventHandler(txtAddresses_MouseWheel);
             txtData.MouseWheel += new MouseEventHandler(txtData_MouseWheel);
-        } 
+        }
+
+        private void GetFirstNonZeroByte()
+        {
+            if (!DesignMode)
+            {
+                Sojaner.MemoryScanner.ProcessMemoryReader reader = new Sojaner.MemoryScanner.ProcessMemoryReader();
+                reader.ReadProcess = this.AcceptedProcess;
+                reader.OpenProcess();
+                uint addr = 0;
+                reader.ReadFirstNonZeroByte(MemoryStart, MemorySize, out addr);
+                GotoAddress(addr);
+            }
+        }
+
         #region IProcessConfig Members
         private Process _AcceptedProcess;
         public Process AcceptedProcess
@@ -54,6 +69,8 @@
                 _AcceptedProcess = value;
                 update_timer.Enabled = (value != null);
                 UpdateEnabled = update_timer.Enabled;
+                if (value != null)
+                    GetFirstNonZeroByte();
             }
         }
         #endregion

 

  ViewVC Help
Powered by ViewVC 1.1.22