I guess I can just put this up. Most of these have been sitting here forever.

This commit is contained in:
Marisa the Magician 2017-09-04 11:24:40 +02:00
commit d2777092d1
26 changed files with 5347 additions and 0 deletions

37
ckmextract.c Normal file
View file

@ -0,0 +1,37 @@
#include <stdio.h>
#include <libgen.h>
#include <string.h>
int main( int argc, char **argv )
{
if ( argc < 2 ) return 1;
FILE *ckm = fopen(argv[1],"rb");
char *ckmfil = basename(argv[1]);
char bsafil[256];
char espfil[256];
strcpy(bsafil,ckmfil);
strcpy(espfil,ckmfil);
strcpy(strchr(bsafil,'.'),".bsa");
strcpy(strchr(espfil,'.'),".esp");
int siz;
fread(&siz,1,4,ckm);
FILE *bsa = fopen(bsafil,"wb");
while ( (siz > 0) )
{
char buf[8192];
int rd = fread(buf,1,(siz>8192)?8192:siz,ckm);
fwrite(buf,1,rd,bsa);
siz -= rd;
}
fclose(bsa);
fread(&siz,1,4,ckm);
FILE *esp = fopen(espfil,"wb");
while ( !feof(ckm) )
{
char buf[8192];
int rd = fread(buf,1,8192,ckm);
fwrite(buf,1,rd,esp);
}
fclose(esp);
return 0;
}