X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcart.c;h=1ce80597d931cb371134124c5a1ca1452c53d91d;hb=ea38612fad50103e224a3d00492d40b7dcff9e94;hp=377ecbc24a63f020032688ca860226f7fb624c47;hpb=b4c2331e793ba8ca719fc540f6f2eb1b9e53a0e6;p=picodrive.git diff --git a/pico/cart.c b/pico/cart.c index 377ecbc..1ce8059 100644 --- a/pico/cart.c +++ b/pico/cart.c @@ -8,9 +8,9 @@ */ #include "pico_int.h" -#include "../zlib/zlib.h" #include "../cpu/debug.h" #include "../unzip/unzip.h" +#include static int rom_alloc_size; @@ -49,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; @@ -326,7 +326,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; @@ -569,7 +569,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; }