All base io functions working

This commit is contained in:
d0k3 2016-02-16 16:26:46 +01:00
parent 7176ffc740
commit dadb604905
3 changed files with 7 additions and 10 deletions

View File

@ -109,7 +109,7 @@ PartitionInfo* GetPartitionInfo(u32 partition_id)
u32 GetNandCtr(u8* ctr, u32 offset) u32 GetNandCtr(u8* ctr, u32 offset)
{ {
static const char* versions[] = {"4.x", "5.x", "6.x", "7.x", "8.x", "9.x"}; // static const char* versions[] = {"4.x", "5.x", "6.x", "7.x", "8.x", "9.x"};
static const u8* version_ctrs[] = { static const u8* version_ctrs[] = {
(u8*)0x080D7CAC, (u8*)0x080D7CAC,
(u8*)0x080D858C, (u8*)0x080D858C,

View File

@ -10,7 +10,7 @@
#include "diskio.h" /* FatFs lower layer API */ #include "diskio.h" /* FatFs lower layer API */
#include "platform.h" #include "platform.h"
#include "sdmmc.h" #include "sdmmc.h"
#include "decryptor/nand.h" #include "3dsnand.h"
#define TYPE_SDCARD 0 #define TYPE_SDCARD 0
#define TYPE_SYSNAND 1 #define TYPE_SYSNAND 1
@ -23,7 +23,7 @@ typedef struct {
} FATpartition; } FATpartition;
FATpartition DriveInfo[28] = { FATpartition DriveInfo[28] = {
{ 0x000000, TYPE_SCARD, 0 }, // 0 - SDCARD { 0x000000, TYPE_SDCARD, 0 }, // 0 - SDCARD
{ 0x000000, TYPE_SYSNAND, P_CTRNAND }, // 1 - SYSNAND CTRNAND { 0x000000, TYPE_SYSNAND, P_CTRNAND }, // 1 - SYSNAND CTRNAND
{ 0x000000, TYPE_SYSNAND, P_TWLN }, // 2 - SYSNAND TWLN { 0x000000, TYPE_SYSNAND, P_TWLN }, // 2 - SYSNAND TWLN
{ 0x000000, TYPE_SYSNAND, P_TWLP }, // 3 - SYSNAND TWLP { 0x000000, TYPE_SYSNAND, P_TWLP }, // 3 - SYSNAND TWLP
@ -96,7 +96,7 @@ DRESULT disk_read (
UINT count /* Number of sectors to read */ UINT count /* Number of sectors to read */
) )
{ {
if (DriveInfo[pdrv].type == TYPE_SCARD) { if (DriveInfo[pdrv].type == TYPE_SDCARD) {
if (sdmmc_sdcard_readsectors(sector, count, buff)) { if (sdmmc_sdcard_readsectors(sector, count, buff)) {
return RES_PARERR; return RES_PARERR;
} }
@ -127,7 +127,7 @@ DRESULT disk_write (
UINT count /* Number of sectors to write */ UINT count /* Number of sectors to write */
) )
{ {
if (DriveInfo[pdrv].type == TYPE_SCARD) { if (DriveInfo[pdrv].type == TYPE_SDCARD) {
if (sdmmc_sdcard_writesectors(sector, count, (BYTE *)buff)) { if (sdmmc_sdcard_writesectors(sector, count, (BYTE *)buff)) {
return RES_PARERR; return RES_PARERR;
} }
@ -166,11 +166,11 @@ DRESULT disk_ioctl (
*((DWORD*) buff) = 0x200; *((DWORD*) buff) = 0x200;
return RES_OK; return RES_OK;
case GET_SECTOR_COUNT: case GET_SECTOR_COUNT:
*((DWORD*) buff) = getMMCDevice((DriveInfo[pdrv].type == TYPE_SCARD) ? 1 : 0)->total_size; *((DWORD*) buff) = getMMCDevice((DriveInfo[pdrv].type == TYPE_SDCARD) ? 1 : 0)->total_size;
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_SCARD) ? RES_OK : RES_PARERR; return (DriveInfo[pdrv].type == TYPE_SDCARD) ? RES_OK : RES_PARERR;
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;

View File

@ -1,10 +1,7 @@
#include "common.h" #include "common.h"
#include "draw.h" #include "draw.h"
#include "fs.h" #include "fs.h"
#include "menu.h"
#include "i2c.h" #include "i2c.h"
#include "decryptor/game.h"
#include "decryptor/nand.h"
void Reboot() void Reboot()
{ {