Example #1
0
void FMVScreen::play(const Common::String &name) {
	Common::SeekableReadStream *stream = nullptr;

	// Play the low-resolution video, if possible
	if (!StarkSettings->getBoolSetting(Settings::kHighFMV) && StarkSettings->hasLowResFMV()) {
		Common::String lowResName = name;
		lowResName.erase(lowResName.size() - 4);
		lowResName += "_lo_res.bbb";

		stream = StarkArchiveLoader->getExternalFile(lowResName, "Global/");
		if (!stream) {
			debug("Could not open %s", lowResName.c_str());
		}
	}

	// Play the original video
	if (!stream) {
		stream = StarkArchiveLoader->getExternalFile(name, "Global/");
	}

	if (!stream) {
		warning("Could not open %s", name.c_str());
		return;
	}

	_decoder->loadStream(stream);
	if (!_decoder->isVideoLoaded()) {
		error("Could not open %s", name.c_str());
	}
	_decoder->start();
}
Example #2
0
Networking::Request *IdStorage::createDirectory(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback) {
	if (!errorCallback)
		errorCallback = getErrorPrintingCallback();
	if (!callback)
		callback = new Common::Callback<IdStorage, BoolResponse>(this, &IdStorage::printBool);

	//find out the parent path and directory name
	Common::String parentPath = "", directoryName = path;
	for (uint32 i = path.size(); i > 0; --i) {
		if (path[i - 1] == '/' || path[i - 1] == '\\') {
			parentPath = path;
			parentPath.erase(i - 1);
			directoryName.erase(0, i);
			break;
		}
	}

	return addRequest(new IdCreateDirectoryRequest(this, parentPath, directoryName, callback, errorCallback));
}
Example #3
0
void RemoteBrowserDialog::goUp() {
	if (_rememberedNodeContents.contains(_node.path()))
		_rememberedNodeContents.erase(_node.path());

	Common::String path = _node.path();
	if (path.size() && (path.lastChar() == '/' || path.lastChar() == '\\'))
		path.deleteLastChar();
	if (path.empty()) {
		_rememberedNodeContents.erase("");
	} else {
		for (int i = path.size() - 1; i >= 0; --i)
			if (i == 0 || path[i] == '/' || path[i] == '\\') {
				path.erase(i);
				break;
			}
	}

	listDirectory(Cloud::StorageFile(path, 0, 0, true));
}
Example #4
0
bool DumpFile::open(const String &filename, bool createPath) {
	assert(!filename.empty());
	assert(!_handle);

	if (createPath) {
		for (uint32 i = 0; i < filename.size(); ++i) {
			if (filename[i] == '/' || filename[i] == '\\') {
				Common::String subpath = filename;
				subpath.erase(i);
				if (subpath.empty()) continue;
				AbstractFSNode *node = g_system->getFilesystemFactory()->makeFileNodePath(subpath);
				if (node->exists()) continue;
				if (!node->create(true)) warning("DumpFile: unable to create directories from path prefix");
			}
		}
	}

	FSNode node(filename);
	return open(node);
}