/* Copyright (C) 2003 Parallel Realities This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include int main(int argc, char *argv[]) { unsigned char *packBuffer; char packFilename[60]; int packFSize; int i; FILE *pak; FILE *fp = NULL; pak = fopen("../starfighter.pak", "wb"); if (pak == NULL) { fprintf(stderr, "Couldn't access the Project: Starfighter data file!\n"); return 1; } fseek(pak, 4, SEEK_SET); for (i = 1; i < argc; i++) { fp = fopen(argv[i], "rb"); if (fp == NULL) { fprintf(stderr, "could not open %s for reading\n", packFilename); return 1; } strcpy(packFilename, argv[i]); fseek(fp, 0, SEEK_END); packFSize = ftell(fp); rewind(fp); fwrite(packFilename, 1, 56, pak); fwrite(&packFSize, 4, 1, pak); packBuffer = (unsigned char*) malloc(packFSize); fread(packBuffer, 1, packFSize, fp); fwrite(packBuffer, 1, packFSize, pak); free(packBuffer); fclose(fp); } fclose(pak); return 0; }