Skip to content

Commit fc31dbb

Browse files
committed
Place all textures in base textures directory
Instead of creating individual directories for each MIO0 section, just prefix the image names with the section name.
1 parent d832cf5 commit fc31dbb

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

n64graphics.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,15 +664,20 @@ static void get_image_info(char *filename, int *offset, img_format *format, int
664664
for (c = 0; c < strlen(stroffset); c++) {
665665
switch (mode) {
666666
case 0:
667+
if (stroffset[c] == '.') {
668+
mode = 1;
669+
}
670+
break;
671+
case 1:
667672
if (stroffset[c] == '.') {
668673
stroffset[c] = '\0';
669674
*offset = strtoul(stroffset, NULL, 0);
670-
mode = 1;
675+
mode = 2;
671676
strformat = &stroffset[c+1];
672677
stroffset[c] = '.';
673678
}
674679
break;
675-
case 1:
680+
case 2:
676681
if (stroffset[c] == '.') {
677682
stroffset[c] = '\0';
678683
if (!strcmp("ia8", strformat)) {
@@ -685,7 +690,7 @@ static void get_image_info(char *filename, int *offset, img_format *format, int
685690
*format = IMG_FORMAT_SKYBOX;
686691
*depth = 16;
687692
}
688-
mode = 2;
693+
mode = 3;
689694
}
690695
break;
691696
}

n64split.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,6 @@ static void split_file(unsigned char *data, unsigned int length, proc_table *pro
830830
texture *texts = sec->extra;
831831
int t;
832832
unsigned int offset = 0;
833-
sprintf(outfilepath, "%s/%s", TEXTURE_DIR, sec->label);
834-
make_dir(outfilepath);
835833
if (sec->label == NULL || sec->label[0] == '\0') {
836834
fprintf(fmake, "$(MIO0_DIR)/%06X.bin:", sec->start);
837835
} else {
@@ -847,7 +845,7 @@ static void split_file(unsigned char *data, unsigned int length, proc_table *pro
847845
{
848846
ia *img = file2ia(binfilename, offset, w, h, texts[t].depth);
849847
if (img) {
850-
sprintf(outfilepath, "%s/%s/0x%05X.ia%d.png", TEXTURE_DIR, sec->label, offset, texts[t].depth);
848+
sprintf(outfilepath, "%s/%s.0x%05X.ia%d.png", TEXTURE_DIR, sec->label, offset, texts[t].depth);
851849
ia2png(img, w, h, outfilepath);
852850
free(img);
853851
fprintf(fmake, " %s", outfilepath);
@@ -858,7 +856,7 @@ static void split_file(unsigned char *data, unsigned int length, proc_table *pro
858856
{
859857
rgba *img = file2rgba(binfilename, offset, w, h);
860858
if (img) {
861-
sprintf(outfilepath, "%s/%s/0x%05X.png", TEXTURE_DIR, sec->label, offset);
859+
sprintf(outfilepath, "%s/%s.0x%05X.png", TEXTURE_DIR, sec->label, offset);
862860
rgba2png(img, w, h, outfilepath);
863861
free(img);
864862
fprintf(fmake, " %s", outfilepath);
@@ -892,7 +890,7 @@ static void split_file(unsigned char *data, unsigned int length, proc_table *pro
892890
sky_offset += 32*32*2;
893891
}
894892
}
895-
sprintf(outfilepath, "%s/%s/0x%05X.skybox.png", TEXTURE_DIR, sec->label, offset);
893+
sprintf(outfilepath, "%s/%s.0x%05X.skybox.png", TEXTURE_DIR, sec->label, offset);
896894
rgba2png(img, w, h, outfilepath);
897895
free(img);
898896
fprintf(fmake, " %s", outfilepath);
@@ -906,13 +904,11 @@ static void split_file(unsigned char *data, unsigned int length, proc_table *pro
906904
fprintf(fmake, "\n\t$(N64GRAPHICS) $@ $^\n\n");
907905
}
908906
#if GENERATE_ALL_PNG
909-
sprintf(outfilepath, "%s/%s", TEXTURE_DIR, sec->label);
910-
make_dir(outfilepath);
911907
w = 32;
912908
h = filesize(binfilename) / (w * 2);
913909
rgba *img = file2rgba(binfilename, 0, w, h);
914910
if (img) {
915-
sprintf(outfilepath, "%s/%s/ALL.png", TEXTURE_DIR, sec->label);
911+
sprintf(outfilepath, "%s/%s.ALL.png", TEXTURE_DIR, sec->label);
916912
rgba2png(img, w, h, outfilepath);
917913
free(img);
918914
img = NULL;

0 commit comments

Comments
 (0)