mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-09 23:53:28 -04:00
checkwps: validate themes against builtin cabbiev2 assets
Themes for a given device often reference the assets of the default cabbiev2 theme. Record a list of what is bundled, and check anything not included with the theme against that list. If something is still missing, then that's an error. This applies to fonts, wps files, backdrops, icons, and so forth. Change-Id: I5ff7feaae892c8b9a81c2cb3035879672f3e6c29
This commit is contained in:
parent
31fac4c400
commit
9d3d2c6e67
3 changed files with 50 additions and 10 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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: ####
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue