[Scummvm-git-logs] scummvm master -> 3017be4ca60b698e7a1840fe36741c91379d6f51

dreammaster noreply at scummvm.org
Mon Oct 26 06:37:38 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
3017be4ca6 ULTIMA: Refactor out custom data_archive for Common::load_engine_data


Commit: 3017be4ca60b698e7a1840fe36741c91379d6f51
    https://github.com/scummvm/scummvm/commit/3017be4ca60b698e7a1840fe36741c91379d6f51
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-10-26T17:37:22+11:00

Commit Message:
ULTIMA: Refactor out custom data_archive for Common::load_engine_data

Changed paths:
  R engines/ultima/shared/engine/data_archive.cpp
  R engines/ultima/shared/engine/data_archive.h
    engines/ultima/module.mk
    engines/ultima/nuvie/conf/configuration.cpp
    engines/ultima/nuvie/keybinding/keys.cpp
    engines/ultima/nuvie/nuvie.cpp
    engines/ultima/nuvie/nuvie.h
    engines/ultima/ultima4/controllers/intro_controller.cpp
    engines/ultima/ultima4/core/config.cpp
    engines/ultima/ultima4/filesys/u4file.cpp
    engines/ultima/ultima4/game/script.cpp
    engines/ultima/ultima4/gfx/imagemgr.cpp
    engines/ultima/ultima4/gfx/screen.cpp
    engines/ultima/ultima4/sound/music.cpp
    engines/ultima/ultima4/sound/sound.cpp
    engines/ultima/ultima4/ultima4.cpp
    engines/ultima/ultima4/ultima4.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 33555fc4461..90cd253563c 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -3,8 +3,7 @@ MODULE := engines/ultima
 MODULE_OBJS := \
 	metaengine.o \
 	shared/conf/xml_node.o \
-	shared/conf/xml_tree.o \
-	shared/engine/data_archive.o
+	shared/conf/xml_tree.o
 
 ifdef ENABLE_AKALABETH
 MODULE_OBJS += \
diff --git a/engines/ultima/nuvie/conf/configuration.cpp b/engines/ultima/nuvie/conf/configuration.cpp
index 270464b7113..3c7320c6ad1 100644
--- a/engines/ultima/nuvie/conf/configuration.cpp
+++ b/engines/ultima/nuvie/conf/configuration.cpp
@@ -36,7 +36,7 @@ Configuration::Configuration() : _configChanged(false) {
 	_localKeys["GameType"] = "";
 	_localKeys["GameName"] = "";
 	_localKeys["GameID"] = "";
-	_localKeys["datadir"] = "data";		// This maps to ultima6/ in ultima.dat
+	_localKeys["datadir"] = "";		// ultima.dat ultima6/ subfolder mapped into local filesystem root
 	_localKeys["quit"] = "no";
 }
 
