/* ================================================================================ Name : Texture-Extractor.c Author : JackCarterSmith License : GPL-v3.0 Description : DAT textures extractor to PNG format with enhanced function in C ================================================================================ */ #include "Texture-Extractor.h" int _options; // Global options settings variable int main(int argc, char *argv[]) { // Init buffer vars HMT_FILE *hmt_fdatas = NULL; int file_index; printf("\n*** RogueSquadron Extractor (RSE) - TEXTURE module - v%s ***\n", VERSION); // Check if filenames arguments exist if (argc < 2) { printf("\n[ERR] No input file/commands specified!\n"); dispHelp(); return EXIT_FAILURE; //TODO: implement own error codes system } _options = checkArgs(argv, argc); // Analyse program arguments if (_options == -1) return EXIT_SUCCESS; // Do the work for (file_index=(_options >> 8) & 0xFF; file_index 1) { for (i=1; itexture_count > 0) { if (_options & OUTPUT_DIR) createSubDir(filename); for (i=0; itexture_count; i++) { switch (hmt_f->textures_list[i].image.type_) { case 0: case 1: case 3: case 4: case 5: if (saveToPNG(&(hmt_f->textures_list[i].image), hmt_f->textures_list[i].name, filename)) return EXIT_FAILURE; break; default: printf("[INFO] Image type %d not currently supported!\n", hmt_f->textures_list[i].image.type_); } } } return EXIT_SUCCESS; } void dispHelp() { printf("\n"); printf("Options:\n -h Print this message\n -v Activate verbose console output\n -no-subdir Extract textures inside current folder\n"); printf("\n"); printf("Usage: RSE-Texture_%s [options] \n", VERSION); printf("\n"); }