Skip to content

Commit

Permalink
NotA and NotAB changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvita committed Mar 1, 2022
1 parent 7c47355 commit 7ce486a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 13 deletions.
1 change: 1 addition & 0 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ typedef enum
SEARCH_MODE_NONE,
SEARCH_MODE_NOT_POINTER,
SEARCH_MODE_NOTAB,
SEARCH_MODE_NOTA,
SEARCH_MODE_SAME_A,
SEARCH_MODE_SAME_B,
// SEARCH_MODE_DIFF_A,
Expand Down
49 changes: 36 additions & 13 deletions source/guis/gui_cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ void GuiCheats::draw()
else
{
static const char *const regionNames[] = {"HEAP", "MAIN", "HEAP + MAIN", "RAM", " "};
static const char *const modeNames[] = {"==", "!=", ">", "StateB", "<", "StateA", "A..B", "SAME", "DIFF", "+ +", "- -", "PTR", "A,B", "A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "SameA","SameB"};
static const char *const modeNames[] = {"==", "!=", ">", "StateB", "<", "StateA", "A..B", "SAME", "DIFF", "+ +", "- -", "PTR", "A,B", "A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "NotA", "SameA","SameB"};
ss.str("");
ss << "Search Type [ " << dataTypes[m_searchType] << " ]";
ss << " Search Mode [ " << modeNames[m_searchMode] << " ]";
Expand Down Expand Up @@ -1773,7 +1773,7 @@ void GuiCheats::drawEditExtraSearchValues()
}
else if ((i % 6) == 2)
{
static const char *const modeNames[] = {"==", "!=", ">", "StateB", "<", "StateA", "A..B", "SAME", "DIFF", "+ +", "- -", "PTR", "A,B","A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "SameA","SameB"};
static const char *const modeNames[] = {"==", "!=", ">", "StateB", "<", "StateA", "A..B", "SAME", "DIFF", "+ +", "- -", "PTR", "A,B","A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "NotA", "SameA","SameB"};
// if (M_ENTRY.type != SEARCH_TYPE_POINTER)
Gui::drawTextAligned(font20, c3, 160 + linegape * (1 + i / 6), cellColor, modeNames[m_multisearch.Entries[i / 6].mode], ALIGNED_CENTER);
}
Expand Down Expand Up @@ -2075,6 +2075,7 @@ void GuiCheats::MTsearchMemoryAddressesPrimary(Debugger *debugger, searchValue_t
case SEARCH_MODE_SAME:
case SEARCH_MODE_DIFF:
case SEARCH_MODE_NOTAB:
case SEARCH_MODE_NOTA:
case SEARCH_MODE_SAME_A:
case SEARCH_MODE_SAME_B:
case SEARCH_MODE_INC:
Expand Down Expand Up @@ -2174,7 +2175,7 @@ void GuiCheats::EditExtraSearchValues_input(u32 kdown, u32 kheld)
updatebookmark(true, false, true);
m_memoryDump = m_memoryDumpBookmark;
}
else if (m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA)
else if (m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_NOTA || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA)
{
if (m_memoryDump->size() == 0)
{
Expand Down Expand Up @@ -3062,7 +3063,7 @@ void GuiCheats::drawSearchRAMMenu()
Gui::drawRectangle(100, 135, Gui::g_framebuffer_width - 200, 1, currTheme.textColor);
{
static const char *const regionNames[] = {"HEAP", "MAIN", "HEAP + MAIN", "RAM", " "};
static const char *const modeNames[] = {"==", "!=", ">", "StateB", "<", "StateA", "A..B", "SAME", "DIFF", "+ +", "- -", "PTR", "A,B","A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "SameA","SameB"};
static const char *const modeNames[] = {"==", "!=", ">", "StateB", "<", "StateA", "A..B", "SAME", "DIFF", "+ +", "- -", "PTR", "A,B","A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "NotA", "SameA","SameB"};
ss.str("");
if (m_memoryDump1 != nullptr)
ss << "\uE132 Search Bookmark";
Expand Down Expand Up @@ -3090,8 +3091,8 @@ void GuiCheats::drawSearchRAMMenu()
Gui::drawTextAligned(font20, 1010, 160, m_searchMenuLocation == SEARCH_VALUE ? currTheme.selectedColor : currTheme.textColor, "VALUE", ALIGNED_CENTER);

static const char *const typeNames[] = {"u8", "s8", "u16", "s16", "u32", "s32", "u64", "s64", "flt", "dbl", "void*"};
static const char *const modeNames[] = {"==", "!=", ">", "StateB", "<", "StateA", "A..B", "SAME", "DIFF", "+ +", "- -", "PTR", "A,B","A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "SameA","SameB"};
static const char *const modeNames1[] = {"==", "!=", ">", "StateA", "<", "", "A..B", "", "Unknown", "? +", "? -", "PTR", "A,B","A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "SameA","SameB"};
static const char *const modeNames[] = {"==", "!=", ">", "StateB", "<", "StateA", "A..B", "SAME", "DIFF", "+ +", "- -", "PTR", "A,B","A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "NotA", "SameA","SameB"};
static const char *const modeNames1[] = {"==", "!=", ">", "StateA", "<", "", "A..B", "", "Unknown", "? +", "? -", "PTR", "A,B","A,,B", "+ + Val", "- - Val", " ", "~PTR", "NotAB", "NotA", "SameA","SameB"};
static const char *const regionNames[] = {"HEAP", "MAIN", "HEAP + MAIN", "RAM"};

switch (m_searchMenuLocation) // search menu
Expand Down Expand Up @@ -3172,8 +3173,8 @@ void GuiCheats::drawSearchRAMMenu()
ALIGNED_CENTER);

//Gui::drawRectangle(300, 250, Gui::g_framebuffer_width - 600, 80, currTheme.separatorColor);
if (m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA) {m_selectedEntry = 1;};
if (!(m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA) || m_use_range)
if (m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_NOTA || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA) {m_selectedEntry = 1;};
if (!(m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_NOTA || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA) || m_use_range)
{
Gui::drawRectangle(300, 327, Gui::g_framebuffer_width - 600, 3, currTheme.textColor);
if (m_searchValueFormat == FORMAT_DEC)
Expand Down Expand Up @@ -3205,7 +3206,7 @@ void GuiCheats::drawSearchRAMMenu()
if (cursorBlinkCnt++ % 20 > 10 && m_selectedEntry == 0 && (m_searchValueIndex == 0))
Gui::drawRectangled(312 + strWidth, 285, 3, 35, currTheme.highlightColor);

if (m_searchMode == SEARCH_MODE_RANGE || m_searchMode == SEARCH_MODE_TWO_VALUES ||m_searchMode == SEARCH_MODE_TWO_VALUES_PLUS || (m_use_range && (m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA)) )
if (m_searchMode == SEARCH_MODE_RANGE || m_searchMode == SEARCH_MODE_TWO_VALUES ||m_searchMode == SEARCH_MODE_TWO_VALUES_PLUS || (m_use_range && (m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_NOTA || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA)) )
{
ss.str("");
if (m_searchValueFormat == FORMAT_DEC)
Expand Down Expand Up @@ -4534,6 +4535,7 @@ void GuiCheats::onInput(u32 kdown)
removef(EDIZON_DIR "/memdump1.dat");
removef(EDIZON_DIR "/memdump1a.dat");
removef(EDIZON_DIR "/datadump2.dat");
removef(EDIZON_DIR "/datadump2B.dat");
removef(EDIZON_DIR "/datadump2.datA");
removef(EDIZON_DIR "/datadump2.datB");
// removef(EDIZON_DIR "/memdump2.dat");
Expand Down Expand Up @@ -5018,7 +5020,7 @@ void GuiCheats::onInput(u32 kdown)
if (m_searchMode == SEARCH_MODE_SAME) {
MemoryDump *newdataDump = new MemoryDump(EDIZON_DIR "/datadump2.dat", DumpType::DATA, false);
MemoryDump *newdataDumpB = new MemoryDump(EDIZON_DIR "/datadump2B.dat", DumpType::DATA, false);
if (newdataDump->size() == newdataDumpB->size())
if (newdataDump->size() == newdataDumpB->size() && newdataDump->size() != 0)
m_searchMode = SEARCH_MODE_SAME_A;
delete newdataDump;
delete newdataDumpB;
Expand All @@ -5040,8 +5042,17 @@ void GuiCheats::onInput(u32 kdown)
};
} else if (kdown & KEY_DDOWN) {
if (m_searchMode == SEARCH_MODE_DIFF)
m_searchMode = SEARCH_MODE_NOTAB;
else
m_searchMode = SEARCH_MODE_NOTA;
else if (m_searchMode == SEARCH_MODE_NOTA) {
MemoryDump *newdataDump = new MemoryDump(EDIZON_DIR "/datadump2.dat", DumpType::DATA, false);
MemoryDump *newdataDumpB = new MemoryDump(EDIZON_DIR "/datadump2B.dat", DumpType::DATA, false);
if (newdataDump->size() == newdataDumpB->size() && newdataDump->size() != 0)
m_searchMode = SEARCH_MODE_NOTAB;
else
m_searchMode = SEARCH_MODE_DIFF;
delete newdataDump;
delete newdataDumpB;
} else
m_searchMode = SEARCH_MODE_DIFF;
} else if (kdown & KEY_DLEFT) {
if (m_searchMode == SEARCH_MODE_DEC)
Expand Down Expand Up @@ -5233,7 +5244,7 @@ void GuiCheats::onInput(u32 kdown)
if (m_memoryDump1 != nullptr) {
updatebookmark(true, false, true);
m_memoryDump = m_memoryDumpBookmark;
} else if (m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_INC_BY || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DEC_BY || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA) {
} else if (m_searchMode == SEARCH_MODE_SAME || m_searchMode == SEARCH_MODE_DIFF || m_searchMode == SEARCH_MODE_NOTAB || m_searchMode == SEARCH_MODE_NOTA || m_searchMode == SEARCH_MODE_SAME_A || m_searchMode == SEARCH_MODE_SAME_B || m_searchMode == SEARCH_MODE_INC || m_searchMode == SEARCH_MODE_INC_BY || m_searchMode == SEARCH_MODE_DEC || m_searchMode == SEARCH_MODE_DEC_BY || m_searchMode == SEARCH_MODE_DIFFA || m_searchMode == SEARCH_MODE_SAMEA) {
if (m_memoryDump->size() == 0) {
delete m_memoryDump;
m_use_range = false;
Expand Down Expand Up @@ -5823,6 +5834,7 @@ void GuiCheats::searchMemoryAddressesPrimary(Debugger *debugger, searchValue_t s
case SEARCH_MODE_SAME:
case SEARCH_MODE_DIFF:
case SEARCH_MODE_NOTAB:
case SEARCH_MODE_NOTA:
case SEARCH_MODE_SAME_A:
case SEARCH_MODE_SAME_B:
case SEARCH_MODE_INC:
Expand Down Expand Up @@ -6095,6 +6107,7 @@ void GuiCheats::searchMemoryAddressesSecondary(Debugger *debugger, searchValue_t
break;
case SEARCH_MODE_DIFF:
case SEARCH_MODE_NOTAB:
case SEARCH_MODE_NOTA:
if (value._s64 != searchValue1._s64)
{
newDump->addData((u8 *)&address, sizeof(u64));
Expand Down Expand Up @@ -6440,6 +6453,14 @@ void GuiCheats::searchMemoryAddressesSecondary2(Debugger *debugger, searchValue_
}
break;
case SEARCH_MODE_NOTAB:
if ((value._s64 != prevalue._s64) && (value._s64 != valueB._s64) && ((value._s64 >= searchValue1._s64 && value._s64 <= searchValue2._s64) || !m_use_range)) {
newDump->addData((u8 *)&address, sizeof(u64));
newdataDump->addData((u8 *)&prevalue, sizeof(u64));
newdataDumpB->addData((u8 *)&valueB, sizeof(u64));
newhelperinfo.count++;
}
break;
case SEARCH_MODE_NOTA:
if ((value._s64 != prevalue._s64) && ((value._s64 >= searchValue1._s64 && value._s64 <= searchValue2._s64) || !m_use_range)) {
newDump->addData((u8 *)&address, sizeof(u64));
newdataDump->addData((u8 *)&prevalue, sizeof(u64));
Expand Down Expand Up @@ -6757,6 +6778,7 @@ void GuiCheats::searchMemoryValuesSecondary(Debugger *debugger, searchType_t sea
}
break;
case SEARCH_MODE_NOTAB:
case SEARCH_MODE_NOTA:
if ((newValue._u64 != oldValue._u64) && (newValue._u64 <= m_heapBaseAddr || newValue._u64 >= (m_heapEnd))) {
addrDump->addData((u8 *)&addr, sizeof(u64));
newMemDump->addData((u8 *)&oldValue, sizeof(u64));
Expand Down Expand Up @@ -7158,6 +7180,7 @@ void GuiCheats::searchMemoryValuesTertiary(Debugger *debugger, searchValue_t sea
}
break;
case SEARCH_MODE_NOTAB:
case SEARCH_MODE_NOTA:
if ((value._s64 != oldvalue._s64)) // && (value._u64 <= m_heapBaseAddr || value._u64 >= (m_heapEnd)))
{
newDump->addData((u8 *)&address, sizeof(u64));
Expand Down

0 comments on commit 7ce486a

Please sign in to comment.