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.
This commit is contained in:
Colin Snover 2017-09-24 22:27:02 -05:00
parent 5bb3ca5a6b
commit 743082ac8c
9 changed files with 70 additions and 47 deletions

View File

@ -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") {

View File

@ -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);

View File

@ -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());

View File

@ -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.

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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) {