Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Commit

Permalink
Hacky fix for back button and dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
FuryBaguette committed Apr 8, 2019
1 parent 6bfd346 commit 7c2f884
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Include/MainApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ class MainApplication : public pu::Application
{
public:
MainApplication();
void SetWaitBack(bool state);
private:
MainLayout *mainLayout;
bool waitBack = false;
};

void SetMainApplication(MainApplication *MainApp);
10 changes: 8 additions & 2 deletions Source/MainApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ void MainLayout::category_Click(AmiiboGame *game)
void MainLayout::item_Click(AmiiboFile *element)
{
if (!waitInput) {
mainapp->SetWaitBack(true);
int sopt = mainapp->CreateShowDialog("Use " + element->GetName() + " ?", "This will set the current Amiibo to " + element->GetName(), { "Yes", "No" }, true);
if (sopt < 0 || sopt == 1) return;
if (sopt == 0) copyFile(element->GetPath().c_str(), "sdmc:/amiibo.bin");
mainapp->SetWaitBack(false);
} else this->waitInput = false;
}

Expand All @@ -197,14 +198,19 @@ MainApplication::MainApplication()
this->SetOnInput([&](u64 Down, u64 Up, u64 Held, bool Touch)
{
if(Down & KEY_PLUS) this->Close();
else if (Down & KEY_Y) {
else if (Down & KEY_B && !this->waitBack) {
this->mainLayout->GetGamesMenu()->SetVisible(true);
this->mainLayout->SetElementOnFocus(this->mainLayout->GetGamesMenu());
this->mainLayout->GetAmiiboMenu()->SetVisible(false);
}
});
}

void MainApplication::SetWaitBack(bool state)
{
this->waitBack = state;
}

void SetMainApplication(MainApplication *MainApp)
{
mainapp = MainApp;
Expand Down

0 comments on commit 7c2f884

Please sign in to comment.