mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Handle drive size for alias drives
This commit is contained in:
parent
9c0e6153f0
commit
3c75c13880
@ -14,6 +14,8 @@ typedef struct {
|
|||||||
FRESULT fx_open (FIL* fp, XFIL* xfp, const TCHAR* path, BYTE mode);
|
FRESULT fx_open (FIL* fp, XFIL* xfp, const TCHAR* path, BYTE mode);
|
||||||
FRESULT fx_read (FIL* fp, XFIL* xfp, void* buff, UINT btr, UINT* br);
|
FRESULT fx_read (FIL* fp, XFIL* xfp, void* buff, UINT btr, UINT* br);
|
||||||
FRESULT fx_write (FIL* fp, XFIL* xfp, const void* buff, UINT btw, UINT* bw);
|
FRESULT fx_write (FIL* fp, XFIL* xfp, const void* buff, UINT btw, UINT* bw);
|
||||||
|
|
||||||
|
void dealias_path (TCHAR* alias, const TCHAR* path);
|
||||||
FRESULT fa_open (FIL* fp, const TCHAR* path, BYTE mode);
|
FRESULT fa_open (FIL* fp, const TCHAR* path, BYTE mode);
|
||||||
FRESULT fa_opendir (DIR* dp, const TCHAR* path);
|
FRESULT fa_opendir (DIR* dp, const TCHAR* path);
|
||||||
FRESULT fa_stat (const TCHAR* path, FILINFO* fno);
|
FRESULT fa_stat (const TCHAR* path, FILINFO* fno);
|
||||||
|
12
source/fs.c
12
source/fs.c
@ -98,6 +98,12 @@ int PathToNumFS(const char* path) {
|
|||||||
return fsnum;
|
return fsnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PathToNumFSA(const char* path) {
|
||||||
|
char alias[256];
|
||||||
|
dealias_path(alias, path);
|
||||||
|
return PathToNumFS(alias);
|
||||||
|
}
|
||||||
|
|
||||||
bool IsSearchDrive(const char* path) {
|
bool IsSearchDrive(const char* path) {
|
||||||
return *search_pattern && *search_path && (strncmp(path, "Z:", 3) == 0);
|
return *search_pattern && *search_path && (strncmp(path, "Z:", 3) == 0);
|
||||||
}
|
}
|
||||||
@ -1213,7 +1219,7 @@ uint64_t GetFreeSpace(const char* path)
|
|||||||
DWORD free_clusters;
|
DWORD free_clusters;
|
||||||
FATFS *fs_ptr;
|
FATFS *fs_ptr;
|
||||||
char fsname[4] = { '\0' };
|
char fsname[4] = { '\0' };
|
||||||
int pdrv = PathToNumFS(path);
|
int pdrv = PathToNumFSA(path);
|
||||||
if (pdrv < 0) return 0;
|
if (pdrv < 0) return 0;
|
||||||
|
|
||||||
snprintf(fsname, 3, "%i:", pdrv);
|
snprintf(fsname, 3, "%i:", pdrv);
|
||||||
@ -1225,7 +1231,7 @@ uint64_t GetFreeSpace(const char* path)
|
|||||||
|
|
||||||
uint64_t GetTotalSpace(const char* path)
|
uint64_t GetTotalSpace(const char* path)
|
||||||
{
|
{
|
||||||
int pdrv = PathToNumFS(path);
|
int pdrv = PathToNumFSA(path);
|
||||||
if (pdrv < 0) return 0;
|
if (pdrv < 0) return 0;
|
||||||
|
|
||||||
return (uint64_t) (fs[pdrv].n_fatent - 2) * fs[pdrv].csize * _MAX_SS;
|
return (uint64_t) (fs[pdrv].n_fatent - 2) * fs[pdrv].csize * _MAX_SS;
|
||||||
@ -1233,7 +1239,7 @@ uint64_t GetTotalSpace(const char* path)
|
|||||||
|
|
||||||
uint64_t GetPartitionOffsetSector(const char* path)
|
uint64_t GetPartitionOffsetSector(const char* path)
|
||||||
{
|
{
|
||||||
int pdrv = PathToNumFS(path);
|
int pdrv = PathToNumFSA(path);
|
||||||
if (pdrv < 0) return -1;
|
if (pdrv < 0) return -1;
|
||||||
|
|
||||||
return (uint64_t) fs[pdrv].volbase;
|
return (uint64_t) fs[pdrv].volbase;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user