Skip to content

Commit

Permalink
cheat status display
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvita committed Mar 22, 2021
1 parent 8fa94f5 commit e2852b6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
VERSION_MAJOR := 3
VERSION_MINOR := 8
VERSION_MICRO := 12
VERSION_MICRO := 13
NIGHTLY :=

APP_TITLE := EdiZon SE
Expand Down
1 change: 1 addition & 0 deletions include/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ typedef struct {
color_t selectedButtonColor;
color_t tooltipColor;
color_t tooltipTextColor;
color_t alert;
} theme_t;

extern theme_t currTheme;
Expand Down
2 changes: 1 addition & 1 deletion include/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define VERSION_STRING "3.8.12"
#define VERSION_STRING "3.8.13"
30 changes: 28 additions & 2 deletions source/guis/gui_cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,33 @@ void GuiCheats::draw()
Gui::drawTextAligned(font14, 768, 205, currTheme.textColor, ss.str().c_str(), ALIGNED_CENTER);
}
}
else
else if (m_menuLocation == CHEATS)
{
if (m_selectedEntry > m_cheatCnt - 1)
m_selectedEntry = m_cheatCnt - 1;
u32 cheatcount = 0;
u32 opcodeused = 0;
for (u32 i = 0; i < m_cheatCnt; i++)
{
if (m_cheats[i].enabled)
{
opcodeused += m_cheats[i].definition.num_opcodes;
cheatcount++;
}
}
s32 opcodeavailable = 1024 - opcodeused;
ss.str("");
ss << "Cheat " << std::dec << (m_selectedEntry + 1) << "/" << m_cheatCnt << " ";
ss << " Opcode count [ " << std::dec << m_cheats[m_selectedEntry].definition.num_opcodes << " ]";
ss << " Cheat enabled [ " << std::dec << cheatcount << " ]";
ss << " Opcode used [ " << std::dec << opcodeused << "/1024 ]";
ss << " Opcode available [ " << std::dec << opcodeavailable << " ]";
if (opcodeavailable < 0)
Gui::drawTextAligned(font14, 768, 205, currTheme.alert, ss.str().c_str(), ALIGNED_CENTER);
else
Gui::drawTextAligned(font14, 768, 205, currTheme.textColor, ss.str().c_str(), ALIGNED_CENTER);
}
else
{
static const char *const regionNames[] = {"HEAP", "MAIN", "HEAP + MAIN", "RAM", " "};
static const char *const modeNames[] = {"==", "!=", ">", "StateB", "<", "StateA", "A..B", "SAME", "DIFF", "+ +", "- -", "PTR", " "};
Expand Down Expand Up @@ -4399,7 +4425,7 @@ void GuiCheats::onInput(u32 kdown)
if (opcodecount > 0x400)
{
(new Snackbar("Total opcode count would exceed 1024!"))->show();
return;
// return;
}

dmntchtToggleCheat(m_cheats[m_selectedEntry].cheat_id);
Expand Down
6 changes: 4 additions & 2 deletions source/theme.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ void setTheme(ColorSetId colorSetId) {
.separatorColor = RGBA8(0xA0, 0xA0, 0xA0, 0xFF),
.selectedButtonColor = RGBA8(0xFD, 0xFD, 0xFD, 0xFF),
.tooltipColor = RGBA8(0xFF, 0xFF, 0xFF, 0xFF),
.tooltipTextColor = RGBA8(0x08, 0xC4, 0xD0, 0xFF)
.tooltipTextColor = RGBA8(0x08, 0xC4, 0xD0, 0xFF),
.alert = RGBA8(0xFF, 0x00, 0x00, 0xFF)
};
break;
case ColorSetId_Dark:
Expand All @@ -27,7 +28,8 @@ void setTheme(ColorSetId colorSetId) {
.separatorColor = RGBA8(0x60, 0x60, 0x60, 0xFF),
.selectedButtonColor = RGBA8(0x25, 0x26, 0x2A, 0xFF),
.tooltipColor = RGBA8(0x60, 0x60, 0x60, 0xFF),
.tooltipTextColor = RGBA8(0x14, 0xBD, 0xFE, 0xFF)
.tooltipTextColor = RGBA8(0x14, 0xBD, 0xFE, 0xFF),
.alert = RGBA8(0xFF, 0x00, 0x00, 0xFF)
};
break;
}
Expand Down

0 comments on commit e2852b6

Please sign in to comment.