[Scummvm-git-logs] scummvm master -> 24c8a26c759f476619c3e844deb7ae8b2c3ca048

csnover csnover at users.noreply.github.com
Mon Sep 25 06:04:19 CEST 2017


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

Summary:
21337e4cf6 SCI32: Implement per-channel audio panning
817887216d SCI32: Fix RAMA auto-save game
f42480d7cd SCI32: Support palette-inverting SCI3 variant of kPalVary
3e107c1eb0 SCI32: Allow invalid references to be passed to kFileIO
663d845d63 SCI32: Add workarounds for uninitialized reads in RAMA
d935ea80c3 SCI32: Correct RAMA detection table entries
76806732e0 SCI: Remove Mac SCI32 code from SCI16 code
5bb3ca5a6b SCI32: Fix bad cursor outlines in RAMA
743082ac8c SCI32: Disable all SCI32 Mac code
24c8a26c75 SCI32: Remove unnecessary negative assertion check on unsigned integer


Commit: 21337e4cf63fa1c4248bbb2b6173f121a126fed8
    https://github.com/scummvm/scummvm/commit/21337e4cf63fa1c4248bbb2b6173f121a126fed8
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:57-05:00

Commit Message:
SCI32: Implement per-channel audio panning

Used by RAMA, in various places, starting with the refrigerator
at base camp after the cable car at the beginning of the game.

Changed paths:
    engines/sci/engine/kernel.h
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/ksound.cpp
    engines/sci/sound/audio32.cpp
    engines/sci/sound/audio32.h


diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index a712474..7e576f5 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -440,6 +440,8 @@ reg_t kDoAudioPreload(EngineState *s, int argc, reg_t *argv);
 reg_t kDoAudioFade(EngineState *s, int argc, reg_t *argv);
 reg_t kDoAudioHasSignal(EngineState *s, int argc, reg_t *argv);
 reg_t kDoAudioSetLoop(EngineState *s, int argc, reg_t *argv);
+reg_t kDoAudioPan(EngineState *s, int argc, reg_t *argv);
+reg_t kDoAudioPanOff(EngineState *s, int argc, reg_t *argv);
 
 reg_t kRobot(EngineState *s, int argc, reg_t *argv);
 reg_t kRobotOpen(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 884a499..6a45241 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -236,8 +236,8 @@ static const SciKernelMapSubEntry kDoAudio_subops[] = {
 	{ SIG_SINCE_SCI21MID, 17, MAP_CALL(DoAudioHasSignal),          "",                     NULL },
 	{ SIG_SINCE_SCI21MID, 18, MAP_EMPTY(DoAudioCritical),          "(i)",                  NULL },
 	{ SIG_SINCE_SCI21MID, 19, MAP_CALL(DoAudioSetLoop),            "iii(o)",               NULL },
-	{ SIG_SCI3,           20, MAP_DUMMY(DoAudioPan),               "",                     NULL },
-	{ SIG_SCI3,           21, MAP_DUMMY(DoAudioPanOff),            "",                     NULL },
+	{ SIG_SCI3,           20, MAP_CALL(DoAudioPan),                "ii(i)(iii)",           NULL },
+	{ SIG_SCI3,           21, MAP_CALL(DoAudioPanOff),             "i(i)(iii)",            NULL },
 	SCI_SUBOPENTRY_TERMINATOR
 };
 #endif
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index ad13756..ee4f8ef 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -466,6 +466,16 @@ reg_t kDoAudioSetLoop(EngineState *s, int argc, reg_t *argv) {
 	return s->r_acc;
 }
 
+reg_t kDoAudioPan(EngineState *s, int argc, reg_t *argv) {
+	g_sci->_audio32->kernelPan(argc, argv);
+	return s->r_acc;
+}
+
+reg_t kDoAudioPanOff(EngineState *s, int argc, reg_t *argv) {
+	g_sci->_audio32->kernelPanOff(argc, argv);
+	return s->r_acc;
+}
+
 reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv) {
 	// This is used by script 90 of MUMG Deluxe from the main menu to toggle
 	// the audio language between English and Spanish.
diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp
index 2f30f7d..2f7338e 100644
--- a/engines/sci/sound/audio32.cpp
+++ b/engines/sci/sound/audio32.cpp
@@ -1312,6 +1312,27 @@ void Audio32::kernelLoop(const int argc, const reg_t *const argv) {
 	setLoop(channelIndex, loop);
 }
 
+void Audio32::kernelPan(const int argc, const reg_t *const argv) {
+	Common::StackLock lock(_mutex);
+
+	const int16 channelIndex = findChannelByArgs(argc, argv, 1, argc == 3 ? argv[2] : NULL_REG);
+	const int16 pan = argv[0].toSint16();
+	if (channelIndex != kNoExistingChannel) {
+		setPan(channelIndex, pan);
+	} else {
+		warning("Attempt to pan a channel that does not exist");
+	}
+}
+
+void Audio32::kernelPanOff(const int argc, const reg_t *const argv) {
+	Common::StackLock lock(_mutex);
+
+	const int16 channelIndex = findChannelByArgs(argc, argv, 0, argc == 2 ? argv[1] : NULL_REG);
+	if (channelIndex != kNoExistingChannel) {
+		setPan(channelIndex, -1);
+	}
+}
+
 #pragma mark -
 #pragma mark Debugging
 
diff --git a/engines/sci/sound/audio32.h b/engines/sci/sound/audio32.h
index 8b8ec2a..71f5883 100644
--- a/engines/sci/sound/audio32.h
+++ b/engines/sci/sound/audio32.h
@@ -508,6 +508,14 @@ public:
 		setLoop(findChannelById(resourceId, soundNode), loop);
 	}
 
+	/**
+	 * Sets the stereo panning for the given channel.
+	 */
+	void setPan(const int16 channelIndex, const int16 pan) {
+		Common::StackLock lock(_mutex);
+		getChannel(channelIndex).pan = pan;
+	}
+
 private:
 	/**
 	 * The tick when audio was globally paused.
@@ -644,6 +652,8 @@ public:
 	reg_t kernelMixing(const int argc, const reg_t *const argv);
 	reg_t kernelFade(const int argc, const reg_t *const argv);
 	void kernelLoop(const int argc, const reg_t *const argv);
+	void kernelPan(const int argc, const reg_t *const argv);
+	void kernelPanOff(const int argc, const reg_t *const argv);
 
 #pragma mark -
 #pragma mark Debugging


Commit: 817887216da95d8065eb187bd887cb08f7618736
    https://github.com/scummvm/scummvm/commit/817887216da95d8065eb187bd887cb08f7618736
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:58-05:00

Commit Message:
SCI32: Fix RAMA auto-save game

Despite what game script disassembly lead me to believe, the game
seems to create only one auto-save, which ends up being saved as
911.sg (not autorama.sg). This save file is created just before
entering the underground Avian Lair in New York, and seems to be
designed as some emergency backup since entering the Avian Lair is
a one-way trip.

Changed paths:
    engines/sci/engine/kfile.cpp


diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index db7bbce..d87013f 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -444,7 +444,7 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
 		return SIGNAL_REG;
 	} else if (g_sci->getGameId() == GID_RAMA) {
 		int saveNo = -1;
-		if (name == "autorama.sg") {
+		if (name == "911.sg") {
 			saveNo = kAutoSaveId;
 		} else if (sscanf(name.c_str(), "ramasg.%i", &saveNo) == 1) {
 			saveNo += kSaveIdShift;
@@ -470,7 +470,9 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
 				out = saveFileMan->openForSaving(fileName);
 				if (out) {
 					Common::String saveName;
-					if (saveNo != kAutoSaveId) {
+					if (saveNo == kAutoSaveId) {
+						saveName = _("(Autosave)");
+					} else {
 						saveName = getRamaSaveName(s, saveNo - kSaveIdShift);
 					}
 					Common::ScopedPtr<Common::SeekableReadStream> versionFile(SearchMan.createReadStreamForMember("VERSION"));
@@ -936,13 +938,12 @@ reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv) {
 }
 
 reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv) {
-	const uint16 handle = argv[0].toUint16();
-	FileHandle *f = getFileFromHandle(s, handle);
+	FileHandle *f = getFileFromHandle(s, argv[0].toUint16());
 	if (!f)
 		return s->r_acc;
 
 	reg_t value;
-	if (s->_fileHandles[handle]._name == "-scummvm-save-") {
+	if (f->_name == "-scummvm-save-") {
 		value._segment = f->_in->readUint16LE();
 		value._offset = f->_in->readUint16LE();
 	} else {
@@ -968,12 +969,12 @@ reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv) {
 		return s->r_acc;
 	}
 
-	if (s->_fileHandles[handle]._name == "-scummvm-save-") {
+	if (f->_name == "-scummvm-save-") {
 		f->_out->writeUint16LE(argv[1]._segment);
 		f->_out->writeUint16LE(argv[1]._offset);
 	} else {
 		if (argv[1].isPointer()) {
-			error("Attempt to write non-number %04x:%04x", PRINT_REG(argv[1]));
+			error("kFileIO(WriteWord): Attempt to write non-number %04x:%04x to non-save file", PRINT_REG(argv[1]));
 		}
 		f->_out->writeUint16LE(argv[1].toUint16());
 	}


Commit: f42480d7cd5f75b661acc74ad48572888af250fc
    https://github.com/scummvm/scummvm/commit/f42480d7cd5f75b661acc74ad48572888af250fc
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:58-05:00

Commit Message:
SCI32: Support palette-inverting SCI3 variant of kPalVary

This is used by RAMA in room 6201, after eating the alien fruit.

Changed paths:
    engines/sci/graphics/palette32.cpp


diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp
index 4b008dd..d878b85 100644
--- a/engines/sci/graphics/palette32.cpp
+++ b/engines/sci/graphics/palette32.cpp
@@ -751,7 +751,24 @@ void GfxPalette32::applyVary() {
 }
 
 void GfxPalette32::kernelPalVarySet(const GuiResourceId paletteId, const int16 percent, const int32 ticks, const int16 fromColor, const int16 toColor) {
-	const Palette palette = getPaletteFromResource(paletteId);
+	Palette palette;
+
+	if (getSciVersion() == SCI_VERSION_3 && paletteId == 0xFFFF) {
+		palette = _currentPalette;
+		assert(fromColor >= 0 && fromColor < 256);
+		assert(toColor >= 0 && toColor < 256);
+		// While palette varying is normally inclusive of `toColor`, the
+		// palette inversion code in SSCI excludes `toColor`, and RAMA room
+		// 6201 requires this or else parts of the game's UI get inverted
+		for (int i = fromColor; i < toColor; ++i) {
+			palette.colors[i].r = ~palette.colors[i].r;
+			palette.colors[i].g = ~palette.colors[i].g;
+			palette.colors[i].b = ~palette.colors[i].b;
+		}
+	} else {
+		palette = getPaletteFromResource(paletteId);
+	}
+
 	setVary(palette, percent, ticks, fromColor, toColor);
 }
 


Commit: 3e107c1eb06a33f1cbb8442a5a5732f98dfa4823
    https://github.com/scummvm/scummvm/commit/3e107c1eb06a33f1cbb8442a5a5732f98dfa4823
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:58-05:00

Commit Message:
SCI32: Allow invalid references to be passed to kFileIO

Near the end of the game, RAMA will start trying to store some
invalid references. This does not affect the save game negatively
in any way, but it was causing the kernel to assert a signature
failure.

Changed paths:
    engines/sci/engine/kernel_tables.h


diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 6a45241..4002062 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -326,7 +326,7 @@ static const SciKernelMapSubEntry kFileIO_subops[] = {
 	{ SIG_SINCE_SCI21MID, 14, MAP_CALL(FileIOWriteByte),           "ii",                   NULL },
 	{ SIG_SINCE_SCI21MID, 15, MAP_CALL(FileIOReadWord),            "i",                    NULL },
 	{ SIG_SCI21MID_LATE,  16, MAP_CALL(FileIOWriteWord),           "ii",                   NULL },
-	{ SIG_SCI3,           16, MAP_CALL(FileIOWriteWord),           "i.",                   NULL },
+	{ SIG_SCI3,           16, MAP_CALL(FileIOWriteWord),           "i[.!]",                NULL },
 	{ SIG_SINCE_SCI21MID, 17, "FileIOCheckFreeSpace", kCheckFreeSpace, "i(r)",             NULL },
 	{ SIG_SINCE_SCI21MID, 18, MAP_CALL(FileIOGetCWD),              "r",                    NULL },
 	{ SIG_SINCE_SCI21MID, 19, MAP_CALL(FileIOIsValidDirectory),    "[ro]",                 NULL },
@@ -698,7 +698,7 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ "FGets", kFileIOReadString,  SIG_EVERYWHERE,           "rii",                   NULL,            NULL },
 	{ "FOpen", kFileIOOpen,        SIG_EVERYWHERE,           "ri",                    NULL,            NULL },
 	{ "FPuts", kFileIOWriteString, SIG_EVERYWHERE,           "ir",                    NULL,            NULL },
-	{ MAP_CALL(FileIO),            SIG_EVERYWHERE,           "i(.*)",                 kFileIO_subops,  NULL },
+	{ MAP_CALL(FileIO),            SIG_EVERYWHERE,           "i([.!]*)",              kFileIO_subops,  NULL },
 	{ MAP_CALL(FindKey),           SIG_EVERYWHERE,           "l.",                    NULL,            kFindKey_workarounds },
 	{ MAP_CALL(FirstNode),         SIG_EVERYWHERE,           "[l0]",                  NULL,            NULL },
 	{ MAP_CALL(FlushResources),    SIG_EVERYWHERE,           "i",                     NULL,            NULL },


Commit: 663d845d631ccd9d970e03fa7504daa55efd4a12
    https://github.com/scummvm/scummvm/commit/663d845d631ccd9d970e03fa7504daa55efd4a12
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:58-05:00

Commit Message:
SCI32: Add workarounds for uninitialized reads in RAMA

Changed paths:
    engines/sci/engine/workarounds.cpp


diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 1bbca75..0254ead 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -236,6 +236,26 @@ static const uint16 sig_uninitread_qfg3_2[] = {
 	SIG_END
 };
 
+//                Game: RAMA
+//      Calling method: securityKeypad::newRoom
+//   Subroutine offset: English 0x3b20 (script 6110)
+// Applies to at least: English
+static const uint16 sig_uninitread_rama_1[] = {
+	0x7e, SIG_UINT16(0x121),                                                      // line 289
+	0x7d, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6b, 0x65, 0x79, 0x2e, 0x73, 0x63, 0x00, // file "securkey.sc"
+	SIG_END
+};
+
+//                Game: RAMA
+//      Calling method: key1::doVerb, key2, key3, etc.
+//   Subroutine offset: English 0x5254 (script 6107)
+// Applies to at least: English
+static const uint16 sig_uninitread_rama_2[] = {
+	0x7e, SIG_UINT16(0xf2),                                                       // line 242
+	0x7d, 0x61, 0x76, 0x73, 0x65, 0x63, 0x75, 0x72, 0x37, 0x2e, 0x73, 0x63, 0x00, // file "avsecur7.sc"
+	SIG_END
+};
+
 //                Game: Space Quest 1
 //      Calling method: firePulsar::changeState
 //   Subroutine offset: English 0x018a (script 703)
@@ -401,6 +421,8 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
 	{ GID_QFG4,          800, 64950,  0,               "View", "handleEvent",                     NULL,     0, { WORKAROUND_FAKE,   0 } }, // CD version, in the room with the spider pillar, when climbing on the pillar
 	{ GID_RAMA,           -1, 64950, -1,                 NULL, "handleEvent",                     NULL,     0, { WORKAROUND_FAKE,   0 } }, // When clicking on the main game interface, or the main menu buttons, or mousing over things in the main game window
 	{ GID_RAMA,           -1, 64923, -1,              "Inset", "init",                            NULL,     0, { WORKAROUND_FAKE,   0 } }, // When receiving a message on the pocket computer at the start of the game
+	{ GID_RAMA,          6107, 6107, -1,                 NULL, "doVerb",         sig_uninitread_rama_2,     0, { WORKAROUND_FAKE,   0 } }, // When pressing keys on the final console in the Avian Lair
+	{ GID_RAMA,          6110, 6110, -1,     "securityKeypad", "newRoom",        sig_uninitread_rama_1,     0, { WORKAROUND_FAKE,   0 } }, // When entering the correct key combination on the security console in the Avian Lair
 	{ GID_SHIVERS,        -1,   952,  0,       "SoundManager", "stop",                            NULL,     2, { WORKAROUND_FAKE,   0 } }, // Just after Sierra logo
 	{ GID_SHIVERS,        -1, 64950,  0,            "Feature", "handleEvent",                     NULL,     0, { WORKAROUND_FAKE,   0 } }, // When clicking on the locked door at the beginning
 	{ GID_SHIVERS,        -1, 64950,  0,               "View", "handleEvent",                     NULL,     0, { WORKAROUND_FAKE,   0 } }, // When clicking on the gargoyle eye at the beginning


Commit: d935ea80c3cafb185c307f082a73d5fa4685df25
    https://github.com/scummvm/scummvm/commit/d935ea80c3cafb185c307f082a73d5fa4685df25
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:58-05:00

Commit Message:
SCI32: Correct RAMA detection table entries

There seems to be no difference between DOS and Windows versions
of the game from what I could see in the game code (it checks
platform but only seems to just set a global which is never used),
and from what I could tell online they are all DOS/Windows hybrids,
so just simplify life and make them all DOS platform versions.

Changed paths:
    engines/sci/detection_tables.h


diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 445f999..375b6a6 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -4022,14 +4022,17 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 #undef GUIO_QFG4_FLOPPY
 #undef GUIO_QFG4_CD
 
-// TODO: Correct GUIOs
-#define GUIO_RAMA_DEMO GUIO5(GUIO_NOMIDI, \
+#define GUIO_RAMA_DEMO GUIO7(GUIO_NOMIDI, \
                              GUIO_NOLAUNCHLOAD, \
                              GUIO_NOASPECT, \
+                             GUIO_LINKSPEECHTOSFX, \
+                             GUIO_LINKMUSICTOSFX, \
                              GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \
                              GAMEOPTION_HQ_VIDEO)
-#define GUIO_RAMA      GUIO5(GUIO_NOMIDI, \
+#define GUIO_RAMA      GUIO7(GUIO_NOMIDI, \
                              GUIO_NOASPECT, \
+                             GUIO_LINKSPEECHTOSFX, \
+                             GUIO_LINKMUSICTOSFX, \
                              GAMEOPTION_ORIGINAL_SAVELOAD, \
                              GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \
                              GAMEOPTION_HQ_VIDEO)
@@ -4040,9 +4043,9 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resmap.001", 0, "775304e9b2a545156be4d94209550094", 1393},
 		{"ressci.001", 0, "259437fd75fdf51e8207fda8c01fa4fd", 2334384},
 		AD_LISTEND},
-		Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE | ADGF_DROPPLATFORM, GUIO_RAMA_DEMO },
+		Common::EN_ANY, Common::kPlatformDOS, ADGF_DEMO | ADGF_UNSTABLE, GUIO_RAMA_DEMO },
 
-	// RAMA - English Windows (from jvprat)
+	// RAMA - English DOS/Windows (from jvprat)
 	// Executable scanning reports "3.000.000", VERSION file reports "1.100.000"
 	{"rama", "", {
 		{"resmap.001", 0, "3bac72a1910a563f8f92cf5b77c8b7f2", 8338},
@@ -4052,9 +4055,9 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resmap.003", 0, "31ef4c0621711585d031f0ae81707251", 1636},
 		{"ressci.003", 0, "2a68edd064e5e4937b5e9c74b38f2082", 6860492},
 		AD_LISTEND},
-		Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_DROPPLATFORM, GUIO_RAMA },
+		Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_RAMA },
 
-	// RAMA - English Windows (from Quietust, in bug report #2850645)
+	// RAMA - English DOS/Windows (from Quietust, in bug report #2850645)
 	{"rama", "", {
 		{"resmap.001", 0, "4a2f3dd87f8033dc0deac43e820cc1ca", 8338},
 		{"ressci.001", 0, "2a68edd064e5e4937b5e9c74b38f2082", 70599164},
@@ -4063,9 +4066,9 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resmap.003", 0, "48841e4b84ef1b98b48d43566fda9e13", 1636},
 		{"ressci.003", 0, "2a68edd064e5e4937b5e9c74b38f2082", 6870356},
 		AD_LISTEND},
-		Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_DROPPLATFORM, GUIO_RAMA },
+		Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_RAMA },
 
-	// RAMA - German Windows CD (from farmboy0, in pull request 397)
+	// RAMA - German DOS/Windows CD (from farmboy0, in gh-397)
 	{"rama", "", {
 		{"resmap.001", 0, "f68cd73308c46977a9632dfc618e1e38", 8338},
 		{"ressci.001", 0, "2a68edd064e5e4937b5e9c74b38f2082", 70595521},
@@ -4074,9 +4077,9 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resmap.003", 0, "222096000bd83a1d56577114a452cccf", 1636},
 		{"ressci.003", 0, "2a68edd064e5e4937b5e9c74b38f2082", 6954219},
 		AD_LISTEND},
-		Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_DROPPLATFORM, GUIO_RAMA },
+		Common::DE_DEU, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_RAMA },
 
-	// RAMA - French Windows CD (from bgK)
+	// RAMA - French DOS/Windows CD (from bgK)
 	// Executable scanning reports "3.000.000", VERSION file reports "1.000.000"
 	{"rama", "", {
 		{"resmap.001", 0, "c931947115a69bb4c1760cef04e4018f", 8338},
@@ -4086,15 +4089,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resmap.003", 0, "fd2ce2312084e60b2cc5194a799873d0", 1636},
 		{"ressci.003", 0, "2a68edd064e5e4937b5e9c74b38f2082", 6379952},
 		AD_LISTEND},
-		Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_DROPPLATFORM, GUIO_RAMA },
+		Common::FR_FRA, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_RAMA },
 
-	// RAMA - Italian Windows CD (from glorifindel)
-	// SCI interpreter version 3.000.000 (a guess?)
+	// RAMA - Italian DOS/Windows CD (from glorifindel)
 	{"rama", "", {
 		{"ressci.001", 0, "2a68edd064e5e4937b5e9c74b38f2082", 70611091},
 		{"resmap.001", 0, "70ba2ff04a2b7fb2c52420ba7fbd47c2", 8338},
 		AD_LISTEND},
-		Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_DROPPLATFORM, GUIO_RAMA },
+		Common::IT_ITA, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_RAMA },
 
 #undef GUIO_RAMA_DEMO
 #undef GUIO_RAMA


Commit: 76806732e032771d51d9015720d32eeed874a3cd
    https://github.com/scummvm/scummvm/commit/76806732e032771d51d9015720d32eeed874a3cd
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:58-05:00

Commit Message:
SCI: Remove Mac SCI32 code from SCI16 code

Changed paths:
    engines/sci/engine/kgraphics.cpp
    engines/sci/graphics/picture.cpp
    engines/sci/graphics/view.cpp


diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index e5336b3..f2111ca 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -189,8 +189,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
 		hotspot = new Common::Point(argv[3].toSint16(), argv[4].toSint16());
 		// Fallthrough
 	case 3:
-		if (g_sci->getPlatform() == Common::kPlatformMacintosh && g_sci->getGameId() != GID_TORIN) {
-			// Torin Mac seems to be the only game that uses view cursors
+		if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
 			delete hotspot; // Mac cursors have their own hotspot, so ignore any we get here
 			g_sci->_gfxCursor->kernelSetMacCursor(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16());
 		} else {
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 9e9dede..3ae1fd0 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -179,15 +179,6 @@ void GfxPicture::drawCelData(const SciSpan<const byte> &inbuffer, int headerPos,
 	Common::SpanOwner<SciSpan<byte> > celBitmap;
 	celBitmap->allocate(pixelCount, _resource->name());
 
-	if (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_2) {
-		// See GfxView::unpackCel() for why this black/white swap is done
-		// This picture swap is only needed in SCI32, not SCI1.1
-		if (clearColor == 0)
-			clearColor = 0xff;
-		else if (clearColor == 0xff)
-			clearColor = 0;
-	}
-
 	if (compression) {
 		unpackCelData(inbuffer, *celBitmap, clearColor, rlePos, literalPos, _resMan->getViewType(), width, false);
 	} else
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index ed849cf..f593225 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -628,7 +628,7 @@ void GfxView::unpackCel(int16 loopNo, int16 celNo, SciSpan<byte> &outPtr) {
 		// code, that they would just put a little snippet of code to swap these colors
 		// in various places around the SCI codebase. We figured that it would be less
 		// hacky to swap pixels instead and run the Mac games with a PC palette.
-		if (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_1_1) {
+		if (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() == SCI_VERSION_1_1) {
 			// clearColor is based on PC palette, but the literal data is not.
 			// We flip clearColor here to make it match the literal data. All
 			// these pixels will be flipped back again below.
@@ -642,7 +642,7 @@ void GfxView::unpackCel(int16 loopNo, int16 celNo, SciSpan<byte> &outPtr) {
 		unpackCelData(*_resource, outPtr, clearColor, celInfo->offsetRLE, celInfo->offsetLiteral, _resMan->getViewType(), celInfo->width, isMacSci11ViewData);
 
 		// Swap 0 and 0xff pixels for Mac SCI1.1+ games (see above)
-		if (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_1_1) {
+		if (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() == SCI_VERSION_1_1) {
 			for (uint32 i = 0; i < outPtr.size(); i++) {
 				if (outPtr[i] == 0)
 					outPtr[i] = 0xff;


Commit: 5bb3ca5a6b83691628502525d463a788df54a4d1
    https://github.com/scummvm/scummvm/commit/5bb3ca5a6b83691628502525d463a788df54a4d1
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:58-05:00

Commit Message:
SCI32: Fix bad cursor outlines in RAMA

Changed paths:
    engines/sci/graphics/remap32.h


diff --git a/engines/sci/graphics/remap32.h b/engines/sci/graphics/remap32.h
index 1b9628c..407e879 100644
--- a/engines/sci/graphics/remap32.h
+++ b/engines/sci/graphics/remap32.h
@@ -345,6 +345,15 @@ public:
 		assert(index < _remaps.size());
 		const SingleRemap &singleRemap = _remaps[index];
 		assert(singleRemap._type != kRemapNone);
+		// SSCI never really properly handled attempts to draw to a target with
+		// pixels above the remap color maximum. In RAMA, the cursor views have
+		// a remap color outlining the cursor, and so get drawn into a target
+		// surface filled with a skip color of 255. In SSCI, this causes the
+		// remapped color to be read from some statically allocated, never
+		// written memory and so always ends up being 0 (black).
+		if (targetColor >= ARRAYSIZE(singleRemap._remapColors)) {
+			return 0;
+		}
 		return singleRemap._remapColors[targetColor];
 	}
 


Commit: 743082ac8c9aa295db25bdcd47242913d7f6c02a
    https://github.com/scummvm/scummvm/commit/743082ac8c9aa295db25bdcd47242913d7f6c02a
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:59-05:00

Commit Message:
SCI32: Disable all SCI32 Mac code

This code is currently untestable and is almost certainly at least
partly based on guesswork & not actual reverse-engineering (as was
the case for all other pre-2015 SCI32 code), so future developers
interested in adding SCI32 Mac support should use it only as an
intermediate reference rather than as known good code.

Changed paths:
    engines/sci/engine/kernel.cpp
    engines/sci/engine/kernel.h
    engines/sci/engine/kmisc.cpp
    engines/sci/engine/ksound.cpp
    engines/sci/engine/message.cpp
    engines/sci/graphics/cursor32.cpp
    engines/sci/graphics/cursor32.h
    engines/sci/graphics/palette32.cpp
    engines/sci/resource.cpp


diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 72c074f..fd64198 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -122,10 +122,14 @@ void Kernel::loadSelectorNames() {
 	Resource *r = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SELECTORS), 0);
 	bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
 
+#ifdef ENABLE_SCI32_MAC
 	// Starting with KQ7, Mac versions have a BE name table. GK1 Mac and earlier (and all
 	// other platforms) always use LE.
-	bool isBE = (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_2_1_EARLY
+	const bool isBE = (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_2_1_EARLY
 			&& g_sci->getGameId() != GID_GK1);
+#else
+	const bool isBE = false;
+#endif
 
 	if (!r) { // No such resource?
 		// Check if we have a table for this game
@@ -610,7 +614,7 @@ void Kernel::mapFunctions() {
 			continue;
 		}
 
-#ifdef ENABLE_SCI32
+#ifdef ENABLE_SCI32_MAC
 		// HACK: Phantasmagoria Mac uses a modified kDoSound (which *nothing*
 		// else seems to use)!
 		if (g_sci->getPlatform() == Common::kPlatformMacintosh && g_sci->getGameId() == GID_PHANTASMAGORIA && kernelName == "DoSound") {
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 7e576f5..69a86ae 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -650,8 +650,10 @@ reg_t kAddLine(EngineState *s, int argc, reg_t *argv);
 reg_t kUpdateLine(EngineState *s, int argc, reg_t *argv);
 reg_t kDeleteLine(EngineState *s, int argc, reg_t *argv);
 
+#ifdef ENABLE_SCI32_MAC
 // Phantasmagoria Mac Special Kernel Function
 reg_t kDoSoundPhantasmagoriaMac(EngineState *s, int argc, reg_t *argv);
+#endif
 
 // SCI3 Kernel functions
 reg_t kPlayDuck(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 62dc2b2..49d2d9f 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -529,7 +529,7 @@ reg_t kMacPlatform(EngineState *s, int argc, reg_t *argv) {
 		// In SCI1, its usage is still unknown
 		// In SCI1.1, it's NOP
 		// In SCI32, it's used for remapping cursor ID's
-#ifdef ENABLE_SCI32
+#ifdef ENABLE_SCI32_MAC
 		if (getSciVersion() >= SCI_VERSION_2_1_EARLY) // Set Mac cursor remap
 			g_sci->_gfxCursor32->setMacCursorRemapList(argc - 1, argv + 1);
 		else
@@ -643,10 +643,12 @@ reg_t kPlatform32(EngineState *s, int argc, reg_t *argv) {
 		case Common::kPlatformWindows:
 			return make_reg(0, kSciPlatformWindows);
 		case Common::kPlatformMacintosh:
+#ifdef ENABLE_SCI32_MAC
 			// For Mac versions, kPlatform(0) with other args has more functionality
 			if (argc > 1)
 				return kMacPlatform(s, argc - 1, argv + 1);
 			else
+#endif
 				return make_reg(0, kSciPlatformMacintosh);
 		default:
 			error("Unknown platform %d", g_sci->getPlatform());
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index ee4f8ef..bbfadf1 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -70,7 +70,7 @@ CREATE_DOSOUND_FORWARD(DoSoundSetVolume)
 CREATE_DOSOUND_FORWARD(DoSoundSetPriority)
 CREATE_DOSOUND_FORWARD(DoSoundSetLoop)
 
-#ifdef ENABLE_SCI32
+#ifdef ENABLE_SCI32_MAC
 reg_t kDoSoundPhantasmagoriaMac(EngineState *s, int argc, reg_t *argv) {
 	// Phantasmagoria Mac (and seemingly no other game (!)) uses this
 	// cutdown version of kDoSound.
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index baa92616..d8e2d48 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -149,7 +149,7 @@ public:
 	}
 };
 
-#ifdef ENABLE_SCI32
+#ifdef ENABLE_SCI32_MAC
 // SCI32 Mac decided to add an extra byte (currently unknown in meaning) between
 // the talker and the string...
 class MessageReaderV4_MacSCI32 : public MessageReader {
@@ -202,6 +202,8 @@ bool MessageState::getRecord(CursorStack &stack, bool recurse, MessageRecord &re
 	case 4:
 #ifdef ENABLE_SCI32
 	case 5: // v5 seems to be compatible with v4
+#endif
+#ifdef ENABLE_SCI32_MAC
 		// SCI32 Mac is different than SCI32 DOS/Win here
 		if (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_2_1_EARLY)
 			reader = new MessageReaderV4_MacSCI32(*res);
diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp
index 6eb7085..74fbafa 100644
--- a/engines/sci/graphics/cursor32.cpp
+++ b/engines/sci/graphics/cursor32.cpp
@@ -184,48 +184,8 @@ void GfxCursor32::setView(const GuiResourceId viewId, const int16 loopNo, const
 	_cursorInfo.loopNo = loopNo;
 	_cursorInfo.celNo = celNo;
 
-	if (_macCursorRemap.empty() && viewId != -1) {
-		CelObjView view(viewId, loopNo, celNo);
-
-		_hotSpot = view._origin;
-		_width = view._width;
-		_height = view._height;
-
-		// SSCI never increased the size of cursors, but some of the cursors
-		// in early SCI32 games were designed for low-resolution display mode
-		// and so are kind of hard to pick out when running in high-resolution
-		// mode.
-		// To address this, we make some slight adjustments to cursor display
-		// in these early games:
-		// GK1: All the cursors are increased in size since they all appear to
-		//      be designed for low-res display.
-		// PQ4: We only make the cursors bigger if they are above a set
-		//      threshold size because inventory items usually have a
-		//      high-resolution cursor representation.
-		bool pixelDouble = false;
-		if (g_sci->_gfxFrameout->_isHiRes &&
-			(g_sci->getGameId() == GID_GK1 ||
-			(g_sci->getGameId() == GID_PQ4 && _width <= 22 && _height <= 22))) {
-
-			_width *= 2;
-			_height *= 2;
-			_hotSpot.x *= 2;
-			_hotSpot.y *= 2;
-			pixelDouble = true;
-		}
-
-		_cursor.data = (byte *)realloc(_cursor.data, _width * _height);
-		_cursor.rect = Common::Rect(_width, _height);
-		memset(_cursor.data, 255, _width * _height);
-		_cursor.skipColor = 255;
-
-		Buffer target(_width, _height, _cursor.data);
-		if (pixelDouble) {
-			view.draw(target, _cursor.rect, Common::Point(0, 0), false, 2, 2);
-		} else {
-			view.draw(target, _cursor.rect, Common::Point(0, 0), false);
-		}
-	} else if (!_macCursorRemap.empty() && viewId != -1) {
+#ifdef ENABLE_SCI32_MAC
+	if (!_macCursorRemap.empty() && viewId != -1) {
 		// Mac cursor handling
 		GuiResourceId viewNum = viewId;
 
@@ -269,6 +229,49 @@ void GfxCursor32::setView(const GuiResourceId viewId, const int16 loopNo, const
 
 		// The cursor will be drawn on next refresh
 		delete macCursor;
+	} else
+#endif
+	if (viewId != -1) {
+		CelObjView view(viewId, loopNo, celNo);
+
+		_hotSpot = view._origin;
+		_width = view._width;
+		_height = view._height;
+
+		// SSCI never increased the size of cursors, but some of the cursors
+		// in early SCI32 games were designed for low-resolution display mode
+		// and so are kind of hard to pick out when running in high-resolution
+		// mode.
+		// To address this, we make some slight adjustments to cursor display
+		// in these early games:
+		// GK1: All the cursors are increased in size since they all appear to
+		//      be designed for low-res display.
+		// PQ4: We only make the cursors bigger if they are above a set
+		//      threshold size because inventory items usually have a
+		//      high-resolution cursor representation.
+		bool pixelDouble = false;
+		if (g_sci->_gfxFrameout->_isHiRes &&
+			(g_sci->getGameId() == GID_GK1 ||
+			(g_sci->getGameId() == GID_PQ4 && _width <= 22 && _height <= 22))) {
+
+			_width *= 2;
+			_height *= 2;
+			_hotSpot.x *= 2;
+			_hotSpot.y *= 2;
+			pixelDouble = true;
+		}
+
+		_cursor.data = (byte *)realloc(_cursor.data, _width * _height);
+		_cursor.rect = Common::Rect(_width, _height);
+		memset(_cursor.data, 255, _width * _height);
+		_cursor.skipColor = 255;
+
+		Buffer target(_width, _height, _cursor.data);
+		if (pixelDouble) {
+			view.draw(target, _cursor.rect, Common::Point(0, 0), false, 2, 2);
+		} else {
+			view.draw(target, _cursor.rect, Common::Point(0, 0), false);
+		}
 	} else {
 		_hotSpot = Common::Point(0, 0);
 		_width = _height = 1;
@@ -462,9 +465,11 @@ void GfxCursor32::move() {
 	}
 }
 
+#ifdef ENABLE_SCI32_MAC
 void GfxCursor32::setMacCursorRemapList(int cursorCount, reg_t *cursors) {
 	for (int i = 0; i < cursorCount; i++)
 		_macCursorRemap.push_back(cursors[i].toUint16());
 }
+#endif
 
 } // End of namespace Sci
diff --git a/engines/sci/graphics/cursor32.h b/engines/sci/graphics/cursor32.h
index 5872744..562a2c5 100644
--- a/engines/sci/graphics/cursor32.h
+++ b/engines/sci/graphics/cursor32.h
@@ -109,7 +109,9 @@ public:
 	 */
 	void clearRestrictedArea();
 
+#ifdef ENABLE_SCI32_MAC
 	void setMacCursorRemapList(int cursorCount, reg_t *cursors);
+#endif
 
 	virtual void saveLoadWithSerializer(Common::Serializer &ser);
 
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp
index d878b85..9a2fa2c 100644
--- a/engines/sci/graphics/palette32.cpp
+++ b/engines/sci/graphics/palette32.cpp
@@ -530,12 +530,16 @@ void GfxPalette32::updateHardware() {
 	memset(bpal + (maxIndex + 1) * 3, 0, (255 - maxIndex - 1) * 3);
 #endif
 
+#ifdef ENABLE_SCI32_MAC
 	if (g_sci->getPlatform() != Common::kPlatformMacintosh) {
 		// The last color must always be white
 		bpal[255 * 3    ] = 255;
 		bpal[255 * 3 + 1] = 255;
 		bpal[255 * 3 + 2] = 255;
 	} else {
+#else
+	{
+#endif
 		bpal[255 * 3    ] = 0;
 		bpal[255 * 3 + 1] = 0;
 		bpal[255 * 3 + 2] = 0;
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 8d27231..ad6415d 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -476,12 +476,14 @@ void MacResourceForkResourceSource::decompressResource(Common::SeekableReadStrea
 	bool canBeCompressed = !(g_sci && g_sci->getGameId() == GID_KQ6) && isCompressableResource(resource->_id.getType());
 	uint32 uncompressedSize = 0;
 
+#ifdef ENABLE_SCI32_MAC
 	// GK2 Mac is crazy. In its Patches resource fork, picture 2315 is not
 	// compressed and it is hardcoded in the executable to say that it's
 	// not compressed. Why didn't they just add four zeroes to the end of
 	// the resource? (Checked with PPC disasm)
 	if (g_sci && g_sci->getGameId() == GID_GK2 && resource->_id.getType() == kResourceTypePic && resource->_id.getNumber() == 2315)
 		canBeCompressed = false;
+#endif
 
 	// Get the uncompressed size from the end of the resource
 	if (canBeCompressed && stream->size() > 4) {


Commit: 24c8a26c759f476619c3e844deb7ae8b2c3ca048
    https://github.com/scummvm/scummvm/commit/24c8a26c759f476619c3e844deb7ae8b2c3ca048
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-24T22:56:59-05:00

Commit Message:
SCI32: Remove unnecessary negative assertion check on unsigned integer

Fixes CID 1381416.

Changed paths:
    engines/sci/engine/file.cpp


diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp
index 7f73703..5821313 100644
--- a/engines/sci/engine/file.cpp
+++ b/engines/sci/engine/file.cpp
@@ -424,7 +424,7 @@ Common::MemoryReadStream *makeCatalogue(const uint maxNumSaves, const uint gameN
 			WRITE_LE_UINT16(out, id);
 			out += kGameIdSize;
 
-			assert(id >= 0 && id < maxNumSaves);
+			assert(id < maxNumSaves);
 			usedSlots[id] = true;
 		}
 	}





More information about the Scummvm-git-logs mailing list