diff options
author | Max Horn | 2010-06-06 09:34:36 +0000 |
---|---|---|
committer | Max Horn | 2010-06-06 09:34:36 +0000 |
commit | 46155b2c3678784f6333eed1d65a35eefdcb2001 (patch) | |
tree | 1f570683935a5bede0e2475493a4f48b1548d320 /backends/platform/android/scummvm-android-themeengine.patch | |
parent | 3efec5720de2c46355c323763dee96b719ed5aa1 (diff) | |
download | scummvm-rg350-46155b2c3678784f6333eed1d65a35eefdcb2001.tar.gz scummvm-rg350-46155b2c3678784f6333eed1d65a35eefdcb2001.tar.bz2 scummvm-rg350-46155b2c3678784f6333eed1d65a35eefdcb2001.zip |
Add Android backend from patch #2603856
svn-id: r49449
Diffstat (limited to 'backends/platform/android/scummvm-android-themeengine.patch')
-rw-r--r-- | backends/platform/android/scummvm-android-themeengine.patch | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/backends/platform/android/scummvm-android-themeengine.patch b/backends/platform/android/scummvm-android-themeengine.patch new file mode 100644 index 0000000000..1eafe7fb62 --- /dev/null +++ b/backends/platform/android/scummvm-android-themeengine.patch @@ -0,0 +1,135 @@ +diff -r 884e66fd1b9c gui/ThemeEngine.cpp +--- a/gui/ThemeEngine.cpp Tue Apr 13 09:30:52 2010 +1000 ++++ b/gui/ThemeEngine.cpp Fri May 28 23:24:43 2010 +1000 +@@ -390,21 +390,19 @@ + + // Try to create a Common::Archive with the files of the theme. + if (!_themeArchive && !_themeFile.empty()) { +- Common::FSNode node(_themeFile); +- if (node.getName().hasSuffix(".zip") && !node.isDirectory()) { ++ Common::ArchiveMemberPtr member = SearchMan.getMember(_themeFile); ++ if (member && member->getName().hasSuffix(".zip")) { + #ifdef USE_ZLIB +- Common::Archive *zipArchive = Common::makeZipArchive(node); ++ Common::Archive *zipArchive = Common::makeZipArchive(member->createReadStream()); + + if (!zipArchive) { +- warning("Failed to open Zip archive '%s'.", node.getPath().c_str()); ++ warning("Failed to open Zip archive '%s'.", member->getDisplayName().c_str()); + } + _themeArchive = zipArchive; + #else + warning("Trying to load theme '%s' in a Zip archive without zLib support", _themeFile.c_str()); + return false; + #endif +- } else if (node.isDirectory()) { +- _themeArchive = new Common::FSDirectory(node); + } + } + +@@ -1436,6 +1434,30 @@ + return tok.empty(); + } + ++bool ThemeEngine::themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName) { ++ Common::File stream; ++ bool foundHeader = false; ++ ++ if (member.getName().hasSuffix(".zip")) { ++#ifdef USE_ZLIB ++ Common::Archive *zipArchive = Common::makeZipArchive(member.createReadStream()); ++ ++ if (zipArchive && zipArchive->hasFile("THEMERC")) { ++ stream.open("THEMERC", *zipArchive); ++ } ++ ++ delete zipArchive; ++#endif ++ } ++ ++ if (stream.isOpen()) { ++ Common::String stxHeader = stream.readLine(); ++ foundHeader = themeConfigParseHeader(stxHeader, themeName); ++ } ++ ++ return foundHeader; ++} ++ + bool ThemeEngine::themeConfigUsable(const Common::FSNode &node, Common::String &themeName) { + Common::File stream; + bool foundHeader = false; +@@ -1493,10 +1515,6 @@ + if (ConfMan.hasKey("themepath")) + listUsableThemes(Common::FSNode(ConfMan.get("themepath")), list); + +-#ifdef DATA_PATH +- listUsableThemes(Common::FSNode(DATA_PATH), list); +-#endif +- + #if defined(MACOSX) || defined(IPHONE) + CFURLRef resourceUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); + if (resourceUrl) { +@@ -1509,10 +1527,7 @@ + } + #endif + +- if (ConfMan.hasKey("extrapath")) +- listUsableThemes(Common::FSNode(ConfMan.get("extrapath")), list); +- +- listUsableThemes(Common::FSNode("."), list, 1); ++ listUsableThemes(SearchMan, list); + + // Now we need to strip all duplicates + // TODO: It might not be the best idea to strip duplicates. The user might +@@ -1531,6 +1546,34 @@ + output.clear(); + } + ++void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List<ThemeDescriptor> &list) { ++ ThemeDescriptor td; ++ ++#ifdef USE_ZLIB ++ Common::ArchiveMemberList fileList; ++ archive.listMatchingMembers(fileList, "*.zip"); ++ for (Common::ArchiveMemberList::iterator i = fileList.begin(); ++ i != fileList.end(); ++i) { ++ td.name.clear(); ++ if (themeConfigUsable(**i, td.name)) { ++ td.filename = (*i)->getName(); ++ td.id = (*i)->getDisplayName(); ++ ++ // If the name of the node object also contains ++ // the ".zip" suffix, we will strip it. ++ if (td.id.hasSuffix(".zip")) { ++ for (int j = 0; j < 4; ++j) ++ td.id.deleteLastChar(); ++ } ++ ++ list.push_back(td); ++ } ++ } ++ ++ fileList.clear(); ++#endif ++} ++ + void ThemeEngine::listUsableThemes(const Common::FSNode &node, Common::List<ThemeDescriptor> &list, int depth) { + if (!node.exists() || !node.isReadable() || !node.isDirectory()) + return; +diff -r 884e66fd1b9c gui/ThemeEngine.h +--- a/gui/ThemeEngine.h Tue Apr 13 09:30:52 2010 +1000 ++++ b/gui/ThemeEngine.h Fri May 28 23:24:43 2010 +1000 +@@ -560,11 +560,13 @@ + static void listUsableThemes(Common::List<ThemeDescriptor> &list); + private: + static bool themeConfigUsable(const Common::FSNode &node, Common::String &themeName); ++ static bool themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName); + static bool themeConfigParseHeader(Common::String header, Common::String &themeName); + + static Common::String getThemeFile(const Common::String &id); + static Common::String getThemeId(const Common::String &filename); + static void listUsableThemes(const Common::FSNode &node, Common::List<ThemeDescriptor> &list, int depth = -1); ++ static void listUsableThemes(Common::Archive &archive, Common::List<ThemeDescriptor> &list); + + protected: + OSystem *_system; /** Global system object. */ |