mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 21:52:48 +00:00
We can finally mount SysNAND and EmuNAND, horray!
This commit is contained in:
parent
6adf9d254d
commit
f13a89d809
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#define COLOR_BLACK RGB(0x00, 0x00, 0x00)
|
#define COLOR_BLACK RGB(0x00, 0x00, 0x00)
|
||||||
#define COLOR_WHITE RGB(0xFF, 0xFF, 0xFF)
|
#define COLOR_WHITE RGB(0xFF, 0xFF, 0xFF)
|
||||||
|
#define COLOR_GREY RGB(0x7F, 0x7F, 0x7F)
|
||||||
#define COLOR_TRANSPARENT RGB(0xFF, 0x00, 0xEF) // otherwise known as 'super fuchsia'
|
#define COLOR_TRANSPARENT RGB(0xFF, 0x00, 0xEF) // otherwise known as 'super fuchsia'
|
||||||
|
|
||||||
#ifdef EXEC_GATEWAY
|
#ifdef EXEC_GATEWAY
|
||||||
|
@ -122,7 +122,7 @@ DRESULT disk_read (
|
|||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Write Sector(s) */
|
/* Write Sector(s) */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
#undef _USE_WRITE
|
||||||
#if _USE_WRITE
|
#if _USE_WRITE
|
||||||
DRESULT disk_write (
|
DRESULT disk_write (
|
||||||
__attribute__((unused))
|
__attribute__((unused))
|
||||||
@ -181,11 +181,12 @@ DRESULT disk_ioctl (
|
|||||||
return RES_OK;
|
return RES_OK;
|
||||||
case GET_BLOCK_SIZE:
|
case GET_BLOCK_SIZE:
|
||||||
*((DWORD*) buff) = 0x2000;
|
*((DWORD*) buff) = 0x2000;
|
||||||
return (DriveInfo[pdrv].type == TYPE_SDCARD) ? RES_OK : RES_PARERR;
|
// return (DriveInfo[pdrv].type == TYPE_SDCARD) ? RES_OK : RES_PARERR;
|
||||||
|
return RES_OK;
|
||||||
case CTRL_SYNC:
|
case CTRL_SYNC:
|
||||||
// nothing to do here - the disk_write function handles that
|
// nothing to do here - the disk_write function handles that
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
}
|
}
|
||||||
return RES_PARERR;
|
return RES_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
/ data transfer. */
|
/ data transfer. */
|
||||||
|
|
||||||
|
|
||||||
#define _FS_READONLY 0
|
#define _FS_READONLY 1
|
||||||
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
||||||
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
||||||
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
||||||
@ -141,7 +141,7 @@
|
|||||||
/ Drive/Volume Configurations
|
/ Drive/Volume Configurations
|
||||||
/---------------------------------------------------------------------------*/
|
/---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define _VOLUMES 1
|
#define _VOLUMES 7
|
||||||
/* Number of volumes (logical drives) to be used. */
|
/* Number of volumes (logical drives) to be used. */
|
||||||
|
|
||||||
|
|
||||||
|
31
source/fs.c
31
source/fs.c
@ -4,7 +4,7 @@
|
|||||||
#include "fatfs/nandio.h"
|
#include "fatfs/nandio.h"
|
||||||
|
|
||||||
// don't use this area for anything else!
|
// don't use this area for anything else!
|
||||||
static FATFS* fs = (FATFS*) 0x20316000;
|
static FATFS* fs = (FATFS*)0x20316000;
|
||||||
// reserve one MB for this, just to be safe
|
// reserve one MB for this, just to be safe
|
||||||
static DirStruct* curdir_contents = (DirStruct*)0x21000000;
|
static DirStruct* curdir_contents = (DirStruct*)0x21000000;
|
||||||
// this is the main buffer
|
// this is the main buffer
|
||||||
@ -22,15 +22,16 @@ bool InitFS()
|
|||||||
u32 emunand_state = CheckEmuNand();
|
u32 emunand_state = CheckEmuNand();
|
||||||
for (numfs = 0; numfs < 16; numfs++) {
|
for (numfs = 0; numfs < 16; numfs++) {
|
||||||
char fsname[8];
|
char fsname[8];
|
||||||
snprintf(fsname, 7, "%lu:", numfs);
|
snprintf(fsname, 8, "%lu:", numfs);
|
||||||
if ((numfs >= 4) && (emunand_state >> (2*((numfs-4)/3)) != EMUNAND_GATEWAY))
|
int res = f_mount(fs + numfs, fsname, 1);
|
||||||
break;
|
if (res != FR_OK) {
|
||||||
if (f_mount(fs, fsname, 0) != FR_OK) {
|
if (numfs >= 4) break;
|
||||||
ShowError("Initialising failed! (%lu/%s)", numfs, fsname);
|
ShowError("Initialising failed! (%lu/%s/%i)", numfs, fsname, res);
|
||||||
DeinitFS();
|
DeinitFS();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ShowError("Mounted: %i partitions", numfs);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,23 +48,23 @@ void DeinitFS()
|
|||||||
bool GetRootDirContentsWorker(DirStruct* contents)
|
bool GetRootDirContentsWorker(DirStruct* contents)
|
||||||
{
|
{
|
||||||
static const char* drvname[16] = {
|
static const char* drvname[16] = {
|
||||||
"sdcard",
|
"SDCARD",
|
||||||
"sysctrn", "systwln", "systwlp",
|
"SYSCTRN", "SYSTWLN", "SYSTWLP",
|
||||||
"emu0ctrn", "emu0twln", "emu0twlp",
|
"EMU0CTRN", "EMU0TWLN", "EMU0TWLP",
|
||||||
"emu1ctrn", "emu1twln", "emu1twlp",
|
"EMU1CTRN", "EMU1TWLN", "EMU1TWLP",
|
||||||
"emu2ctrn", "emu2twln", "emu2twlp",
|
"EMU2CTRN", "EMU2TWLN", "EMU2TWLP",
|
||||||
"emu3ctrn", "emu3twln", "emu3twlp"
|
"EMU3CTRN", "EMU3TWLN", "EMU3TWLP"
|
||||||
};
|
};
|
||||||
|
|
||||||
for (u32 pdrv = 0; (pdrv < numfs) && (pdrv < MAX_ENTRIES); pdrv++) {
|
for (u32 pdrv = 0; (pdrv < numfs) && (pdrv < MAX_ENTRIES); pdrv++) {
|
||||||
memset(contents->entry[pdrv].path, 0x00, 16);
|
memset(contents->entry[pdrv].path, 0x00, 16);
|
||||||
snprintf(contents->entry[pdrv].path + 0, 4, "%lu:", pdrv);
|
snprintf(contents->entry[pdrv].path + 0, 4, "%lu:", pdrv);
|
||||||
snprintf(contents->entry[pdrv].path + 4, 4, "%s", drvname[pdrv]);
|
snprintf(contents->entry[pdrv].path + 4, 16, "[%lu:] (%s)", pdrv, drvname[pdrv]);
|
||||||
contents->entry[pdrv].name = contents->entry[pdrv].path + 4;
|
contents->entry[pdrv].name = contents->entry[pdrv].path + 4;
|
||||||
contents->entry[pdrv].size = 0;
|
contents->entry[pdrv].size = 0;
|
||||||
contents->entry[pdrv].type = T_FAT_ROOT;
|
contents->entry[pdrv].type = T_FAT_ROOT;
|
||||||
contents->n_entries = pdrv;
|
|
||||||
}
|
}
|
||||||
|
contents->n_entries = numfs;
|
||||||
|
|
||||||
return contents->n_entries;
|
return contents->n_entries;
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
|
||||||
void DrawDirContents(DirStruct* contents, u32 offset, u32 cursor) {
|
void DrawDirContents(DirStruct* contents, u32 offset, u32 cursor) {
|
||||||
const int str_width = 38;
|
const int str_width = 40;
|
||||||
const u32 stp_y = 10;
|
const u32 stp_y = 12;
|
||||||
const u32 pos_x = 10;
|
const u32 pos_x = 0;
|
||||||
u32 pos_y = 10;
|
u32 pos_y = 2;
|
||||||
|
|
||||||
for (u32 i = 0; pos_y < SCREEN_HEIGHT; i++) {
|
for (u32 i = 0; pos_y < SCREEN_HEIGHT; i++) {
|
||||||
char tempstr[str_width + 1];
|
char tempstr[str_width + 1];
|
||||||
@ -15,12 +15,17 @@ void DrawDirContents(DirStruct* contents, u32 offset, u32 cursor) {
|
|||||||
u32 color_font;
|
u32 color_font;
|
||||||
u32 color_bg;
|
u32 color_bg;
|
||||||
if (offset_i < contents->n_entries) {
|
if (offset_i < contents->n_entries) {
|
||||||
color_font = COLOR_WHITE;
|
if (cursor != offset_i) {
|
||||||
color_bg = COLOR_BLACK;
|
color_font = COLOR_GREY;
|
||||||
|
color_bg = COLOR_BLACK;
|
||||||
|
} else {
|
||||||
|
color_font = COLOR_WHITE;
|
||||||
|
color_bg = COLOR_BLACK;
|
||||||
|
}
|
||||||
snprintf(tempstr, str_width + 1, "%-*.*s", str_width, str_width, contents->entry[offset_i].name);
|
snprintf(tempstr, str_width + 1, "%-*.*s", str_width, str_width, contents->entry[offset_i].name);
|
||||||
} else {
|
} else {
|
||||||
color_font = COLOR_BLACK;
|
color_font = COLOR_WHITE;
|
||||||
color_bg = COLOR_WHITE;
|
color_bg = COLOR_BLACK;
|
||||||
snprintf(tempstr, str_width + 1, "%-*.*s", str_width, str_width, "");
|
snprintf(tempstr, str_width + 1, "%-*.*s", str_width, str_width, "");
|
||||||
}
|
}
|
||||||
DrawStringF(false, pos_x, pos_y, color_font, color_bg, tempstr);
|
DrawStringF(false, pos_x, pos_y, color_font, color_bg, tempstr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user