mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-22 01:49:17 +01:00
only bypass cache fill on write for nds. this is sub-optimal on wii/gc.
This commit is contained in:
parent
639836914a
commit
ba3622a4cd
@ -264,7 +264,7 @@ bool _FAT_cache_eraseWritePartialSector (CACHE* cache, const void* buffer, sec_t
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifndef GEKKO
|
||||
static CACHE_ENTRY* _FAT_cache_findPage(CACHE *cache, sec_t sector, sec_t count) {
|
||||
|
||||
unsigned int i;
|
||||
@ -291,6 +291,7 @@ static CACHE_ENTRY* _FAT_cache_findPage(CACHE *cache, sec_t sector, sec_t count)
|
||||
|
||||
return entry;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool _FAT_cache_writeSectors (CACHE* cache, sec_t sector, sec_t numSectors, const void* buffer)
|
||||
{
|
||||
@ -301,37 +302,35 @@ bool _FAT_cache_writeSectors (CACHE* cache, sec_t sector, sec_t numSectors, cons
|
||||
|
||||
while(numSectors>0)
|
||||
{
|
||||
#ifdef GEKKO
|
||||
entry = _FAT_cache_getPage(cache,sector);
|
||||
if(entry==NULL) return false;
|
||||
#else
|
||||
entry = _FAT_cache_findPage(cache,sector,numSectors);
|
||||
|
||||
if(entry!=NULL) {
|
||||
if(entry==NULL)
|
||||
return _FAT_disc_writeSectors(cache->disc,sector,numSectors,src);
|
||||
|
||||
if ( entry->sector > sector) {
|
||||
if ( entry->sector > sector) {
|
||||
secs_to_write = 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;
|
||||
}
|
||||
|
||||
sec = sector - entry->sector;
|
||||
secs_to_write = entry->count - sec;
|
||||
|
||||
if(secs_to_write>numSectors) secs_to_write = numSectors;
|
||||
|
||||
memcpy(entry->cache + (sec*BYTES_PER_READ),src,(secs_to_write*BYTES_PER_READ));
|
||||
|
||||
_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;
|
||||
|
||||
entry->dirty = true;
|
||||
|
||||
} else {
|
||||
_FAT_disc_writeSectors(cache->disc,sector,numSectors,src);
|
||||
numSectors=0;
|
||||
}
|
||||
#endif
|
||||
sec = sector - entry->sector;
|
||||
secs_to_write = entry->count - sec;
|
||||
if(secs_to_write>numSectors) secs_to_write = numSectors;
|
||||
|
||||
memcpy(entry->cache + (sec*BYTES_PER_READ),src,(secs_to_write*BYTES_PER_READ));
|
||||
|
||||
src += (secs_to_write*BYTES_PER_READ);
|
||||
sector += secs_to_write;
|
||||
numSectors -= secs_to_write;
|
||||
|
||||
entry->dirty = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user