[Scummvm-git-logs] scummvm master -> aba570ab424d1126204457be46667c56be1a4305

dreammaster paulfgilbert at gmail.com
Sun Feb 23 22:58:36 UTC 2020


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

Summary:
aba570ab42 ULTIMA8: Cleanup of perr usage on startup


Commit: aba570ab424d1126204457be46667c56be1a4305
    https://github.com/scummvm/scummvm/commit/aba570ab424d1126204457be46667c56be1a4305
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-23T14:58:13-08:00

Commit Message:
ULTIMA8: Cleanup of perr usage on startup

Changed paths:
    engines/ultima/ultima8/kernel/core_app.cpp
    engines/ultima/ultima8/misc/debugger.h
    engines/ultima/ultima8/ultima8.cpp
    engines/ultima/ultima8/usecode/uc_machine.cpp


diff --git a/engines/ultima/ultima8/kernel/core_app.cpp b/engines/ultima/ultima8/kernel/core_app.cpp
index 3e54268..24ce8dc 100644
--- a/engines/ultima/ultima8/kernel/core_app.cpp
+++ b/engines/ultima/ultima8/kernel/core_app.cpp
@@ -336,10 +336,10 @@ void CoreApp::ParseArgs(const int argc_, const char *const *const argv_) {
 }
 
 void CoreApp::helpMe() {
-	debug("\t-h\t\t- quick help menu (this)\n");
-	debug("\t-q\t\t- silence general logging messages\n");
-	debug("\t-qq\t\t- silence general logging messages and\n\t\t\t  non-critical warnings/errors\n");
-	debug("\t--game {name}\t- select a game\n");
+	debug(MM_INFO, "\t-h\t\t- quick help menu (this)\n");
+	debug(MM_INFO, "\t-q\t\t- silence general logging messages\n");
+	debug(MM_INFO, "\t-qq\t\t- silence general logging messages and\n\t\t\t  non-critical warnings/errors\n");
+	debug(MM_INFO, "\t--game {name}\t- select a game\n");
 }
 
 GameInfo *CoreApp::getGameInfo(istring game) const {
diff --git a/engines/ultima/ultima8/misc/debugger.h b/engines/ultima/ultima8/misc/debugger.h
index 8d44e31..29500db 100644
--- a/engines/ultima/ultima8/misc/debugger.h
+++ b/engines/ultima/ultima8/misc/debugger.h
@@ -91,11 +91,21 @@ class console_ostream : public ConsoleStream {
 
 template<class T>
 class console_err_ostream : public ConsoleStream {
+private:
+	Common::String _line;
 public:
 	uint32 write(const void *dataPtr, uint32 dataSize) override {
-		Common::String str((const char *)dataPtr, dataSize);
-		::warning("%s", str.c_str());
-		return str.size();
+		_line += Common::String((const char *)dataPtr, dataSize);
+
+		size_t lineEnd;
+		while ((lineEnd = _line.find(Std::endl)) != Common::String::npos) {
+			if (lineEnd > 0)
+				warning("%s", Common::String(_line.c_str(), lineEnd).c_str());
+
+			_line = Common::String(_line.c_str() + lineEnd + 1);
+		}
+
+		return dataSize;
 	}
 };
 
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index dde5398..fabcca4 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -1265,21 +1265,21 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ds = sg->getDataSource("UCSTRINGS");
 	ok = _ucMachine->loadStrings(ds, version);
 	totalok &= ok;
-	perr << "UCSTRINGS: " << (ok ? "ok" : "failed") << Std::endl;
+	pout << "UCSTRINGS: " << (ok ? "ok" : "failed") << Std::endl;
 	if (!ok) message += "UCSTRINGS: failed\n";
 	delete ds;
 
 	ds = sg->getDataSource("UCGLOBALS");
 	ok = _ucMachine->loadGlobals(ds, version);
 	totalok &= ok;
-	perr << "UCGLOBALS: " << (ok ? "ok" : "failed") << Std::endl;
+	pout << "UCGLOBALS: " << (ok ? "ok" : "failed") << Std::endl;
 	if (!ok) message += "UCGLOBALS: failed\n";
 	delete ds;
 
 	ds = sg->getDataSource("UCLISTS");
 	ok = _ucMachine->loadLists(ds, version);
 	totalok &= ok;
-	perr << "UCLISTS: " << (ok ? "ok" : "failed") << Std::endl;
+	pout << "UCLISTS: " << (ok ? "ok" : "failed") << Std::endl;
 	if (!ok) message += "UCLISTS: failed\n";
 	delete ds;
 
@@ -1288,14 +1288,14 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ds = sg->getDataSource("KERNEL");
 	ok = _kernel->load(ds, version);
 	totalok &= ok;
-	perr << "KERNEL: " << (ok ? "ok" : "failed") << Std::endl;
+	pout << "KERNEL: " << (ok ? "ok" : "failed") << Std::endl;
 	if (!ok) message += "KERNEL: failed\n";
 	delete ds;
 
 	ds = sg->getDataSource("APP");
 	ok = load(ds, version);
 	totalok &= ok;
-	perr << "APP: " << (ok ? "ok" : "failed") << Std::endl;
+	pout << "APP: " << (ok ? "ok" : "failed") << Std::endl;
 	if (!ok) message += "APP: failed\n";
 	delete ds;
 
@@ -1303,28 +1303,28 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
 	ds = sg->getDataSource("WORLD");
 	ok = _world->load(ds, version);
 	totalok &= ok;
-	perr << "WORLD: " << (ok ? "ok" : "failed") << Std::endl;
+	pout << "WORLD: " << (ok ? "ok" : "failed") << Std::endl;
 	if (!ok) message += "WORLD: failed\n";
 	delete ds;
 
 	ds = sg->getDataSource("CURRENTMAP");
 	ok = _world->getCurrentMap()->load(ds, version);
 	totalok &= ok;
-	perr << "CURRENTMAP: " << (ok ? "ok" : "failed") << Std::endl;
+	pout << "CURRENTMAP: " << (ok ? "ok" : "failed") << Std::endl;
 	if (!ok) message += "CURRENTMAP: failed\n";
 	delete ds;
 
 	ds = sg->getDataSource("OBJECTS");
 	ok = _objectManager->load(ds, version);
 	totalok &= ok;
-	perr << "OBJECTS: " << (ok ? "ok" : "failed") << Std::endl;
+	pout << "OBJECTS: " << (ok ? "ok" : "failed") << Std::endl;
 	if (!ok) message += "OBJECTS: failed\n";
 	delete ds;
 
 	ds = sg->getDataSource("MAPS");
 	ok = _world->loadMaps(ds, version);
 	totalok &= ok;
-	perr << "MAPS: " << (ok ? "ok" : "failed") << Std::endl;
+	pout << "MAPS: " << (ok ? "ok" : "failed") << Std::endl;
 	if (!ok) message += "MAPS: failed\n";
 	delete ds;
 
diff --git a/engines/ultima/ultima8/usecode/uc_machine.cpp b/engines/ultima/ultima8/usecode/uc_machine.cpp
index c51fb5d..30bc6e7 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -353,7 +353,7 @@ void UCMachine::execProcess(UCProcess *p) {
 			//! TODO
 			uint16 arg_bytes = cs.read1();
 			uint16 func = cs.read2();
-			debug("calli\t\t%04Xh (%02Xh arg bytes) %s \n", func, arg_bytes, _convUse->intrinsics()[func]);
+			debug(MM_INFO, "calli\t\t%04Xh (%02Xh arg bytes) %s \n", func, arg_bytes, _convUse->intrinsics()[func]);
 
 			// !constants
 			if (func >= _intrinsicCount || _intrinsics[func] == 0) {
@@ -1366,7 +1366,7 @@ void UCMachine::execProcess(UCProcess *p) {
 			int this_size = cs.read1();
 			int unknown = cs.read1(); // ??
 
-			debug("spawn inline\t%04X:%04X+%04X=%04X %02X %02X\n",
+			debug(MM_INFO, "spawn inline\t%04X:%04X+%04X=%04X %02X %02X\n",
 				classid, offset, delta, offset + delta, this_size, unknown);
 
 			uint32 thisptr = 0;




More information about the Scummvm-git-logs mailing list