diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeRenderer.cpp | 67 | ||||
-rw-r--r-- | gui/themes/scummodern.zip | bin | 137193 -> 116190 bytes |
2 files changed, 38 insertions, 29 deletions
diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp index 9f517abd2d..3cb7f13dbd 100644 --- a/gui/ThemeRenderer.cpp +++ b/gui/ThemeRenderer.cpp @@ -412,43 +412,52 @@ bool ThemeRenderer::loadDefaultXML() { bool ThemeRenderer::loadThemeXML(Common::String themeName) { assert(_parser); - - if (!parser()->loadFile(themeName + ".stx")){ + #ifdef USE_ZLIB - unzFile zipFile = unzOpen((themeName + ".zip").c_str()); - - if (zipFile && unzLocateFile(zipFile, (themeName + ".stx").c_str(), 2) == UNZ_OK) { - + unzFile zipFile = unzOpen((themeName + ".zip").c_str()); + char fileNameBuffer[32]; + int parseCount = 0; + + if (zipFile && unzGoToFirstFile(zipFile) == UNZ_OK) { + while (true) { unz_file_info fileInfo; unzOpenCurrentFile(zipFile); - unzGetCurrentFileInfo(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - uint8 *buffer = new uint8[fileInfo.uncompressed_size+1]; - assert(buffer); - memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8)); - unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size); - unzCloseCurrentFile(zipFile); - - Common::MemoryReadStream *stream = new Common::MemoryReadStream(buffer, fileInfo.uncompressed_size+1, true); + unzGetCurrentFileInfo(zipFile, &fileInfo, fileNameBuffer, 32, NULL, 0, NULL, 0); + + if (matchString(fileNameBuffer, "*.stx")) { + uint8 *buffer = new uint8[fileInfo.uncompressed_size+1]; + assert(buffer); + memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8)); + unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size); - if (!parser()->loadStream(stream)) { - unzClose(zipFile); - delete stream; - return false; + Common::MemoryReadStream *stream = new Common::MemoryReadStream(buffer, fileInfo.uncompressed_size+1, true); + + if (parser()->loadStream(stream) == false || parser()->parse() == false) { + warning("Failed to load stream for %s", fileNameBuffer); + unzClose(zipFile); + delete stream; + return false; + } + + parseCount++; } - -// delete[] buffer; - buffer = 0; - } else { - unzClose(zipFile); - return false; + + unzCloseCurrentFile(zipFile); + + if (unzGoToNextFile(zipFile) == UNZ_END_OF_LIST_OF_FILE) + break; } - unzClose(zipFile); -#else - return false; -#endif + } else if (parser()->loadFile(themeName + ".stx") && parser()->parse()) { + parseCount++; + } else { + warning("No theme files for '%s' found.", themeName.c_str()); } - return parser()->parse(); + unzClose(zipFile); + return (parseCount > 0); +#else + return (parser()->loadFile(themeName + ".stx") && parser()->parse()); +#endif } bool ThemeRenderer::isWidgetCached(DrawData type, const Common::Rect &r) { diff --git a/gui/themes/scummodern.zip b/gui/themes/scummodern.zip Binary files differindex a607166b47..3f23dde775 100644 --- a/gui/themes/scummodern.zip +++ b/gui/themes/scummodern.zip |