[Scummvm-git-logs] scummvm master -> 53d2b20df845c6ddc1834dbd4f6e8e35a7bd4d21

mgerhardy noreply at scummvm.org
Tue Jan 17 07:49:17 UTC 2023


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

Summary:
5fc73620a4 TWINE: show dotemu splash screen
53d2b20df8 TWINE: added potential dotemu windows release detection entry


Commit: 5fc73620a45bf6f59f0c957c1885d9716fef6e2c
    https://github.com/scummvm/scummvm/commit/5fc73620a45bf6f59f0c957c1885d9716fef6e2c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-17T06:28:45+01:00

Commit Message:
TWINE: show dotemu splash screen

Changed paths:
    engines/twine/renderer/screens.cpp
    engines/twine/twine.cpp
    image/bmp.h
    image/png.h


diff --git a/engines/twine/renderer/screens.cpp b/engines/twine/renderer/screens.cpp
index bef020c8f37..90f9e4372bd 100644
--- a/engines/twine/renderer/screens.cpp
+++ b/engines/twine/renderer/screens.cpp
@@ -21,10 +21,13 @@
 
 #include "twine/renderer/screens.h"
 #include "common/file.h"
+#include "common/str.h"
 #include "common/system.h"
 #include "graphics/managed_surface.h"
 #include "graphics/surface.h"
 #include "image/bmp.h"
+#include "image/image_decoder.h"
+#include "image/png.h"
 #include "twine/audio/music.h"
 #include "twine/resources/hqr.h"
 #include "twine/resources/resources.h"
@@ -99,33 +102,61 @@ bool Screens::loadImageDelay(TwineImage image, int32 seconds) {
 	return false;
 }
 
