From 038b31f0158a0018dbf2eceb71026cc4e665faa9 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Tue, 6 Oct 2015 21:28:40 +0800 Subject: Add the SMELT files... Please, do not laugh too loudly. --- tools/dtputil/anmutil.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++++++ tools/dtputil/build | 3 +++ tools/dtputil/dtputil.cpp | 43 ++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 tools/dtputil/anmutil.cpp create mode 100755 tools/dtputil/build create mode 100644 tools/dtputil/dtputil.cpp (limited to 'tools/dtputil') diff --git a/tools/dtputil/anmutil.cpp b/tools/dtputil/anmutil.cpp new file mode 100644 index 0000000..6636e2c --- /dev/null +++ b/tools/dtputil/anmutil.cpp @@ -0,0 +1,63 @@ +#include "../../include/smdatapack.hpp" +#include +#include +#include +int main(int argc,char** argv) +{ + if(argc<3) + return printf("usage: %s [filetoread1/filetowrite1] ...\n",argv[0]),1; + if(argv[1][0]=='w') + { + smDtpFileW file; + for(int i=3;i %s",wn,argv[2]); + if(system(comm)) + puts("Error while trying decompressing the file, you may have to decompress it yourself."); + else{sprintf(comm,"rm %s",wn);system(comm);} + delete wn; + } + if(argv[1][0]=='r') + { + smDtpFileR file; + FILE *pFile;DWORD size,rsize;char *buff; + pFile=fopen(argv[2],"rb"); + if(!pFile)return 0; + fseek(pFile,0,SEEK_END);size=ftell(pFile);rewind(pFile); + buff=(char*)malloc(sizeof(char)*size); + if(!buff)return 0; + rsize=fread(buff,1,size,pFile); + if(rsize!=size)return 0; + file.openDtpFromMemory(buff,size); + if(argc==3) + { + for(char* c=file.getFirstFile();c;c=file.getNextFile(c)) + { + puts(c); + char *ptr=file.getFilePtr(c); + if(!ptr)printf("error\n");else + printf("size:%lu, first bytes:%c%c%c\n",file.getFileSize(c),*ptr,*(ptr+1),*(ptr+2)); + file.releaseFilePtr(c); + } + } + else + for(int i=3;i +int main(int argc,char** argv) +{ + if(argc<3) + return printf("usage: %s [filetoread1/filetowrite1] ...\n",argv[0]),1; + if(argv[1][0]=='w') + { + smDtpFileW file; + for(int i=3;i