From: hackbard Date: Mon, 4 Oct 2004 15:33:50 +0000 (+0000) Subject: added tool to convert big endian save files to little endian (dont tell anyone!) X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39debc53e01d3f427efbb7830eace54254a12b40;p=physik%2Fnlsop.git added tool to convert big endian save files to little endian (dont tell anyone!) --- diff --git a/.cvsignore b/.cvsignore index 209faf8..b7561ec 100644 --- a/.cvsignore +++ b/.cvsignore @@ -7,3 +7,4 @@ Makefile nlsop-* parse_trim_collision ft +be2le diff --git a/be2le.c b/be2le.c new file mode 100644 index 0000000..d1fcfaa --- /dev/null +++ b/be2le.c @@ -0,0 +1,150 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +#include "dfbapi.h" +#include "nlsop.h" + +int byte_switch(void *data,int bytes) { + + unsigned char tmp; + unsigned char *d; + int i; + + d=(unsigned char *)data; + + for(i=0;i ",i); + fflush(stdout); + write(1,&i,4); + printf("\n"); + byte_switch(&i,sizeof(int)); + printf("%d -> ",i); + fflush(stdout); + write(1,&i,4); + printf("\n"); + + if((rfd=open(argv[1],O_RDONLY))<0) { + printf("failed opening file %s\n",argv[1]); + return -1; + } + + if((wfd=open(argv[2],O_WRONLY|O_CREAT))<0) { + printf("failed opening file %s\n",argv[2]); + return -1; + } + + size=sizeof(d3_lattice); + if(read(rfd,&l,size)