Consoles: Add exit button to bottom right of launcher menu

This commit is contained in:
UnknownShadow200 2024-04-30 12:09:15 +10:00
parent 5e5b4680e4
commit d1320bd2c9
4 changed files with 23 additions and 11 deletions

View File

@ -886,6 +886,12 @@ static void MainScreen_ApplyUpdateLabel(struct MainScreen* s) {
}
}
#ifdef CC_BUILD_CONSOLE
static void MainScreen_ExitApp(void* w) {
Window_Main.Exists = false;
}
#endif
static void MainScreen_Activated(struct LScreen* s_) {
struct MainScreen* s = (struct MainScreen*)s_;
@ -909,8 +915,6 @@ static void MainScreen_Activated(struct LScreen* s_) {
SwitchToSplitScreen, main_btnSplit);
#endif
LLabel_Add(s, &s->lblUpdate, "&eChecking..",
Updater_Supported ? main_lblUpdate_N : main_lblUpdate_H);
if (Process_OpenSupported) {
LButton_Add(s, &s->btnRegister, 100, 35, "Register",
MainScreen_Register, main_btnRegister);
@ -918,10 +922,19 @@ static void MainScreen_Activated(struct LScreen* s_) {
LButton_Add(s, &s->btnOptions, 100, 35, "Options",
SwitchToSettings, main_btnOptions);
#ifdef CC_BUILD_CONSOLE
LLabel_Add(s, &s->lblUpdate, "&eChecking..", main_lblUpdate_N);
LButton_Add(s, &s->btnUpdates, 100, 35, "Exit",
MainScreen_ExitApp, main_btnUpdates);
#else
LLabel_Add(s, &s->lblUpdate, "&eChecking..",
Updater_Supported ? main_lblUpdate_N : main_lblUpdate_H);
if (Updater_Supported) {
LButton_Add(s, &s->btnUpdates, 100, 35, "Updates",
SwitchToUpdates, main_btnUpdates);
}
#endif
s->btnResume.OnHover = MainScreen_ResumeHover;
s->btnResume.OnUnhover = MainScreen_ResumeUnhover;

View File

@ -189,7 +189,7 @@ cc_result File_Length(cc_file file, cc_uint32* len) {
*len = st.st_size; return 0;
}
static void InitFilesystem(cc_bool dsiMode) {
static void InitFilesystem(void) {
char* dir = fatGetDefaultCwd();
if (dir && dir[0]) {
root_path.buffer = dir;
@ -199,7 +199,7 @@ static void InitFilesystem(cc_bool dsiMode) {
// I don't know why I have to call this function, but if I don't,
// then when running in DSi mode AND an SD card is readable,
// fatInitDefault gets stuck somewhere (in disk_initialize it seems)
if (dsiMode) {
if (isDSiMode()) {
const DISC_INTERFACE* sd_io = get_io_dsisd();
if (sd_io) sd_io->startup();
}
@ -404,10 +404,7 @@ static void InitNetworking(void) {
*--------------------------------------------------------Platform---------------------------------------------------------*
*#########################################################################################################################*/
void Platform_Init(void) {
cc_bool dsiMode = isDSiMode();
Platform_Log1("Running in %c mode", dsiMode ? "DSi" : "DS");
InitFilesystem(dsiMode);
InitFilesystem();
InitNetworking();
cpuStartTiming(1);

View File

@ -725,10 +725,8 @@ static void TouchScreen_LayoutOnscreen(struct TouchScreen* s, cc_uint8 alignment
static void TouchScreen_Layout(void* screen) {
struct TouchScreen* s = (struct TouchScreen*)screen;
const struct TouchButtonDesc* desc;
int haligns = GetOnscreenHAligns();
float scale = Gui.RawTouchScale;
cc_uint8 halign;
int i, x, y, height;
int i, height;
/* Need to align these relative to the hotbar */
height = HUDScreen_LayoutHotbar();

View File

@ -15,6 +15,7 @@
#include <nds/arm9/input.h>
#include <nds/arm9/keyboard.h>
#include <nds/interrupts.h>
#include <nds/system.h>
/*########################################################################################################################*
@ -151,6 +152,9 @@ void Window_Init(void) {
vramSetBankI(VRAM_I_SUB_BG_0x06208000);
setBrightness(2, 0);
consoleInit();
cc_bool dsiMode = isDSiMode();
Platform_Log1("Running in %c mode", dsiMode ? "DSi" : "DS");
}
void Window_Free(void) { }