mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 11:21:23 +00:00
Fix a critical bug with exFAT FatFs + a list bug
Nintendo you hear? Fix your driver already. (for us never caused any problem, because we always sync fs dir changes to medium.)
This commit is contained in:
parent
c5a6ad823e
commit
da5a1a9641
3 changed files with 8 additions and 11 deletions
|
@ -168,10 +168,10 @@ int ini_parse(link_t *dst, char *ini_path, bool is_dir)
|
||||||
|
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
|
||||||
} while (is_dir);
|
if (csec)
|
||||||
|
list_append(dst, &csec->link);
|
||||||
|
|
||||||
if (csec)
|
} while (is_dir);
|
||||||
list_append(dst, &csec->link);
|
|
||||||
|
|
||||||
free(filename);
|
free(filename);
|
||||||
free(filelist);
|
free(filelist);
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
extern gfx_ctxt_t gfx_ctxt;
|
extern gfx_ctxt_t gfx_ctxt;
|
||||||
extern gfx_con_t gfx_con;
|
extern gfx_con_t gfx_con;
|
||||||
extern heap_t _heap;
|
extern heap_t _heap;
|
||||||
extern sdmmc_t sd_sdmmc;
|
|
||||||
extern sdmmc_storage_t sd_storage;
|
|
||||||
|
|
||||||
extern void *sd_file_read(char *path);
|
extern void *sd_file_read(char *path);
|
||||||
extern bool sd_mount();
|
extern bool sd_mount();
|
||||||
|
@ -48,8 +46,6 @@ static void _ianos_call_ep(moduleEntrypoint_t entrypoint, void *moduleConfig)
|
||||||
bdkParameters->memcpy = (memcpy_t)&memcpy;
|
bdkParameters->memcpy = (memcpy_t)&memcpy;
|
||||||
bdkParameters->memset = (memset_t)&memset;
|
bdkParameters->memset = (memset_t)&memset;
|
||||||
bdkParameters->sharedHeap = &_heap;
|
bdkParameters->sharedHeap = &_heap;
|
||||||
bdkParameters->sdSdmmc = &sd_sdmmc;
|
|
||||||
bdkParameters->sdStorage = &sd_storage;
|
|
||||||
|
|
||||||
entrypoint(moduleConfig, bdkParameters);
|
entrypoint(moduleConfig, bdkParameters);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4943,6 +4943,7 @@ FRESULT f_mkdir (
|
||||||
{
|
{
|
||||||
FRESULT res;
|
FRESULT res;
|
||||||
DIR dj;
|
DIR dj;
|
||||||
|
FFOBJID sobj;
|
||||||
FATFS *fs;
|
FATFS *fs;
|
||||||
BYTE *dir;
|
BYTE *dir;
|
||||||
DWORD dcl, pcl, tm;
|
DWORD dcl, pcl, tm;
|
||||||
|
@ -4960,8 +4961,8 @@ FRESULT f_mkdir (
|
||||||
res = FR_INVALID_NAME;
|
res = FR_INVALID_NAME;
|
||||||
}
|
}
|
||||||
if (res == FR_NO_FILE) { /* Can create a new directory */
|
if (res == FR_NO_FILE) { /* Can create a new directory */
|
||||||
dcl = create_chain(&dj.obj, 0); /* Allocate a cluster for the new directory table */
|
sobj.fs = fs; /* New object id to create a new chain */
|
||||||
dj.obj.objsize = (DWORD)fs->csize * SS(fs);
|
dcl = create_chain(&sobj, 0); /* Allocate a cluster for the new directory */
|
||||||
res = FR_OK;
|
res = FR_OK;
|
||||||
if (dcl == 0) res = FR_DENIED; /* No space to allocate a new cluster */
|
if (dcl == 0) res = FR_DENIED; /* No space to allocate a new cluster */
|
||||||
if (dcl == 1) res = FR_INT_ERR;
|
if (dcl == 1) res = FR_INT_ERR;
|
||||||
|
@ -4991,8 +4992,8 @@ FRESULT f_mkdir (
|
||||||
if (fs->fs_type == FS_EXFAT) { /* Initialize directory entry block */
|
if (fs->fs_type == FS_EXFAT) { /* Initialize directory entry block */
|
||||||
st_dword(fs->dirbuf + XDIR_ModTime, tm); /* Created time */
|
st_dword(fs->dirbuf + XDIR_ModTime, tm); /* Created time */
|
||||||
st_dword(fs->dirbuf + XDIR_FstClus, dcl); /* Table start cluster */
|
st_dword(fs->dirbuf + XDIR_FstClus, dcl); /* Table start cluster */
|
||||||
st_dword(fs->dirbuf + XDIR_FileSize, (DWORD)dj.obj.objsize); /* File size needs to be valid */
|
st_dword(fs->dirbuf + XDIR_FileSize, (DWORD)fs->csize * SS(fs)); /* File size needs to be valid */
|
||||||
st_dword(fs->dirbuf + XDIR_ValidFileSize, (DWORD)dj.obj.objsize);
|
st_dword(fs->dirbuf + XDIR_ValidFileSize, (DWORD)fs->csize * SS(fs));
|
||||||
fs->dirbuf[XDIR_GenFlags] = 3; /* Initialize the object flag */
|
fs->dirbuf[XDIR_GenFlags] = 3; /* Initialize the object flag */
|
||||||
fs->dirbuf[XDIR_Attr] = AM_DIR; /* Attribute */
|
fs->dirbuf[XDIR_Attr] = AM_DIR; /* Attribute */
|
||||||
res = store_xdir(&dj);
|
res = store_xdir(&dj);
|
||||||
|
|
Loading…
Reference in a new issue