/[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

revision 476 by william, Mon Jun 3 18:22:20 2013 UTC revision 477 by william, Mon Jun 3 18:35:45 2013 UTC
# Line 45  namespace RomCheater.Docking Line 45  namespace RomCheater.Docking
45  {  {
46      public partial class FloatingMemorySearcher : DockContent,      public partial class FloatingMemorySearcher : DockContent,
47         IAcceptsPlugin<IConfigPlugin>,         IAcceptsPlugin<IConfigPlugin>,
48          IAcceptsProcess,          IAcceptsProcess<Process>,
49          IAcceptsProcessAndConfig,          IAcceptsProcessAndConfig,
50          ISearchInProgress,          ISearchInProgress,
51          IAcceptsBrowseMemoryRegion,          IAcceptsBrowseMemoryRegion,
# Line 60  namespace RomCheater.Docking Line 60  namespace RomCheater.Docking
60          const bool USE_OLD_SEARCH_RESULTS_COMPRATOR_CODE = false;          const bool USE_OLD_SEARCH_RESULTS_COMPRATOR_CODE = false;
61          const bool USE_NONRANGE_SEARCH_RESULT_READER = false;          const bool USE_NONRANGE_SEARCH_RESULT_READER = false;
62          private bool DefaultUnsignedState = true; // set unsigned to true          private bool DefaultUnsignedState = true; // set unsigned to true
63          public FloatingMemorySearcher() { InitializeComponent(); this.AcceptedPlugin = null; OnBrowseMemoryRegion = null; this.ProcessPID = 0; SearchInProgess = false; Reload(); }          public FloatingMemorySearcher() { InitializeComponent(); this.AcceptedPlugin = null; OnBrowseMemoryRegion = null; this.AcceptedProcess = null; SearchInProgess = false; Reload(); }
64          public FloatingMemorySearcher(IConfigPlugin config) : this() { this.AcceptedPlugin = config; }          public FloatingMemorySearcher(IConfigPlugin config) : this() { this.AcceptedPlugin = config; }
65          public FloatingMemorySearcher(IConfigPlugin config, int pid) : this() { this.AcceptedPlugin = config; this.ProcessPID = pid; }          public FloatingMemorySearcher(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; }
66    
67          //new Action<int, string>(UpdateProgress) to use this as a delegate          //new Action<int, string>(UpdateProgress) to use this as a delegate
68          private void UpdateProgress(int value, string message)          private void UpdateProgress(int value, string message)
# Line 77  namespace RomCheater.Docking Line 77  namespace RomCheater.Docking
77          }          }
78    
79          #region IAcceptsProcess<Process> Members          #region IAcceptsProcess<Process> Members
80          private int _ProcessPID;          private Process _AcceptedProcess;
81          public int ProcessPID { get { return _ProcessPID; } set { _ProcessPID = value; UpdateProcessPID(value); } }          public Process AcceptedProcess { get { return _AcceptedProcess; } set { _AcceptedProcess = value; UpdateAcceptedProcess(value); } }
82          #endregion          #endregion
83          #region IAcceptsPlugin<IConfigPlugin> Members          #region IAcceptsPlugin<IConfigPlugin> Members
84          private IConfigPlugin _AcceptedPlugin;          private IConfigPlugin _AcceptedPlugin;
# Line 98  namespace RomCheater.Docking Line 98  namespace RomCheater.Docking
98                  MemoryRangeSize = AcceptedPlugin.MemoryRangeStart + AcceptedPlugin.MemoryRangeSize;                  MemoryRangeSize = AcceptedPlugin.MemoryRangeStart + AcceptedPlugin.MemoryRangeSize;
99              }              }
100          }          }
101          private void UpdateProcessPID(int pid)          private void UpdateAcceptedProcess(Process process)
102          {          {            
103              this.lstResults.ProcessPID = pid;              this.lstResults.AcceptedProcess = process;            
104              this.lstPatchList.ProcessPID = pid;              this.lstPatchList.AcceptedProcess = process;
105  #if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && FORCE_USE_OF_MEMORYSIZECONSTANTS  #if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && FORCE_USE_OF_MEMORYSIZECONSTANTS
106              logger.Warn.WriteLine("FloatingMemorySearcher.UpdateAcceptedProcessAndConfig(IConfigPlugin config, Process process):");              logger.Warn.WriteLine("FloatingMemorySearcher.UpdateAcceptedProcessAndConfig(IConfigPlugin config, Process process):");
107              logger.Warn.WriteLine("Both USE_AUTOMATIC_MEMORY_SEARCH_RANGE and FORCE_USE_OF_MEMORYSIZECONSTANTS are defined");              logger.Warn.WriteLine("Both USE_AUTOMATIC_MEMORY_SEARCH_RANGE and FORCE_USE_OF_MEMORYSIZECONSTANTS are defined");
# Line 423  namespace RomCheater.Docking Line 423  namespace RomCheater.Docking
423          }          }
424          private bool ShouldUpdateResults()          private bool ShouldUpdateResults()
425          {          {
426              if (this.ProcessPID == 0) return false;              if (this.AcceptedProcess == null) return false;
427              if (SearchWorkerThread.IsBusy) return false;              if (SearchWorkerThread.IsBusy) return false;
428              //if (JokerSearchWorker.IsBusy) return false;              //if (JokerSearchWorker.IsBusy) return false;
429              if (this.IsResultsUpdateFrozen) return false;              if (this.IsResultsUpdateFrozen) return false;
430              if (mnuAddedResults.Visible) return false;              if (mnuAddedResults.Visible) return false;
431              if (mnuResults.Visible) return false;              if (mnuResults.Visible) return false;
432              if (Process.GetProcessById(this.ProcessPID) == null) return false;              if (Process.GetProcessById(this.AcceptedProcess.Id) == null) return false;
433              if (lstResults.Items.Count > 0) return true;              if (lstResults.Items.Count > 0) return true;
434              if (lstPatchList.Items.Count > 0) return true;              if (lstPatchList.Items.Count > 0) return true;
435              return false;              return false;
# Line 677  namespace RomCheater.Docking Line 677  namespace RomCheater.Docking
677          private void ThawResultsUpdate()          private void ThawResultsUpdate()
678          {          {
679              this.IsResultsUpdateFrozen = false;              this.IsResultsUpdateFrozen = false;
680              if (this.ProcessPID != 0)              if (this.AcceptedProcess != null)
681              {              {
682  #if !DO_NOT_SUSPEND_RESUME_THREAD_ON_FREEZE  #if !DO_NOT_SUSPEND_RESUME_THREAD_ON_FREEZE
683                  ThreadControl.ResumeProcess(this.ProcessPID);                      ThreadControl.ResumeProcess(this.AcceptedProcess.Id);
684  #endif  #endif
685              }              }
686          }          }
# Line 689  namespace RomCheater.Docking Line 689  namespace RomCheater.Docking
689          {          {
690              this.IsResultsUpdateFrozen = true;              this.IsResultsUpdateFrozen = true;
691              //this.IsResultsUpdateFrozen = false;              //this.IsResultsUpdateFrozen = false;
692              if (this.ProcessPID != 0)              if (this.AcceptedProcess != null)
693              {              {
694  #if !DO_NOT_SUSPEND_RESUME_THREAD_ON_FREEZE  #if !DO_NOT_SUSPEND_RESUME_THREAD_ON_FREEZE
695                  ThreadControl.SuspendProcess(this.ProcessPID);                  ThreadControl.SuspendProcess(this.AcceptedProcess.Id);
696  #endif  #endif
697              }              }
698          }          }
# Line 1019  namespace RomCheater.Docking Line 1019  namespace RomCheater.Docking
1019              //if (SearchArgs == null) return;              //if (SearchArgs == null) return;
1020              try              try
1021              {              {
1022                  lstPatchList.ProcessID = this.ProcessPID;                  lstPatchList.ProcessID = this.AcceptedProcess.Id;
1023                  this.FreezeResultsUpdate();                  this.FreezeResultsUpdate();
1024                  for (int i = 0; i < lstPatchList.SelectedIndices.Count; i++)                  for (int i = 0; i < lstPatchList.SelectedIndices.Count; i++)
1025                  {                  {
# Line 1041  namespace RomCheater.Docking Line 1041  namespace RomCheater.Docking
1041              //if (SearchArgs == null) return;              //if (SearchArgs == null) return;
1042              try              try
1043              {              {
1044                  lstPatchList.ProcessID = this.ProcessPID;                  lstPatchList.ProcessID = this.AcceptedProcess.Id;
1045                  this.FreezeResultsUpdate();                  this.FreezeResultsUpdate();
1046                  for (int i = 0; i < lstPatchList.SelectedIndices.Count; i++)                  for (int i = 0; i < lstPatchList.SelectedIndices.Count; i++)
1047                  {                  {
# Line 2545  namespace RomCheater.Docking Line 2545  namespace RomCheater.Docking
2545              new Action<int, string>(UpdateProgress).Invoke(0, string.Empty);              new Action<int, string>(UpdateProgress).Invoke(0, string.Empty);
2546              grpDataType.Enabled = false;              grpDataType.Enabled = false;
2547              // resume process on reset, incase it was suspended              // resume process on reset, incase it was suspended
2548              ThreadControl.ResumeProcess(this.ProcessPID);              ThreadControl.ResumeProcess(this.AcceptedProcess.Id);
2549              //Application.DoEvents();              //Application.DoEvents();
2550              this.Refresh();              this.Refresh();
2551          }          }
# Line 2567  namespace RomCheater.Docking Line 2567  namespace RomCheater.Docking
2567          }          }
2568          private void search_progress_updater_Tick(object sender, EventArgs e)          private void search_progress_updater_Tick(object sender, EventArgs e)
2569          {          {
2570              if ((this.ProcessPID == 0) || Process.GetProcessById(this.ProcessPID) == null)              if ((this.AcceptedProcess ==null) || Process.GetProcessById(this.AcceptedProcess.Id) == null)
2571              {              {
2572                  SearchWorkerThread.CancelAsync();                  SearchWorkerThread.CancelAsync();
2573                  //JokerSearchWorker.CancelAsync();                  //JokerSearchWorker.CancelAsync();

Legend:
Removed from v.476  
changed lines
  Added in v.477

  ViewVC Help
Powered by ViewVC 1.1.22