[Scummvm-git-logs] scummvm master -> 0ef46b7673880c67d712c8364d5bf58254a6a28a

OMGPizzaGuy 48367439+OMGPizzaGuy at users.noreply.github.com
Tue Feb 2 05:52:20 UTC 2021


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

Summary:
25852a0720 ULTIMA8: Remove dead code around old built-in data file handling
1b8ac227db ULTIMA8: Remove unused virtual paths for @work and @save
0ef46b7673 ULTIMA8: Update mark and recall commands to use ConfigManager


Commit: 25852a0720ea6a80711bbac001854d14e3b22e14
    https://github.com/scummvm/scummvm/commit/25852a0720ea6a80711bbac001854d14e3b22e14
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-01T23:51:07-06:00

Commit Message:
ULTIMA8: Remove dead code around old built-in data file handling

Changed paths:
  R engines/ultima/ultima8/filesys/data.cpp
    engines/ultima/module.mk
    engines/ultima/ultima8/filesys/file_system.cpp
    engines/ultima/ultima8/filesys/file_system.h
    engines/ultima/ultima8/ultima8.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 8baf9053d6..0df1299d32 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -400,7 +400,6 @@ MODULE_OBJS := \
 	ultima8/convert/crusader/convert_shape_crusader.o \
 	ultima8/filesys/archive.o \
 	ultima8/filesys/archive_file.o \
-	ultima8/filesys/data.o \
 	ultima8/filesys/file_system.o \
 	ultima8/filesys/flex_file.o \
 	ultima8/filesys/raw_archive.o \
