Skip to content

Commit

Permalink
Show things in the hex editor!
Browse files Browse the repository at this point in the history
  • Loading branch information
piepie62 committed Jan 8, 2019
1 parent 385d58e commit 65469a4
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 8 deletions.
1 change: 1 addition & 0 deletions include/gui/screen/HexEditScreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class HexEditScreen : public Screen
bool toggleBit(int selected, int offset);
bool editNumber(bool high, bool up);
bool checkValue(void);
void drawMeaning(void) const;
std::pair<std::string, SecurityLevel> selectedDescription;
std::vector<int> selectBytes;
std::shared_ptr<PKX> pkm;
Expand Down
106 changes: 98 additions & 8 deletions source/gui/screen/HexEditScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,7 @@ void HexEditScreen::draw() const
button->draw();
}
}
drawMeaning();
}

void HexEditScreen::update(touchPosition* touch)
Expand All @@ -1517,45 +1518,45 @@ void HexEditScreen::update(touchPosition* touch)

if (down & KEY_TOUCH && level < UNRESTRICTED)
{
if (touch->px < 20 && touch->py < 20)
if (touch->px > 0 && touch->px < 30 && touch->py > 0 && touch->py < 30)
{
if (superSecretCornersPressed[0])
{
superSecretCornersPressed[4] = true;
}
superSecretCornersPressed[0] = true;
countDownSecretTimer = true;
superSecretTimer = 300;
superSecretTimer = 600;
}
else if (touch->px > 300 && touch->py < 20)
else if (touch->px > 290 && touch->px < 320 && touch->py < 30 && touch->py > 0)
{
if (superSecretCornersPressed[1])
{
superSecretCornersPressed[5] = true;
}
superSecretCornersPressed[1] = true;
countDownSecretTimer = true;
superSecretTimer = 300;
superSecretTimer = 600;
}
else if (touch->px < 20 && touch->py > 220)
else if (touch->px > 0 && touch->px < 30 && touch->py > 210 && touch->py < 240)
{
if (superSecretCornersPressed[2])
{
superSecretCornersPressed[6] = true;
}
superSecretCornersPressed[2] = true;
countDownSecretTimer = true;
superSecretTimer = 300;
superSecretTimer = 600;
}
else if (touch->px > 300 && touch->py > 220)
else if (touch->px > 290 && touch->px < 320 && touch->py > 210 && touch->py < 240)
{
if (superSecretCornersPressed[3])
{
superSecretCornersPressed[7] = true;
}
superSecretCornersPressed[3] = true;
countDownSecretTimer = true;
superSecretTimer = 300;
superSecretTimer = 600;
}
if (level == NORMAL)
{
Expand Down Expand Up @@ -1630,3 +1631,92 @@ void HexEditScreen::update(touchPosition* touch)
timerCount = 0;
}
}

void HexEditScreen::drawMeaning() const
{
size_t i = hid.fullIndex();
switch (pkm->generation())
{
case Generation::FOUR:
case Generation::FIVE:
switch (i)
{
case 0x8 ... 0x9:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::species(Configuration::getInstance().language(), pkm->species()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0xA ... 0xB:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::item(Configuration::getInstance().language(), pkm->heldItem()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0x15:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::ability(Configuration::getInstance().language(), pkm->ability()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0x28 ... 0x2F:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::move(Configuration::getInstance().language(), pkm->move((i - 0x5A) / 2)), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0x5F:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::game(Configuration::getInstance().language(), pkm->version()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0x44 ... 0x45:
if (pkm->generation() == Generation::FIVE)
{
break;
}
case 0x78 ... 0x79:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::location(Configuration::getInstance().language(), pkm->eggLocation(), pkm->generation()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0x46 ... 0x47:
if (pkm->generation() == Generation::FIVE)
{
break;
}
case 0x80 ... 0x81:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::location(Configuration::getInstance().language(), pkm->metLocation(), pkm->generation()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
}
break;
case Generation::SIX:
case Generation::SEVEN:
case Generation::LGPE:
switch (i)
{
case 0x8 ... 0x9:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::species(Configuration::getInstance().language(), pkm->species()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0xA ... 0xB:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::item(Configuration::getInstance().language(), pkm->heldItem()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0x14:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::ability(Configuration::getInstance().language(), pkm->ability()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0x5A ... 0x61:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::move(Configuration::getInstance().language(), pkm->move((i - 0x5A) / 2)), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0xDF:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::game(Configuration::getInstance().language(), pkm->version()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0x6A ... 0x71:
if (pkm->generation() == Generation::SEVEN)
{
Gui::dynamicText(GFX_BOTTOM, 100, i18n::move(Configuration::getInstance().language(), ((PK7*)pkm.get())->relearnMove((i - 0x5A) / 2)), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
}
else if (pkm->generation() == Generation::SIX)
{
Gui::dynamicText(GFX_BOTTOM, 100, i18n::move(Configuration::getInstance().language(), ((PK6*)pkm.get())->relearnMove((i - 0x5A) / 2)), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
}
else
{
Gui::dynamicText(GFX_BOTTOM, 100, i18n::move(Configuration::getInstance().language(), ((PB7*)pkm.get())->relearnMove((i - 0x5A) / 2)), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
}
break;
case 0xD8 ... 0xD9:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::location(Configuration::getInstance().language(), pkm->eggLocation(), pkm->generation()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
case 0xDA ... 0xDB:
Gui::dynamicText(GFX_BOTTOM, 100, i18n::location(Configuration::getInstance().language(), pkm->metLocation(), pkm->generation()), FONT_SIZE_12, FONT_SIZE_12, COLOR_WHITE);
break;
}
break;
default:
break;
}
}

0 comments on commit 65469a4

Please sign in to comment.