diff options
-rw-r--r-- | base/main.cpp | 13 | ||||
-rw-r--r-- | common/xmlparser.h | 2 | ||||
-rw-r--r-- | gui/virtualKeyboard.cpp | 4 | ||||
-rw-r--r-- | gui/virtualKeyboard.h | 3 | ||||
-rw-r--r-- | gui/virtualKeyboardParser.cpp | 12 |
5 files changed, 23 insertions, 11 deletions
diff --git a/base/main.cpp b/base/main.cpp index 88d9f3bab5..4ab486ee9b 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -52,6 +52,12 @@ #include "gui/launcher.h" #endif +#define ___VK_TEST + +#if defined(___VK_TEST) +#include "gui/virtualKeyboard.h" +#endif + static bool launcherDialog(OSystem &system) { @@ -68,6 +74,13 @@ static bool launcherDialog(OSystem &system) { // Clear the main screen system.clearScreen(); +#if defined(___VK_TEST) + GUI::VirtualKeyboard *vk = new GUI::VirtualKeyboard(); + if (vk->loadKeyboardPack("test")) + printf("Successfully parsed test keyboard pack\n"); + +#endif + #if defined(_WIN32_WCE) CELauncherDialog dlg; #elif defined(__DC__) diff --git a/common/xmlparser.h b/common/xmlparser.h index 167d04249c..3738b69b7b 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -283,7 +283,7 @@ protected: while (isValidNameChar(_text[_pos])) _token += _text[_pos++]; - return isspace(_text[_pos]) != 0 || _text[_pos] == '>'; + return isspace(_text[_pos]) != 0 || _text[_pos] == '>' || _text[_pos] == '='; } /** diff --git a/gui/virtualKeyboard.cpp b/gui/virtualKeyboard.cpp index b90f87edb9..a47f890ce5 100644 --- a/gui/virtualKeyboard.cpp +++ b/gui/virtualKeyboard.cpp @@ -62,10 +62,10 @@ bool VirtualKeyboard::loadKeyboardPack(Common::String packName) { unzGetCurrentFileInfo(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); byte *buffer = new byte[fileInfo.uncompressed_size+1]; assert(buffer); - memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(uint8)); + memset(buffer, 0, (fileInfo.uncompressed_size+1)*sizeof(byte)); unzReadCurrentFile(zipFile, buffer, fileInfo.uncompressed_size); unzCloseCurrentFile(zipFile); - if (!_parser->loadBuffer(buffer, true)) { + if (!_parser->loadBuffer(buffer, fileInfo.uncompressed_size+1, true)) { unzClose(zipFile); return false; } diff --git a/gui/virtualKeyboard.h b/gui/virtualKeyboard.h index ad426d4efd..7885f2cc17 100644 --- a/gui/virtualKeyboard.h +++ b/gui/virtualKeyboard.h @@ -31,7 +31,6 @@ class OSystem; #include "common/hashmap.h" #include "common/hash-str.h" #include "common/imagemap.h" -#include "common/singleton.h" #include "common/str.h" #include "graphics/surface.h" @@ -41,7 +40,7 @@ class VirtualKeyboardParser; -class VirtualKeyboard : public Common::Singleton<VirtualKeyboard> { +class VirtualKeyboard { private: /** Type of key event */ enum EventType { diff --git a/gui/virtualKeyboardParser.cpp b/gui/virtualKeyboardParser.cpp index a3aa61c866..ca4a9c521a 100644 --- a/gui/virtualKeyboardParser.cpp +++ b/gui/virtualKeyboardParser.cpp @@ -90,13 +90,13 @@ bool VirtualKeyboardParser::parserCallback_Mode() { Common::StringTokenizer tok(resolutions, " ,"); uint16 scrX = g_system->getOverlayWidth(), scrY = g_system->getOverlayHeight(); - uint16 diff = 0xFFFF; + uint32 diff = 0xFFFFFFFF; for (Common::String res = tok.nextToken(); res.size() > 0; res = tok.nextToken()) { - uint16 resX, resY; - if (sscanf(res.c_str(), "%dx%d", &resX, &resY) != 2) + int resX, resY; + if (sscanf(res.c_str(), "%dx%d", &resX, &resY) != 2) { parserError("Invalid resolution specification"); - else { + } else { if (resX == scrX && resY == scrY) { _currentMode->resolution = res; break; @@ -232,7 +232,7 @@ bool VirtualKeyboardParser::parserCallback_Area() { Common::String shape = areaNode->values["shape"]; if (shape == "rect") { - int16 x1, y1, x2, y2; + int x1, y1, x2, y2; if (!parseIntegerKey(areaNode->values["coords"].c_str(), 4, &x1, &y1, &x2, &y2)) return parserError("Invalid coords for rect area"); @@ -242,7 +242,7 @@ bool VirtualKeyboardParser::parserCallback_Area() { Common::StringTokenizer tok (areaNode->values["coords"], ", "); Common::Polygon poly; for (Common::String st = tok.nextToken(); !st.empty(); st = tok.nextToken()) { - int16 x, y; + int x, y; if (sscanf(st.c_str(), "%d", &x) != 1) return parserError("Invalid coords for polygon area"); st = tok.nextToken(); |