@@ -1430,7 +1430,8 @@ int dsClassicMenu(void) {
14301430
14311431 if (ms ().previousUsedDevice && bothSDandFlashcard () && ms ().launchType [ms ().previousUsedDevice ] == 3
14321432 && ((access (ms ().dsiWarePubPath .c_str (), F_OK) == 0 && access (" sd:/_nds/TWiLightMenu/tempDSiWare.pub" , F_OK) == 0 )
1433- || (access (ms ().dsiWarePrvPath .c_str (), F_OK) == 0 && access (" sd:/_nds/TWiLightMenu/tempDSiWare.prv" , F_OK) == 0 ))) {
1433+ || (access (ms ().dsiWarePrvPath .c_str (), F_OK) == 0 && access (" sd:/_nds/TWiLightMenu/tempDSiWare.prv" , F_OK) == 0 )
1434+ || (access (ms ().dsiWareBnrPath .c_str (), F_OK) == 0 && access (" sd:/_nds/TWiLightMenu/tempDSiWare.bnr" , F_OK) == 0 ))) {
14341435 controlTopBright = false ;
14351436 whiteScreen = true ;
14361437 fadeType = true ; // Fade in from white
@@ -1445,6 +1446,10 @@ int dsClassicMenu(void) {
14451446 fcopy (" sd:/_nds/TWiLightMenu/tempDSiWare.prv" , ms ().dsiWarePrvPath .c_str ());
14461447 rename (" sd:/_nds/TWiLightMenu/tempDSiWare.prv" , " sd:/_nds/TWiLightMenu/tempDSiWare.prv.bak" );
14471448 }
1449+ if (access (ms ().dsiWareBnrPath .c_str (), F_OK) == 0 ) {
1450+ fcopy (" sd:/_nds/TWiLightMenu/tempDSiWare.bnr" , ms ().dsiWareBnrPath .c_str ());
1451+ rename (" sd:/_nds/TWiLightMenu/tempDSiWare.bnr" , " sd:/_nds/TWiLightMenu/tempDSiWare.bnr.bak" );
1452+ }
14481453 fadeType = false ; // Fade to white
14491454 for (int i = 0 ; i < 30 ; i++) swiWaitForVBlank ();
14501455 clearText (false );
@@ -2218,6 +2223,9 @@ int dsClassicMenu(void) {
22182223 if (access (" sd:/_nds/TWiLightMenu/tempDSiWare.prv.bak" , F_OK) == 0 ) {
22192224 remove (" sd:/_nds/TWiLightMenu/tempDSiWare.prv.bak" );
22202225 }
2226+ if (access (" sd:/_nds/TWiLightMenu/tempDSiWare.bnr.bak" , F_OK) == 0 ) {
2227+ remove (" sd:/_nds/TWiLightMenu/tempDSiWare.bnr.bak" );
2228+ }
22212229 if (access (" sd:/_nds/nds-bootstrap/patchOffsetCache/tempDSiWare.bin" , F_OK) == 0 ) {
22222230 remove (" sd:/_nds/nds-bootstrap/patchOffsetCache/tempDSiWare.bin" );
22232231 }
@@ -2264,6 +2272,8 @@ int dsClassicMenu(void) {
22642272 if (isDSiWare[ms ().secondaryDevice ]) {
22652273 remove (sys ().isRunFromSD () ? " sd:/_nds/nds-bootstrap/esrb.bin" : " fat:/_nds/nds-bootstrap/esrb.bin" );
22662274
2275+ loadPerGameSettings (filename[ms ().secondaryDevice ]);
2276+
22672277 std::string typeToReplace = filename[ms ().secondaryDevice ].substr (filename[ms ().secondaryDevice ].rfind (' .' ));
22682278
22692279 char *name = argarray.at (0 );
@@ -2286,6 +2296,7 @@ int dsClassicMenu(void) {
22862296 mkdir (" saves" , 0777 );
22872297 }
22882298 ms ().dsiWarePrvPath = ms ().dsiWarePubPath ;
2299+ ms ().dsiWareBnrPath = ms ().dsiWarePubPath ;
22892300 const bool savFormat = (ms ().secondaryDevice && (!isDSiMode () || !sys ().scfgSdmmcEnabled () || bs ().b4dsMode ));
22902301 if (savFormat) {
22912302 ms ().dsiWarePubPath = replaceAll (ms ().dsiWarePubPath , typeToReplace, getSavExtension ());
@@ -2294,6 +2305,7 @@ int dsClassicMenu(void) {
22942305 ms ().dsiWarePubPath = replaceAll (ms ().dsiWarePubPath , typeToReplace, getPubExtension ());
22952306 ms ().dsiWarePrvPath = replaceAll (ms ().dsiWarePrvPath , typeToReplace, getPrvExtension ());
22962307 }
2308+ ms ().dsiWareBnrPath = replaceAll (ms ().dsiWareBnrPath , typeToReplace, getBnrExtension ());
22972309 ms ().homebrewBootstrap = isHomebrew[ms ().secondaryDevice ];
22982310 ms ().launchType [ms ().secondaryDevice ] = TWLSettings::EDSiWareLaunch;
22992311 ms ().saveSettings ();
@@ -2385,6 +2397,32 @@ int dsClassicMenu(void) {
23852397 }
23862398 }
23872399
2400+ if ((NDSHeader.dsi_flags & BIT (2 )) && getFileSize (ms ().dsiWareBnrPath .c_str ()) == 0 ) {
2401+ while (!fadeType && !screenFadedOut ()) {
2402+ swiWaitForVBlank ();
2403+ }
2404+ s2RamAccessAlt (true );
2405+ whiteScreen = true ;
2406+ fadeSpeed = true ;
2407+ controlTopBright = false ;
2408+ clearText ();
2409+ printSmall (false , 0 , 88 , STR_CREATING_BANNER_SAVE, Alignment::center);
2410+ fadeType = true ; // Fade in from white
2411+ updateText (false );
2412+
2413+ FILE *pFile = fopen (ms ().dsiWareBnrPath .c_str (), " wb" );
2414+ if (pFile) {
2415+ fseek (pFile, 0x4000 - 1 , SEEK_SET);
2416+ fputc (' \0 ' , pFile);
2417+ fclose (pFile);
2418+ }
2419+
2420+ clearText ();
2421+ printSmall (false , 0 , 88 , STR_BANNER_SAVE_CREATED, Alignment::center);
2422+ updateText (false );
2423+ for (int i = 0 ; i < 60 ; i++) swiWaitForVBlank ();
2424+ }
2425+
23882426 fadeType = false ; // Fade to white
23892427
23902428 if (ms ().secondaryDevice && !bs ().b4dsMode && (ms ().dsiWareToSD || (!(perGameSettings_dsiwareBooter == -1 ? ms ().dsiWareBooter : perGameSettings_dsiwareBooter) && ms ().consoleModel == 0 )) && sdFound ()) {
@@ -2407,10 +2445,14 @@ int dsClassicMenu(void) {
24072445 if ((access (ms ().dsiWarePrvPath .c_str (), F_OK) == 0 ) && (NDSHeader.prvSavSize > 0 )) {
24082446 fcopy (ms ().dsiWarePrvPath .c_str (), " sd:/_nds/TWiLightMenu/tempDSiWare.prv" );
24092447 }
2448+ if ((NDSHeader.dsi_flags & BIT (2 )) && access (ms ().dsiWareBnrPath .c_str (), F_OK) == 0 ) {
2449+ fcopy (ms ().dsiWareBnrPath .c_str (), " sd:/_nds/TWiLightMenu/tempDSiWare.bnr" );
2450+ }
24102451 fadeType = false ; // Fade to white
24112452
24122453 if ((access (ms ().dsiWarePubPath .c_str (), F_OK) == 0 && (NDSHeader.pubSavSize > 0 ))
2413- || (access (ms ().dsiWarePrvPath .c_str (), F_OK) == 0 && (NDSHeader.prvSavSize > 0 ))) {
2454+ || (access (ms ().dsiWarePrvPath .c_str (), F_OK) == 0 && (NDSHeader.prvSavSize > 0 ))
2455+ || ((NDSHeader.dsi_flags & BIT (2 )) && access (ms ().dsiWareBnrPath .c_str (), F_OK) == 0 )) {
24142456 for (int i = 0 ; i < 25 ; i++) swiWaitForVBlank ();
24152457 clearText ();
24162458 printSmall (false , 0 , 8 , STR_RESTART_AFTER_SAVE, Alignment::center);
@@ -2463,19 +2505,20 @@ int dsClassicMenu(void) {
24632505
24642506 if (((perGameSettings_dsiwareBooter == -1 ? ms ().dsiWareBooter : perGameSettings_dsiwareBooter) || (ms ().secondaryDevice && bs ().b4dsMode ) || sys ().arm7SCFGLocked () || ms ().consoleModel > 0 ) && !ms ().homebrewBootstrap ) {
24652507 // Use nds-bootstrap
2466- loadPerGameSettings (filename[ms ().secondaryDevice ]);
2467-
24682508 char sfnSrl[62 ];
24692509 char sfnPub[62 ];
24702510 char sfnPrv[62 ];
2511+ char sfnBnr[62 ];
24712512 if (ms ().secondaryDevice && !bs ().b4dsMode && ms ().dsiWareToSD && sdFound ()) {
24722513 fatGetAliasPath (" sd:/" , " sd:/_nds/TWiLightMenu/tempDSiWare.dsi" , sfnSrl);
24732514 fatGetAliasPath (" sd:/" , " sd:/_nds/TWiLightMenu/tempDSiWare.pub" , sfnPub);
24742515 fatGetAliasPath (" sd:/" , " sd:/_nds/TWiLightMenu/tempDSiWare.prv" , sfnPrv);
2516+ fatGetAliasPath (" sd:/" , " sd:/_nds/TWiLightMenu/tempDSiWare.bnr" , sfnBnr);
24752517 } else {
24762518 fatGetAliasPath (ms ().secondaryDevice ? " fat:/" : " sd:/" , ms ().dsiWareSrlPath .c_str (), sfnSrl);
24772519 fatGetAliasPath (ms ().secondaryDevice ? " fat:/" : " sd:/" , ms ().dsiWarePubPath .c_str (), sfnPub);
24782520 fatGetAliasPath (ms ().secondaryDevice ? " fat:/" : " sd:/" , ms ().dsiWarePrvPath .c_str (), sfnPrv);
2521+ fatGetAliasPath (ms ().secondaryDevice ? " fat:/" : " sd:/" , ms ().dsiWareBnrPath .c_str (), sfnBnr);
24792522 }
24802523
24812524 const char *bootstrapinipath = sdFound () ? BOOTSTRAP_INI : BOOTSTRAP_INI_FC;
@@ -2484,6 +2527,7 @@ int dsClassicMenu(void) {
24842527 bootstrapini.SetString (" NDS-BOOTSTRAP" , " APP_PATH" , sfnSrl);
24852528 bootstrapini.SetString (" NDS-BOOTSTRAP" , " SAV_PATH" , sfnPub);
24862529 bootstrapini.SetString (" NDS-BOOTSTRAP" , " PRV_PATH" , sfnPrv);
2530+ bootstrapini.SetString (" NDS-BOOTSTRAP" , " BNR_PATH" , sfnBnr);
24872531 bootstrapini.SetString (" NDS-BOOTSTRAP" , " MANUAL_PATH" , getGameManual (filename[ms ().secondaryDevice ].c_str ()));
24882532 bootstrapini.SetString (" NDS-BOOTSTRAP" , " QUIT_PATH" , mainSrldrPath (sys ().isRunFromSD () && (!ms ().secondaryDevice || !bs ().b4dsMode )));
24892533 bootstrapini.SetString (" NDS-BOOTSTRAP" , " GUI_LANGUAGE" , ms ().getGuiLanguageString ());
0 commit comments