diff --git a/engines/ultima/nuvie/keybinding/keys.cpp b/engines/ultima/nuvie/keybinding/keys.cpp
index 0c8a827cf28..06c87c3cd70 100644
--- a/engines/ultima/nuvie/keybinding/keys.cpp
+++ b/engines/ultima/nuvie/keybinding/keys.cpp
@@ -300,7 +300,7 @@ KeyBinder::KeyBinder(const Configuration *config) : enable_joystick(false) {
 	if (keyfilename != "(default)" && !key_file_exists)
 		::error("Couldn't find the default key setting at %s - trying defaultkeys.txt in the data directory\n", keyfilename.c_str());
 	if (keyfilename == "(default)" || !key_file_exists) {
-		config->value("config/datadir", dir, "./data");
+		config->value("config/datadir", dir, ".");
 		keyfilename = dir + "/defaultkeys.txt";
 	}
 	LoadFromFile(keyfilename.c_str());
@@ -676,7 +676,7 @@ void KeyBinder::LoadGameSpecificKeys() {
 	Common::String key_path_str;
 	Common::String default_key_path;
 	const Configuration *config = Game::get_game()->get_config();
-	config->value("config/datadir", default_key_path, "./data");
+	config->value("config/datadir", default_key_path, ".");
 	nuvie_game_t game_type = get_game_type(config);
 
 	if (game_type == NUVIE_GAME_U6)
diff --git a/engines/ultima/nuvie/nuvie.cpp b/engines/ultima/nuvie/nuvie.cpp
index 1796551b28c..9a35ad36863 100644
--- a/engines/ultima/nuvie/nuvie.cpp
+++ b/engines/ultima/nuvie/nuvie.cpp
@@ -36,8 +36,8 @@
 #include "ultima/nuvie/gui/widgets/map_window.h"
 #include "ultima/nuvie/save/save_game.h"
 #include "ultima/nuvie/gui/widgets/msg_scroll.h"
-#include "ultima/shared/engine/data_archive.h"
 #include "common/config-manager.h"
+#include "common/engine_data.h"
 #include "common/translation.h"
 #include "common/compression/unzip.h"
 
@@ -64,7 +64,7 @@ NuvieEngine::~NuvieEngine() {
 	g_engine = nullptr;
 }
 
-bool NuvieEngine::isDataRequired(Common::Path &folder, int &majorVersion, int &minorVersion) {
+bool NuvieEngine::isDataRequired(const char *&folder, int &majorVersion, int &minorVersion) {
 	folder = "ultima6";
 	majorVersion = 1;
 	minorVersion = 1;
@@ -84,7 +84,7 @@ bool NuvieEngine::initialize() {
 	bool playEnding = false;
 	bool showVirtueMsg = false;
 
-	Common::Path folder;
+	const char *folder;
 	int reqMajorVersion, reqMinorVersion;
 
 	// Call syncSoundSettings to get default volumes set
@@ -96,7 +96,7 @@ bool NuvieEngine::initialize() {
 
 	// Try and set up the data archive
 	Common::U32String errorMsg;
-	if (!Shared::UltimaDataArchive::load(folder, reqMajorVersion, reqMinorVersion, errorMsg)) {
+	if (!Common::load_engine_data("ultima.dat", folder, reqMajorVersion, reqMinorVersion, errorMsg)) {
 		GUIErrorMessage(errorMsg);
 		return false;
 	}
diff --git a/engines/ultima/nuvie/nuvie.h b/engines/ultima/nuvie/nuvie.h
index f3e970deac1..8b85c32579b 100644
--- a/engines/ultima/nuvie/nuvie.h
+++ b/engines/ultima/nuvie/nuvie.h
@@ -66,7 +66,7 @@ protected:
 	/**
 	 * Returns the data archive folder and version that's required
 	 */
-	bool isDataRequired(Common::Path &folder, int &majorVersion, int &minorVersion);
+	bool isDataRequired(const char *&folder, int &majorVersion, int &minorVersion);
 public:
 	const Common::String c_empty_string;
 public:
diff --git a/engines/ultima/shared/engine/data_archive.cpp b/engines/ultima/shared/engine/data_archive.cpp
deleted file mode 100644
index fb19907eb02..00000000000
--- a/engines/ultima/shared/engine/data_archive.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/shared/engine/data_archive.h"
-#include "common/config-manager.h"
-#include "common/file.h"
-#include "common/translation.h"
-#include "common/compression/unzip.h"
-
-namespace Ultima {
-namespace Shared {
-
-#define DATA_FILENAME "ultima.dat"
-
-class UltimaDataArchiveMember : public Common::ArchiveMember {
-private:
-	Common::SharedPtr<Common::ArchiveMember> _member;
-	Common::Path _publicFolder;
-	Common::Path _innerfolder;
-public:
-	UltimaDataArchiveMember(Common::SharedPtr<Common::ArchiveMember> member,
-		const Common::Path &subfolder) :
-		_member(member), _publicFolder("data/"), _innerfolder(subfolder) {
-	}
-	~UltimaDataArchiveMember() override {}
-	Common::SeekableReadStream *createReadStream() const override {
-		return _member->createReadStream();
-	}
-	Common::SeekableReadStream *createReadStreamForAltStream(Common::AltStreamType altStreamType) const override {
-		return _member->createReadStreamForAltStream(altStreamType);
-	}
-	Common::Path getPathInArchive() const override {
-		Common::Path name = _member->getPathInArchive();
-		assert(name.isRelativeTo(_innerfolder));
-		return _publicFolder.join(name.relativeTo(_innerfolder));
-	}
-	Common::U32String getDisplayName() const override {
-		return _member->getDisplayName();
-	}
-	
-	Common::String getFileName() const override { return _member->getFileName(); }
-	Common::String getName() const override { return getPathInArchive().toString('/'); }
-
-	bool isDirectory() const override { return _member->isDirectory(); }
-};
-
-/*-------------------------------------------------------------------*/
-
-bool UltimaDataArchive::load(const Common::Path &subfolder,
-		int reqMajorVersion, int reqMinorVersion, Common::U32String &errorMsg) {
-	Common::Archive *dataArchive = nullptr;
-	Common::File f;
-
-#ifndef RELEASE_BUILD
-	Common::FSNode folder;
-	if (ConfMan.hasKey("extrapath")) {
-		if ((folder = Common::FSNode(ConfMan.getPath("extrapath"))).exists()
-				&& (folder = folder.getChild("files")).exists()
-				&& (folder = folder.getChild(subfolder.baseName())).exists()) {
-			f.open(folder.getChild("version.txt"));
-		}
-	}
-
-#endif
-	if (!f.isOpen()) {
-		if (!Common::File::exists(DATA_FILENAME) ||
-			(dataArchive = Common::makeZipArchive(DATA_FILENAME)) == 0 ||
-			!f.open(subfolder.join("version.txt"), *dataArchive)) {
-			delete dataArchive;
-			errorMsg = Common::U32String::format(_("Could not locate engine data %s"), DATA_FILENAME);
-			return false;
-		}
-	}
-
-	// Validate the version
-	char buffer[5];
-	f.read(buffer, 4);
-	buffer[4] = '\0';
-
-	int major = 0, minor = 0;
-	if (buffer[1] == '.') {
-		major = buffer[0] - '0';
-		minor = atoi(&buffer[2]);
-	}
-
-	if (major != reqMajorVersion || minor != reqMinorVersion) {
-		delete dataArchive;
-		errorMsg = Common::U32String::format(_("Out of date engine data. Expected %d.%d, but got version %d.%d"),
-			reqMajorVersion, reqMinorVersion, major, minor);
-		return false;
-	}
-
-	// It was all validated correctly
-	Common::Archive *archive;
-#ifndef RELEASE_BUILD
-	if (!dataArchive)
-		archive = new UltimaDataArchiveProxy(folder);
-	else
-#endif
-		archive = new UltimaDataArchive(dataArchive, subfolder);
-
-	SearchMan.add("data", archive);
-	return true;
-}
-
-/*-------------------------------------------------------------------*/
-
-bool UltimaDataArchive::hasFile(const Common::Path &path) const {
-	if (!path.isRelativeTo(_publicFolder))
-		return false;
-
-	Common::Path realFilename = innerToPublic(path);
-	return _zip->hasFile(realFilename);
-}
-
-int UltimaDataArchive::listMatchingMembers(Common::ArchiveMemberList &list, const Common::Path &pattern, bool matchPathComponents) const {
-	Common::ArchiveMemberList innerList;
-	int numMatches = 0;
-	// Test whether we can skip filtering.
-	bool matchAll = matchPathComponents && pattern == "*";
-
-	// First, get all zip members relevant to the current game
-	_zip->listMatchingMembers(innerList, _innerfolder.appendComponent("*"), true);
-
-	// Modify the results to change the filename, then filter with pattern
-	for (const auto &innerMember : innerList) {
-		Common::ArchiveMemberPtr member = Common::ArchiveMemberPtr(
-			new UltimaDataArchiveMember(innerMember, _innerfolder));
-		if (matchAll || member->getPathInArchive().toString().matchString(pattern.toString(), true, matchPathComponents ? nullptr : "/")) {
-			list.push_back(member);
-			++numMatches;
-		}
-	}
-	return numMatches;
-}
-
-int UltimaDataArchive::listMembers(Common::ArchiveMemberList &list) const {
-	return listMatchingMembers(list, "*", true);
-}
-
-const Common::ArchiveMemberPtr UltimaDataArchive::getMember(const Common::Path &path) const {
-	if (!hasFile(path))
-		return Common::ArchiveMemberPtr();
-
-	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(path, *this));
-}
-
-Common::SeekableReadStream *UltimaDataArchive::createReadStreamForMember(const Common::Path &path) const {
-	if (hasFile(path)) {
-		Common::Path filename = innerToPublic(path);
-		return _zip->createReadStreamForMember(filename);
-	}
-
-	return nullptr;
-}
-
-bool UltimaDataArchive::isPathDirectory(const Common::Path &path) const {
-	return _zip->isPathDirectory(innerToPublic(path));
-}
-/*-------------------------------------------------------------------*/
-
-#ifndef RELEASE_BUILD
-
-const Common::ArchiveMemberPtr UltimaDataArchiveProxy::getMember(const Common::Path &path) const {
-	if (!hasFile(path))
-		return Common::ArchiveMemberPtr();
-
-	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(path, *this));
-}
-
-Common::SeekableReadStream *UltimaDataArchiveProxy::createReadStreamForMember(const Common::Path &path) const {
-	if (hasFile(path))
-		return getNode(path).createReadStream();
-
-	return nullptr;
-}
-
-Common::FSNode UltimaDataArchiveProxy::getNode(const Common::Path &name) const {
-	Common::Path remainingName = name.relativeTo(_publicFolder);
-	Common::FSNode node = _folder;
-
-	Common::StringArray components = remainingName.splitComponents();
-
-	if (components.empty()) {
-		return node;
-	}
-
-	for(Common::StringArray::const_iterator it = components.begin(); it != components.end() - 1; it++) {
-		node = node.getChild(*it);
-		if (!node.exists())
-			return node;
-	}
-
-	node = node.getChild(*(components.end() - 1));
-
-	return node;
-}
-
-int UltimaDataArchiveProxy::listMembers(Common::ArchiveMemberList &list) const {
-	return listMatchingMembers(list, "*", true);
-}
-
-int UltimaDataArchiveProxy::listMatchingMembers(Common::ArchiveMemberList &list,
-		const Common::Path &pattern, bool matchPathComponents) const {
-	// Let FSDirectory adjust the filenames for us by using its prefix feature.
-	// Note: dir is intentionally constructed again on each call to prevent stale entries due to caching:
-	// Since this proxy class is intended for use during development, picking up modifications while the
-	// game is running might be useful.
-	const int maxDepth = 255; // chosen arbitrarily
-	Common::FSDirectory dir(_publicFolder, _folder, maxDepth, false, false, true);
-	if (matchPathComponents && pattern == "*")
-		return dir.listMembers(list);
-	else
-		return dir.listMatchingMembers(list, pattern, matchPathComponents);
-}
-
-bool UltimaDataArchiveProxy::isPathDirectory(const Common::Path &path) const {
-	return getNode(path).isDirectory();
-}
-#endif
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/shared/engine/data_archive.h b/engines/ultima/shared/engine/data_archive.h
deleted file mode 100644
index 7f99ca8cb04..00000000000
--- a/engines/ultima/shared/engine/data_archive.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_ENGINE_DATA_ARCHIVE_H
-#define ULTIMA_SHARED_ENGINE_DATA_ARCHIVE_H
-
-#include "common/archive.h"
-#include "common/fs.h"
-#include "common/path.h"
-
-namespace Ultima {
-namespace Shared {
-
-/**
- * The data archive class encapsulates access to a specific subfolder within
- * the ultima.dat data file for a game. It wraps up the subfolder so it can
- * be accessed in each game as a generic "data" subfolder. This allows the
- * individual games to simplify their data loading code.
- */
-class UltimaDataArchive : public Common::Archive {
-private:
-	Common::Archive *_zip;
-	Common::Path _publicFolder;
-	Common::Path _innerfolder;
-
-
-	UltimaDataArchive(Common::Archive *zip, const Common::Path &subfolder) :
-		_zip(zip), _publicFolder("data/"), _innerfolder(subfolder) {}
-
-	Common::Path innerToPublic(const Common::Path &filename) const {
-		assert(filename.isRelativeTo(_publicFolder));
-		return _innerfolder.join(filename.relativeTo(_publicFolder));
-	}
-public:
-	/**
-	 * Creates a data archive wrapper for the ultima.dat datafile.
-	 * Firstly, for debugging purposes, if a "files" folder exists on any path that
-	 * has the given subfolder, it will be used first. This will allow for setting
-	 * the ScummVM Extra Path to the create_ultima folder, and it will give preference
-	 * the files there. Otherwise, it checks for the presence of ultima.dat, and
-	 * if the required data is found, it returns the new archive.
-	 * Otherwise, returns an error message in the errorMsg field
-	 */
-	static bool load(const Common::Path &subfolder,
-		int reqMajorVersion, int reqMinorVersion, Common::U32String &errorMsg);
-public:
-	~UltimaDataArchive() override {
-		delete _zip;
-	}
-
-	/**
-	 * Check if a member with the given name is present in the Archive.
-	 * Patterns are not allowed, as this is meant to be a quick File::exists()
-	 * replacement.
-	 */
-	bool hasFile(const Common::Path &path) const override;
-
-	/**
-	 * Add all members of the Archive matching the specified pattern to list.
-	 * Must only append to list, and not remove elements from it.
-	 *
-	 * @return the number of members added to list
-	 */
-	int listMatchingMembers(Common::ArchiveMemberList &list,
-		const Common::Path &pattern, bool matchPathComponents = false) const override;
-
-	/**
-	 * Add all members of the Archive to list.
-	 * Must only append to list, and not remove elements from it.
-	 *
-	 * @return the number of names added to list
-	 */
-	int listMembers(Common::ArchiveMemberList &list) const override;
-
-	/**
-	 * Returns a ArchiveMember representation of the given file.
-	 */
-	const Common::ArchiveMemberPtr getMember(const Common::Path &path)
-		const override;
-
-	/**
-	 * Create a stream bound to a member with the specified name in the
-	 * archive. If no member with this name exists, 0 is returned.
-	 * @return the newly created input stream
-	 */
-	Common::SeekableReadStream *createReadStreamForMember(
-		const Common::Path &path) const override;
-
-	bool isPathDirectory(const Common::Path &path) const override;
-};
-
-#ifndef RELEASE_BUILD
-
-/**
- * The data archive proxy class is used for debugging purposes to access engine data
- * files when the create_ultima folder is in the search path. It will allow for
- * local mucking around with the data files and committing changes without having to
- * recreate the ultima.dat file every time a change is made. ultima.dat then just has
- * to be recreated prior to a release or when the changes are completed and stable
- */
-class UltimaDataArchiveProxy : public Common::Archive {
-	friend class UltimaDataArchive;
-private:
-	Common::FSNode _folder;
-	const Common::Path _publicFolder;
-
-	UltimaDataArchiveProxy(const Common::FSNode &folder) : _folder(folder), _publicFolder("data/") {}
-
-	/**
-	 * Gets a file node from the passed filename
-	 */
-	Common::FSNode getNode(const Common::Path &name) const;
-public:
-	~UltimaDataArchiveProxy() override {
-	}
-
-	/**
-	 * Check if a member with the given name is present in the Archive.
-	 * Patterns are not allowed, as this is meant to be a quick File::exists()
-	 * replacement.
-	 */
-	bool hasFile(const Common::Path &path) const override {
-		return path.isRelativeTo(_publicFolder) && getNode(path).exists();
-	}
-
-	/**
-	 * Add all members of the Archive matching the specified pattern to list.
-	 * Must only append to list, and not remove elements from it.
-	 *
-	 * @return the number of members added to list
-	 */
-	int listMatchingMembers(Common::ArchiveMemberList &list,
-			const Common::Path &pattern, bool matchPathComponents = false) const override;
-
-	/**
-	 * Add all members of the Archive to list.
-	 * Must only append to list, and not remove elements from it.
-	 *
-	 * @return the number of names added to list
-	 */
-	int listMembers(Common::ArchiveMemberList &list) const override;
-
-	/**
-	 * Returns a ArchiveMember representation of the given file.
-	 */
-	const Common::ArchiveMemberPtr getMember(const Common::Path &path)
-		const override;
-
-	/**
-	 * Create a stream bound to a member with the specified name in the
-	 * archive. If no member with this name exists, 0 is returned.
-	 * @return the newly created input stream
-	 */
-	Common::SeekableReadStream *createReadStreamForMember(
-		const Common::Path &path) const override;
-
-	bool isPathDirectory(const Common::Path &path) const override;
-};
-
-#endif
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima4/controllers/intro_controller.cpp b/engines/ultima/ultima4/controllers/intro_controller.cpp
index 52084c0fd33..3a33fb7ee13 100644
--- a/engines/ultima/ultima4/controllers/intro_controller.cpp
+++ b/engines/ultima/ultima4/controllers/intro_controller.cpp
@@ -109,7 +109,7 @@ IntroBinData::~IntroBinData() {
 }
 
 void IntroBinData::openFile(Common::File &f, const Common::String &name) {
-	if (!f.open(Common::Path(Common::String::format("data/intro/%s.dat", name.c_str()))))
+	if (!f.open(Common::Path(Common::String::format("intro/%s.dat", name.c_str()))))
 		error("Could not load '%s'", name.c_str());
 }
 
diff --git a/engines/ultima/ultima4/core/config.cpp b/engines/ultima/ultima4/core/config.cpp
index 55f081458eb..45e59b3719b 100644
--- a/engines/ultima/ultima4/core/config.cpp
+++ b/engines/ultima/ultima4/core/config.cpp
@@ -30,7 +30,7 @@ Config *Config::_instance;
 Config::Config() {
 	_instance = this;
 
-	if (!_doc.readConfigFile("data/conf/config.xml"))
+	if (!_doc.readConfigFile("conf/config.xml"))
 		error("Failed to read core configuration");
 }
 
diff --git a/engines/ultima/ultima4/filesys/u4file.cpp b/engines/ultima/ultima4/filesys/u4file.cpp
index 4e79611bde6..445c80c5899 100644
--- a/engines/ultima/ultima4/filesys/u4file.cpp
+++ b/engines/ultima/ultima4/filesys/u4file.cpp
@@ -27,7 +27,7 @@ namespace Ultima4 {
 
 Common::Array<Common::String> u4read_stringtable(const Common::String &filename) {
 	Common::File f;
-	if (!f.open(Common::Path(Common::String::format("data/text/%s.dat", filename.c_str()))))
+	if (!f.open(Common::Path(Common::String::format("text/%s.dat", filename.c_str()))))
 		error("Could not open string table '%s'", filename.c_str());
 
 	Common::Array<Common::String> strs;
diff --git a/engines/ultima/ultima4/game/script.cpp b/engines/ultima/ultima4/game/script.cpp
index 248e120d4c3..23e9ade74e3 100644
--- a/engines/ultima/ultima4/game/script.cpp
+++ b/engines/ultima/ultima4/game/script.cpp
@@ -157,7 +157,7 @@ bool Script::load(const Common::String &filename, const Common::String &baseId,
 	 * Open and parse the .xml file
 	 */
 	Shared::XMLTree *doc = new Shared::XMLTree(
-		Common::Path(Common::String::format("data/conf/%s", filename.c_str())));
+		Common::Path(Common::String::format("conf/%s", filename.c_str())));
 	_vendorScriptDoc = root = doc->getTree();
 
 	if (!root->id().equalsIgnoreCase("scripts"))
diff --git a/engines/ultima/ultima4/gfx/imagemgr.cpp b/engines/ultima/ultima4/gfx/imagemgr.cpp
index 52893de785a..b9b06bd6483 100644
--- a/engines/ultima/ultima4/gfx/imagemgr.cpp
+++ b/engines/ultima/ultima4/gfx/imagemgr.cpp
@@ -532,7 +532,7 @@ Common::File *ImageMgr::getImageFile(ImageInfo *info) {
 			return file;
 	}
 
-	if (file->open(Common::Path("data/graphics/").joinInPlace(filename)))
+	if (file->open(Common::Path("graphics/").joinInPlace(filename)))
 		return file;
 
 	delete file;
diff --git a/engines/ultima/ultima4/gfx/screen.cpp b/engines/ultima/ultima4/gfx/screen.cpp
index 8e7409e8129..7e17cc3db93 100644
--- a/engines/ultima/ultima4/gfx/screen.cpp
+++ b/engines/ultima/ultima4/gfx/screen.cpp
@@ -148,7 +148,7 @@ void Screen::loadMouseCursors() {
 	// enable or disable the mouse cursor
 	if (settings._mouseOptions._enabled) {
 		Common::File cursorsFile;
-		if (!cursorsFile.open("data/graphics/cursors.txt"))
+		if (!cursorsFile.open("graphics/cursors.txt"))
 			error("Could not load mouse cursors");
 
 		for (int idx = 0; idx < 5; ++idx)
diff --git a/engines/ultima/ultima4/sound/music.cpp b/engines/ultima/ultima4/sound/music.cpp
index cdd6605729e..ee83913f49a 100644
--- a/engines/ultima/ultima4/sound/music.cpp
+++ b/engines/ultima/ultima4/sound/music.cpp
@@ -121,7 +121,7 @@ void Music::playMusic(const Common::String &filename) {
 
 bool Music::startMusic(const Common::String &filename) {
 	Common::File musicFile;
-	if (!musicFile.open(Common::Path(Common::String::format("data/mid/%s", filename.c_str()))))
+	if (!musicFile.open(Common::Path(Common::String::format("mid/%s", filename.c_str()))))
 		// No such file exists
 		return false;
 
diff --git a/engines/ultima/ultima4/sound/sound.cpp b/engines/ultima/ultima4/sound/sound.cpp
index 9d231649a33..2a67e5c0ba8 100644
--- a/engines/ultima/ultima4/sound/sound.cpp
+++ b/engines/ultima/ultima4/sound/sound.cpp
@@ -76,7 +76,7 @@ bool SoundManager::load(Sound sound) {
 	assertMsg(sound < SOUND_MAX, "Attempted to load an invalid sound");
 
 	if (_sounds[sound] == nullptr) {
-		Common::Path pathname("data/sound/");
+		Common::Path pathname("sound/");
 		pathname.joinInPlace(_soundFilenames[sound]);
 		Common::String basename = pathname.baseName();
 		if (!basename.empty() && !basename.hasSuffix("/"))
diff --git a/engines/ultima/ultima4/ultima4.cpp b/engines/ultima/ultima4/ultima4.cpp
index 1ce65e421ab..7586cb5e1f9 100644
--- a/engines/ultima/ultima4/ultima4.cpp
+++ b/engines/ultima/ultima4/ultima4.cpp
@@ -46,8 +46,8 @@
 #include "ultima/ultima4/map/tileset.h"
 #include "ultima/ultima4/sound/music.h"
 #include "ultima/ultima4/sound/sound.h"
-#include "ultima/shared/engine/data_archive.h"
 #include "common/debug.h"
+#include "common/engine_data.h"
 #include "common/system.h"
 
 namespace Ultima {
@@ -113,7 +113,7 @@ Ultima4Engine::~Ultima4Engine() {
 }
 
 bool Ultima4Engine::initialize() {
-	Common::Path folder;
+	const char *folder;
 	int reqMajorVersion, reqMinorVersion;
 
 	// Call syncSoundSettings to get default volumes set
@@ -125,7 +125,7 @@ bool Ultima4Engine::initialize() {
 
 	// Try and set up the data archive
 	Common::U32String errorMsg;
-	if (!Shared::UltimaDataArchive::load(folder, reqMajorVersion, reqMinorVersion, errorMsg)) {
+	if (!Common::load_engine_data("ultima.dat", folder, reqMajorVersion, reqMinorVersion, errorMsg)) {
 		GUIErrorMessage(errorMsg);
 		return false;
 	}
@@ -201,7 +201,7 @@ Common::Error Ultima4Engine::run() {
 	return Common::kNoError;
 }
 
-bool Ultima4Engine::isDataRequired(Common::Path &folder, int &majorVersion, int &minorVersion) {
+bool Ultima4Engine::isDataRequired(const char *&folder, int &majorVersion, int &minorVersion) {
 	folder = "ultima4";
 	majorVersion = 1;
 	minorVersion = 0;
diff --git a/engines/ultima/ultima4/ultima4.h b/engines/ultima/ultima4/ultima4.h
index 3d55863ac7f..26cf9063480 100644
--- a/engines/ultima/ultima4/ultima4.h
+++ b/engines/ultima/ultima4/ultima4.h
@@ -69,7 +69,7 @@ protected:
 	/**
 	 * Returns the data archive folder and version that's required
 	 */
-	bool isDataRequired(Common::Path &folder, int &majorVersion, int &minorVersion);
+	bool isDataRequired(const char *&folder, int &majorVersion, int &minorVersion);
 public:
 	Armors *_armors;
 	Codex *_codex;




More information about the Scummvm-git-logs mailing list