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 359 by william, Sun Jun 10 00:47:58 2012 UTC vs.
Revision 360 by william, Sun Jun 10 01:24:25 2012 UTC

--- trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/06/10 01:09:58	359
+++ trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/06/10 01:24:25	360
@@ -1,5 +1,5 @@
 //#define DISABLE_GETFIRSTNONZEROBYTE_ONUPDATE_ACCEPTEDPROCESS // when defined will not call GetFirstNonZeroByte() when AcceptedProcess is updated and is not null
-//#define DISABLE_GETFIRSTNONZERO_BYTE // when defined will make GetFirstNonZeroByte() an empty void method
+#define DISABLE_GETFIRSTNONZERO_BYTE // when defined will make GetFirstNonZeroByte() an empty void method
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -69,6 +69,8 @@ namespace RomCheater.Docking.UI
                 provider.CloseProvider();
                 GotoAddress(addr);
             }
+#else
+            this.GotoImageBase();    
 #endif
         }
         #region IBrowseMemoryRegion
@@ -557,32 +559,32 @@ namespace RomCheater.Docking.UI
             //this.UpdateEnabled = reenable;
             //isScrolling = false;
         }
-
-        private void btnGotoImageBase_Click(object sender, EventArgs e)
-        {
+        private void GotoImageBase()
+        {            
             if (this.peData == null) return;
             object ImageBase = 0;
-            bool x86 = this.peData.Is32bitAssembly();
-            logger.VerboseDebug.WriteLine("UIMemoryViewer::btnGotoImageBase_Click(0x{0:x8})", ImageBase);
+            bool x86 = this.peData.Is32bitAssembly();            
             if (x86)
             {
                 ImageBase = this.peData.NTHeader.OptionalHeader32._ImageBase;
                 uint ib = Convert.ToUInt32(ImageBase);
-                //logger.Debug.WriteLine("UIMemoryViewer::btnGotoImageBase_Click(0x{0:x8})", ib);
+                logger.VerboseDebug.WriteLine("UIMemoryViewer::GotoImageBase(0x{0:x8})", ib);
                 txthexGoto.Value = ib;
-                btnGotoAddress.PerformClick();
             }
             else
             {
                 ImageBase = this.peData.NTHeader.OptionalHeader64._ImageBase;
                 ulong ib = Convert.ToUInt64(ImageBase);
+                logger.VerboseDebug.WriteLine("UIMemoryViewer::GotoImageBase(0x{0:x16})", ib);
                 txthexGoto.Value = (long)ib;
-                btnGotoAddress.PerformClick();
             }
-            IntPtr lpBaseAddress = this.AcceptedProcess.MainModule.BaseAddress;
-            int BaseAddress = lpBaseAddress.ToInt32();
-            txthexGoto.Value = BaseAddress;
-            btnGotoAddress.PerformClick();
+            
+            this.GotoAddress(txthexGoto.ToInt32());
+        }
+        private void btnGotoImageBase_Click(object sender, EventArgs e)
+        {
+            
+            this.GotoImageBase();
         }
 
     }