[Scummvm-git-logs] scummvm master -> 2fd8736dde2603a6a753ece0cd94754bf27ef208

Die4Ever noreply at scummvm.org
Tue Jan 4 05:55:00 UTC 2022


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:
2fd8736dde GROOVIE: roq dumpAllSurfaces for debugging


Commit: 2fd8736dde2603a6a753ece0cd94754bf27ef208
    https://github.com/scummvm/scummvm/commit/2fd8736dde2603a6a753ece0cd94754bf27ef208
Author: Die4Ever (die4ever2005 at gmail.com)
Date: 2022-01-03T23:54:29-06:00

Commit Message:
GROOVIE: roq dumpAllSurfaces for debugging

Changed paths:
    engines/groovie/video/roq.cpp
    engines/groovie/video/roq.h


diff --git a/engines/groovie/video/roq.cpp b/engines/groovie/video/roq.cpp
index 5f1ef95b5af..8f6c94968a5 100644
--- a/engines/groovie/video/roq.cpp
+++ b/engines/groovie/video/roq.cpp
@@ -43,6 +43,13 @@
 #include "audio/mixer.h"
 #include "audio/decoders/raw.h"
 
+#include <common/file.h>
+#ifdef USE_PNG
+#include "image/png.h"
+#else
+#include "image/bmp.h"
+#endif
+
 /* copied from transparent_surface.cpp */
 #ifdef SCUMM_LITTLE_ENDIAN
 static const int kAIndex = 0;
@@ -259,6 +266,46 @@ void ROQPlayer::redrawRestoreArea(int screenOffset) {
 	_restoreArea->right = 0;
 }
 
+void writeImage(const Common::String filename, Graphics::Surface &surface) {
+	Common::String tname = "img/" + filename;
+#ifdef USE_PNG
+	tname += ".png";
+#else
+	tname += ".bmp";
+#endif
+
+	Common::DumpFile out;
+	if (!out.open(tname)) {
+		error("failed to open %s", tname.c_str());
+	}
+
+#ifdef USE_PNG
+	Image::writePNG(out, surface);
+#else
+	Image::writeBMP(out, surface);
+#endif
+}
+
+void ROQPlayer::dumpAllSurfaces() {
+	TimeDate date;
+	int curMonth;
+	g_system->getTimeAndDate(date, true);
+	curMonth = date.tm_mon + 1; // month is base 0, we need base 1 (1 = january and so on)
+	uint millis = g_system->getMillis();
+	Common::String timestamp = Common::String::format("%d-%02d-%02d %02d-%02d-%02d %08u",
+													  date.tm_year + 1900, curMonth, date.tm_mday,
+													  date.tm_hour, date.tm_min, date.tm_sec, millis);
+
+	writeImage("lockScreen " + timestamp, *_vm->_system->lockScreen());
+	_vm->_system->unlockScreen();
+	writeImage("_bg " + timestamp, *_bg);
+	writeImage("_currBuf " + timestamp, *_currBuf);
+	writeImage("_overBuf " + timestamp, *_overBuf);
+	writeImage("_prevBuf " + timestamp, *_prevBuf);
+	writeImage("_screen " + timestamp, *_screen);
+	g_system->delayMillis(15); // make sure we get a new timestamp every time
+}
+
 void ROQPlayer::buildShowBuf() {
 	// Calculate screen offset for normal / fullscreen videos and images
 	int screenOffset = 0;
@@ -338,6 +385,10 @@ void ROQPlayer::buildShowBuf() {
 		}
 	}
 
+	if (gDebugLevel >= 8 && DebugMan.isDebugChannelEnabled(kDebugVideo)) {
+		dumpAllSurfaces();
+	}
+
 	if (!_flagNoPlay) {
 		_vm->_system->unlockScreen();
 		_vm->_system->updateScreen();
diff --git a/engines/groovie/video/roq.h b/engines/groovie/video/roq.h
index 12e22da5077..566928029b3 100644
--- a/engines/groovie/video/roq.h
+++ b/engines/groovie/video/roq.h
@@ -72,6 +72,7 @@ private:
 	bool processBlockAudioContainer(ROQBlockHeader &blockHeader);
 	bool playFirstFrame() { return _flagNoPlay; }; // _alpha && !_flagOverlay; }
 	void clearOverlay();
+	void dumpAllSurfaces();
 
 	void paint2(byte i, int destx, int desty);
 	void paint4(byte i, int destx, int desty);




More information about the Scummvm-git-logs mailing list