GBA-Exploader/arm9/source/bootloader/ret_menu9_gen.c
ApacheThunder 4ec14bae55 Fix Rumble Menu soft reset ...
* Soft Reset for Rumble Menu fixed. New scheme is now used for loading
SoftReset.xxxx. Now instead it will look for R4TF.nds (R4TF = 4
character ioType code for DLDI user is currently using with R4TF as an
example). If not found it will look for a few specific NDS files to try.
If those aren't found it will try boot.nds. If boot.nds isn't found then
rumble menu will not be available.
2024-05-19 18:24:16 -05:00

60 lines
1.6 KiB
C
Raw 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;
}