detect jumping address and change mode accordingly

This commit is contained in:
LiquidFenrir 2017-12-16 04:14:21 +01:00
parent 37a9fa1bf4
commit 2be2826b0b

View File

@ -324,8 +324,17 @@ static void ProcessListMenu_MemoryViewer(const ProcessInfo *info)
void finishJumping(void) void finishJumping(void)
{ {
gotoAddress -= __builtin_bswap32((u32)menus[MENU_MODE_NORMAL].buf); gotoAddress = __builtin_bswap32(gotoAddress); // The data is edited in reverse, so it needs to be swapped before usage
menus[MENU_MODE_NORMAL].selected = __builtin_bswap32(gotoAddress); // The data is edited in reverse, so it needs to be swapped before usage
u32 codeEndAddress = codeStartAddress + codeTotalSize;
u32 heapEndAddress = heapStartAddress + heapTotalSize;
if(gotoAddress >= codeStartAddress && gotoAddress < codeEndAddress)
viewCode();
else if(gotoAddress >= heapStartAddress && gotoAddress < heapEndAddress)
viewHeap();
gotoAddress -= (u32)menus[MENU_MODE_NORMAL].buf;
menus[MENU_MODE_NORMAL].selected = gotoAddress;
menus[MENU_MODE_NORMAL].starti = totalRows; menus[MENU_MODE_NORMAL].starti = totalRows;
} }