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

--- trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/05/31 09:03:53	203
+++ trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/05/31 09:19:16	205
@@ -325,7 +325,7 @@
             uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;
 
             ////if (e.Type == ScrollEventType.EndScroll) return;
-            uint size = max_ram_view;
+            //uint size = max_ram_view;
 
             bool haveModifier = false;
             switch (e.Modifiers)
@@ -337,7 +337,7 @@
                             this.CURRENT_TOP_ADDR = 0; //NonHandledKeysAreBeingPressed = false; 
                             break;
                         case Keys.End:
-                            this.CURRENT_TOP_ADDR = (uint)((size - 1) - max_ram_view); //NonHandledKeysAreBeingPressed = false;
+                            this.CURRENT_TOP_ADDR = (uint)((MemorySize - 1) - max_ram_view); //NonHandledKeysAreBeingPressed = false;
                             break;
                         default:
                             //NonHandledKeysAreBeingPressed = true;
@@ -351,13 +351,27 @@
                 switch (e.KeyCode)
                 {
                     case Keys.Up:
-                        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))
+                        {
+                            this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
+                        }
+                        else
+                        {
+                            this.CURRENT_TOP_ADDR -= (uint)small_scroll_change; //NonHandledKeysAreBeingPressed = false;
+                        }
                         break;
                     case Keys.Down:
                         this.CURRENT_TOP_ADDR += (uint)small_scroll_change; //NonHandledKeysAreBeingPressed = false;
                         break;
                     case Keys.PageUp:
-                        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))
+                        {
+                            this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
+                        }
+                        else
+                        {
+                            this.CURRENT_TOP_ADDR -= (uint)(large_scroll_change); //NonHandledKeysAreBeingPressed = false;
+                        }
                         break;
                     case Keys.PageDown:
                         this.CURRENT_TOP_ADDR += (uint)(large_scroll_change); //NonHandledKeysAreBeingPressed = false;
@@ -369,8 +383,8 @@
             }
             if (this.CURRENT_TOP_ADDR < MemoryStart) this.CURRENT_TOP_ADDR = MemoryStart;
             //if (this.CURRENT_TOP_ADDR >= VTLB_VADDR_SIZE) this.CURRENT_TOP_ADDR = (size - 1) - max_ram_view;
-            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);
+            
             //this.UpdateEnabled = reenable;
         }
 
@@ -427,7 +441,7 @@
 
             this.UpdateMaxRamView();
             uint ORIGINAL_ADDR = this.CURRENT_TOP_ADDR;
-            uint size = MemorySize;
+            //uint size = MemorySize;
             if (e.Type == ScrollEventType.EndScroll) return;
 
             switch (e.Type)
@@ -469,7 +483,7 @@
             if (this.CURRENT_TOP_ADDR < 0) this.CURRENT_TOP_ADDR = 0;
             //if (this.CURRENT_TOP_ADDR >= VTLB_VADDR_SIZE) this.CURRENT_TOP_ADDR = VTLB_VADDR_SIZE - max_ram_view;
             //if (this.CURRENT_TOP_ADDR < 0 || this.CURRENT_TOP_ADDR >= VTLB_VADDR_SIZE) this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
-            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;
             //this.UpdateEnabled = reenable;
             //isScrolling = false;
         }

 

  ViewVC Help
Powered by ViewVC 1.1.22