//Insert '|' in front of filename //Doing this tells kzopen to load the file only if inside a .ZIP file static intptr_t kzipopen(char *filnam) { uint32_t i; char newst[BMAX_PATH+8]; newst[0] = '|'; for (i=0; filnam[i] && (i < sizeof(newst)-2); i++) newst[i+1] = filnam[i]; newst[i+1] = 0; return(kzopen(newst)); }
void kpzload (const char *filnam, intptr_t *pic, int *bpl, int *xsiz, int *ysiz) { char *buf; int leng; (*pic) = 0; if (!kzopen(filnam)) return; leng = kzfilelength(); buf = (char *)malloc(leng); if (!buf) { kzclose(); return; } kzread(buf,leng); kzclose(); kpgetdim(buf,leng,xsiz,ysiz); (*bpl) = ((*xsiz)<<2); (*pic) = (intptr_t)malloc((*ysiz)*(*bpl)); if (!(*pic)) { free(buf); return; } if (kprender(buf,leng,*pic,*bpl,*xsiz,*ysiz,0,0) < 0) { free(buf); free((void *)*pic); (*pic) = 0; return; } free(buf); }