Skip to content

Commit

Permalink
Show message for if FAT takes a while to init on DSi/3DS SD Card
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Dec 27, 2023
1 parent 2b47061 commit b929323
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
19 changes: 14 additions & 5 deletions booter/arm9/source/graphics/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
#define CONSOLE_SCREEN_HEIGHT 24

extern bool fadeType;
extern bool waitBeforeFade;
int screenBrightness = 31;
int fadeWaitTimer = 0;

int subBgTexID;
glImage subBgImage[(256 / 16) * (256 / 16)];
Expand Down Expand Up @@ -99,12 +101,19 @@ void vBlankHandler()
{
glBegin2D();
{
if (fadeType == true) {
screenBrightness--;
if (screenBrightness < 0) screenBrightness = 0;
if (waitBeforeFade) {
fadeWaitTimer++;
if (fadeWaitTimer > 60*4) {
waitBeforeFade = false;
}
} else {
screenBrightness++;
if (screenBrightness > 31) screenBrightness = 31;
if (fadeType == true) {
screenBrightness--;
if (screenBrightness < 0) screenBrightness = 0;
} else {
screenBrightness++;
if (screenBrightness > 31) screenBrightness = 31;
}
}
SetBrightness(0, screenBrightness);
SetBrightness(1, screenBrightness);
Expand Down
29 changes: 23 additions & 6 deletions booter/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "graphics/fontHandler.h"

bool fadeType = false; // false = out, true = in
bool waitBeforeFade = false;

using namespace std;

Expand Down Expand Up @@ -187,12 +188,22 @@ int main(int argc, char **argv) {
unlaunchRomBoot(srldrPath); // Start via Unlaunch
}

graphicsInit();
fontInit();
clearText();

waitBeforeFade = true;

printSmall(false, 4, 4, "Please wait...");
printSmall(false, 4, 12, "This may take a while.");

fadeType = true;

extern const DISC_INTERFACE __my_io_dsisd;

if (!fatMountSimple("sd", &__my_io_dsisd)) {
graphicsInit();
fontInit();
fadeType = true;
waitBeforeFade = false;
// fadeType = true;

clearText();
printSmall(false, 4, 4, "FAT init failed!");
Expand All @@ -204,15 +215,21 @@ int main(int argc, char **argv) {
fwrite((void*)0x02800000, 1, 0x400, deviceList);
fclose(deviceList);*/

if (!waitBeforeFade) {
fadeType = false;
for (int i = 0; i < 24; i++) {
swiWaitForVBlank();
}
}

vector<char *> argarray;
argarray.push_back((char*)srldrPath);

int err = runNdsFile(argarray[0], argarray.size(), (const char**)&argarray[0], true, false, false, true, true, false, -1);
bool twlmFound = (access("sd:/_nds/TWiLightMenu", F_OK) == 0);

graphicsInit();
fontInit();
fadeType = true;
waitBeforeFade = false;
// fadeType = true;

int returnTextPos = 28;
clearText();
Expand Down

0 comments on commit b929323

Please sign in to comment.