win32: memView - update address range check in WM_CHAR handler

This commit is contained in:
gocha 2012-07-28 22:43:33 +00:00
parent e86533e8ff
commit 59aff514f3
1 changed files with 17 additions and 2 deletions

View File

@ -922,8 +922,23 @@ LRESULT CALLBACK MemView_ViewBoxProc(HWND hCtl, UINT uMsg, WPARAM wParam, LPARAM
}
else if(wnd->selAddress >= (wnd->address + 0x100))
{
wnd->address = min((u32)0xFFFFFF00, (wnd->address + 0x10));
SetScrollPos(hCtl, SB_VERT, ((wnd->address >> 4) & 0x000FFFFF), TRUE);
MemViewRegion& region = s_memoryRegions[wnd->region];
HWAddressType addrMin = (region.hardwareAddress) & 0xFFFFFF00;
HWAddressType addrMax = max(addrMin, (region.hardwareAddress + region.size - 0x100 - 1) & 0xFFFFFF00);
if (wnd->address + 0x10 <= addrMax)
{
wnd->address += 0x10;
SetScrollPos(hCtl, SB_VERT, (((wnd->address - region.hardwareAddress) >> 4) & 0x000FFFFF), TRUE);
}
else
{
switch(wnd->viewMode)
{
case 0: wnd->selAddress--; break;
case 1: wnd->selAddress -= 2; break;
case 2: wnd->selAddress -= 4; break;
}
}
}
}
}