-bool Screens::loadBitmapDelay(const char *image, int32 seconds) {
+template<class ImageDecoder>
+static bool loadImageDelayViaDecoder(TwinEEngine *engine, const Common::String &fileName, int32 seconds) {
+	ImageDecoder decoder;
 	Common::File fileHandle;
-	if (!fileHandle.open(image)) {
-		warning("Failed to open %s", image);
+	if (!fileHandle.open(fileName)) {
+		warning("Failed to open %s", fileName.c_str());
 		return false;
 	}
-
-	Image::BitmapDecoder bitmap;
-	if (!bitmap.loadStream(fileHandle)) {
-		warning("Failed to load %s", image);
+	if (!decoder.loadStream(fileHandle)) {
+		warning("Failed to load %s", fileName.c_str());
 		return false;
 	}
-	const Graphics::Surface *src = bitmap.getSurface();
+	const Graphics::Surface *src = decoder.getSurface();
 	if (src == nullptr) {
-		warning("Failed to decode %s", image);
+		warning("Failed to decode %s", fileName.c_str());
 		return false;
 	}
-	Graphics::ManagedSurface &target = _engine->_frontVideoBuffer;
+	Graphics::ManagedSurface &target = engine->_frontVideoBuffer;
 	Common::Rect rect(src->w, src->h);
-	_engine->setPalette(bitmap.getPaletteStartIndex(), bitmap.getPaletteColorCount(), bitmap.getPalette());
+	engine->setPalette(decoder.getPaletteStartIndex(), decoder.getPaletteColorCount(), decoder.getPalette());
 	target.transBlitFrom(*src, rect, target.getBounds(), 0, false, 0, 0xff, nullptr, true);
-	if (_engine->delaySkip(1000 * seconds)) {
+	if (engine->delaySkip(1000 * seconds)) {
 		return true;
 	}
 	return false;
 }
 
+bool Screens::loadBitmapDelay(const char *image, int32 seconds) {
+	Common::String filename(image);
+	size_t extPos = filename.rfind(".");
+	if (extPos == Common::String::npos) {
+		warning("Failed to extract extension %s", image);
+		return false;
+	}
+
+	struct ImageLoader {
+		const char *extension;
+		bool (*loadImageDelay)(TwinEEngine *engine, const Common::String &fileName, int32 seconds);
+	};
+
+	static const ImageLoader s_imageLoaders[] = {
+		{ "bmp", loadImageDelayViaDecoder<Image::BitmapDecoder> },
+		{ "png", loadImageDelayViaDecoder<Image::PNGDecoder> },
+		{ nullptr, nullptr }
+	};
+	const Common::String &ext = filename.substr(extPos + 1);
+	for (const ImageLoader *loader = s_imageLoaders; loader->extension; ++loader) {
+		if (!scumm_stricmp(loader->extension, ext.c_str())) {
+			return loader->loadImageDelay(_engine, filename, seconds);
+		}
+	}
+	warning("Failed to find suitable image handler %s", image);
+	return false;
+}
+
 void Screens::fadeIn(const uint32 *pal) {
 	fadeToPal(pal);
 
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 2a48336ceaa..e787ef88fdb 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -548,6 +548,9 @@ void TwinEEngine::playIntro() {
 			abort |= _screens->loadBitmapDelay("TLBA1C_640_480_256.bmp", 3);
 		}
 	} else {
+		if (isDotEmuEnhanced()) {
+			abort |= _screens->loadBitmapDelay("splash_1.png", 3);
+		}
 		abort |= _screens->adelineLogo();
 
 		if (isLBA1()) {
@@ -555,14 +558,14 @@ void TwinEEngine::playIntro() {
 			if (!abort && _cfgfile.Version == EUROPE_VERSION) {
 				// Little Big Adventure screen
 				abort |= _screens->loadImageDelay(_resources->lbaLogo(), 3);
-				if (!abort) {
+				if (!abort && !isDotEmuEnhanced()) {
 					// Electronic Arts Logo
 					abort |= _screens->loadImageDelay(_resources->eaLogo(), 2);
 				}
 			} else if (!abort && _cfgfile.Version == USA_VERSION) {
 				// Relentless screen
 				abort |= _screens->loadImageDelay(_resources->relentLogo(), 3);
-				if (!abort) {
+				if (!abort && !isDotEmuEnhanced()) {
 					// Electronic Arts Logo
 					abort |= _screens->loadImageDelay(_resources->eaLogo(), 2);
 				}
diff --git a/image/bmp.h b/image/bmp.h
index 58265cd6bf8..9c8bd3a7938 100644
--- a/image/bmp.h
+++ b/image/bmp.h
@@ -56,6 +56,7 @@ namespace Image {
  *  - Hugo
  *  - Mohawk
  *  - Petka
+ *  - TwinE
  *  - Wintermute
  *  - Ultima8
  * @{
diff --git a/image/png.h b/image/png.h
index b6ceb52d047..b35ea166436 100644
--- a/image/png.h
+++ b/image/png.h
@@ -48,6 +48,7 @@ namespace Image {
  *
  * Used in engines:
  * - Sword25
+ * - TwinE
  * - Wintermute
  * @{
  */


Commit: 53d2b20df845c6ddc1834dbd4f6e8e35a7bd4d21
    https://github.com/scummvm/scummvm/commit/53d2b20df845c6ddc1834dbd4f6e8e35a7bd4d21
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-17T06:32:35+01:00

Commit Message:
TWINE: added potential dotemu windows release detection entry

see https://bugs.scummvm.org/ticket/13885

Changed paths:
    engines/twine/detection.cpp


diff --git a/engines/twine/detection.cpp b/engines/twine/detection.cpp
index a4bb735f66c..360826518e2 100644
--- a/engines/twine/detection.cpp
+++ b/engines/twine/detection.cpp
@@ -222,6 +222,10 @@ static const ADGameDescription twineGameDescriptions[] = {
 	// 8 Sep 2014 at 15:56
 	TWINE_DETECTION_ENTRY("lba", "DotEmu", AD_ENTRY1s("text.hqr", "a374c93450dd2bb874b7167a63974e8d", 377224), Common::kPlatformAndroid, TwinE::TF_DOTEMU_ENHANCED),
 
+	// Potentially the DotEmu release for windows from steam
+	// see https://bugs.scummvm.org/ticket/13885
+	TWINE_DETECTION_ENTRY("lba", "DotEmu", AD_ENTRY1s("LBA.EXE", "615a9a0c3dae2c3b5fca0dee4d84dc72", 931328), Common::kPlatformWindows, TwinE::TF_DOTEMU_ENHANCED),
+
 	// Little Big Adventure - GOG Version
 	// LBA.GOG
 	// 11 October 2011 at 17:30




More information about the Scummvm-git-logs mailing list