[Scummvm-git-logs] scummvm master -> 7ddf7ae7fe5d80028ec244644738914980287d47

Helco noreply at scummvm.org
Thu Oct 16 09:57:44 UTC 2025


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

Summary:
840207e4d8 ALCACHOFA: Fix empty dialog lines
3984acdca2 ALCACHOFA: Support PoT-only OpenGL platforms
7ddf7ae7fe ALCACHOFA: Improve detection tables


Commit: 840207e4d87c4730f685cabb9924b92dfa31665a
    https://github.com/scummvm/scummvm/commit/840207e4d87c4730f685cabb9924b92dfa31665a
Author: Helco (hermann.noll at hotmail.com)
Date: 2025-10-16T11:28:05+02:00

Commit Message:
ALCACHOFA: Fix empty dialog lines

Changed paths:
    engines/alcachofa/rooms.cpp


diff --git a/engines/alcachofa/rooms.cpp b/engines/alcachofa/rooms.cpp
index ffadfffe641..31311874cf0 100644
--- a/engines/alcachofa/rooms.cpp
+++ b/engines/alcachofa/rooms.cpp
@@ -784,7 +784,7 @@ void World::loadDialogLines() {
 			if (cursor > dialogLineEnd)
 				g_engine->game().invalidDialogLine(_dialogLines.size());
 			cursor = lineStart; // store an empty string
-			dialogLineEnd = lineStart + 1;
+			dialogLineEnd = lineStart;
 		}
 
 		*dialogLineEnd = 0;


Commit: 3984acdca21a793af9b3f547fd2c135c2b2fcf79
    https://github.com/scummvm/scummvm/commit/3984acdca21a793af9b3f547fd2c135c2b2fcf79
Author: Helco (hermann.noll at hotmail.com)
Date: 2025-10-16T11:39:40+02:00

Commit Message:
ALCACHOFA: Support PoT-only OpenGL platforms

Changed paths:
    engines/alcachofa/alcachofa.cpp
    engines/alcachofa/common.cpp
    engines/alcachofa/common.h
    engines/alcachofa/graphics-opengl.cpp
    engines/alcachofa/graphics-opengl.h
    engines/alcachofa/graphics-tinygl.cpp
    engines/alcachofa/graphics.cpp
    engines/alcachofa/graphics.h


diff --git a/engines/alcachofa/alcachofa.cpp b/engines/alcachofa/alcachofa.cpp
index 8aa9bb3aff2..1e5d6b664f6 100644
--- a/engines/alcachofa/alcachofa.cpp
+++ b/engines/alcachofa/alcachofa.cpp
@@ -28,6 +28,7 @@
 #include "graphics/paletteman.h"
 #include "graphics/framelimiter.h"
 #include "graphics/thumbnail.h"
+#include "graphics/managed_surface.h"
 #include "image/png.h"
 #include "video/avi_decoder.h"
 #include "video/mpegps_decoder.h"
@@ -45,6 +46,7 @@
 #include "alcachofa/game.h"
 
 using namespace Math;
