GBA-Exploader/arm9/include/ret_menu9_gen.c
ApacheThunder 7084d26052 FIx Slot-2 DS mode ...
* Fix mistake that caused DS mode Slot-2 booting to not work.
(accidently removed needed arm7 code in previous commit after optimizing
code relating to Rumble Menu softreset)
2024-05-19 23:50:00 -05:00

60 lines
1.6 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/***********************************************************
Arm9 Soft rest for General purpose
by Rudolph (<28>cé)
***************************************************************/
#include <nds.h>
#include <nds/arm9/dldi.h>
#include <fat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "nds_loader_arm9.h"
static char *menu_nam;
static char name[32];
bool ret_menu_chk() {
char buf[5];
menu_nam = NULL;
buf[0] = io_dldi_data->ioInterface.ioType & 0xFF;
buf[1] = (io_dldi_data->ioInterface.ioType >> 8) & 0xFF;
buf[2] = (io_dldi_data->ioInterface.ioType >> 16) & 0xFF;
buf[3] = (io_dldi_data->ioInterface.ioType >> 24) & 0xFF;
buf[4] = 0;
sprintf(name, "/%s.nds", buf);
if(access(name, F_OK) == 0) {
menu_nam = name;
return true;
}
switch (io_dldi_data->ioInterface.ioType) {
case 0x53444353: menu_nam = "/MSFORSC.NDS"; break; // Moonshel for SCDS
case 0x4F49524E: menu_nam = "/udisk.nds"; break; // N-Card and Clones
case 0x4E475052: menu_nam = "/akmenu4.nds"; break; // AK.R.P.G NAND
case 0x53475052: menu_nam = "/akmenu4.nds"; break; // AK.R.P.G SD
case 0x44533958: menu_nam = "/loader.nds"; break; // X9 SD
case 0x4F495454: menu_nam = "/TTMENU.DAT"; break; // DSTT
case 0x4F4D4544: menu_nam = "/R4.DAT"; break; // Timebombed DSTTi clones like R4 SDHC Gold Pro
}
if((menu_nam != NULL) && (access(menu_nam, F_OK) == 0)) {
return true;
} else if (access("/boot.nds", F_OK) == 0) {
menu_nam = "/boot.nds";
return true;
}
return false;
}
bool ret_menu9_Gen() {
runNdsFile(menu_nam, 0, NULL);
return false;
}