Skip to content

Commit

Permalink
Bookmark added from memory editor inherit pointer chain that was used…
Browse files Browse the repository at this point in the history
… as starting address
  • Loading branch information
tomvita committed Aug 12, 2020
1 parent 26932ce commit ce67d2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/guis/gui_cheats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class GuiCheats : public Gui
u64 m_numoffset = 3;
u64 m_max_source = 200;
u64 m_max_depth = 2;
u64 m_max_range = 0x300;
u64 m_max_range = 0x800;
u64 m_EditorBaseAddr = 0;
u64 m_mainBaseAddr;
u64 m_mainend;
Expand All @@ -90,7 +90,7 @@ class GuiCheats : public Gui
u64 m_numoffset = 3;
u64 m_max_source = 200;
u64 m_max_depth = 2;
u64 m_max_range = 0x300;
u64 m_max_range = 0x800;
u64 m_low_main_heap_addr = 0x100000000;
u64 m_high_main_heap_addr = 0x10000000000;
u64 m_pointer_found = 0;
Expand Down
17 changes: 15 additions & 2 deletions source/guis/gui_cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,7 @@ void GuiCheats::onInput(u32 kdown)
if (kdown & KEY_RSTICK && m_memoryDump->getDumpInfo().dumpType == DumpType::ADDR)
{
m_memoryDump->getData((m_selectedEntry + m_addresslist_offset) * sizeof(u64), &m_EditorBaseAddr, sizeof(u64));
m_AttributeDumpBookmark->getData((m_selectedEntry + m_addresslist_offset) * sizeof(bookmark_t), &m_bookmark, sizeof(bookmark_t));
m_searchMenuLocation = SEARCH_editRAM;
m_selectedEntry = (m_EditorBaseAddr % 16) / 4 + 11;
}
Expand Down Expand Up @@ -2175,11 +2176,22 @@ void GuiCheats::onInput(u32 kdown)
bookmark.type = m_searchType;
Gui::requestKeyboardInput("Enter Label", "Enter Label to add to bookmark .", "", SwkbdType_QWERTY, bookmark.label, 18);
m_AttributeDumpBookmark->addData((u8 *)&bookmark, sizeof(bookmark_t));
m_memoryDumpBookmark->addData((u8 *)&address, sizeof(u64));
if (m_bookmark.pointer.depth > 0)
{
s64 offset = address - m_EditorBaseAddr + m_bookmark.pointer.offset[0];
if (offset >= 0 && offset < (s64)m_max_range)
{
memcpy(&(bookmark.pointer), &(m_bookmark.pointer), (m_bookmark.pointer.depth + 2) * 8);
bookmark.pointer.offset[0] = (u64)offset;
m_AttributeDumpBookmark->addData((u8 *)&bookmark, sizeof(bookmark_t));
m_memoryDumpBookmark->addData((u8 *)&address, sizeof(u64));
}
}
m_AttributeDumpBookmark->flushBuffer();
m_memoryDumpBookmark->flushBuffer();

(new Snackbar("Address added to bookmark!"))->show();
m_memoryDumpBookmark->addData((u8 *)&address, sizeof(u64));
m_memoryDumpBookmark->flushBuffer();
printf("%s\n", "PLUS key pressed");
}
if (kdown & KEY_ZR)
Expand Down Expand Up @@ -5194,6 +5206,7 @@ bool GuiCheats::reloadcheatsfromfile(u8 *buildID, u64 titleID)
//
reloadcheats();
}
return true;
}
void GuiCheats::reloadcheats()
{
Expand Down

0 comments on commit ce67d2a

Please sign in to comment.