2021-10-09 00:58:55 +02:00
|
|
|
#pragma once
|
|
|
|
|
2022-07-26 14:27:31 +02:00
|
|
|
#include "common/common.h"
|
2022-07-26 08:16:27 +02:00
|
|
|
#include "input/Input.h"
|
|
|
|
#include "utils/ScreenUtils.h"
|
|
|
|
#include "utils/WiiUScreen.h"
|
2022-07-28 14:33:27 +02:00
|
|
|
#include "version.h"
|
2022-07-26 08:16:27 +02:00
|
|
|
#include <stdint.h>
|
2021-10-09 00:58:55 +02:00
|
|
|
|
|
|
|
class ApplicationState {
|
|
|
|
public:
|
2021-10-15 15:41:16 +02:00
|
|
|
enum eSubState {
|
|
|
|
SUBSTATE_RUNNING,
|
|
|
|
SUBSTATE_RETURN,
|
2021-10-09 00:58:55 +02:00
|
|
|
};
|
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual ~ApplicationState() = default;
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual void render() = 0;
|
2021-10-09 01:24:12 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual eSubState update(Input *input) = 0;
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2021-10-16 13:03:32 +02:00
|
|
|
virtual void proccessMenuNavigationY(Input *input, int32_t maxOptionValue) {
|
2021-10-15 15:41:16 +02:00
|
|
|
if (input->data.buttons_d & Input::BUTTON_UP) {
|
2021-10-16 13:03:32 +02:00
|
|
|
this->selectedOptionY--;
|
2021-10-15 15:41:16 +02:00
|
|
|
} else if (input->data.buttons_d & Input::BUTTON_DOWN) {
|
2021-10-16 13:03:32 +02:00
|
|
|
this->selectedOptionY++;
|
2021-10-15 15:41:16 +02:00
|
|
|
}
|
2021-10-16 13:03:32 +02:00
|
|
|
if (this->selectedOptionY < 0) {
|
2022-07-26 09:24:06 +02:00
|
|
|
this->selectedOptionY = maxOptionValue - 1;
|
2021-10-16 13:03:32 +02:00
|
|
|
} else if (this->selectedOptionY >= maxOptionValue) {
|
|
|
|
this->selectedOptionY = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void proccessMenuNavigationX(Input *input, int32_t maxOptionValue) {
|
|
|
|
if (input->data.buttons_d & Input::BUTTON_LEFT) {
|
|
|
|
this->selectedOptionX--;
|
|
|
|
} else if (input->data.buttons_d & Input::BUTTON_RIGHT) {
|
|
|
|
this->selectedOptionX++;
|
|
|
|
}
|
2022-07-26 14:27:31 +02:00
|
|
|
|
2021-10-16 13:03:32 +02:00
|
|
|
if (this->selectedOptionX < 0) {
|
2022-07-26 14:27:31 +02:00
|
|
|
this->selectedOptionX = maxOptionValue - 1;
|
2021-10-16 13:03:32 +02:00
|
|
|
} else if (this->selectedOptionX >= maxOptionValue) {
|
|
|
|
this->selectedOptionX = 0;
|
2021-10-15 15:41:16 +02:00
|
|
|
}
|
|
|
|
}
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2022-07-26 09:24:06 +02:00
|
|
|
virtual bool buttonPressed(Input *input, Input::eButtons button) {
|
|
|
|
return input->data.buttons_d & button;
|
|
|
|
}
|
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual bool entrySelected(Input *input) {
|
|
|
|
return input->data.buttons_d & Input::BUTTON_A;
|
|
|
|
}
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual void printHeader() {
|
2022-08-06 22:06:41 +02:00
|
|
|
WiiUScreen::drawLine("WUDD - Wii U Disc Dumper v1.2.0" VERSION_EXTRA);
|
2021-10-15 15:41:16 +02:00
|
|
|
WiiUScreen::drawLine("==================");
|
|
|
|
WiiUScreen::drawLine("");
|
|
|
|
}
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual void printFooter() {
|
2022-07-26 09:24:06 +02:00
|
|
|
if (gRunFromHBL && !gBlockHomeButton) {
|
2022-07-26 14:27:31 +02:00
|
|
|
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_TV, 0, 25, "Press HOME to exit to HBL");
|
|
|
|
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_DRC, 0, 15, "Press HOME to exit to HBL");
|
2022-07-26 09:24:06 +02:00
|
|
|
} else if (gRunFromHBL && gBlockHomeButtonCooldown > 0) {
|
|
|
|
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_TV, 0, 25, "You can not exit while dumping.");
|
|
|
|
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_DRC, 0, 15, "You can not exit while dumping.");
|
|
|
|
gBlockHomeButtonCooldown--;
|
2022-07-26 14:27:31 +02:00
|
|
|
}
|
2021-10-16 13:27:19 +02:00
|
|
|
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_TV, 0, 27, "Created by Maschell, inspired by wudump from FIX94");
|
|
|
|
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_DRC, 0, 17, "Created by Maschell, inspired by wudump from FIX94");
|
2021-10-15 15:41:16 +02:00
|
|
|
}
|
2021-10-09 00:58:55 +02:00
|
|
|
|
|
|
|
|
2021-10-16 13:03:32 +02:00
|
|
|
int selectedOptionY = 0;
|
|
|
|
int selectedOptionX = 0;
|
2022-08-06 22:06:41 +02:00
|
|
|
};
|