示例#1
0
bool VirtualKeyboard::loadKeyboardPack(const String &packName) {
	_kbdGUI->initSize(_system->getOverlayWidth(), _system->getOverlayHeight());

	delete _fileArchive;
	_fileArchive = 0;
	_loaded = false;

	bool opened = false;
	if (ConfMan.hasKey("vkeybdpath"))
		opened = openPack(packName, FSNode(ConfMan.get("vkeybdpath")));
	else if (ConfMan.hasKey("extrapath"))
		opened = openPack(packName, FSNode(ConfMan.get("extrapath")));

	// fallback to the current dir
	if (!opened)
		opened = openPack(packName, FSNode("."));

	if (opened) {
		_parser->setParseMode(VirtualKeyboardParser::kParseFull);
		_loaded = _parser->parse();

		if (_loaded) {
			printf("Keyboard pack '%s' loaded successfully!\n", packName.c_str());
		} else {
			warning("Error parsing the keyboard pack '%s'", packName.c_str());

			delete _fileArchive;
			_fileArchive = 0;
		}
	} else {
		warning("Keyboard pack not found");
	}

	return _loaded;
}
示例#2
0
文件: fs.cpp 项目: RobLoach/scummvm
FSNode FSNode::getChild(const String &n) const {
    // If this node is invalid or not a directory, return an invalid node
    if (_realNode == 0 || !_realNode->isDirectory())
        return FSNode();

    AbstractFSNode *node = _realNode->getChild(n);
    return FSNode(node);
}
示例#3
0
文件: fs.cpp 项目: RobLoach/scummvm
FSNode FSNode::getParent() const {
    if (_realNode == 0)
        return *this;

    AbstractFSNode *node = _realNode->getParent();
    if (node == 0) {
        return *this;
    } else {
        return FSNode(node);
    }
}
示例#4
0
bool TranslationManager::openTranslationsFile(File& inFile) {
	// First try to open it directly (i.e. using the SearchMan).
	if (inFile.open("translations.dat"))
		return true;

	// Then look in the Themepath if we can find the file.
	if (ConfMan.hasKey("themepath"))
		return openTranslationsFile(FSNode(ConfMan.get("themepath")), inFile);

	return false;
}
示例#5
0
文件: fs.cpp 项目: RobLoach/scummvm
bool FSNode::getChildren(FSList &fslist, ListMode mode, bool hidden) const {
    if (!_realNode || !_realNode->isDirectory())
        return false;

    AbstractFSList tmp;

    if (!_realNode->getChildren(tmp, mode, hidden))
        return false;

    fslist.clear();
    for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i) {
        fslist.push_back(FSNode(*i));
    }

    return true;
}
示例#6
0
bool TranslationManager::openTranslationsFile(File &inFile) {
	// First look in the Themepath if we can find the file.
	if (ConfMan.hasKey("themepath") && openTranslationsFile(FSNode(ConfMan.get("themepath")), inFile))
		return true;

	// Then try to open it using the SearchMan.
	ArchiveMemberList fileList;
	SearchMan.listMatchingMembers(fileList, "translations.dat");
	for (ArchiveMemberList::iterator it = fileList.begin(); it != fileList.end(); ++it) {
		SeekableReadStream *stream = it->get()->createReadStream();
		if (stream && inFile.open(stream, it->get()->getName())) {
			if (checkHeader(inFile))
				return true;
			inFile.close();
		}
	}

	return false;
}