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

Comparing trunk/RomCheater/Docking/FloatingMemorySearcher.cs (file contents):
Revision 398 by william, Wed Jun 20 12:16:34 2012 UTC vs.
Revision 399 by william, Wed Jun 20 13:24:49 2012 UTC

# Line 25 | Line 25 | using Sojaner.MemoryScanner.MemoryProvie
25   using RomCheater.PluginFramework.Events;
26   using System.Reflection;
27   using Sojaner.MemoryScanner;
28 + using System.Collections;
29  
30   namespace RomCheater.Docking
31   {
# Line 106 | Line 107 | namespace RomCheater.Docking
107  
108          }
109          #region ISearchInProgress members
110 <        public bool SearchInProgess { get; private set; }
110 >        private bool _SearchInProgess;
111 >        public bool SearchInProgess
112 >        {
113 >            get { return _SearchInProgess; }
114 >            private set
115 >            {
116 >                _SearchInProgess = value;
117 >                if (this.AcceptedPlugin != null)
118 >                    this.AcceptedPlugin.SetMemorySearchReference(this);
119 >            }
120 >        }
121          #endregion
122  
123          #region IAcceptsMemoryRange
# Line 1025 | Line 1036 | namespace RomCheater.Docking
1036              //List<ResultType<object>> tmp_Results = new List<ResultType<object>>();
1037              List<ResultType<object>> second_tmp_Results = new List<ResultType<object>>();
1038              const int ElementsBeforeDisplay = 100;
1028            //const double _UPDATE_DELAY = 1024.0;
1029            //double UPDATE_DELAY = 1;        
1030            //tmp_Results = SearchArgs.Results.GetRange(0,SearchArgs.Results.Count);
1031            //SearchArgs.Results = null;
1032            //SearchArgs.Results.Clear();
1033            // log options
1039              SearchArgs.LogSearchOptions();
1040              uint STEP_SIZE = (uint)SearchArgs.DataType / 8;
1041 +
1042 +            bool unsigned = SearchArgs.IsUnsignedDataType;
1043 +            SearchDataTypes sdt = SearchArgs.DataType;
1044              byte[] buffered_mem = new byte[(MemoryRangeSize - MemoryRangeStart)]; // throws OutOfMemoryException if size is over 2G
1045              using (GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
1046              {
# Line 1062 | Line 1070 | namespace RomCheater.Docking
1070                          {
1071                              using (ResultType<object> _tmp_result = new ResultType<object>())
1072                              {
1073 <                                switch (SearchArgs.DataType)
1073 >                                switch (sdt)
1074                                  {
1075                                      case SearchDataTypes._8bits:
1076 <                                        if (SearchArgs.IsUnsignedDataType) { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadByte(); }
1076 >                                        if (unsigned) { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadByte(); }
1077                                          else { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadSByte(); } break;
1078                                      case SearchDataTypes._16bits:
1079 <                                        if (SearchArgs.IsUnsignedDataType) { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadUInt16(); }
1079 >                                        if (unsigned) { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadUInt16(); }
1080                                          else { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadInt16(); } break;
1081                                      case SearchDataTypes._32bits:
1082 <                                        if (SearchArgs.IsUnsignedDataType) { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadUInt32(); }
1082 >                                        if (unsigned) { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadUInt32(); }
1083                                          else { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadInt32(); } break;
1084                                      case SearchDataTypes._64bits:
1085 <                                        if (SearchArgs.IsUnsignedDataType) { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadUInt64(); }
1085 >                                        if (unsigned) { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadUInt64(); }
1086                                          else { _tmp_result.Address = (uint)r_ms.BaseStream.Position; _tmp_result.Value = r_ms.ReadInt64(); } break;
1087                                  }
1088                                  //results_list.Add(_tmp_result);
1089                                  SearchArgs.Results.Add(_tmp_result);
1090                              }
1091 <                            double double_percent_done = 100.0 * (double)((double)r_ms.BaseStream.Position / (double)buffered_mem.Length);
1091 >                            double double_percent_done = 100.0 * (double)((double)r_ms.BaseStream.Position / (double)r_ms.BaseStream.Length);
1092                              int int_percent_done = (int)double_percent_done;
1093                              if (int_percent_done != Last_Whole_Percent_Done && r_ms.BaseStream.Position % ElementsBeforeDisplay == 0)
1094                              {
1095                                  resultsprogress.Value = int_percent_done;
1096 <                                resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", r_ms.BaseStream.Position);
1096 >                                resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", r_ms.BaseStream.Position + MemoryRangeStart);
1097                                  Last_Whole_Percent_Done = int_percent_done;
1098                                  //Application.DoEvents();
1099                              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines