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

csnover csnover at users.noreply.github.com
Tue Jan 3 00:02:39 CET 2017


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:
3be2025a5e SCI32: Remove invalid GUIO options from GK2
a91b432cdb SCI32: Load VMDs from resource bundles


Commit: 3be2025a5e5b029fc5e4a26a221ac8383efb587f
    https://github.com/scummvm/scummvm/commit/3be2025a5e5b029fc5e4a26a221ac8383efb587f
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-01-02T17:02:31-06:00

Commit Message:
SCI32: Remove invalid GUIO options from GK2

Changed paths:
    engines/sci/detection_tables.h


diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 0709bd4..98dab7b 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -840,16 +840,12 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		AD_LISTEND},
 		Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO_GK1_MAC },
 
-#define GUIO_GK2_DEMO GUIO5(GUIO_NOSPEECH, \
+#define GUIO_GK2_DEMO GUIO3(GUIO_NOSPEECH, \
                             GUIO_NOASPECT, \
-                            GAMEOPTION_PREFER_DIGITAL_SFX, \
-                            GAMEOPTION_ORIGINAL_SAVELOAD, \
-                            GAMEOPTION_FB01_MIDI)
-#define GUIO_GK2      GUIO5(GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \
+                            GAMEOPTION_ORIGINAL_SAVELOAD)
+#define GUIO_GK2      GUIO3(GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \
                             GUIO_NOASPECT, \
-                            GAMEOPTION_PREFER_DIGITAL_SFX, \
-                            GAMEOPTION_ORIGINAL_SAVELOAD, \
-                            GAMEOPTION_FB01_MIDI)
+                            GAMEOPTION_ORIGINAL_SAVELOAD)
 #define GUIO_GK2_MAC  GUIO_GK2
 
 	// Gabriel Knight 2 - English Windows Non-Interactive Demo


Commit: a91b432cdbd97b1fde73dae2b67bd2b6b4ef6257
    https://github.com/scummvm/scummvm/commit/a91b432cdbd97b1fde73dae2b67bd2b6b4ef6257
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-01-02T17:02:31-06:00

Commit Message:
SCI32: Load VMDs from resource bundles

GK2 includes some VMDs in the RESSCI.00n volume bundles for the
chase scene at the end of Chapter 6.

Changed paths:
    engines/sci/engine/kscripts.cpp
    engines/sci/graphics/video32.cpp
    engines/sci/graphics/video32.h


diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 0e29ccf..77ef92b 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -102,15 +102,9 @@ reg_t kLock(EngineState *s, int argc, reg_t *argv) {
 }
 
 reg_t kResCheck(EngineState *s, int argc, reg_t *argv) {
-	Resource *res = NULL;
+	Resource *res = nullptr;
 	ResourceType restype = g_sci->getResMan()->convertResType(argv[0].toUint16());
 
-	if (restype == kResourceTypeVMD) {
-		char fileName[10];
-		sprintf(fileName, "%d.vmd", argv[1].toUint16());
-		return make_reg(0, Common::File::exists(fileName));
-	}
-
 	if ((restype == kResourceTypeAudio36) || (restype == kResourceTypeSync36)) {
 		if (argc >= 6) {
 			uint noun = argv[2].toUint16() & 0xff;
@@ -124,7 +118,16 @@ reg_t kResCheck(EngineState *s, int argc, reg_t *argv) {
 		res = g_sci->getResMan()->testResource(ResourceId(restype, argv[1].toUint16()));
 	}
 
-	return make_reg(0, res != NULL);
+#ifdef ENABLE_SCI32
+	// GK2 stores some VMDs inside of resource volumes, but usually they are
+	// streamed from the filesystem
+	if (res == nullptr && restype == kResourceTypeVMD) {
+		const Common::String fileName = Common::String::format("%u.vmd", argv[1].toUint16());
+		return make_reg(0, Common::File::exists(fileName));
+	}
+#endif
+
+	return make_reg(0, res != nullptr);
 }
 
 reg_t kClone(EngineState *s, int argc, reg_t *argv) {
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index c3aafb6..4af1e76 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -39,6 +39,7 @@
 #include "sci/graphics/palette32.h"      // for GfxPalette32
 #include "sci/graphics/plane32.h"        // for Plane, PlanePictureCodes::kP...
 #include "sci/graphics/screen_item32.h"  // for ScaleInfo, ScreenItem, Scale...
+#include "sci/resource.h"                // for ResourceManager, ResourceId,...
 #include "sci/sci.h"                     // for SciEngine, g_sci, getSciVersion
 #include "sci/sound/audio32.h"           // for Audio32
 #include "sci/video/seq_decoder.h"       // for SEQDecoder
@@ -492,6 +493,7 @@ VMDPlayer::VMDPlayer(SegManager *segMan, EventManager *eventMan) :
 
 	_isOpen(false),
 	_isInitialized(false),
+	_bundledVmd(nullptr),
 	_yieldFrame(0),
 	_yieldInterval(0),
 	_lastYieldedFrameNo(0),
@@ -536,15 +538,29 @@ VMDPlayer::IOStatus VMDPlayer::open(const Common::String &fileName, const OpenFl
 		g_sci->_audio32->stop(kAllChannels);
 	}
 
-	if (_decoder->loadFile(fileName)) {
+	Resource *bundledVmd = g_sci->getResMan()->findResource(ResourceId(kResourceTypeVMD, fileName.asUint64()), true);
+
+	if (bundledVmd != nullptr) {
+		Common::SeekableReadStream *stream = bundledVmd->makeStream();
+		if (_decoder->loadStream(stream)) {
+			_bundledVmd = bundledVmd;
+			_isOpen = true;
+		} else {
+			delete stream;
+			g_sci->getResMan()->unlockResource(bundledVmd);
+		}
+	} else if (_decoder->loadFile(fileName)) {
+		_isOpen = true;
+	}
+
+	if (_isOpen) {
 		if (flags & kOpenFlagMute) {
 			_decoder->setVolume(0);
 		}
-		_isOpen = true;
 		return kIOSuccess;
-	} else {
-		return kIOError;
 	}
+
+	return kIOError;
 }
 
 void VMDPlayer::init(const int16 x, const int16 y, const PlayFlags flags, const int16 boostPercent, const int16 boostStartColor, const int16 boostEndColor) {
@@ -571,6 +587,11 @@ VMDPlayer::IOStatus VMDPlayer::close() {
 	_isInitialized = false;
 	_ignorePalettes = false;
 
+	if (_bundledVmd) {
+		g_sci->getResMan()->unlockResource(_bundledVmd);
+		_bundledVmd = nullptr;
+	}
+
 	_segMan->freeBitmap(_screenItem->_celInfo.bitmap);
 
 	if (!_planeIsOwned && _screenItem != nullptr) {
diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h
index 69acdf2..5ed8fd9 100644
--- a/engines/sci/graphics/video32.h
+++ b/engines/sci/graphics/video32.h
@@ -321,6 +321,13 @@ private:
 	bool _isInitialized;
 
 	/**
+	 * The Resource object for VMDs that are read out
+	 * of a resource bundle instead of being streamed
+	 * from the filesystem.
+	 */
+	Resource *_bundledVmd;
+
+	/**
 	 * For VMDs played with the `kEventFlagToFrame` flag,
 	 * the target frame for yielding back to the SCI VM.
 	 */





More information about the Scummvm-git-logs mailing list