aboutsummaryrefslogtreecommitdiff
path: root/gui/ThemeEngine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/ThemeEngine.cpp')
-rw-r--r--gui/ThemeEngine.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index ed01204180..6562a1d922 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -739,12 +739,23 @@ bool ThemeEngine::loadDefaultXML() {
// Use the Python script "makedeftheme.py" to convert a normal XML theme
// into the "default.inc" file, which is ready to be included in the code.
#ifndef DISABLE_GUI_BUILTIN_THEME
- const char *defaultXML =
#include "themes/default.inc"
- ;
+ int xmllen = 0;
+
+ for (int i = 0; i < ARRAYSIZE(defaultXML); i++)
+ xmllen += strlen(defaultXML[i]);
+
+ byte *tmpXML = (byte *)malloc(xmllen + 1);
+ tmpXML[0] = '\0';
+
+ for (int i = 0; i < ARRAYSIZE(defaultXML); i++)
+ strncat((char *)tmpXML, defaultXML[i], xmllen);
+
+ if (!_parser->loadBuffer(tmpXML, xmllen)) {
+ free(tmpXML);
- if (!_parser->loadBuffer((const byte *)defaultXML, strlen(defaultXML)))
return false;
+ }
_themeName = "ScummVM Classic Theme (Builtin Version)";
_themeId = "builtin";
@@ -753,6 +764,8 @@ bool ThemeEngine::loadDefaultXML() {
bool result = _parser->parse();
_parser->close();
+ free(tmpXML);
+
return result;
#else
warning("The built-in theme is not enabled in the current build. Please load an external theme");