2021-04-07 00:23:23 +02:00
|
|
|
#include "ConfigUtils.h"
|
|
|
|
|
|
|
|
#include "../config/WUPSConfig.h"
|
|
|
|
#include "../globals.h"
|
|
|
|
#include "DrawUtils.h"
|
2022-05-14 14:00:20 +02:00
|
|
|
#include "hooks.h"
|
2022-02-04 16:25:44 +01:00
|
|
|
#include "logger.h"
|
2021-04-07 00:23:23 +02:00
|
|
|
|
|
|
|
#include <coreinit/screen.h>
|
2022-02-04 16:25:44 +01:00
|
|
|
#include <gx2/display.h>
|
2021-04-07 00:23:23 +02:00
|
|
|
#include <memory/mappedmemory.h>
|
|
|
|
#include <padscore/kpad.h>
|
2022-02-04 16:25:44 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <vpad/input.h>
|
2021-04-07 00:23:23 +02:00
|
|
|
|
2022-02-04 16:25:44 +01:00
|
|
|
#define COLOR_BACKGROUND Color(238, 238, 238, 255)
|
|
|
|
#define COLOR_TEXT Color(51, 51, 51, 255)
|
|
|
|
#define COLOR_TEXT2 Color(72, 72, 72, 255)
|
|
|
|
#define COLOR_DISABLED Color(255, 0, 0, 255)
|
|
|
|
#define COLOR_BORDER Color(204, 204, 204, 255)
|
2021-04-07 00:23:23 +02:00
|
|
|
#define COLOR_BORDER_HIGHLIGHTED Color(0x3478e4FF)
|
2022-02-04 16:25:44 +01:00
|
|
|
#define COLOR_WHITE Color(0xFFFFFFFF)
|
|
|
|
#define COLOR_BLACK Color(0, 0, 0, 255)
|
2021-04-07 00:23:23 +02:00
|
|
|
|
|
|
|
struct ConfigDisplayItem {
|
2021-09-25 14:26:18 +02:00
|
|
|
WUPSConfig *config{};
|
2021-04-07 00:23:23 +02:00
|
|
|
std::string name;
|
|
|
|
std::string author;
|
|
|
|
std::string version;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_BUTTONS_ON_SCREEN 8
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
static uint32_t remapWiiMoteButtons(uint32_t buttons) {
|
2021-04-07 00:23:23 +02:00
|
|
|
uint32_t conv_buttons = 0;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_BUTTON_LEFT)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_LEFT;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_BUTTON_RIGHT)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_RIGHT;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_BUTTON_DOWN)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_DOWN;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_BUTTON_UP)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_UP;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_BUTTON_PLUS)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_PLUS;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_BUTTON_B)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_B;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_BUTTON_A)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_A;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_BUTTON_MINUS)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_MINUS;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_BUTTON_HOME)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_HOME;
|
|
|
|
|
|
|
|
return conv_buttons;
|
|
|
|
}
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
static uint32_t remapClassicButtons(uint32_t buttons) {
|
2021-04-07 00:23:23 +02:00
|
|
|
uint32_t conv_buttons = 0;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_LEFT)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_LEFT;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_RIGHT)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_RIGHT;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_DOWN)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_DOWN;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_UP)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_UP;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_PLUS)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_PLUS;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_X)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_X;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_Y)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_Y;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_B)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_B;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_A)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_A;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_MINUS)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_MINUS;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_HOME)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_HOME;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_ZR)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_ZR;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_ZL)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_ZL;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_R)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_R;
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (buttons & WPAD_CLASSIC_BUTTON_L)
|
2021-04-07 00:23:23 +02:00
|
|
|
conv_buttons |= VPAD_BUTTON_L;
|
|
|
|
|
|
|
|
return conv_buttons;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfigUtils::displayMenu() {
|
|
|
|
std::vector<ConfigDisplayItem> configs;
|
2022-05-14 14:00:20 +02:00
|
|
|
for (auto &plugin : gLoadedPlugins) {
|
2021-04-07 00:23:23 +02:00
|
|
|
ConfigDisplayItem cfg;
|
2022-05-14 14:00:20 +02:00
|
|
|
cfg.name = plugin->metaInformation->getName();
|
|
|
|
cfg.author = plugin->metaInformation->getAuthor();
|
|
|
|
cfg.version = plugin->metaInformation->getVersion();
|
2021-04-07 00:23:23 +02:00
|
|
|
|
2022-05-14 14:00:20 +02:00
|
|
|
for (auto &hook : plugin->getPluginInformation()->getHookDataList()) {
|
|
|
|
|
|
|
|
if (hook->getType() == WUPS_LOADER_HOOK_GET_CONFIG /*WUPS_LOADER_HOOK_GET_CONFIG*/) {
|
|
|
|
if (hook->getFunctionPointer() == nullptr) {
|
2021-04-07 00:23:23 +02:00
|
|
|
break;
|
|
|
|
}
|
2022-05-14 14:00:20 +02:00
|
|
|
auto *cur_config = reinterpret_cast<WUPSConfig *>(((WUPSConfigHandle(*)())((uint32_t *) hook->getFunctionPointer()))());
|
2021-09-25 14:26:18 +02:00
|
|
|
if (cur_config == nullptr) {
|
2021-04-07 00:23:23 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
cfg.config = cur_config;
|
|
|
|
configs.push_back(cfg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-04 16:25:44 +01:00
|
|
|
ConfigDisplayItem *currentConfig = nullptr;
|
2021-09-25 14:26:18 +02:00
|
|
|
WUPSConfigCategory *currentCategory = nullptr;
|
2021-04-07 00:23:23 +02:00
|
|
|
|
|
|
|
uint32_t selectedBtn = 0;
|
2022-02-04 16:25:44 +01:00
|
|
|
uint32_t start = 0;
|
|
|
|
uint32_t end = MAX_BUTTONS_ON_SCREEN;
|
2021-04-07 00:23:23 +02:00
|
|
|
if (configs.size() < MAX_BUTTONS_ON_SCREEN) {
|
|
|
|
end = configs.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool redraw = true;
|
|
|
|
uint32_t buttonsTriggered;
|
|
|
|
uint32_t buttonsReleased;
|
|
|
|
|
|
|
|
VPADStatus vpad_data{};
|
|
|
|
VPADReadError vpad_error;
|
|
|
|
KPADStatus kpad_data{};
|
2022-02-11 22:18:15 +01:00
|
|
|
KPADError kpad_error;
|
2021-04-07 00:23:23 +02:00
|
|
|
|
2022-09-23 21:39:34 +02:00
|
|
|
int32_t prevSelectedItem = -1;
|
2022-09-23 21:39:02 +02:00
|
|
|
bool isItemMovementAllowed = true;
|
|
|
|
|
2021-04-07 00:23:23 +02:00
|
|
|
while (true) {
|
|
|
|
buttonsTriggered = 0;
|
2022-02-04 16:25:44 +01:00
|
|
|
buttonsReleased = 0;
|
2021-04-07 00:23:23 +02:00
|
|
|
|
|
|
|
VPADRead(VPAD_CHAN_0, &vpad_data, 1, &vpad_error);
|
|
|
|
if (vpad_error == VPAD_READ_SUCCESS) {
|
|
|
|
buttonsTriggered = vpad_data.trigger;
|
2022-02-04 16:25:44 +01:00
|
|
|
buttonsReleased = vpad_data.release;
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
2021-09-25 14:26:18 +02:00
|
|
|
if (KPADReadEx((KPADChan) i, &kpad_data, 1, &kpad_error) > 0) {
|
2022-09-19 15:57:10 +02:00
|
|
|
if (kpad_error == KPAD_ERROR_OK && kpad_data.extensionType != 0xFF) {
|
2021-04-07 00:23:23 +02:00
|
|
|
if (kpad_data.extensionType == WPAD_EXT_CORE || kpad_data.extensionType == WPAD_EXT_NUNCHUK) {
|
|
|
|
buttonsTriggered |= remapWiiMoteButtons(kpad_data.trigger);
|
|
|
|
buttonsReleased |= remapWiiMoteButtons(kpad_data.release);
|
|
|
|
} else {
|
|
|
|
buttonsTriggered |= remapClassicButtons(kpad_data.classic.trigger);
|
|
|
|
buttonsReleased |= remapClassicButtons(kpad_data.classic.release);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-19 21:02:25 +02:00
|
|
|
if (buttonsReleased & VPAD_BUTTON_HOME) {
|
2021-04-07 00:23:23 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-08-28 13:13:35 +02:00
|
|
|
if (configs.empty()) {
|
|
|
|
renderNoConfigFoundScreen();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-04-07 00:23:23 +02:00
|
|
|
if (!currentConfig || !currentConfig->config) {
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_DOWN) {
|
|
|
|
if (selectedBtn < configs.size() - 1) {
|
|
|
|
selectedBtn++;
|
|
|
|
redraw = true;
|
|
|
|
}
|
2021-09-25 14:26:18 +02:00
|
|
|
} else if (buttonsTriggered & VPAD_BUTTON_UP) {
|
2021-04-07 00:23:23 +02:00
|
|
|
if (selectedBtn > 0) {
|
|
|
|
selectedBtn--;
|
|
|
|
redraw = true;
|
|
|
|
}
|
|
|
|
}
|
2022-08-28 13:13:06 +02:00
|
|
|
if (buttonsTriggered & VPAD_BUTTON_A) {
|
2021-04-07 00:23:23 +02:00
|
|
|
currentConfig = &configs[selectedBtn];
|
2021-09-25 14:26:18 +02:00
|
|
|
if (currentConfig == nullptr) {
|
2021-04-07 00:23:23 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
selectedBtn = 0;
|
2022-02-04 16:25:44 +01:00
|
|
|
start = 0;
|
|
|
|
end = MAX_BUTTONS_ON_SCREEN;
|
2021-04-07 00:23:23 +02:00
|
|
|
|
|
|
|
auto cats = currentConfig->config->getCategories();
|
|
|
|
if (cats.size() < MAX_BUTTONS_ON_SCREEN) {
|
|
|
|
end = cats.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
redraw = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedBtn >= end) {
|
2022-02-04 16:25:44 +01:00
|
|
|
end = selectedBtn + 1;
|
2021-04-07 00:23:23 +02:00
|
|
|
start = end - MAX_BUTTONS_ON_SCREEN;
|
2021-09-25 14:26:18 +02:00
|
|
|
} else if (selectedBtn < start) {
|
2021-04-07 00:23:23 +02:00
|
|
|
start = selectedBtn;
|
2022-02-04 16:25:44 +01:00
|
|
|
end = start + MAX_BUTTONS_ON_SCREEN;
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (redraw) {
|
|
|
|
DrawUtils::beginDraw();
|
|
|
|
DrawUtils::clear(COLOR_BACKGROUND);
|
|
|
|
|
|
|
|
// draw buttons
|
|
|
|
uint32_t index = 8 + 24 + 8 + 4;
|
|
|
|
for (uint32_t i = start; i < end; i++) {
|
2022-08-28 13:13:06 +02:00
|
|
|
DrawUtils::setFontColor(COLOR_TEXT);
|
2021-04-07 00:23:23 +02:00
|
|
|
|
|
|
|
if (i == selectedBtn) {
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 4, COLOR_BORDER_HIGHLIGHTED);
|
2021-04-07 00:23:23 +02:00
|
|
|
} else {
|
2022-08-28 13:13:06 +02:00
|
|
|
DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 2, COLOR_BORDER);
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DrawUtils::setFontSize(24);
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::print(16 * 2, index + 8 + 24, configs[i].name.c_str());
|
2021-04-07 00:23:23 +02:00
|
|
|
uint32_t sz = DrawUtils::getTextWidth(configs[i].name.c_str());
|
|
|
|
DrawUtils::setFontSize(12);
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::print(16 * 2 + sz + 4, index + 8 + 24, configs[i].author.c_str());
|
|
|
|
DrawUtils::print(SCREEN_WIDTH - 16 * 2, index + 8 + 24, configs[i].version.c_str(), true);
|
2021-04-07 00:23:23 +02:00
|
|
|
index += 42 + 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawUtils::setFontColor(COLOR_TEXT);
|
|
|
|
|
|
|
|
// draw top bar
|
|
|
|
DrawUtils::setFontSize(24);
|
|
|
|
DrawUtils::print(16, 6 + 24, "Wii U Plugin System Config Menu");
|
|
|
|
DrawUtils::setFontSize(18);
|
2022-09-19 16:06:38 +02:00
|
|
|
DrawUtils::print(SCREEN_WIDTH - 16, 8 + 24, VERSION_FULL, true);
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::drawRectFilled(8, 8 + 24 + 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
|
|
|
|
|
|
|
// draw bottom bar
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::drawRectFilled(8, SCREEN_HEIGHT - 24 - 8 - 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::setFontSize(18);
|
|
|
|
DrawUtils::print(16, SCREEN_HEIGHT - 8, "\ue07d Navigate ");
|
|
|
|
|
|
|
|
// draw scroll indicator
|
|
|
|
DrawUtils::setFontSize(24);
|
|
|
|
if (end < configs.size()) {
|
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + 12, SCREEN_HEIGHT - 32, "\ufe3e", true);
|
|
|
|
}
|
|
|
|
if (start > 0) {
|
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + 12, 32 + 20, "\ufe3d", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// draw home button
|
|
|
|
DrawUtils::setFontSize(18);
|
2021-09-25 14:26:18 +02:00
|
|
|
const char *exitHint = "\ue044 Exit";
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(exitHint) / 2, SCREEN_HEIGHT - 8, exitHint, true);
|
|
|
|
|
|
|
|
DrawUtils::endDraw();
|
|
|
|
redraw = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
if (!currentCategory) {
|
|
|
|
auto cats = currentConfig->config->getCategories();
|
2021-04-07 00:23:23 +02:00
|
|
|
if (buttonsTriggered & VPAD_BUTTON_DOWN) {
|
|
|
|
if (selectedBtn < cats.size() - 1) {
|
|
|
|
selectedBtn++;
|
|
|
|
redraw = true;
|
|
|
|
}
|
2021-09-25 14:26:18 +02:00
|
|
|
} else if (buttonsTriggered & VPAD_BUTTON_UP) {
|
2021-04-07 00:23:23 +02:00
|
|
|
if (selectedBtn > 0) {
|
|
|
|
selectedBtn--;
|
|
|
|
redraw = true;
|
|
|
|
}
|
2021-09-25 14:26:18 +02:00
|
|
|
} else if (buttonsTriggered & VPAD_BUTTON_A) {
|
2021-04-07 00:23:23 +02:00
|
|
|
currentCategory = cats[selectedBtn];
|
2021-09-25 14:26:18 +02:00
|
|
|
if (currentCategory == nullptr) {
|
2022-04-22 22:55:53 +02:00
|
|
|
DEBUG_FUNCTION_LINE_ERR("currentCategory was NULL");
|
2021-04-07 00:23:23 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-09-23 21:39:34 +02:00
|
|
|
selectedBtn = 0;
|
|
|
|
start = 0;
|
|
|
|
end = MAX_BUTTONS_ON_SCREEN;
|
|
|
|
prevSelectedItem = -1;
|
2021-04-07 00:23:23 +02:00
|
|
|
|
|
|
|
auto items = currentCategory->getItems();
|
|
|
|
if (items.size() < MAX_BUTTONS_ON_SCREEN) {
|
|
|
|
end = items.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
redraw = true;
|
|
|
|
continue;
|
|
|
|
} else if (buttonsTriggered & VPAD_BUTTON_B) {
|
2022-02-04 16:25:44 +01:00
|
|
|
currentConfig = nullptr;
|
2021-04-07 00:23:23 +02:00
|
|
|
currentCategory = nullptr;
|
2022-02-04 16:25:44 +01:00
|
|
|
selectedBtn = 0;
|
|
|
|
start = 0;
|
|
|
|
end = MAX_BUTTONS_ON_SCREEN;
|
2021-04-07 00:23:23 +02:00
|
|
|
if (configs.size() < MAX_BUTTONS_ON_SCREEN) {
|
|
|
|
end = configs.size();
|
|
|
|
}
|
|
|
|
redraw = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedBtn >= end) {
|
2022-02-04 16:25:44 +01:00
|
|
|
end = selectedBtn + 1;
|
2021-04-07 00:23:23 +02:00
|
|
|
start = end - MAX_BUTTONS_ON_SCREEN;
|
2021-09-25 14:26:18 +02:00
|
|
|
} else if (selectedBtn < start) {
|
2021-04-07 00:23:23 +02:00
|
|
|
start = selectedBtn;
|
2022-02-04 16:25:44 +01:00
|
|
|
end = start + MAX_BUTTONS_ON_SCREEN;
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (redraw) {
|
|
|
|
DrawUtils::beginDraw();
|
|
|
|
DrawUtils::clear(COLOR_BACKGROUND);
|
|
|
|
|
|
|
|
// draw buttons
|
|
|
|
uint32_t index = 8 + 24 + 8 + 4;
|
|
|
|
for (uint32_t i = start; i < end; i++) {
|
|
|
|
DrawUtils::setFontColor(COLOR_TEXT);
|
|
|
|
|
|
|
|
if (i == selectedBtn) {
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 4, COLOR_BORDER_HIGHLIGHTED);
|
2021-04-07 00:23:23 +02:00
|
|
|
} else {
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 2, COLOR_BORDER);
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DrawUtils::setFontSize(24);
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::print(16 * 2, index + 8 + 24, cats[i]->getName().c_str());
|
2021-04-07 00:23:23 +02:00
|
|
|
index += 42 + 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawUtils::setFontColor(COLOR_TEXT);
|
|
|
|
|
|
|
|
// draw top bar
|
|
|
|
DrawUtils::setFontSize(24);
|
2022-09-19 21:47:09 +02:00
|
|
|
DrawUtils::print(16, 6 + 24, StringTools::truncate(currentConfig->config->getName(), 45).c_str());
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::setFontSize(18);
|
|
|
|
DrawUtils::print(SCREEN_WIDTH - 16, 8 + 24, currentConfig->version.c_str(), true);
|
|
|
|
DrawUtils::drawRectFilled(8, 8 + 24 + 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
|
|
|
|
|
|
|
// draw bottom bar
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::drawRectFilled(8, SCREEN_HEIGHT - 24 - 8 - 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::setFontSize(18);
|
|
|
|
DrawUtils::print(16, SCREEN_HEIGHT - 8, "\ue07d Navigate ");
|
|
|
|
|
|
|
|
// draw scroll indicator
|
|
|
|
DrawUtils::setFontSize(24);
|
|
|
|
if (end < configs.size()) {
|
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + 12, SCREEN_HEIGHT - 32, "\ufe3e", true);
|
|
|
|
}
|
|
|
|
if (start > 0) {
|
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + 12, 32 + 20, "\ufe3d", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// draw home button
|
|
|
|
DrawUtils::setFontSize(18);
|
2021-09-25 14:26:18 +02:00
|
|
|
const char *exitHint = "\ue044 Exit";
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(exitHint) / 2, SCREEN_HEIGHT - 8, exitHint, true);
|
|
|
|
|
|
|
|
DrawUtils::endDraw();
|
|
|
|
redraw = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<WUPSConfigItem *> config_items = currentCategory->getItems();
|
|
|
|
|
2022-09-23 21:39:02 +02:00
|
|
|
if (isItemMovementAllowed) {
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_DOWN) {
|
|
|
|
if (selectedBtn < config_items.size() - 1) {
|
|
|
|
selectedBtn++;
|
|
|
|
redraw = true;
|
|
|
|
}
|
|
|
|
} else if (buttonsTriggered & VPAD_BUTTON_UP) {
|
|
|
|
if (selectedBtn > 0) {
|
|
|
|
selectedBtn--;
|
|
|
|
redraw = true;
|
|
|
|
}
|
|
|
|
} else if (buttonsTriggered & VPAD_BUTTON_B) {
|
|
|
|
currentCategory = nullptr;
|
|
|
|
selectedBtn = 0;
|
|
|
|
start = 0;
|
|
|
|
end = MAX_BUTTONS_ON_SCREEN;
|
|
|
|
auto catSize = currentConfig->config->getCategories().size();
|
|
|
|
if (catSize < MAX_BUTTONS_ON_SCREEN) {
|
|
|
|
end = catSize;
|
|
|
|
}
|
2021-04-07 00:23:23 +02:00
|
|
|
redraw = true;
|
2022-09-23 21:39:02 +02:00
|
|
|
continue;
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WUPSConfigButtons pressedButtons = WUPS_CONFIG_BUTTON_NONE;
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_A) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_A;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_LEFT) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_LEFT;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_RIGHT) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_RIGHT;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_L) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_L;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_R) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_R;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_ZL) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_ZL;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_ZR) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_ZR;
|
|
|
|
}
|
2022-09-23 21:51:13 +02:00
|
|
|
if (buttonsTriggered & VPAD_BUTTON_X) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_Y;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_Y) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_X;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_STICK_L) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_STICK_L;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_STICK_R) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_STICK_R;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_PLUS) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_PLUS;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_MINUS) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_MINUS;
|
|
|
|
}
|
|
|
|
|
2022-09-23 21:39:02 +02:00
|
|
|
if (!isItemMovementAllowed) {
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_B) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_B;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_UP) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_UP;
|
|
|
|
}
|
|
|
|
if (buttonsTriggered & VPAD_BUTTON_DOWN) {
|
|
|
|
pressedButtons |= WUPS_CONFIG_BUTTON_UP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-07 00:23:23 +02:00
|
|
|
if (pressedButtons != WUPS_CONFIG_BUTTON_NONE) {
|
|
|
|
redraw = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedBtn >= end) {
|
2022-02-04 16:25:44 +01:00
|
|
|
end = selectedBtn + 1;
|
2021-04-07 00:23:23 +02:00
|
|
|
start = end - MAX_BUTTONS_ON_SCREEN;
|
2021-09-25 14:26:18 +02:00
|
|
|
} else if (selectedBtn < start) {
|
2021-04-07 00:23:23 +02:00
|
|
|
start = selectedBtn;
|
2022-02-04 16:25:44 +01:00
|
|
|
end = start + MAX_BUTTONS_ON_SCREEN;
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (redraw) {
|
2022-09-23 21:39:34 +02:00
|
|
|
if (prevSelectedItem != (int32_t) selectedBtn) {
|
|
|
|
if (prevSelectedItem >= 0) {
|
|
|
|
config_items[prevSelectedItem]->onSelected(false);
|
|
|
|
}
|
|
|
|
config_items[selectedBtn]->onSelected(true);
|
|
|
|
prevSelectedItem = (int32_t) selectedBtn;
|
|
|
|
}
|
|
|
|
|
2022-09-23 21:40:06 +02:00
|
|
|
if (pressedButtons != WUPS_CONFIG_BUTTON_NONE) {
|
|
|
|
config_items[selectedBtn]->onButtonPressed(pressedButtons);
|
|
|
|
}
|
|
|
|
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::beginDraw();
|
|
|
|
DrawUtils::clear(COLOR_BACKGROUND);
|
|
|
|
|
|
|
|
// draw buttons
|
|
|
|
uint32_t index = 8 + 24 + 8 + 4;
|
|
|
|
for (uint32_t i = start; i < end; i++) {
|
|
|
|
DrawUtils::setFontColor(COLOR_TEXT);
|
|
|
|
|
|
|
|
if (i == selectedBtn) {
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 4, COLOR_BORDER_HIGHLIGHTED);
|
2021-04-07 00:23:23 +02:00
|
|
|
} else {
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::drawRect(16, index, SCREEN_WIDTH - 16 * 2, 44, 2, COLOR_BORDER);
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DrawUtils::setFontSize(24);
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::print(16 * 2, index + 8 + 24, config_items[i]->getDisplayName().c_str());
|
2021-04-07 00:23:23 +02:00
|
|
|
if (i == selectedBtn) {
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::print(SCREEN_WIDTH - 16 * 2, index + 8 + 24, config_items[i]->getCurrentValueSelectedDisplay().c_str(), true);
|
|
|
|
} else {
|
|
|
|
DrawUtils::print(SCREEN_WIDTH - 16 * 2, index + 8 + 24, config_items[i]->getCurrentValueDisplay().c_str(), true);
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
index += 42 + 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawUtils::setFontColor(COLOR_TEXT);
|
|
|
|
|
2022-05-14 14:00:20 +02:00
|
|
|
auto headline = string_format("%s - %s", currentConfig->config->getName().c_str(), currentCategory->getName().c_str());
|
2021-04-07 00:23:23 +02:00
|
|
|
// draw top bar
|
|
|
|
DrawUtils::setFontSize(24);
|
2022-09-19 21:47:09 +02:00
|
|
|
DrawUtils::print(16, 6 + 24, StringTools::truncate(headline, 45).c_str());
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::drawRectFilled(8, 8 + 24 + 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
|
|
|
DrawUtils::setFontSize(18);
|
|
|
|
DrawUtils::print(SCREEN_WIDTH - 16, 8 + 24, currentConfig->version.c_str(), true);
|
|
|
|
|
|
|
|
// draw bottom bar
|
2021-09-25 14:26:18 +02:00
|
|
|
DrawUtils::drawRectFilled(8, SCREEN_HEIGHT - 24 - 8 - 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::setFontSize(18);
|
|
|
|
DrawUtils::print(16, SCREEN_HEIGHT - 8, "\ue07d Navigate ");
|
|
|
|
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 8, "\ue001 Back", true);
|
|
|
|
|
|
|
|
// draw scroll indicator
|
|
|
|
DrawUtils::setFontSize(24);
|
|
|
|
if (end < configs.size()) {
|
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + 12, SCREEN_HEIGHT - 32, "\ufe3e", true);
|
|
|
|
}
|
|
|
|
if (start > 0) {
|
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + 12, 32 + 20, "\ufe3d", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// draw home button
|
|
|
|
DrawUtils::setFontSize(18);
|
2021-09-25 14:26:18 +02:00
|
|
|
const char *exitHint = "\ue044 Exit";
|
2021-04-07 00:23:23 +02:00
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(exitHint) / 2, SCREEN_HEIGHT - 8, exitHint, true);
|
|
|
|
|
|
|
|
DrawUtils::endDraw();
|
2022-08-28 13:10:57 +02:00
|
|
|
redraw = pressedButtons != WUPS_CONFIG_BUTTON_NONE;
|
2022-09-23 21:39:02 +02:00
|
|
|
|
|
|
|
isItemMovementAllowed = config_items[selectedBtn]->isMovementAllowed();
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-04 16:25:44 +01:00
|
|
|
for (const auto &element : configs) {
|
|
|
|
for (const auto &cat : element.config->getCategories()) {
|
|
|
|
for (const auto &item : cat->getItems()) {
|
2021-09-25 14:26:18 +02:00
|
|
|
if (item->isDirty()) {
|
2021-04-07 00:23:23 +02:00
|
|
|
item->callCallback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-14 14:00:20 +02:00
|
|
|
CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_CONFIG_CLOSED);
|
2021-04-07 00:23:23 +02:00
|
|
|
|
2022-02-04 16:25:44 +01:00
|
|
|
for (const auto &element : configs) {
|
2021-04-07 00:23:23 +02:00
|
|
|
delete element.config;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-18 20:57:20 +02:00
|
|
|
#define __SetDCPitchReg ((void (*)(uint32_t, uint32_t))(0x101C400 + 0x1e714))
|
|
|
|
|
2021-09-25 14:26:18 +02:00
|
|
|
void ConfigUtils::openConfigMenu() {
|
2021-04-07 00:23:23 +02:00
|
|
|
bool wasHomeButtonMenuEnabled = OSIsHomeButtonMenuEnabled();
|
|
|
|
|
|
|
|
OSScreenInit();
|
|
|
|
|
|
|
|
uint32_t screen_buf0_size = OSScreenGetBufferSizeEx(SCREEN_TV);
|
|
|
|
uint32_t screen_buf1_size = OSScreenGetBufferSizeEx(SCREEN_DRC);
|
2022-02-04 16:25:44 +01:00
|
|
|
void *screenbuffer0 = MEMAllocFromMappedMemoryForGX2Ex(screen_buf0_size, 0x100);
|
|
|
|
void *screenbuffer1 = MEMAllocFromMappedMemoryForGX2Ex(screen_buf1_size, 0x100);
|
2021-04-07 00:23:23 +02:00
|
|
|
|
2022-09-18 20:57:20 +02:00
|
|
|
// Fix the TV buffer pitch if a 1080p buffer is used.
|
|
|
|
if (screen_buf0_size == 0x00FD2000) {
|
|
|
|
__SetDCPitchReg(SCREEN_TV, 1920);
|
|
|
|
}
|
|
|
|
|
2021-04-07 00:23:23 +02:00
|
|
|
bool skipScreen0Free = false;
|
|
|
|
bool skipScreen1Free = false;
|
|
|
|
|
|
|
|
if (!screenbuffer0 || !screenbuffer1) {
|
2021-09-25 14:26:18 +02:00
|
|
|
if (screenbuffer0 == nullptr) {
|
2022-05-14 14:00:20 +02:00
|
|
|
if (gStoredTVBuffer.buffer_size >= screen_buf0_size) {
|
|
|
|
screenbuffer0 = gStoredTVBuffer.buffer;
|
2021-04-07 00:23:23 +02:00
|
|
|
skipScreen0Free = true;
|
2022-04-22 22:55:53 +02:00
|
|
|
DEBUG_FUNCTION_LINE_VERBOSE("Use storedTVBuffer");
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
}
|
2021-09-25 14:26:18 +02:00
|
|
|
if (screenbuffer1 == nullptr) {
|
2022-05-14 14:00:20 +02:00
|
|
|
if (gStoredDRCBuffer.buffer_size >= screen_buf1_size) {
|
|
|
|
screenbuffer1 = gStoredDRCBuffer.buffer;
|
2021-04-07 00:23:23 +02:00
|
|
|
skipScreen1Free = true;
|
2022-04-22 22:55:53 +02:00
|
|
|
DEBUG_FUNCTION_LINE_VERBOSE("Use storedDRCBuffer");
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!screenbuffer0 || !screenbuffer1) {
|
2022-04-22 22:55:53 +02:00
|
|
|
DEBUG_FUNCTION_LINE_ERR("Failed to alloc buffers");
|
2021-04-07 00:23:23 +02:00
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OSScreenSetBufferEx(SCREEN_TV, screenbuffer0);
|
|
|
|
OSScreenSetBufferEx(SCREEN_DRC, screenbuffer1);
|
|
|
|
|
|
|
|
OSScreenEnableEx(SCREEN_TV, 1);
|
|
|
|
OSScreenEnableEx(SCREEN_DRC, 1);
|
|
|
|
|
|
|
|
// Clear screens
|
|
|
|
OSScreenClearBufferEx(SCREEN_TV, 0);
|
|
|
|
OSScreenClearBufferEx(SCREEN_DRC, 0);
|
|
|
|
|
|
|
|
// Flip buffers
|
|
|
|
OSScreenFlipBuffersEx(SCREEN_TV);
|
|
|
|
OSScreenFlipBuffersEx(SCREEN_DRC);
|
|
|
|
|
|
|
|
DrawUtils::initBuffers(screenbuffer0, screen_buf0_size, screenbuffer1, screen_buf1_size);
|
|
|
|
DrawUtils::initFont();
|
|
|
|
|
|
|
|
// disable the home button menu to prevent opening it when exiting
|
|
|
|
OSEnableHomeButtonMenu(false);
|
|
|
|
|
|
|
|
displayMenu();
|
|
|
|
|
|
|
|
OSEnableHomeButtonMenu(wasHomeButtonMenuEnabled);
|
|
|
|
|
|
|
|
DrawUtils::deinitFont();
|
|
|
|
|
2022-02-04 16:25:44 +01:00
|
|
|
error_exit:
|
2021-04-07 00:23:23 +02:00
|
|
|
|
2022-05-14 14:00:20 +02:00
|
|
|
if (gStoredTVBuffer.buffer != nullptr) {
|
|
|
|
GX2SetTVBuffer(gStoredTVBuffer.buffer, gStoredTVBuffer.buffer_size, static_cast<GX2TVRenderMode>(gStoredTVBuffer.mode),
|
|
|
|
gStoredTVBuffer.surface_format, gStoredTVBuffer.buffering_mode);
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
|
2022-05-14 14:00:20 +02:00
|
|
|
if (gStoredDRCBuffer.buffer != nullptr) {
|
|
|
|
GX2SetDRCBuffer(gStoredDRCBuffer.buffer, gStoredDRCBuffer.buffer_size, static_cast<GX2DrcRenderMode>(gStoredDRCBuffer.mode),
|
|
|
|
gStoredDRCBuffer.surface_format, gStoredDRCBuffer.buffering_mode);
|
2021-04-07 00:23:23 +02:00
|
|
|
}
|
|
|
|
if (!skipScreen0Free && screenbuffer0) {
|
|
|
|
MEMFreeToMappedMemory(screenbuffer0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!skipScreen1Free && screenbuffer1) {
|
|
|
|
MEMFreeToMappedMemory(screenbuffer1);
|
|
|
|
}
|
|
|
|
}
|
2022-08-28 13:13:35 +02:00
|
|
|
void ConfigUtils::renderNoConfigFoundScreen() {
|
|
|
|
DrawUtils::beginDraw();
|
|
|
|
DrawUtils::clear(COLOR_BACKGROUND);
|
|
|
|
DrawUtils::setFontColor(COLOR_TEXT);
|
|
|
|
|
|
|
|
// draw top bar
|
|
|
|
DrawUtils::setFontSize(24);
|
|
|
|
DrawUtils::print(16, 6 + 24, "Wii U Plugin System Config Menu");
|
|
|
|
DrawUtils::setFontSize(18);
|
|
|
|
DrawUtils::print(SCREEN_WIDTH - 16, 8 + 24, "v1.0", true);
|
|
|
|
DrawUtils::drawRectFilled(8, 8 + 24 + 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
|
|
|
|
|
|
|
// draw bottom bar
|
|
|
|
DrawUtils::drawRectFilled(8, SCREEN_HEIGHT - 24 - 8 - 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
|
|
|
DrawUtils::setFontSize(18);
|
|
|
|
DrawUtils::print(16, SCREEN_HEIGHT - 8, "\ue07d Navigate ");
|
|
|
|
|
|
|
|
const char *noConfigFoundText = "No configurable plugins loaded";
|
|
|
|
DrawUtils::setFontSize(24);
|
|
|
|
uint32_t sz = DrawUtils::getTextWidth(noConfigFoundText);
|
|
|
|
|
|
|
|
DrawUtils::print((SCREEN_WIDTH / 2) - (sz / 2), (SCREEN_HEIGHT / 2), noConfigFoundText);
|
|
|
|
|
|
|
|
// draw home button
|
|
|
|
DrawUtils::setFontSize(18);
|
|
|
|
const char *exitHint = "\ue044 Exit";
|
|
|
|
DrawUtils::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(exitHint) / 2, SCREEN_HEIGHT - 8, exitHint, true);
|
|
|
|
|
|
|
|
DrawUtils::endDraw();
|
|
|
|
}
|