char * configPathForType(int configType) { if (configType == configTypeMain) { char * path = malloc(strlen(configFilePath)+1); strcpy(path, configFilePath); return path; } else if (configType == configTypeTheme) { char * themePath = currentThemePath(); char * filename = malloc(128); sprintf(filename, "%shbltheme.cfg", themePath); free(themePath); return filename; } else { return NULL; } }
void loadSplashImages() { char * themePath = currentThemePath(); char path[128]; sprintf(path, "%ssplashtop.png", themePath); if(!loadThemeImage(path, "Top splash screen", 400, 240, NULL, themeImageSplashTop, themeImages)) { char emergencyPath[128]; sprintf(emergencyPath, "%ssplashtop.png", defaultThemePath); loadThemeImage(emergencyPath, "Top splash screen", 400, 240, NULL, themeImageSplashTop, themeImages); } sprintf(path, "%ssplashbottom.png", themePath); if(!loadThemeImage(path, "Bottom splash screen", 320, 240, NULL, themeImageSplashBottom, themeImages)) { char emergencyPath[128]; sprintf(emergencyPath, "%ssplashbottom.png", defaultThemePath); loadThemeImage(emergencyPath, "Bottom splash screen", 320, 240, NULL, themeImageSplashBottom, themeImages); } free(themePath); }
void initThemeImages() { char * themePath = currentThemePath(); char path[128]; sprintf(path, "%sappbackground.png", themePath); loadThemeImage(path, "App background", 56, 56, (u8*)appbackgroundalphamask_bin, themeImageAppBackground, themeImages); sprintf(path, "%sappbackgroundselected.png", themePath); loadThemeImage(path, "Selected app background", 56, 56, (u8*)appbackgroundalphamask_bin, themeImageAppBackgroundSelected, themeImages); sprintf(path, "%scartbackground.png", themePath); loadThemeImage(path, "Cart background", 59, 59, (u8*)cartbackgroundalphamask_bin, themeImageCartBackground, themeImages); sprintf(path, "%scartbackgroundselected.png", themePath); loadThemeImage(path, "Selected cart background", 59, 59, (u8*)cartbackgroundalphamask_bin, themeImageCartBackgroundSelected, themeImages); sprintf(path, "%swallpapertop.png", themePath); loadThemeImage(path, "Top wallpaper", 400, 240, NULL, themeImageTopWallpaper, themeImages); sprintf(path, "%swallpapertopinfo.png", themePath); loadThemeImage(path, "Top info wallpaper", 400, 240, NULL, themeImageTopWallpaperInfo, themeImages); sprintf(path, "%swallpaperbottom.png", themePath); loadThemeImage(path, "Bottom wallpaper", 320, 240, NULL, themeImageBottomWallpaper, themeImages); sprintf(path, "%swallpaperbottomnongrid.png", themePath); loadThemeImage(path, "Bottom wallpaper (non grid)", 320, 240, NULL, themeImageBottomWallpaperNonGrid, themeImages); sprintf(path, "%sbuttontopleft.png", themePath); loadThemeImage(path, "Top left button", 36, 36, NULL, themeImageTopLeftButton, themeImages); sprintf(path, "%sbuttontopright.png", themePath); loadThemeImage(path, "Top right button", 36, 36, NULL, themeImageTopRightButton, themeImages); sprintf(path, "%sbuttonbottomleft.png", themePath); loadThemeImage(path, "Bottom left button", 36, 36, NULL, themeImageBottomLeftButton, themeImages); sprintf(path, "%sbuttonbottomright.png", themePath); loadThemeImage(path, "Bottom right button", 36, 36, NULL, themeImageBottomRightButton, themeImages); sprintf(path, "%sbuttontopleftselected.png", themePath); loadThemeImage(path, "Top left selected button", 36, 36, NULL, themeImageTopLeftButtonSelected, themeImages); sprintf(path, "%sbuttontoprightselected.png", themePath); loadThemeImage(path, "Top right selected button", 36, 36, NULL, themeImageTopRightButtonSelected, themeImages); sprintf(path, "%sbuttonbottomleftselected.png", themePath); loadThemeImage(path, "Bottom left selected button", 36, 36, NULL, themeImageBottomLeftButtonSelected, themeImages); sprintf(path, "%sbuttonbottomrightselected.png", themePath); loadThemeImage(path, "Bottom right selected button", 36, 36, NULL, themeImageBottomRightButtonSelected, themeImages); sprintf(path, "%shelpicon.png", themePath); loadThemeImage(path, "Help icon", 36, 36, NULL, themeImageHelpSymbol, themeImages); sprintf(path, "%sbackicon.png", themePath); loadThemeImage(path, "Back icon", 36, 36, NULL, themeImageBackSymbol, themeImages); sprintf(path, "%shomeicon.png", themePath); loadThemeImage(path, "Home icon", 36, 36, NULL, themeImageHomeSymbol, themeImages); sprintf(path, "%ssettingsicon.png", themePath); loadThemeImage(path, "Settings icon", 36, 36, NULL, themeImageSettingsSymbol, themeImages); sprintf(path, "%sfoldersicon.png", themePath); loadThemeImage(path, "Folders icon", 36, 36, NULL, themeImageFoldersSymbol, themeImages); numProgressWheelImages = 0; int frame; for (frame = 0; frame < maxProgressWheelImages; frame++) { char progressWheelFrameFilename[128]; sprintf(progressWheelFrameFilename, "%sprogressWheelFrame%d.png", themePath, frame+1); bool loadSuccess = loadThemeImage(progressWheelFrameFilename, "Progress wheel frame", 36, 36, NULL, frame, progressWheelImages); if (loadSuccess) { numProgressWheelImages++; } else { break; } } themeHasProgressWheel = (numProgressWheelImages > 0); free(themePath); }