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

revision 202 by william, Thu May 31 08:38:16 2012 UTC revision 206 by william, Thu May 31 09:31:57 2012 UTC
# Line 43  namespace RomCheater.Docking.UI Line 43  namespace RomCheater.Docking.UI
43    
44              txtAddresses.MouseWheel += new MouseEventHandler(txtAddresses_MouseWheel);              txtAddresses.MouseWheel += new MouseEventHandler(txtAddresses_MouseWheel);
45              txtData.MouseWheel += new MouseEventHandler(txtData_MouseWheel);              txtData.MouseWheel += new MouseEventHandler(txtData_MouseWheel);
46          }          }
47    
48            private void GetFirstNonZeroByte()
49            {
50                if (!DesignMode)
51                {
52                    Sojaner.MemoryScanner.ProcessMemoryReader reader = new Sojaner.MemoryScanner.ProcessMemoryReader();
53                    reader.ReadProcess = this.AcceptedProcess;
54                    reader.OpenProcess();
55                    uint addr = 0;
56                    reader.ReadFirstNonZeroByte(MemoryStart, MemorySize, out addr);
57                    GotoAddress(addr);
58                }
59            }
60    
61          #region IProcessConfig Members          #region IProcessConfig Members
62          private Process _AcceptedProcess;          private Process _AcceptedProcess;
63          public Process AcceptedProcess          public Process AcceptedProcess
# Line 54  namespace RomCheater.Docking.UI Line 68  namespace RomCheater.Docking.UI
68                  _AcceptedProcess = value;                  _AcceptedProcess = value;
69                  update_timer.Enabled = (value != null);                  update_timer.Enabled = (value != null);
70                  UpdateEnabled = update_timer.Enabled;                  UpdateEnabled = update_timer.Enabled;
71                    if (value != null)
72                        GetFirstNonZeroByte();
73              }              }
74          }          }
75          #endregion          #endregion
# Line 61  namespace RomCheater.Docking.UI Line 77  namespace RomCheater.Docking.UI
77          public IConfigPlugin AcceptedPlugin { get; set; }          public IConfigPlugin AcceptedPlugin { get; set; }
78          #endregion          #endregion
79          #region IAcceptsMemoryRange members          #region IAcceptsMemoryRange members
80          private uint MemoryStart { get { return 0; } }          public uint MemoryStart { get { return 0; } }
81          private uint MemorySize { get { return int.MaxValue; } }          public uint MemorySize { get { return int.MaxValue; } }
82          #endregion          #endregion
83          public void GotoTop() { this.CURRENT_TOP_ADDR = 0; }          public void GotoTop() { this.CURRENT_TOP_ADDR = 0; }
84          public void GotoBottom() { uint size = MemorySize; this.CURRENT_TOP_ADDR = (uint)((size - 1) - max_ram_view); }          public void GotoBottom() { uint size = MemorySize; this.CURRENT_TOP_ADDR = (uint)((size - 1) - max_ram_view); }
# Line 308  namespace RomCheater.Docking.UI Line 324  namespace RomCheater.Docking.UI
324              uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;              uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;
325    
326              ////if (e.Type == ScrollEventType.EndScroll) return;              ////if (e.Type == ScrollEventType.EndScroll) return;
327              uint size = max_ram_view;              //uint size = max_ram_view;
328    
329              bool haveModifier = false;              bool haveModifier = false;
330              switch (e.Modifiers)              switch (e.Modifiers)
# Line 320  namespace RomCheater.Docking.UI Line 336  namespace RomCheater.Docking.UI
336                              this.CURRENT_TOP_ADDR = 0; //NonHandledKeysAreBeingPressed = false;                              this.CURRENT_TOP_ADDR = 0; //NonHandledKeysAreBeingPressed = false;
337                              break;                              break;
338                          case Keys.End:                          case Keys.End:
339                              this.CURRENT_TOP_ADDR = (uint)((size - 1) - max_ram_view); //NonHandledKeysAreBeingPressed = false;                              this.CURRENT_TOP_ADDR = (uint)((MemorySize - 1) - max_ram_view); //NonHandledKeysAreBeingPressed = false;
340                              break;                              break;
341                          default:                          default:
342                              //NonHandledKeysAreBeingPressed = true;                              //NonHandledKeysAreBeingPressed = true;
# Line 334  namespace RomCheater.Docking.UI Line 350  namespace RomCheater.Docking.UI
350                  switch (e.KeyCode)                  switch (e.KeyCode)
351                  {                  {
352                      case Keys.Up:                      case Keys.Up:
353                          this.CURRENT_TOP_ADDR -= (uint)small_scroll_change; //NonHandledKeysAreBeingPressed = false;                          if (this.CURRENT_TOP_ADDR == 0 && (this.CURRENT_TOP_ADDR - small_scroll_change > this.CURRENT_TOP_ADDR))
354                            {
355                                this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
356                            }
357                            else
358                            {
359                                this.CURRENT_TOP_ADDR -= (uint)small_scroll_change; //NonHandledKeysAreBeingPressed = false;
360                            }
361                          break;                          break;
362                      case Keys.Down:                      case Keys.Down:
363                          this.CURRENT_TOP_ADDR += (uint)small_scroll_change; //NonHandledKeysAreBeingPressed = false;                          this.CURRENT_TOP_ADDR += (uint)small_scroll_change; //NonHandledKeysAreBeingPressed = false;
364                          break;                          break;
365                      case Keys.PageUp:                      case Keys.PageUp:
366                          this.CURRENT_TOP_ADDR -= (uint)(large_scroll_change); //NonHandledKeysAreBeingPressed = false;                          if (this.CURRENT_TOP_ADDR == 0 && (this.CURRENT_TOP_ADDR - large_scroll_change > this.CURRENT_TOP_ADDR))
367                            {
368                                this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
369                            }
370                            else
371                            {
372                                this.CURRENT_TOP_ADDR -= (uint)(large_scroll_change); //NonHandledKeysAreBeingPressed = false;
373                            }
374                          break;                          break;
375                      case Keys.PageDown:                      case Keys.PageDown:
376                          this.CURRENT_TOP_ADDR += (uint)(large_scroll_change); //NonHandledKeysAreBeingPressed = false;                          this.CURRENT_TOP_ADDR += (uint)(large_scroll_change); //NonHandledKeysAreBeingPressed = false;
# Line 352  namespace RomCheater.Docking.UI Line 382  namespace RomCheater.Docking.UI
382              }              }
383              if (this.CURRENT_TOP_ADDR < MemoryStart) this.CURRENT_TOP_ADDR = MemoryStart;              if (this.CURRENT_TOP_ADDR < MemoryStart) this.CURRENT_TOP_ADDR = MemoryStart;
384              //if (this.CURRENT_TOP_ADDR >= VTLB_VADDR_SIZE) this.CURRENT_TOP_ADDR = (size - 1) - max_ram_view;              //if (this.CURRENT_TOP_ADDR >= VTLB_VADDR_SIZE) this.CURRENT_TOP_ADDR = (size - 1) - max_ram_view;
385              if (this.CURRENT_TOP_ADDR + max_ram_view >= MemorySize) this.CURRENT_TOP_ADDR = (size - 1);              if (this.CURRENT_TOP_ADDR + max_ram_view >= MemorySize) this.CURRENT_TOP_ADDR = (MemorySize - max_ram_view);
386                
387              //this.UpdateEnabled = reenable;              //this.UpdateEnabled = reenable;
388          }          }
389    
# Line 410  namespace RomCheater.Docking.UI Line 440  namespace RomCheater.Docking.UI
440    
441              this.UpdateMaxRamView();              this.UpdateMaxRamView();
442              uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;              uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;
443              uint size = MemorySize;              //uint size = MemorySize;
444              if (e.Type == ScrollEventType.EndScroll) return;              if (e.Type == ScrollEventType.EndScroll) return;
445    
446              switch (e.Type)              switch (e.Type)
# Line 452  namespace RomCheater.Docking.UI Line 482  namespace RomCheater.Docking.UI
482              if (this.CURRENT_TOP_ADDR < 0) this.CURRENT_TOP_ADDR = 0;              if (this.CURRENT_TOP_ADDR < 0) this.CURRENT_TOP_ADDR = 0;
483              //if (this.CURRENT_TOP_ADDR >= VTLB_VADDR_SIZE) this.CURRENT_TOP_ADDR = VTLB_VADDR_SIZE - max_ram_view;              //if (this.CURRENT_TOP_ADDR >= VTLB_VADDR_SIZE) this.CURRENT_TOP_ADDR = VTLB_VADDR_SIZE - max_ram_view;
484              //if (this.CURRENT_TOP_ADDR < 0 || this.CURRENT_TOP_ADDR >= VTLB_VADDR_SIZE) this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;              //if (this.CURRENT_TOP_ADDR < 0 || this.CURRENT_TOP_ADDR >= VTLB_VADDR_SIZE) this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
485              if (this.CURRENT_TOP_ADDR + max_ram_view >= MemorySize) this.CURRENT_TOP_ADDR = (size - 1) - max_ram_view;              if (this.CURRENT_TOP_ADDR + max_ram_view >= MemorySize) this.CURRENT_TOP_ADDR = MemorySize - max_ram_view;
486              //this.UpdateEnabled = reenable;              //this.UpdateEnabled = reenable;
487              //isScrolling = false;              //isScrolling = false;
488          }          }

Legend:
Removed from v.202  
changed lines
  Added in v.206

  ViewVC Help
Powered by ViewVC 1.1.22