@@ -173,7 +173,7 @@ void *ziso_alloc(u32 size)
173173int DeviceReadSectorsCached (u64 lsn , void * buffer , unsigned int sectors )
174174{
175175 if (sectors < MAX_SECTOR_CACHE ) { // if MAX_SECTOR_CACHE is 0 then it will act as disabled and passthrough
176- if (cur_sector == 0xffffffffffff || lsn < cur_sector || (lsn + sectors ) - cur_sector > MAX_SECTOR_CACHE ) {
176+ if (cur_sector == 0xffffffffffffffff || lsn < cur_sector || (lsn + sectors ) - cur_sector > MAX_SECTOR_CACHE ) {
177177 DeviceReadSectors (lsn , sector_cache , MAX_SECTOR_CACHE );
178178 cur_sector = lsn ;
179179 }
@@ -356,14 +356,13 @@ static int cdvdman_read(u32 lsn, u32 sectors, u16 sector_size, void *buf)
356356 cdvdman_stat .status = SCECdStatRead ;
357357 buf = (void * )PHYSADDR (buf );
358358
359- #if defined(HDD_DRIVER ) || defined(USE_BDM_ATA ) // As of now, only the ATA interface requires this. We do this here to share cdvdman_buf.
360359 // OPL only has 2048 bytes no matter what. For other sizes we have to copy to the offset and prepoluate the sector header data (the extra bytes.)
361360 u32 offset = 0 ;
362361
363362 if (sector_size == 2340 )
364363 offset = 12 ; // head - sub - data(2048) -- edc-ecc
365364
366- if ((u32 )(buf )& 3 ) {
365+ if ((u32 )(buf )& 3 || ( sector_size != 2048 ) ) {
367366 // For transfers to unaligned buffers, a double-copy is required to avoid stalling the device's DMA channel.
368367 WaitSema (cdvdman_searchfilesema );
369368
@@ -409,17 +408,11 @@ static int cdvdman_read(u32 lsn, u32 sectors, u16 sector_size, void *buf)
409408 header [6 ] = header [10 ] = 0x8 ;
410409 header [7 ] = header [11 ] = 0 ;
411410 }
412-
413411 buf = (void * )((u8 * )buf + nbytes );
414412 }
415-
416413 SignalSema (cdvdman_searchfilesema );
417- } else {
418- #endif
414+ } else
419415 cdvdman_read_sectors (lsn , sectors , buf );
420- #if defined(HDD_DRIVER ) || defined(USE_BDM_ATA )
421- }
422- #endif
423416
424417 ReadPos = 0 ; /* Reset the buffer offset indicator. */
425418
0 commit comments