X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=Pico%2FCart.c;fp=Pico%2FCart.c;h=c07bfda4949fda5487d82d6211245eae364d2bf6;hb=f8af96349ea464111fbef3c6528016c3dc34cdcf;hp=de340a1151a6479ae667e2b6d0a4ae19d4658ca9;hpb=02ba8788a0a15cd76fefc777908738cc27e78e6c;p=picodrive.git diff --git a/Pico/Cart.c b/Pico/Cart.c index de340a1..c07bfda 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -137,8 +137,10 @@ zip_failed: if (f == NULL) goto cso_failed; +#ifndef __EPOC32__ /* we use our own buffering */ setvbuf(f, NULL, _IONBF, 0); +#endif cso = malloc(sizeof(*cso)); if (cso == NULL) @@ -192,9 +194,6 @@ cso_failed: f = fopen(path, "rb"); if (f == NULL) return NULL; - /* we use our own buffering */ - setvbuf(f, NULL, _IONBF, 0); - file = malloc(sizeof(*file)); if (file == NULL) { fclose(f); @@ -207,6 +206,12 @@ cso_failed: file->type = PMT_UNCOMPRESSED; fseek(f, 0, SEEK_SET); +#ifndef __EPOC32__ // makes things worse on Symbian + if (file->size > 0x400000) + /* we use our own buffering */ + setvbuf(f, NULL, _IONBF, 0); +#endif + return file; } @@ -445,7 +450,7 @@ int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize) rom=PicoCartAlloc(size); if (rom==NULL) { elprintf(EL_STATUS, "out of memory (wanted %i)", size); - return 1; + return 2; } if (PicoCartLoadProgressCB != NULL) @@ -470,7 +475,7 @@ int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize) if (bytes_read <= 0) { elprintf(EL_STATUS, "read failed"); free(rom); - return 1; + return 3; } // maybe we are loading MegaCD BIOS?