X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcart.c;h=9dce38d98ea27c629b889c21c50cc01c57949288;hb=653f0b1399313ecef86d99a2552f40fb9e51b820;hp=3bab61586e9a01aee5508b1f1a21aa8c880f1184;hpb=32cc15e8116db5fa6eb191212f76352707fb25a0;p=picodrive.git diff --git a/pico/cart.c b/pico/cart.c index 3bab615..9dce38d 100644 --- a/pico/cart.c +++ b/pico/cart.c @@ -8,10 +8,9 @@ */ #include "pico_int.h" -#include "../zlib/zlib.h" #include "../cpu/debug.h" #include "../unzip/unzip.h" -#include "../unzip/unzip_stream.h" +#include static int rom_alloc_size; @@ -50,7 +49,7 @@ typedef struct _cso_struct } cso_struct; -static int uncompress2(void *dest, int destLen, void *source, int sourceLen) +static int uncompress_buf(void *dest, int destLen, void *source, int sourceLen) { z_stream stream; int err; @@ -298,7 +297,7 @@ size_t pm_read(void *ptr, size_t bytes, pm_file *stream) } cso->block_in_buff = block; } - rret = uncompress2(tmp_dst, 2048, cso->in_buff, read_len); + rret = uncompress_buf(tmp_dst, 2048, cso->in_buff, read_len); if (rret != 0) { elprintf(EL_STATUS, "cso: uncompress failed @ %08x with %i", read_pos, rret); break; @@ -332,9 +331,7 @@ int pm_seek(pm_file *stream, long offset, int whence) if (stream->type == PMT_UNCOMPRESSED) { fseek(stream->file, offset, whence); - int ret = ftell(stream->file); - elprintf(EL_STATUS, "seeked ok."); //HACK for VITA - return ret; + return ftell(stream->file); } #ifndef NO_ZLIB else if (stream->type == PMT_ZIP) @@ -515,7 +512,7 @@ int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize,int is_sms) bytes_read = pm_read(rom,size,f); // Load up the rom if (bytes_read <= 0) { elprintf(EL_STATUS, "read failed"); - free(rom); + plat_munmap(rom, rom_alloc_size); return 3; }