X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcd%2Fbuffering.c;h=826184b5284d46631621d55cb492b530410697de;hb=85a4b5a4a26f22389c4dbe3f95a2f31452ff7579;hp=8287618928ec1889c54e15bedc9904fcae6d5bdb;hpb=8022f53da61b8e70420a3bac97250119bbe26457;p=picodrive.git diff --git a/Pico/cd/buffering.c b/Pico/cd/buffering.c index 8287618..826184b 100644 --- a/Pico/cd/buffering.c +++ b/Pico/cd/buffering.c @@ -43,11 +43,17 @@ void PicoCDBufferFree(void) cd_buffer = NULL; } if (reads) - printf("CD buffer hits: %i/%i (%i%%)\n", hits, reads, hits * 100 / reads); + elprintf(EL_STATUS, "CD buffer hits: %i/%i (%i%%)\n", hits, reads, hits * 100 / reads); } -/* this is a try to fight slow SD access of GP2X */ +void PicoCDBufferFlush(void) +{ + prev_lba = 0x80000000; +} + + +/* this is was a try to fight slow SD access of GP2X */ PICO_INTERNAL void PicoCDBufferRead(void *dest, int lba) { int is_bin, offs, read_len, moved = 0; @@ -104,17 +110,20 @@ PICO_INTERNAL void PicoCDBufferRead(void *dest, int lba) { int i = 0; #if REDUCE_IO_CALLS - int bufs = (read_len*2048+304) / (2048+304); + int bufs = (read_len*2048) / (2048+304); pm_read(cd_buffer, bufs*(2048+304), Pico_mcd->TOC.Tracks[0].F); for (i = 1; i < bufs; i++) // should really use memmove here, but my memcpy32 implementation is also suitable here memcpy32((int *)(cd_buffer + i*2048), (int *)(cd_buffer + i*(2048+304)), 2048/4); #endif - for (; i < read_len; i++) + for (; i < read_len - 1; i++) { pm_read(cd_buffer + i*2048, 2048 + 304, Pico_mcd->TOC.Tracks[0].F); // pm_seek(Pico_mcd->TOC.Tracks[0].F, 304, SEEK_CUR); // seeking is slower, in PSP case even more } + // further data might be moved, do not overwrite + pm_read(cd_buffer + i*2048, 2048, Pico_mcd->TOC.Tracks[0].F); + pm_seek(Pico_mcd->TOC.Tracks[0].F, 304, SEEK_CUR); } else {