diff --git a/engines/ultima/ultima8/filesys/data.cpp b/engines/ultima/ultima8/filesys/data.cpp
deleted file mode 100644
index 73f397c15a..0000000000
--- a/engines/ultima/ultima8/filesys/data.cpp
+++ /dev/null
@@ -1,59 +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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-
-#include "ultima/ultima8/filesys/file_system.h"
-
-#ifdef BUILTIN_DATA
-#endif
-
-namespace Ultima {
-namespace Ultima8 {
-
-void FileSystem::initBuiltinData(bool allowoverride) {
-#ifdef BUILTIN_DATA
-	allowdataoverride = allowoverride;
-
-	int i = 0;
-	while (true) {
-		PentagramData::DataFile &file = PentagramData::files[i++];
-		if (!file.name) break;
-
-		Std::string vp = "@data/";
-		vp += file.name;
-
-		Std::map<Common::String, MemoryFile *>::iterator p = memoryfiles.find(vp);
-
-		if (p != memoryfiles.end()) {
-			perr << "Warning: duplicate builtin data file: " << vp
-			     << Std::endl;
-			continue;
-		}
-
-		memoryfiles[vp] = new MemoryFile(file.data, file.size);
-
-	}
-#endif
-}
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/filesys/file_system.cpp b/engines/ultima/ultima8/filesys/file_system.cpp
index 55c166f67c..f2456ddd27 100644
--- a/engines/ultima/ultima8/filesys/file_system.cpp
+++ b/engines/ultima/ultima8/filesys/file_system.cpp
@@ -32,7 +32,7 @@ using Std::string;
 FileSystem *FileSystem::_fileSystem = nullptr;
 
 FileSystem::FileSystem(bool noforced)
-	: _noForcedVPaths(noforced), _allowDataOverride(true) {
+	: _noForcedVPaths(noforced) {
 	debugN(MM_INFO, "Creating FileSystem...\n");
 
 	_fileSystem = this;
@@ -48,15 +48,6 @@ FileSystem::~FileSystem() {
 
 // Open a streaming file as readable. Streamed (0 on failure)
 IDataSource *FileSystem::ReadFile(const string &vfn, bool is_text) {
-	IDataSource *data = checkBuiltinData(vfn, is_text);
-
-	// allow data-override?
-	if (!_allowDataOverride && data)
-		return data;
-
-	if (data)
-		delete data;
-
 	Common::SeekableReadStream *readStream;
 	if (!rawOpen(readStream, vfn))
 		return nullptr;
@@ -251,17 +242,6 @@ bool FileSystem::RemoveVirtualPath(const string &vpath) {
 	}
 }
 
-IDataSource *FileSystem::checkBuiltinData(const Std::string &vfn, bool is_text) {
-	// Is it a Memory file?
-	Std::map<Common::String, MemoryFile *>::const_iterator mf = _memoryFiles.find(vfn);
-
-	if (mf != _memoryFiles.end())
-		return new IBufferDataSource(mf->_value->_data,
-		                             mf->_value->_len, is_text);
-
-	return nullptr;
-}
-
 bool FileSystem::rewrite_virtual_path(string &vfn) const {
 	bool ret = false;
 	string::size_type pos = vfn.size();
diff --git a/engines/ultima/ultima8/filesys/file_system.h b/engines/ultima/ultima8/filesys/file_system.h
index b534310652..76891fc85f 100644
--- a/engines/ultima/ultima8/filesys/file_system.h
+++ b/engines/ultima/ultima8/filesys/file_system.h
@@ -37,9 +37,6 @@ public:
 	FileSystem(bool noforcedvpaths = false);
 	~FileSystem();
 
-	//! Initialize builtin data files.
-	void initBuiltinData(bool allowoverride);
-
 	static FileSystem *get_instance() {
 		return _fileSystem;
 	}
@@ -97,26 +94,11 @@ private:
 	// It's useful for 'tools'
 	bool    _noForcedVPaths;
 
-	// This enables/disables overriding builtin data files with external ones
-	bool    _allowDataOverride;
-
 	// rewrite virtual path in-place (i.e., fvn is replaced)
 	// returns false if no rewriting was done
 	bool rewrite_virtual_path(Std::string &vfn) const;
 
 	Std::map<Common::String, Std::string> _virtualPaths;
-
-	//! Check if the given file is a builtin data file.
-	//! If so, return an IDataSource for it. If not, return nullptr.
-	IDataSource *checkBuiltinData(const Std::string &vfn, bool is_text = false);
-
-	struct MemoryFile {
-		MemoryFile(const uint8 *data, const uint32 len)
-			: _data(data), _len(len) { }
-		const uint8 *_data;
-		const uint32 _len;
-	};
-	Std::map<Common::String, MemoryFile *> _memoryFiles; // Files mounted in memory
 };
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index c6bda874f0..6abc022cf6 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -26,7 +26,6 @@
 
  // TODO: !! a lot of these includes are just for some hacks... clean up sometime
 #include "ultima/ultima8/filesys/file_system.h"
-#include "ultima/ultima8/conf/setting_manager.h"
 #include "ultima/ultima8/kernel/object_manager.h"
 #include "ultima/ultima8/games/start_u8_process.h"
 #include "ultima/ultima8/graphics/fonts/font_manager.h"
@@ -175,12 +174,6 @@ bool Ultima8Engine::startup() {
 	// parent's startup first
 	CoreApp::startup();
 
-	bool dataoverride;
-	if (!_settingMan->get("dataoverride", dataoverride,
-		SettingManager::DOM_GLOBAL))
-		dataoverride = false;
-	_fileSystem->initBuiltinData(dataoverride);
-
 	_kernel = new Kernel();
 
 	//!! move this elsewhere


Commit: 1b8ac227dbf477df54f3b67e46f2c0db4f4ac6e0
    https://github.com/scummvm/scummvm/commit/1b8ac227dbf477df54f3b67e46f2c0db4f4ac6e0
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-01T23:51:07-06:00

Commit Message:
ULTIMA8: Remove unused virtual paths for @work and @save

Changed paths:
    engines/ultima/ultima8/filesys/file_system.cpp
    engines/ultima/ultima8/kernel/core_app.cpp
    engines/ultima/ultima8/kernel/core_app.h


diff --git a/engines/ultima/ultima8/filesys/file_system.cpp b/engines/ultima/ultima8/filesys/file_system.cpp
index f2456ddd27..cee2677fd2 100644
--- a/engines/ultima/ultima8/filesys/file_system.cpp
+++ b/engines/ultima/ultima8/filesys/file_system.cpp
@@ -83,15 +83,6 @@ bool FileSystem::rawOpen(Common::SeekableReadStream *&in, const string &fname) {
 		delete f;
 	}
 
-	// Handle opening savegames
-	if (name.hasPrefix("@save/")) {
-		int slotNumber = atoi(name.c_str() + 6);
-		Std::string saveFilename = Ultima8Engine::get_instance()->getSaveStateName(slotNumber);
-
-		in = g_system->getSavefileManager()->openForLoading(saveFilename);
-		return in != nullptr;
-	}
-
 	if (!rewrite_virtual_path(name))
 		return false;
 
@@ -116,15 +107,7 @@ bool FileSystem::rawOpen(Common::WriteStream *&out,  const string &fname) {
 	string name = fname;
 	switch_slashes(name);
 
-	if (name.hasPrefix("@save/")) {
-		int slotNumber = atoi(name.c_str() + 6);
-		Std::string saveFilename = Ultima8Engine::get_instance()->getSaveStateName(slotNumber);
-
-		out = g_system->getSavefileManager()->openForSaving(saveFilename, false);
-		return out != nullptr;
-	} else {
-		return false;
-	}
+	return false;
 
 #if 0
 	if (!rewrite_virtual_path(name)) {
diff --git a/engines/ultima/ultima8/kernel/core_app.cpp b/engines/ultima/ultima8/kernel/core_app.cpp
index bac909dbbe..d3455518b8 100644
--- a/engines/ultima/ultima8/kernel/core_app.cpp
+++ b/engines/ultima/ultima8/kernel/core_app.cpp
@@ -128,8 +128,6 @@ void CoreApp::killGame() {
 	_settingMan->write();
 
 	_fileSystem->RemoveVirtualPath("@game");
-	_fileSystem->RemoveVirtualPath("@work");
-	_fileSystem->RemoveVirtualPath("@save");
 
 	_configFileMan->clearRoot("bindings");
 	_configFileMan->clearRoot("language");
@@ -200,21 +198,6 @@ void CoreApp::setupGamePaths(GameInfo *ginfo) {
 	Std::string gpath;
 	_settingMan->get("path", gpath, SettingManager::DOM_GAME);
 	_fileSystem->AddVirtualPath("@game", gpath);
-
-	// load work path. Default is @home/game-work
-	// where 'game' in the above is the specified 'game' loaded
-	Std::string work;
-	if (!_settingMan->get("work", work, SettingManager::DOM_GAME))
-		work = "@home/" + game + "-work";
-
-	// load savegame path. Default is @home/game-save
-	Std::string save;
-	if (!_settingMan->get("save", save, SettingManager::DOM_GAME))
-		save = "@home/" + game + "-save";
-
-	// force creation if it doesn't exist
-	_fileSystem->AddVirtualPath("@save", save, true);
-	debugN(MM_INFO, "Savegame directory: %s\n", save.c_str());
 }
 
 void CoreApp::ParseArgs(const int argc, const char *const *const argv) {
diff --git a/engines/ultima/ultima8/kernel/core_app.h b/engines/ultima/ultima8/kernel/core_app.h
index 8a8c754603..c06b9632e8 100644
--- a/engines/ultima/ultima8/kernel/core_app.h
+++ b/engines/ultima/ultima8/kernel/core_app.h
@@ -107,7 +107,7 @@ protected:
 	void killGame();
 
 	//! Setup the virtual game paths for the current game (set in gameinfo)
-	//! Specifically, @game and @work
+	//! Specifically, @game
 	void setupGamePaths(GameInfo *gameinfo);
 };
 


Commit: 0ef46b7673880c67d712c8364d5bf58254a6a28a
    https://github.com/scummvm/scummvm/commit/0ef46b7673880c67d712c8364d5bf58254a6a28a
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-01T23:51:07-06:00

Commit Message:
ULTIMA8: Update mark and recall commands to use ConfigManager

Changed paths:
    engines/ultima/ultima8/misc/debugger.cpp


diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index 919d80c0ee..4bc6f1566c 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -20,12 +20,13 @@
  *
  */
 
+#include "common/config-manager.h"
+#include "common/tokenizer.h"
 #include "image/png.h"
 #include "image/bmp.h"
 #include "ultima/ultima8/ultima8.h"
 #include "ultima/ultima8/audio/audio_process.h"
 #include "ultima/ultima8/audio/music_process.h"
-#include "ultima/ultima8/conf/setting_manager.h"
 #include "ultima/ultima8/filesys/file_system.h"
 #include "ultima/ultima8/graphics/inverter_process.h"
 #include "ultima/ultima8/graphics/render_surface.h"
@@ -926,20 +927,16 @@ bool Debugger::cmdMark(int argc, const char **argv) {
 		return true;
 	}
 
-	SettingManager *settings = SettingManager::get_instance();
 	MainActor *mainActor = getMainActor();
 	int curmap = mainActor->getMapNum();
 	int32 x, y, z;
 	mainActor->getLocation(x, y, z);
 
-	istring confkey = Common::String::format("marks/%s", argv[1]);
-	char buf[100]; // large enough for 4 ints
-	sprintf(buf, "%d %d %d %d", curmap, x, y, z);
+	Common::String key = Common::String::format("mark_%s", argv[1]);
+	Common::String value = Common::String::format("%d %d %d %d", curmap, x, y, z);
+	ConfMan.set(key, value);
 
-	settings->set(confkey, buf);
-	settings->write(); //!! FIXME: clean this up
-
-	debugPrintf("Set mark \"%s\" to %s\n", argv[1], buf);
+	debugPrintf("Set mark \"%s\" to %s\n", argv[1], value.c_str());
 	return true;
 }
 
@@ -953,15 +950,14 @@ bool Debugger::cmdRecall(int argc, const char **argv) {
 		return true;
 	}
 
-	SettingManager *settings = SettingManager::get_instance();
 	MainActor *mainActor = getMainActor();
-	Common::String confKey = Common::String::format("marks/%s", argv[1]);
-	Std::string target;
-	if (!settings->get(confKey, target)) {
+	Common::String key = Common::String::format("mark_%s", argv[1]);
+	if (!ConfMan.hasKey(key)) {
 		debugPrintf("recall: no such mark\n");
 		return true;
 	}
 
+	Common::String target = ConfMan.get(key);
 	int t[4];
 	int n = sscanf(target.c_str(), "%d%d%d%d", &t[0], &t[1], &t[2], &t[3]);
 	if (n != 4) {
@@ -974,12 +970,19 @@ bool Debugger::cmdRecall(int argc, const char **argv) {
 }
 
 bool Debugger::cmdListMarks(int argc, const char **argv) {
-	SettingManager *settings = SettingManager::get_instance();
-	Std::vector<istring> marks;
-	marks = settings->listDataKeys("marks");
-	for (Std::vector<istring>::const_iterator iter = marks.begin();
-		iter != marks.end(); ++iter) {
-		debugPrintf("%s\n", iter->c_str());
+	const Common::ConfigManager::Domain *domain = ConfMan.getActiveDomain();
+	Common::ConfigManager::Domain::const_iterator dit;
+	Common::StringArray marks;
+	for (dit = domain->begin(); dit != domain->end(); ++dit) {
+		if (dit->_key.hasPrefix("mark_")) {
+			marks.push_back(dit->_key.substr(5));
+		}
+	}
+
+	Common::sort(marks.begin(), marks.end());
+	Common::StringArray::const_iterator mit;
+	for (mit = marks.begin(); mit != marks.end(); ++mit) {
+		debugPrintf("%s\n", mit->c_str());
 	}
 
 	return true;




More information about the Scummvm-git-logs mailing list