/[RomCheater]/trunk/RomCheater/Docking/FloatingMemorySearcher.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/FloatingMemorySearcher.cs

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

--- trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2012/06/05 08:52:07	287
+++ trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2012/06/05 09:01:43	288
@@ -68,6 +68,8 @@
             logger.Warn.WriteLine("FloatingMemorySearcher.UpdateAcceptedProcessAndConfig(IConfigPlugin config, Process process):");
             logger.Warn.WriteLine("Both USE_AUTOMATIC_MEMORY_SEARCH_RANGE and FORCE_USE_OF_MEMORYSIZECONSTANTS are defined");
             logger.Warn.WriteLine("FORCE_USE_OF_MEMORYSIZECONSTANTS will take precedence and will ignore the values supplied in the memeory search range");
+            txtMemoryRangeStart.Value = MemorySizeConstants.MinimumAddress;
+            txtMemoryRangeSize.Value = (MemorySizeConstants.MinimumAddress > 0) ? (uint)(MemorySizeConstants.MaximumAddress - MemorySizeConstants.MinimumAddress) : MemorySizeConstants.MaximumAddress;
 #endif
 #if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && !FORCE_USE_OF_MEMORYSIZECONSTANTS
             // code to automatically choose the best starting memory address and size
@@ -987,8 +989,8 @@
             provider.OpenProvider();
             int bytes_read = 0;
 
-            byte[] buffered_mem = new byte[txtMemorySize.Value]; // throws OutOfMemoryException if size is over 2G
-            provider.ReadProcessMemory((int)txtMemoryStart.Value, (uint)txtMemorySize.Value, out bytes_read, out buffered_mem);
+            byte[] buffered_mem = new byte[MemoryRangeSize]; // throws OutOfMemoryException if size is over 2G
+            provider.ReadProcessMemory((int)MemoryRangeStart, MemoryRangeSize, out bytes_read, out buffered_mem);
             provider.CloseProvider();
        
             if (buffered_mem.Length == 0) { logger.Warn.WriteLine("Buffered Memory is Zero Length."); return; }
@@ -1688,12 +1690,12 @@
 
         private void chkMemoryRangeExpertMode_CheckedChanged(object sender, EventArgs e)
         {
-            txtMemoryStart.ReadOnly = !chkMemoryRangeExpertMode.Checked;
-            txtMemorySize.ReadOnly = !chkMemoryRangeExpertMode.Checked;
+            txtMemoryRangeStart.ReadOnly = !chkMemoryRangeExpertMode.Checked;
+            txtMemoryRangeSize.ReadOnly = !chkMemoryRangeExpertMode.Checked;
         }
 
-        private void txtMemoryStart_ValueChanged(object sender, ValueChangedEventArgs e) { this.MemoryRangeStart = Convert.ToInt32(e.NewValue); }
-        private void txtMemorySize_ValueChanged(object sender, ValueChangedEventArgs e) { this.MemoryRangeSize = Convert.ToUInt32(e.NewValue); }
+        private void txtMemoryRangeStart_ValueChanged(object sender, ValueChangedEventArgs e) { this.MemoryRangeStart = Convert.ToInt32(e.NewValue); }
+        private void txtMemoryRangeSize_ValueChanged(object sender, ValueChangedEventArgs e) { this.MemoryRangeSize = Convert.ToUInt32(e.NewValue); }
                
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22