+using namespace Graphics;
 
 namespace Alcachofa {
 
@@ -163,20 +165,46 @@ void AlcachofaEngine::playVideo(int32 videoId) {
 		return;
 	}
 
-	_sounds.stopAll();
-	auto texture = _renderer->createTexture(decoder->getWidth(), decoder->getHeight(), false);
+	Vector2d texMax(1.0f, 1.0f);
+	int16 texWidth = decoder->getWidth(), texHeight = decoder->getHeight();
+	ManagedSurface tmpSurface;
+	if (_renderer->requiresPoTTextures() &&
+		(!isPowerOfTwo(texWidth) || !isPowerOfTwo(texHeight))) {
+		texWidth = nextPowerOfTwo(texWidth);
+		texHeight = nextPowerOfTwo(texHeight);
+		texMax = {
+			decoder->getWidth() / (float)texWidth,
+			decoder->getHeight() / (float)texHeight,
+		};
+		tmpSurface.create(texWidth, texHeight, _renderer->getPixelFormat());
+	}
+	auto texture = _renderer->createTexture(texWidth, texHeight, false);
+
 	Common::Event e;
+	_sounds.stopAll();
 	decoder->start();
 	while (!decoder->endOfVideo() && !shouldQuit()) {
 		if (decoder->needsUpdate()) {
 			auto surface = decoder->decodeNextFrame();
-			if (surface)
-				texture->update(*surface);
+			if (surface) {
+				if (tmpSurface.empty())
+					texture->update(*surface);
+				else {
+					tmpSurface.blitFrom(*surface);
+					texture->update(tmpSurface);
+				}
+			}
 			_renderer->begin();
 			_renderer->setBlendMode(BlendMode::Alpha);
 			_renderer->setLodBias(0.0f);
 			_renderer->setTexture(texture.get());
-			_renderer->quad({}, { (float)g_system->getWidth(), (float)g_system->getHeight() });
+			_renderer->quad(
+				{},
+				{ (float)g_system->getWidth(), (float)g_system->getHeight() },
+				kWhite,
+				{},
+				{},
+				texMax);
 			_renderer->end();
 			g_system->updateScreen();
 		}
diff --git a/engines/alcachofa/common.cpp b/engines/alcachofa/common.cpp
index f59a5d81d18..6c963840a02 100644
--- a/engines/alcachofa/common.cpp
+++ b/engines/alcachofa/common.cpp
@@ -27,6 +27,23 @@ using namespace Math;
 
 namespace Alcachofa {
 
+bool isPowerOfTwo(int16 x) {
+	return (x & (x - 1)) == 0;
+}
+
+int16 nextPowerOfTwo(int16 v) {
+	// adapted from https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
+	assert(v >= 0);
+	if (v == 0)
+		return 0;
+	v--;
+	v |= v >> 1;
+	v |= v >> 2;
+	v |= v >> 4;
+	v |= v >> 8;
+	return v + 1;
+}
+
 float ease(float t, EasingType type) {
 	switch (type) {
 	case EasingType::Linear:
diff --git a/engines/alcachofa/common.h b/engines/alcachofa/common.h
index a28ac48fe79..cd8da0fae88 100644
--- a/engines/alcachofa/common.h
+++ b/engines/alcachofa/common.h
@@ -113,6 +113,9 @@ private:
 	FakeSemaphore *_semaphore = nullptr;
 };
 
+bool isPowerOfTwo(int16 x);
+int16 nextPowerOfTwo(int16 v);
+
 float ease(float t, EasingType type);
 
 Math::Vector3d as3D(const Math::Vector2d &v);
diff --git a/engines/alcachofa/graphics-opengl.cpp b/engines/alcachofa/graphics-opengl.cpp
index 10b2c495292..044bacbc651 100644
--- a/engines/alcachofa/graphics-opengl.cpp
+++ b/engines/alcachofa/graphics-opengl.cpp
@@ -37,6 +37,10 @@ using namespace Graphics;
 
 namespace Alcachofa {
 
+//
+// OpenGL classes, calls to gl* are allowed here
+//
+
 OpenGLTexture::OpenGLTexture(int32 w, int32 h, bool withMipmaps)
 	: ITexture({ (int16)w, (int16)h })
 	, _withMipmaps(withMipmaps) {
@@ -49,10 +53,6 @@ OpenGLTexture::OpenGLTexture(int32 w, int32 h, bool withMipmaps)
 	setMirrorWrap(false);
 }
 
-//
-// OpenGL classes, calls to gl* are allowed here
-//
-
 OpenGLTexture::~OpenGLTexture() {
 	if (_handle != 0)
 		GL_CALL(glDeleteTextures(1, &_handle));
@@ -102,7 +102,7 @@ OpenGLRenderer::OpenGLRenderer(Point resolution) : OpenGLRendererBase(resolution
 	GL_CALL(glEnable(GL_BLEND));
 	GL_CALL(glDepthMask(GL_FALSE));
 
-	if (!OpenGLContext.NPOTSupported || !OpenGLContext.textureMirrorRepeatSupported) {
+	if (!OpenGLContext.textureMirrorRepeatSupported) {
 		GUI::displayErrorDialog(_("Old OpenGL detected, some graphical errors will occur."));
 	}
 }
@@ -112,8 +112,12 @@ ScopedPtr<ITexture> OpenGLRenderer::createTexture(int32 w, int32 h, bool withMip
 	return ScopedPtr<ITexture>(new OpenGLTexture(w, h, withMipmaps));
 }
 
-Graphics::PixelFormat OpenGLRenderer::getPixelFormat() const {
-	return Graphics::PixelFormat::createFormatRGBA32();
+PixelFormat OpenGLRenderer::getPixelFormat() const {
+	return PixelFormat::createFormatRGBA32();
+}
+
+bool OpenGLRenderer::requiresPoTTextures() const {
+	return !OpenGLContext.NPOTSupported;
 }
 
 void OpenGLRenderer::end() {
diff --git a/engines/alcachofa/graphics-opengl.h b/engines/alcachofa/graphics-opengl.h
index b53ab590a85..ad2987d4c50 100644
--- a/engines/alcachofa/graphics-opengl.h
+++ b/engines/alcachofa/graphics-opengl.h
@@ -51,6 +51,7 @@ public:
 
 	Common::ScopedPtr<ITexture> createTexture(int32 w, int32 h, bool withMipmaps) override;
 	Graphics::PixelFormat getPixelFormat() const override;
+	bool requiresPoTTextures() const override;
 	void end() override;
 	void setOutput(Graphics::Surface &output) override;
 
diff --git a/engines/alcachofa/graphics-tinygl.cpp b/engines/alcachofa/graphics-tinygl.cpp
index 00141e25289..8a1fcdf5fc1 100644
--- a/engines/alcachofa/graphics-tinygl.cpp
+++ b/engines/alcachofa/graphics-tinygl.cpp
@@ -124,8 +124,12 @@ public:
 		return ScopedPtr<ITexture>(new TinyGLTexture(w, h, withMipmaps));
 	}
 
-	Graphics::PixelFormat getPixelFormat() const override {
-		return Graphics::PixelFormat::createFormatRGBA32();
+	PixelFormat getPixelFormat() const override {
+		return PixelFormat::createFormatRGBA32();
+	}
+
+	bool requiresPoTTextures() const override {
+		return false;
 	}
 
 	void begin() override {
diff --git a/engines/alcachofa/graphics.cpp b/engines/alcachofa/graphics.cpp
index b8e13112b04..06992694b7c 100644
--- a/engines/alcachofa/graphics.cpp
+++ b/engines/alcachofa/graphics.cpp
@@ -37,7 +37,11 @@ using namespace Graphics;
 
 namespace Alcachofa {
 
-ITexture::ITexture(Point size) : _size(size) {}
+ITexture::ITexture(Point size) : _size(size) {
+	if ((!isPowerOfTwo(size.x) || !isPowerOfTwo(size.y)) &&
+		g_engine->renderer().requiresPoTTextures())
+		warning("Created unsupported NPOT texture (%dx%d)", size.x, size.y);
+}
 
 void IDebugRenderer::debugShape(const Shape &shape, Color color) {
 	constexpr uint kMaxPoints = 16;
@@ -252,8 +256,13 @@ void Animation::load() {
 		return;
 	AnimationBase::load();
 	Rect maxBounds = maxFrameBounds();
-	_renderedSurface.create(maxBounds.width(), maxBounds.height(), g_engine->renderer().getPixelFormat());
-	_renderedTexture = g_engine->renderer().createTexture(maxBounds.width(), maxBounds.height(), true);
+	int16 texWidth = maxBounds.width(), texHeight = maxBounds.height();
+	if (g_engine->renderer().requiresPoTTextures()) {
+		texWidth = nextPowerOfTwo(maxBounds.width());
+		texHeight = nextPowerOfTwo(maxBounds.height());
+	}
+	_renderedSurface.create(texWidth, texHeight, g_engine->renderer().getPixelFormat());
+	_renderedTexture = g_engine->renderer().createTexture(texWidth, texHeight, true);
 
 	// We always create mipmaps, even for the backgrounds that usually do not scale much,
 	// the exception to this is the thumbnails for the savestates.
@@ -323,22 +332,34 @@ int32 Animation::frameAtTime(uint32 time) const {
 }
 
 void Animation::overrideTexture(const ManagedSurface &surface) {
+	int16 texWidth = surface.w, texHeight = surface.h;
+	if (g_engine->renderer().requiresPoTTextures()) {
+		texWidth = nextPowerOfTwo(texWidth);
+		texHeight = nextPowerOfTwo(texHeight);
+	}
+
 	// In order to really use the overridden surface we have to override all
 	// values used for calculating the output size
 	_renderedFrameI = 0;
 	_renderedPremultiplyAlpha = _premultiplyAlpha;
 	_renderedSurface.free();
-	_renderedSurface.w = surface.w;
-	_renderedSurface.h = surface.h;
+	_renderedSurface.w = texWidth;
+	_renderedSurface.h = texHeight;
 	_images[0]->free();
 	_images[0]->w = surface.w;
 	_images[0]->h = surface.h;
 
-	if (_renderedTexture->size() != Point(surface.w, surface.h)) {
+	if (_renderedTexture->size() != Point(texWidth, texHeight)) {
 		_renderedTexture = Common::move(
-			g_engine->renderer().createTexture(surface.w, surface.h, false));
+			g_engine->renderer().createTexture(texWidth, texHeight, false));
+	}
+	if (surface.w == texWidth && surface.h == texHeight)
+		_renderedTexture->update(surface);
+	else {
+		ManagedSurface tmpSurface(texWidth, texHeight, g_engine->renderer().getPixelFormat());
+		tmpSurface.blitFrom(surface);
+		_renderedTexture->update(tmpSurface);
 	}
-	_renderedTexture->update(surface);
 }
 
 void Animation::prerenderFrame(int32 frameI) {
@@ -428,17 +449,6 @@ void Animation::drawEffect(int32 frameI, Vector3d topLeft, Vector2d size, Vector
 
 Font::Font(String fileName) : AnimationBase(fileName) {}
 
-static int16 nextPowerOfTwo(int16 v) {
-	// adapted from https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
-	assert(v > 0);
-	v--;
-	v |= v >> 1;
-	v |= v >> 2;
-	v |= v >> 4;
-	v |= v >> 8;
-	return v + 1;
-}
-
 void Font::load() {
 	if (_isLoaded)
 		return;
diff --git a/engines/alcachofa/graphics.h b/engines/alcachofa/graphics.h
index fa6dd2452b5..7a751491da4 100644
--- a/engines/alcachofa/graphics.h
+++ b/engines/alcachofa/graphics.h
@@ -77,6 +77,7 @@ public:
 
 	virtual Common::ScopedPtr<ITexture> createTexture(int32 w, int32 h, bool withMipmaps = true) = 0;
 	virtual Graphics::PixelFormat getPixelFormat() const = 0;
+	virtual bool requiresPoTTextures() const = 0;
 
 	virtual void begin() = 0;
 	virtual void setTexture(ITexture *texture) = 0;


Commit: 7ddf7ae7fe5d80028ec244644738914980287d47
    https://github.com/scummvm/scummvm/commit/7ddf7ae7fe5d80028ec244644738914980287d47
Author: Helco (hermann.noll at hotmail.com)
Date: 2025-10-16T11:56:58+02:00

Commit Message:
ALCACHOFA: Improve detection tables

- Add pirated german version
- Mark original spanish CD release as unstable

Changed paths:
    engines/alcachofa/detection_tables.h


diff --git a/engines/alcachofa/detection_tables.h b/engines/alcachofa/detection_tables.h
index 1d3bd5393e1..6f52319c4ba 100644
--- a/engines/alcachofa/detection_tables.h
+++ b/engines/alcachofa/detection_tables.h
@@ -33,12 +33,27 @@ const ADGameDescription gameDescriptions[] = {
 	{
 		"aventuradecine",
 		"Clever & Smart - A Movie Adventure",
-		AD_ENTRY1s("Textos/Objetos.nkr", "a2b1deff5ca7187f2ebf7f2ab20747e9", 17606),
+		AD_ENTRY2s(
+			"Textos/Objetos.nkr", "a2b1deff5ca7187f2ebf7f2ab20747e9", 17606,
+			"Data/DATA02.BIN", "ab6d8867585fbc0f555f5b13d8d1bdf3", 55906308
+		),
 		Common::DE_DEU,
 		Common::kPlatformWindows,
 		ADGF_TESTING | ADGF_USEEXTRAASTITLE | ADGF_REMASTERED,
 		GUIO2(GAMEOPTION_32BITS, GAMEOPTION_HIGH_QUALITY)
 	},
+	{
+		"aventuradecine",
+		"Clever & Smart - A Movie Adventure",
+		AD_ENTRY2s(
+			"Textos/Objetos.nkr", "a2b1deff5ca7187f2ebf7f2ab20747e9", 17606,
+			"Data/DATA02.BIN", "4693e52835bad0c6deab63b60ead81fb", 38273192
+		),
+		Common::DE_DEU,
+		Common::kPlatformWindows,
+		ADGF_TESTING | ADGF_USEEXTRAASTITLE | ADGF_REMASTERED | ADGF_PIRATED,
+		GUIO2(GAMEOPTION_32BITS, GAMEOPTION_HIGH_QUALITY)
+	},
 	{
 		"aventuradecine",
 		"Clever & Smart - A Movie Adventure",
@@ -77,7 +92,7 @@ const ADGameDescription gameDescriptions[] = {
 		AD_ENTRY1s("Textos/Objetos.nkr", "8a8b23c04fdc4ced8070a7bccd0177bb", 24467),
 		Common::ES_ESP,
 		Common::kPlatformWindows,
-		ADGF_TESTING | ADGF_USEEXTRAASTITLE | ADGF_REMASTERED | ADGF_CD,
+		ADGF_UNSTABLE | ADGF_USEEXTRAASTITLE | ADGF_REMASTERED | ADGF_CD,
 		GUIO2(GAMEOPTION_32BITS, GAMEOPTION_HIGH_QUALITY)
 	},
 




More information about the Scummvm-git-logs mailing list