ref: aa44e7ca49617b45d654cd5dae8f422dd1bfc9e6
parent: fcaddc6252ccfe3b29108ae3408a1bb4bea684f9
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue May 21 12:56:44 EDT 2019
Reduce the size of bin2h-generated .h files The Japanese font went from 50MB to 25MB.
--- a/src/misc/bin2h.c
+++ b/src/misc/bin2h.c
@@ -65,17 +65,17 @@
setvbuf(out_file, NULL, _IOFBF, 0x10000);
- fprintf(out_file, "#pragma once\n\nconst unsigned char r%s[0x%lX] = {\n\t", filename, in_file_size);
+ fprintf(out_file, "#pragma once\n\nstatic const unsigned char r%s[0x%lX] = {\n\t", filename, in_file_size);
for (i = 0; i < in_file_size - 1; ++i)
{
- if (i % 16 == 15)
- fprintf(out_file, "0x%02X,\n\t", *in_file_pointer++);
+ if (i % 32 == 32-1)
+ fprintf(out_file, "%d,\n\t", *in_file_pointer++);
else
- fprintf(out_file, "0x%02X, ", *in_file_pointer++);
+ fprintf(out_file, "%d,", *in_file_pointer++);
}
- fprintf(out_file, "0x%02X\n};\n", *in_file_pointer++);
+ fprintf(out_file, "%d\n};\n", *in_file_pointer++);
fclose(out_file);
free(in_file_buffer);