mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Fix power off, hide Reboot in DS mode
This commit is contained in:
parent
d653187818
commit
bf7a850701
@ -7,10 +7,17 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <nds.h>
|
#include <nds.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define ITEMS_PER_SCREEN 8
|
#define ITEMS_PER_SCREEN 8
|
||||||
|
|
||||||
constexpr std::array<std::string *, 3> startMenuItems = {
|
enum class StartMenuItem : u8 {
|
||||||
|
powerOff = 0,
|
||||||
|
reboot = 1,
|
||||||
|
langauge = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr std::array<std::string *, 3> startMenuStrings = {
|
||||||
&STR_POWER_OFF,
|
&STR_POWER_OFF,
|
||||||
&STR_REBOOT,
|
&STR_REBOOT,
|
||||||
&STR_LANGUAGE
|
&STR_LANGUAGE
|
||||||
@ -23,6 +30,20 @@ constexpr std::array<std::pair<const char *, const char *>, 3> languageList = {{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
void startMenu() {
|
void startMenu() {
|
||||||
|
std::vector<StartMenuItem> startMenuItems;
|
||||||
|
if(isDSiMode()) {
|
||||||
|
startMenuItems = {
|
||||||
|
StartMenuItem::powerOff,
|
||||||
|
StartMenuItem::reboot,
|
||||||
|
StartMenuItem::langauge
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
startMenuItems = {
|
||||||
|
StartMenuItem::powerOff,
|
||||||
|
StartMenuItem::langauge
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
int cursorPosition = 0;
|
int cursorPosition = 0;
|
||||||
u16 pressed, held;
|
u16 pressed, held;
|
||||||
while(1) {
|
while(1) {
|
||||||
@ -30,9 +51,9 @@ void startMenu() {
|
|||||||
font->print(0, 3, false, STR_START_MENU, Alignment::center);
|
font->print(0, 3, false, STR_START_MENU, Alignment::center);
|
||||||
for(int i = 0; i < (int)startMenuItems.size(); i++) {
|
for(int i = 0; i < (int)startMenuItems.size(); i++) {
|
||||||
if(cursorPosition == i)
|
if(cursorPosition == i)
|
||||||
font->printf(0, 5 + i, false, Alignment::center, Palette::white, "> %s <", startMenuItems[i]->c_str());
|
font->printf(0, 5 + i, false, Alignment::center, Palette::white, "> %s <", startMenuStrings[u8(startMenuItems[i])]->c_str());
|
||||||
else
|
else
|
||||||
font->print(0, 5 + i, false, startMenuItems[i]->c_str(), Alignment::center);
|
font->print(0, 5 + i, false, startMenuStrings[u8(startMenuItems[i])]->c_str(), Alignment::center);
|
||||||
}
|
}
|
||||||
font->print(0, 5 + startMenuItems.size() + 1, false, STR_A_SELECT_B_CANCEL, Alignment::center);
|
font->print(0, 5 + startMenuItems.size() + 1, false, STR_A_SELECT_B_CANCEL, Alignment::center);
|
||||||
font->update(false);
|
font->update(false);
|
||||||
@ -53,15 +74,15 @@ void startMenu() {
|
|||||||
if(cursorPosition >= (int)startMenuItems.size())
|
if(cursorPosition >= (int)startMenuItems.size())
|
||||||
cursorPosition = 0;
|
cursorPosition = 0;
|
||||||
} else if(pressed & KEY_A) {
|
} else if(pressed & KEY_A) {
|
||||||
switch(cursorPosition) {
|
switch(startMenuItems[cursorPosition]) {
|
||||||
case 0: // Power off
|
case StartMenuItem::powerOff:
|
||||||
// TODO
|
systemShutDown();
|
||||||
break;
|
break;
|
||||||
case 1: // Reboot
|
case StartMenuItem::reboot:
|
||||||
fifoSendValue32(FIFO_USER_02, 1);
|
fifoSendValue32(FIFO_USER_02, 1);
|
||||||
while(1) swiWaitForVBlank();
|
while(1) swiWaitForVBlank();
|
||||||
break;
|
break;
|
||||||
case 2: // language
|
case StartMenuItem::langauge:
|
||||||
languageMenu();
|
languageMenu();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user