diff --git a/tools/checkwps/checkwps.c b/tools/checkwps/checkwps.c index a62105fc12..a80c081d56 100644 --- a/tools/checkwps/checkwps.c +++ b/tools/checkwps/checkwps.c @@ -227,6 +227,7 @@ bool radio_hardware_present(void) #endif #include "fontbundle.h" +#include "themeassets.h" static int loaded_fonts = 0; static struct font _font; @@ -277,29 +278,57 @@ static int checkwps_loader(const char *path, const char *search, int mode) int missing = 1; if (final) *final = 0; - /* Check if font is included in the bundle */ - for (int i = 0 ; bundledfonts[i] != NULL ; i++) + /* Check if font is a default theme asset */ + for (int i = 0 ; themeassets[i] != NULL; i++) { - if (first && !strcmp(first+1, bundledfonts[i])) + if (first && !strcmp(first+1, themeassets[i])) { missing = 0; break; } } + /* Check if font is included in the bundle */ if (missing) + { + for (int i = 0 ; bundledfonts[i] != NULL ; i++) + { + if (first && !strcmp(first+1, bundledfonts[i])) + { + missing = 2; + break; + } + } + } + + if (missing == 1) { printf("Font missing >%s<\n", first+1); return -4; - } else { + } else if (missing == 2) { printf("INFO: Theme requires rockbox font bundle\n"); } } - - if (mode == 2) + else if (mode == 2) /* Not found and it's an asset */ { - printf("ERROR: File missing: %s\n", path); - return -5; + char *first = strrchr(buf, '/'); + char *final = strrchr(buf, '.'); + int missing = 1; + if (final) *final = 0; + + for (int i = 0 ; themeassets[i] != NULL; i++) + { + if (first && !strcmp(first+1, themeassets[i])) + { + missing = 0; + break; + } + } + if (missing) + { + printf("ERROR: File missing: %s\n", path); + return -5; + } } } diff --git a/tools/checkwps/checkwps.make b/tools/checkwps/checkwps.make index c103cdcc47..86384dee7c 100644 --- a/tools/checkwps/checkwps.make +++ b/tools/checkwps/checkwps.make @@ -42,11 +42,22 @@ $(BUILDDIR)/$(BINARY): $$(CHECKWPS_OBJ) $$(CORE_LIBS) $(BUILDDIR)/fontbundle.h: $(ROOTDIR)/fonts/*bdf @echo FONTBUNDLE - $(SILENT)echo "static unsigned char* bundledfonts[] = {" > $@ + $(SILENT)echo "static const unsigned char* bundledfonts[] = {" > $@ $(SILENT)ls $(ROOTDIR)/fonts/*bdf | perl -pne 's|.*/(\d+-.*)\.bdf| "$$1",|;' >> $@ $(SILENT)echo " NULL, " >> $@ $(SILENT)echo "};" >> $@ +$(BUILDDIR)/themeassets.h: $(ROOTDIR)/firmware/export/config/$(MODELNAME).h $(ROOTDIR)/wps/WPSLIST + @echo THEMEASSETS + $(SILENT)rm -Rf $(BUILDDIR)/.rockbox + $(SILENT)mkdir $(BUILDDIR)/.rockbox + $(SILENT)echo "static const unsigned char* themeassets[] = {" > $@ + $(SILENT)$(ROOTDIR)/wps/wpsbuild.pl $(ROOTDIR)/wps/WPSLIST $(TARGET) > /dev/null 2>&1 + $(SILENT)find $(BUILDDIR)/.rockbox -type f | perl -pne 's|.*/(\S+)\.\S+| "$$1",|;' >> $@ + $(SILENT)echo " NULL, " >> $@ + $(SILENT)echo "};" >> $@ + $(SILENT)rm -Rf $(BUILDDIR)/.rockbox + #### Everything below is hacked in from apps.make and lang.make $(BUILDDIR)/apps/features: $(ROOTDIR)/apps/features.txt diff --git a/tools/root.make b/tools/root.make index 878ecd1c36..d2ff41eab4 100644 --- a/tools/root.make +++ b/tools/root.make @@ -236,7 +236,7 @@ clean:: $(LINKRAM) $(LINKROM) rockbox.elf rockbox.map rockbox.bin \ make.dep rombox.elf rombox.map rombox.bin romstart.txt \ $(BINARY) $(FLASHFILE) uisimulator bootloader flash $(BOOTLINK) \ - rockbox.apk lang_enum.h rbversion.h fontbundle.h 3ds rockbox.3dsx \ + rockbox.apk lang_enum.h rbversion.h fontbundle.h themeassets.h 3ds rockbox.3dsx \ rockbox.bnr rockbox.cia rockbox.icn rockbox.smdh #### linking the binaries: ####