This commit is contained in:
JeffRuLz 2019-06-26 20:26:57 -05:00 committed by GitHub
parent 464fbd6151
commit 4729646e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 23 deletions

View File

@ -148,7 +148,12 @@ static void generateList(Menu* m)
bool done = false; bool done = false;
struct dirent* ent; struct dirent* ent;
DIR* dir = opendir(currentDir); DIR* dir = NULL;
if (currentDir[0] == '\0')
dir = opendir("/");
else
dir = opendir(currentDir);
if (dir) if (dir)
{ {

View File

@ -3,7 +3,7 @@
#include "message.h" #include "message.h"
#include <time.h> #include <time.h>
#define VERSION "0.6.8.1" #define VERSION "0.7.0"
enum { enum {
MAIN_MENU_INSTALL, MAIN_MENU_INSTALL,

View File

@ -504,33 +504,29 @@ unsigned long long getSDCardFree()
unsigned long long getDsiSize() unsigned long long getDsiSize()
{ {
//The DSi has 256MB of internal storage. Some is unavailable and used by other things. //The DSi has 256MB of internal storage. Some is unavailable and used by other things.
//Find a better way to do this //An empty DSi reads 1024 open blocks
return 240 * 1024 * 1024; return 1024 * BYTES_PER_BLOCK;
} }
unsigned long long getDsiFree() unsigned long long getDsiFree()
{ {
//Get free space by subtracting file sizes in emulated nand folders //Get free space by subtracting file sizes in emulated nand folders
//Find a better way to do this unsigned long long size = getDsiSize();
long long size = getDsiSize(); unsigned long long appSize = getDirSize("/title/00030004");
size -= getDirSize("/sys"); //round up to a full block
size -= getDirSize("/title/0003000f"); if (appSize % BYTES_PER_BLOCK != 0)
size -= getDirSize("/title/00030004"); appSize = ((int)(appSize / BYTES_PER_BLOCK) * BYTES_PER_BLOCK) + BYTES_PER_BLOCK;
size -= getDirSize("/title/00030005");
size -= getDirSize("/title/00030017");
size -= getDirSize("/ticket");
size -= getDirSize("/shared1");
size -= getDirSize("/shared2");
size -= getDirSize("/import");
size -= getDirSize("/tmp");
size -= getDirSize("/progress");
size -= getDirSize("/photo"); //subtract, but don't go under 0
size -= getDirSize("/private"); if (appSize > size)
{
size = 0;
}
else
{
size -= appSize;
}
if (size < 0) return size;
return 0;
return (unsigned long long)size;
} }