mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-25 19:36:52 +01:00
revert cache bypass
This commit is contained in:
parent
ba3622a4cd
commit
8d8b83e967
@ -264,34 +264,6 @@ bool _FAT_cache_eraseWritePartialSector (CACHE* cache, const void* buffer, sec_t
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GEKKO
|
|
||||||
static CACHE_ENTRY* _FAT_cache_findPage(CACHE *cache, sec_t sector, sec_t count) {
|
|
||||||
|
|
||||||
unsigned int i;
|
|
||||||
CACHE_ENTRY* cacheEntries = cache->cacheEntries;
|
|
||||||
unsigned int numberOfPages = cache->numberOfPages;
|
|
||||||
CACHE_ENTRY *entry = NULL;
|
|
||||||
sec_t lowest = UINT_MAX;
|
|
||||||
|
|
||||||
for(i=0;i<numberOfPages;i++) {
|
|
||||||
if (cacheEntries[i].sector != CACHE_FREE) {
|
|
||||||
bool intersect;
|
|
||||||
if (sector > cacheEntries[i].sector) {
|
|
||||||
intersect = sector - cacheEntries[i].sector < cacheEntries[i].count;
|
|
||||||
} else {
|
|
||||||
intersect = cacheEntries[i].sector - sector < count;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( intersect && (cacheEntries[i].sector < lowest)) {
|
|
||||||
lowest = cacheEntries[i].sector;
|
|
||||||
entry = &cacheEntries[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool _FAT_cache_writeSectors (CACHE* cache, sec_t sector, sec_t numSectors, const void* buffer)
|
bool _FAT_cache_writeSectors (CACHE* cache, sec_t sector, sec_t numSectors, const void* buffer)
|
||||||
{
|
{
|
||||||
@ -302,24 +274,9 @@ bool _FAT_cache_writeSectors (CACHE* cache, sec_t sector, sec_t numSectors, cons
|
|||||||
|
|
||||||
while(numSectors>0)
|
while(numSectors>0)
|
||||||
{
|
{
|
||||||
#ifdef GEKKO
|
|
||||||
entry = _FAT_cache_getPage(cache,sector);
|
entry = _FAT_cache_getPage(cache,sector);
|
||||||
if(entry==NULL) return false;
|
if(entry==NULL) return false;
|
||||||
#else
|
|
||||||
entry = _FAT_cache_findPage(cache,sector,numSectors);
|
|
||||||
|
|
||||||
if(entry==NULL)
|
|
||||||
return _FAT_disc_writeSectors(cache->disc,sector,numSectors,src);
|
|
||||||
|
|
||||||
if ( entry->sector > sector) {
|
|
||||||
secs_to_write = entry->sector - sector;
|
|
||||||
|
|
||||||
_FAT_disc_writeSectors(cache->disc,sector,secs_to_write,src);
|
|
||||||
src += (secs_to_write*BYTES_PER_READ);
|
|
||||||
sector += secs_to_write;
|
|
||||||
numSectors -= secs_to_write;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
sec = sector - entry->sector;
|
sec = sector - entry->sector;
|
||||||
secs_to_write = entry->count - sec;
|
secs_to_write = entry->count - sec;
|
||||||
if(secs_to_write>numSectors) secs_to_write = numSectors;
|
if(secs_to_write>numSectors) secs_to_write = numSectors;
|
||||||
|
Loading…
Reference in New Issue
Block a user