Detailed debug info, clear log
This commit is contained in:
parent
a536991daa
commit
82dddcb5dc
@ -26,7 +26,7 @@ HMT_FILE *parseHMTFile(FILE *hmt_src) {
|
|||||||
// Read textures
|
// Read textures
|
||||||
fseek(hmt_src, _buff->texture_offset, SEEK_SET);
|
fseek(hmt_src, _buff->texture_offset, SEEK_SET);
|
||||||
fread(&(_buff->texture_count), 4, 1, hmt_src);
|
fread(&(_buff->texture_count), 4, 1, hmt_src);
|
||||||
printf("[INFO] Textures detected: %d\n\n", _buff->texture_count);
|
printf("[INFO] Textures detected: %d\n", _buff->texture_count);
|
||||||
if (_buff->texture_count > 0) {
|
if (_buff->texture_count > 0) {
|
||||||
_buff->textures_list = calloc(_buff->texture_count, sizeof(HMT_TEXTURE)); // Create a big list of textures entries
|
_buff->textures_list = calloc(_buff->texture_count, sizeof(HMT_TEXTURE)); // Create a big list of textures entries
|
||||||
for (i=0; i<_buff->texture_count; i++) {
|
for (i=0; i<_buff->texture_count; i++) {
|
||||||
@ -48,7 +48,7 @@ int readMaterial(HMT_MATERIAL *mat, FILE *hmt_src) {
|
|||||||
|
|
||||||
if (_options & 0x1) {
|
if (_options & 0x1) {
|
||||||
if (mat->zero != 0 || mat->hex_a != 0x0A) printf("\n Uncommon file detected!\n");
|
if (mat->zero != 0 || mat->hex_a != 0x0A) printf("\n Uncommon file detected!\n");
|
||||||
printf("Material type: %d\nTexture index: %d\n", mat->type_, mat->texture_index);
|
printf(" Material type: %d\n Texture index: %d\n\n", mat->type_, mat->texture_index); //TODO: To develop?!
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
@ -87,14 +87,16 @@ int readTexture(HMT_TEXTURE *tex, FILE *hmt_src) {
|
|||||||
tex->image.height = tex->height;
|
tex->image.height = tex->height;
|
||||||
|
|
||||||
if (_options & VERBOSE_ENABLED) {
|
if (_options & VERBOSE_ENABLED) {
|
||||||
|
printf(" Texture name: %s\n", tex->name);
|
||||||
|
printf(" Size w: %ld h: %ld\n", tex->width, tex->height);
|
||||||
|
printf(" u0: %d u1: %d\n", u0, u1);
|
||||||
|
printf(" Texture type: %d\n", tex->image.type_);
|
||||||
|
printf(" Samplebits: %d\n", tex->image.sampleBits);
|
||||||
|
printf(" Palette entries: %d\n", tex->image.paletteEntries);
|
||||||
|
printf(" Transparent color (RGB): %X %X %X\n", tex->image.alpha_color._red, tex->image.alpha_color._green, tex->image.alpha_color._blue);
|
||||||
|
printf(" Palette offset: %d\n", tex->palette_offset);
|
||||||
|
printf(" Data offset: %d\n", tex->data_offset);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Texture name: %s\n", tex->name);
|
|
||||||
printf("Size w: %ld h: %ld\n", tex->width, tex->height);
|
|
||||||
printf("Texture subtype: %d\n", tex->image.type_);
|
|
||||||
printf("Palette offset: %d\n", tex->palette_offset);
|
|
||||||
printf("Data offset: %d\n", tex->data_offset);
|
|
||||||
printf("Transparent color (RGB): %X %X %X\n", tex->image.alpha_color._red, tex->image.alpha_color._green, tex->image.alpha_color._blue);
|
|
||||||
printf("u0: %d u1: %d\n", u0, u1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tex->palette_offset > 0) {
|
if (tex->palette_offset > 0) {
|
||||||
|
@ -53,12 +53,12 @@ int checkArgs(char *args[], int arg_nbr) {
|
|||||||
return -1;
|
return -1;
|
||||||
} else if (strcmp(args[i], "-v") == 0) {
|
} else if (strcmp(args[i], "-v") == 0) {
|
||||||
_o |= VERBOSE_ENABLED;
|
_o |= VERBOSE_ENABLED;
|
||||||
printf("[INFO] Verbose enabled.\n");
|
printf("[OPTN] Verbose enabled.\n");
|
||||||
} else if (strcmp(args[i], "-no-subdir") == 0) {
|
} else if (strcmp(args[i], "-no-subdir") == 0) {
|
||||||
_o &= ~OUTPUT_DIR;
|
_o &= ~OUTPUT_DIR;
|
||||||
printf("[INFO] Extract to current directory.\n");
|
printf("[OPTN] Extract to current directory.\n");
|
||||||
} else {
|
} else {
|
||||||
printf("[INFO] Unknown option: %s\n", args[i]);
|
printf("[ERR] Unknown option: %s\n", args[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_o = (i << 8) | (_o & 0x00FF);
|
_o = (i << 8) | (_o & 0x00FF);
|
||||||
@ -86,11 +86,11 @@ HMT_FILE *extractDatasFromHMT(char *hmt_filename) {
|
|||||||
|
|
||||||
_hmtFile = fopen(hmt_filename, "rb");
|
_hmtFile = fopen(hmt_filename, "rb");
|
||||||
if (_hmtFile != NULL) {
|
if (_hmtFile != NULL) {
|
||||||
printf("\n[INFO] - Parsing file: %s\n", hmt_filename);
|
printf("\n=============================================\n[INFO] - Parsing file: %s ...\n", hmt_filename);
|
||||||
hmt_fdatas = parseHMTFile(_hmtFile);
|
hmt_fdatas = parseHMTFile(_hmtFile);
|
||||||
if (hmt_fdatas == NULL) printf("[ERR] Failed to parse datas from %s\n", hmt_filename);
|
if (hmt_fdatas == NULL) printf("[ERR] Failed to parse datas from %s\n", hmt_filename);
|
||||||
} else {
|
} else {
|
||||||
printf("[ERR] Input file %s not found!\n", hmt_filename);
|
printf("\n[ERR] Input file %s not found!\n", hmt_filename);
|
||||||
}
|
}
|
||||||
fclose(_hmtFile);
|
fclose(_hmtFile);
|
||||||
|
|
||||||
@ -109,10 +109,13 @@ int exportTextures(HMT_FILE *hmt_f, char *filename) {
|
|||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
if (saveToPNG(&(hmt_f->textures_list[i].image), hmt_f->textures_list[i].name, filename)) return EXIT_FAILURE;
|
if (saveToPNG(&(hmt_f->textures_list[i].image), hmt_f->textures_list[i].name, filename)) {
|
||||||
|
printf("[ERR] Failed saving image file: %s\n", hmt_f->textures_list[i].name);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
} else printf("[INFO] Saved image file: %s\n", hmt_f->textures_list[i].name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("[INFO] Image type %d not currently supported!\n", hmt_f->textures_list[i].image.type_);
|
printf("[WARN] Can't export %s ! Image type %d not currently supported! (WIP)\n", hmt_f->textures_list[i].name, hmt_f->textures_list[i].image.type_);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user