/[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 205 by william, Thu May 31 09:19:16 2012 UTC
# Line 15  namespace RomCheater.Docking.UI Line 15  namespace RomCheater.Docking.UI
15  {  {
16      public partial class UIMemoryViewer : UserControl, IProcessConfig, IAcceptsPlugin<IConfigPlugin>//, IAcceptsMemoryRange      public partial class UIMemoryViewer : UserControl, IProcessConfig, IAcceptsPlugin<IConfigPlugin>//, IAcceptsMemoryRange
17      {      {
18            private bool first_load = true;
19          public UIMemoryViewer()          public UIMemoryViewer()
20          {          {
21              InitializeComponent();              InitializeComponent();
# Line 43  namespace RomCheater.Docking.UI Line 44  namespace RomCheater.Docking.UI
44    
45              txtAddresses.MouseWheel += new MouseEventHandler(txtAddresses_MouseWheel);              txtAddresses.MouseWheel += new MouseEventHandler(txtAddresses_MouseWheel);
46              txtData.MouseWheel += new MouseEventHandler(txtData_MouseWheel);              txtData.MouseWheel += new MouseEventHandler(txtData_MouseWheel);
47          }          }
48    
49            private void GetFirstNonZeroByte()
50            {
51                if (!DesignMode)
52                {
53                    Sojaner.MemoryScanner.ProcessMemoryReader reader = new Sojaner.MemoryScanner.ProcessMemoryReader();
54                    reader.ReadProcess = this.AcceptedProcess;
55                    reader.OpenProcess();
56                    uint addr = 0;
57                    reader.ReadFirstNonZeroByte(MemoryStart, MemorySize, out addr);
58                    GotoAddress(addr);
59                }
60            }
61    
62          #region IProcessConfig Members          #region IProcessConfig Members
63          private Process _AcceptedProcess;          private Process _AcceptedProcess;
64          public Process AcceptedProcess          public Process AcceptedProcess
# Line 54  namespace RomCheater.Docking.UI Line 69  namespace RomCheater.Docking.UI
69                  _AcceptedProcess = value;                  _AcceptedProcess = value;
70                  update_timer.Enabled = (value != null);                  update_timer.Enabled = (value != null);
71                  UpdateEnabled = update_timer.Enabled;                  UpdateEnabled = update_timer.Enabled;
72                    if (value != null)
73                        GetFirstNonZeroByte();
74              }              }
75          }          }
76          #endregion          #endregion
# Line 308  namespace RomCheater.Docking.UI Line 325  namespace RomCheater.Docking.UI
325              uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;              uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;
326    
327              ////if (e.Type == ScrollEventType.EndScroll) return;              ////if (e.Type == ScrollEventType.EndScroll) return;
328              uint size = max_ram_view;              //uint size = max_ram_view;
329    
330              bool haveModifier = false;              bool haveModifier = false;
331              switch (e.Modifiers)              switch (e.Modifiers)
# Line 320  namespace RomCheater.Docking.UI Line 337  namespace RomCheater.Docking.UI
337                              this.CURRENT_TOP_ADDR = 0; //NonHandledKeysAreBeingPressed = false;                              this.CURRENT_TOP_ADDR = 0; //NonHandledKeysAreBeingPressed = false;
338                              break;                              break;
339                          case Keys.End:                          case Keys.End:
340                              this.CURRENT_TOP_ADDR = (uint)((size - 1) - max_ram_view); //NonHandledKeysAreBeingPressed = false;                              this.CURRENT_TOP_ADDR = (uint)((MemorySize - 1) - max_ram_view); //NonHandledKeysAreBeingPressed = false;
341                              break;                              break;
342                          default:                          default:
343                              //NonHandledKeysAreBeingPressed = true;                              //NonHandledKeysAreBeingPressed = true;
# Line 334  namespace RomCheater.Docking.UI Line 351  namespace RomCheater.Docking.UI
351                  switch (e.KeyCode)                  switch (e.KeyCode)
352                  {                  {
353                      case Keys.Up:                      case Keys.Up:
354                          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))
355                            {
356                                this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
357                            }
358                            else
359                            {
360                                this.CURRENT_TOP_ADDR -= (uint)small_scroll_change; //NonHandledKeysAreBeingPressed = false;
361                            }
362                          break;                          break;
363                      case Keys.Down:                      case Keys.Down:
364                          this.CURRENT_TOP_ADDR += (uint)small_scroll_change; //NonHandledKeysAreBeingPressed = false;                          this.CURRENT_TOP_ADDR += (uint)small_scroll_change; //NonHandledKeysAreBeingPressed = false;
365                          break;                          break;
366                      case Keys.PageUp:                      case Keys.PageUp:
367                          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))
368                            {
369                                this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
370                            }
371                            else
372                            {
373                                this.CURRENT_TOP_ADDR -= (uint)(large_scroll_change); //NonHandledKeysAreBeingPressed = false;
374                            }
375                          break;                          break;
376                      case Keys.PageDown:                      case Keys.PageDown:
377                          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 383  namespace RomCheater.Docking.UI
383              }              }
384              if (this.CURRENT_TOP_ADDR < MemoryStart) this.CURRENT_TOP_ADDR = MemoryStart;              if (this.CURRENT_TOP_ADDR < MemoryStart) this.CURRENT_TOP_ADDR = MemoryStart;
385              //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;
386              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);
387                
388              //this.UpdateEnabled = reenable;              //this.UpdateEnabled = reenable;
389          }          }
390    
# Line 410  namespace RomCheater.Docking.UI Line 441  namespace RomCheater.Docking.UI
441    
442              this.UpdateMaxRamView();              this.UpdateMaxRamView();
443              uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;              uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;
444              uint size = MemorySize;              //uint size = MemorySize;
445              if (e.Type == ScrollEventType.EndScroll) return;              if (e.Type == ScrollEventType.EndScroll) return;
446    
447              switch (e.Type)              switch (e.Type)
# Line 452  namespace RomCheater.Docking.UI Line 483  namespace RomCheater.Docking.UI
483              if (this.CURRENT_TOP_ADDR < 0) this.CURRENT_TOP_ADDR = 0;              if (this.CURRENT_TOP_ADDR < 0) this.CURRENT_TOP_ADDR = 0;
484              //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;
485              //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;
486              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;
487              //this.UpdateEnabled = reenable;              //this.UpdateEnabled = reenable;
488              //isScrolling = false;              //isScrolling = false;
489          }          }

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

  ViewVC Help
Powered by ViewVC 1.1.22