Skip to content

Commit

Permalink
update cheat list scrolling for expert mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvita committed Dec 21, 2020
1 parent 7d0fd02 commit ef57f09
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 13 deletions.
5 changes: 4 additions & 1 deletion source/guis/gui_about.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ void GuiAbout::onInput(u32 kdown) {
}
Debugger *l_debugger = new Debugger();
if (l_debugger->getRunningApplicationPID() != 0)
Gui::g_nextGui = GUI_CHEATS;
if (Config::getConfig()->easymode)
Gui::g_nextGui = GUI_FIRST_RUN;
else
Gui::g_nextGui = GUI_CHOOSE_MISSION;
else
Gui::g_nextGui = GUI_MAIN;
}
Expand Down
55 changes: 43 additions & 12 deletions source/guis/gui_cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1984,8 +1984,8 @@ void GuiCheats::onInput(u32 kdown)
m_selectedEntry--;

if (m_menuLocation == CHEATS)
if (m_selectedEntry == cheatListOffset && cheatListOffset > 0)
cheatListOffset--;
if (m_selectedEntry+1 == cheatListOffset && cheatListOffset > 0)
cheatListOffset-=8;
}

if (kdown & KEY_DOWN) //
Expand All @@ -2000,8 +2000,8 @@ void GuiCheats::onInput(u32 kdown)
if (m_selectedEntry < (m_cheatCnt - 1))
m_selectedEntry++;

if (m_selectedEntry == (cheatListOffset + 7) && cheatListOffset < (m_cheatCnt - 8))
cheatListOffset++;
if (m_selectedEntry == (cheatListOffset + 8) && cheatListOffset < (m_cheatCnt - 8))
cheatListOffset+=8;
}
}
// start mod
Expand Down Expand Up @@ -2908,18 +2908,49 @@ void GuiCheats::onInput(u32 kdown)

if ((kdown & KEY_ZR) && !(kheld & KEY_ZL))
{
m_addresslist_offset += 8;
if (m_addresslist_offset >= (m_memoryDump->size() / sizeof(u64)))
m_addresslist_offset -= 8;
if (m_selectedEntry + m_addresslist_offset + 1 > (m_memoryDump->size() / sizeof(u64)))
m_selectedEntry = (m_memoryDump->size() / sizeof(u64)) % 8 - 1;
// printf("%s\n", "ZR key pressed");
if (m_menuLocation == CHEATS)
{
cheatListOffset += 8;
m_selectedEntry += 8;
if (cheatListOffset >= m_cheatCnt)
{
cheatListOffset -= 8;
m_selectedEntry -= 8;
}
if (m_selectedEntry + 1 > m_cheatCnt)
m_selectedEntry = m_cheatCnt - 1;
}
else
{
m_addresslist_offset += 8;
if (m_addresslist_offset >= (m_memoryDump->size() / sizeof(u64)))
m_addresslist_offset -= 8;
if (m_selectedEntry + m_addresslist_offset + 1 > (m_memoryDump->size() / sizeof(u64)))
m_selectedEntry = (m_memoryDump->size() / sizeof(u64)) % 8 - 1;
// printf("%s\n", "ZR key pressed");
}
}

if ((kdown & KEY_ZR) && (kheld & KEY_ZL))
{
if (m_addresslist_offset >= 8)
m_addresslist_offset -= 8;
if (m_menuLocation == CHEATS)
{
if (cheatListOffset >= 8)
{
cheatListOffset -= 8;
m_selectedEntry -= 8;
}
else
{
cheatListOffset = 0;
m_selectedEntry = 0;
}
}
else
{
if (m_addresslist_offset >= 8)
m_addresslist_offset -= 8;
}
// printf("%s\n", "ZL key pressed");
}

Expand Down

0 comments on commit ef57f09

Please sign in to comment.