mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Unmount flashcard and return to [root] menu, if directory listing of flashcard is shown
This commit is contained in:
parent
e0a39ee850
commit
23515b11d6
@ -34,8 +34,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static bool dmTextPrinted = false;
|
static bool dmTextPrinted = false;
|
||||||
static int dmCursorPosition = 0;
|
int dmCursorPosition = 0;
|
||||||
static u8 dm_SCFG_MC = 0;
|
|
||||||
|
|
||||||
void driveMenu (void) {
|
void driveMenu (void) {
|
||||||
int pressed = 0;
|
int pressed = 0;
|
||||||
@ -101,8 +100,8 @@ void driveMenu (void) {
|
|||||||
|
|
||||||
dmTextPrinted = true;
|
dmTextPrinted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
dm_SCFG_MC = REG_SCFG_MC;
|
stored_SCFG_MC = REG_SCFG_MC;
|
||||||
|
|
||||||
// Power saving loop. Only poll the keys once per frame and sleep the CPU if there is nothing else to do
|
// Power saving loop. Only poll the keys once per frame and sleep the CPU if there is nothing else to do
|
||||||
do {
|
do {
|
||||||
@ -116,7 +115,7 @@ void driveMenu (void) {
|
|||||||
held = keysHeld();
|
held = keysHeld();
|
||||||
swiWaitForVBlank();
|
swiWaitForVBlank();
|
||||||
|
|
||||||
if (REG_SCFG_MC != dm_SCFG_MC) {
|
if (REG_SCFG_MC != stored_SCFG_MC) {
|
||||||
dmTextPrinted = false;
|
dmTextPrinted = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
extern int dmCursorPosition;
|
||||||
|
|
||||||
extern void driveMenu (void);
|
extern void driveMenu (void);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
static sNDSHeader nds;
|
static sNDSHeader nds;
|
||||||
|
|
||||||
|
u8 stored_SCFG_MC = 0;
|
||||||
|
|
||||||
bool sdMounted = false;
|
bool sdMounted = false;
|
||||||
bool flashcardMounted = false;
|
bool flashcardMounted = false;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#ifndef FLASHCARD_H
|
#ifndef FLASHCARD_H
|
||||||
#define FLASHCARD_H
|
#define FLASHCARD_H
|
||||||
|
|
||||||
|
extern u8 stored_SCFG_MC;
|
||||||
|
|
||||||
extern bool sdMounted;
|
extern bool sdMounted;
|
||||||
extern bool flashcardMounted;
|
extern bool flashcardMounted;
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,8 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "date.h"
|
#include "date.h"
|
||||||
#include "fileOperations.h"
|
#include "fileOperations.h"
|
||||||
|
#include "driveMenu.h"
|
||||||
|
#include "driveOperations.h"
|
||||||
|
|
||||||
#define SCREEN_COLS 32
|
#define SCREEN_COLS 32
|
||||||
#define ENTRIES_PER_SCREEN 22
|
#define ENTRIES_PER_SCREEN 22
|
||||||
@ -148,8 +150,15 @@ string browseForFile (void) {
|
|||||||
getDirectoryContents (dirContents);
|
getDirectoryContents (dirContents);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
if (isDSiMode() && !pressed && dmCursorPosition == 1 && REG_SCFG_MC == 0x11) {
|
||||||
|
if (flashcardMounted) {
|
||||||
|
flashcardUnmount();
|
||||||
|
screenMode = 0;
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true);
|
consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true);
|
||||||
//consoleClear();
|
|
||||||
DirEntry* entry = &dirContents.at(fileOffset);
|
DirEntry* entry = &dirContents.at(fileOffset);
|
||||||
printf (entry->name.c_str());
|
printf (entry->name.c_str());
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
@ -157,13 +166,12 @@ string browseForFile (void) {
|
|||||||
printf ("(dir)");
|
printf ("(dir)");
|
||||||
} else {
|
} else {
|
||||||
fileSize = getFileSize(entry->name.c_str());
|
fileSize = getFileSize(entry->name.c_str());
|
||||||
iprintf ("%i Bytes", (int)fileSize);
|
printf ("%i Bytes", (int)fileSize);
|
||||||
}
|
}
|
||||||
iprintf ("\x1b[23;0H");
|
printf ("\x1b[23;0H");
|
||||||
printf (titleName);
|
printf (titleName);
|
||||||
|
|
||||||
consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, true, true);
|
consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, true, true);
|
||||||
//consoleClear();
|
|
||||||
showDirectoryContents (dirContents, screenOffset);
|
showDirectoryContents (dirContents, screenOffset);
|
||||||
|
|
||||||
// Clear old cursors
|
// Clear old cursors
|
||||||
@ -173,18 +181,22 @@ string browseForFile (void) {
|
|||||||
// Show cursor
|
// Show cursor
|
||||||
iprintf ("\x1b[%d;0H*", fileOffset - screenOffset + ENTRIES_START_ROW);
|
iprintf ("\x1b[%d;0H*", fileOffset - screenOffset + ENTRIES_START_ROW);
|
||||||
|
|
||||||
//iconTitleUpdate (dirContents.at(fileOffset).isDirectory,dirContents.at(fileOffset).name.c_str());
|
stored_SCFG_MC = REG_SCFG_MC;
|
||||||
|
|
||||||
// Power saving loop. Only poll the keys once per frame and sleep the CPU if there is nothing else to do
|
// Power saving loop. Only poll the keys once per frame and sleep the CPU if there is nothing else to do
|
||||||
do {
|
do {
|
||||||
// Move to right side of screen
|
// Move to right side of screen
|
||||||
iprintf ("\x1b[0;27H");
|
printf ("\x1b[0;27H");
|
||||||
// Print time
|
// Print time
|
||||||
printf (RetTime().c_str());
|
printf (RetTime().c_str());
|
||||||
|
|
||||||
scanKeys();
|
scanKeys();
|
||||||
pressed = keysDownRepeat();
|
pressed = keysDownRepeat();
|
||||||
swiWaitForVBlank();
|
swiWaitForVBlank();
|
||||||
|
|
||||||
|
if (REG_SCFG_MC != stored_SCFG_MC) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
} while (!(pressed & KEY_UP) && !(pressed & KEY_DOWN) && !(pressed & KEY_LEFT) && !(pressed & KEY_RIGHT)
|
} while (!(pressed & KEY_UP) && !(pressed & KEY_DOWN) && !(pressed & KEY_LEFT) && !(pressed & KEY_RIGHT)
|
||||||
&& !(pressed & KEY_A) && !(pressed & KEY_B));
|
&& !(pressed & KEY_A) && !(pressed & KEY_B));
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user