[Scummvm-git-logs] scummvm master -> 8b6e7fb75d74987ea68f798b29ba9567f3343699
bluegr
noreply at scummvm.org
Fri Nov 20 01:49:43 UTC 2026
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
85718cf051 MADE: allow Win16 cursors for Manhole: New and Enhanced
dca06085ae MADE: Cleanup database.cpp
5ff939b5e3 MADE: Reorganize detection tables
461cbfcb27 MADE: Add support for The Manhole (English CD)
8b6e7fb75d MADE: clean objects in database destruction, Manhole changes
Commit: 85718cf0515546ca182b8b26386b1f6fa6a75546
https://github.com/scummvm/scummvm/commit/85718cf0515546ca182b8b26386b1f6fa6a75546
Author: Greg Kennedy (kennedy.greg at gmail.com)
Date: 2026-11-20T03:49:35+02:00
Commit Message:
MADE: allow Win16 cursors for Manhole: New and Enhanced
Reuses routine from Rodney's Funscreen to get hand cursor for Manhole.
Changed paths:
engines/made/detection_tables.h
engines/made/made.cpp
engines/made/made.h
diff --git a/engines/made/detection_tables.h b/engines/made/detection_tables.h
index 9fc28dfcf1c..a37f746b46e 100644
--- a/engines/made/detection_tables.h
+++ b/engines/made/detection_tables.h
@@ -482,7 +482,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_CD,
- GUIO1(GUIO_NOSPEECH)
+ GUIO2(GUIO_NOSPEECH, GAMEOPTION_WINDOWS_CURSORS)
},
GID_MANHOLE,
0,
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index dc908abfeb2..95038200586 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -390,6 +390,26 @@ void MadeEngine::handleEvents() {
}
+void MadeEngine::loadWin16Cursor(Common::String basename) {
+ // Try to open the EXE and get the hand cursor out
+ Common::WinResources *exe = Common::WinResources::createFromEXE(Common::Path(basename + "w.exe")); // Win16 executable
+ if (!exe)
+ exe = Common::WinResources::createFromEXE(Common::Path(basename + "v.exe")); // Tandy VIS executable
+
+ if (exe) {
+ Graphics::WinCursorGroup *_winCursor = Graphics::WinCursorGroup::createCursorGroup(exe, Common::WinResourceID("HANDCURSOR"));
+ if (_winCursor) {
+ if (_winCursor->cursors.size() > 0) {
+ _screen->setMouseCursor(_winCursor->cursors[0].cursor);
+ _useWinCursors = true;
+ }
+ delete _winCursor;
+ }
+
+ delete exe;
+ }
+}
+
Common::Error MadeEngine::run() {
if (getPlatform() == Common::kPlatformMacintosh)
_music = nullptr; // TODO: Macintosh music player
@@ -443,6 +463,10 @@ Common::Error MadeEngine::run() {
} else {
_res->openResourceBlocks();
}
+
+ if (ConfMan.hasKey("windows_cursors") && ConfMan.getBool("windows_cursors"))
+ loadWin16Cursor("manhole");
+
} else if (getGameID() == GID_LGOP2) {
_dat->open("lgop2.dat");
_res->open("lgop2.prj");
@@ -450,25 +474,9 @@ Common::Error MadeEngine::run() {
_dat->open("rodneys.dat");
_res->open("rodneys.prj");
- if (ConfMan.hasKey("windows_cursors") && ConfMan.getBool("windows_cursors")) {
- // Try to open the EXE and get the hand cursor out
- Common::WinResources *exe = Common::WinResources::createFromEXE("rodneysw.exe"); // Win16 executable
- if (!exe)
- exe = Common::WinResources::createFromEXE("rodneysv.exe"); // Tandy VIS executable
-
- if (exe) {
- Graphics::WinCursorGroup *_winCursor = Graphics::WinCursorGroup::createCursorGroup(exe, Common::WinResourceID("HANDCURSOR"));
- if (_winCursor) {
- if (_winCursor->cursors.size() > 0) {
- _screen->setMouseCursor(_winCursor->cursors[0].cursor);
- _useWinCursors = true;
- }
- delete _winCursor;
- }
+ if (ConfMan.hasKey("windows_cursors") && ConfMan.getBool("windows_cursors"))
+ loadWin16Cursor("rodneys");
- delete exe;
- }
- }
} else if (getGameID() == GID_RSBESTNDE) {
if (getFeatures() & GF_DEMO) {
_dat->open("bestdemo.dat");
diff --git a/engines/made/made.h b/engines/made/made.h
index b20fa235a79..bf423870c71 100644
--- a/engines/made/made.h
+++ b/engines/made/made.h
@@ -156,6 +156,7 @@ public:
void handleEvents();
protected:
+ void loadWin16Cursor(Common::String basename);
void pauseEngineIntern(bool pause) override;
};
Commit: dca06085aee56a2e9b349acedb4b95ebc1c66e55
https://github.com/scummvm/scummvm/commit/dca06085aee56a2e9b349acedb4b95ebc1c66e55
Author: Greg Kennedy (kennedy.greg at gmail.com)
Date: 2026-11-20T03:49:35+02:00
Commit Message:
MADE: Cleanup database.cpp
Reorganize database.cpp to make more sensible inheritance order, and rename some class members / functions to improve readability.
Also fixes a use-after-free when a saved game is loaded, due to the script data being freed and re-allocated, while the script parser keeps a dangling pointer.
Finally, fixes original savegame compatibility with V1 / V2 games (LGOP2) by word-aligning read and write from savegames.
Changed paths:
engines/made/database.cpp
engines/made/database.h
engines/made/made.cpp
engines/made/script.cpp
engines/made/script.h
diff --git a/engines/made/database.cpp b/engines/made/database.cpp
index 9dbd002b98e..945958743e7 100644
--- a/engines/made/database.cpp
+++ b/engines/made/database.cpp
@@ -31,6 +31,22 @@
namespace Made {
+Object::Object() : _objData(nullptr), _objSize(0), _freeData(false) {}
+
+Object::~Object() {
+ if (_freeData)
+ delete[] _objData;
+}
+
+// Default impls for when a subclass does not override
+uint16 Object::getFlags() const {
+ return 1; // V1 / V2 objects do not have flags
+}
+
+int Object::save(Common::WriteStream &dest) const {
+ error("Object::save Not implemented/used for this version"); // V3 objects do not Save
+}
+
/*
Class types:
0x7FFF byte array
@@ -38,73 +54,69 @@ namespace Made {
< 0x7FFE object
*/
-Object::Object() : _objData(nullptr), _freeData(false) {
- _objSize = 0;
+bool Object::isByteArray() const {
+ return getClass() == 0x7FFF;
}
-Object::~Object() {
- if (_freeData && _objData)
- delete[] _objData;
+bool Object::isWordArray() const {
+ return getClass() == 0x7FFE;
}
-const char *Object::getString() {
- if (getClass() == 0x7FFF)
- return (const char*)getData();
- else
+bool Object::isObject() const {
+ return getClass() < 0x7FFE;
+}
+
+bool Object::isWritable() const {
+ return getFlags() & 1;
+}
+
+const char *Object::getString() const {
+ if (isByteArray())
+ return (const char *)getData();
+ else {
+ warning("getString() called on non-byte-array object (%04X)", getClass());
return nullptr;
+ }
}
void Object::setString(const char *str) {
- if (getClass() == 0x7FFF) {
+ if (isByteArray()) {
char *objStr = (char *)getData();
if (str)
- strncpy(objStr, str, getSize());
+ strncpy(objStr, str, getCount());
else
objStr[0] = '\0';
- }
-}
-
-bool Object::isObject() {
- return getClass() < 0x7FFE;
-}
-
-int16 Object::getVectorSize() {
- if (getClass() == 0x7FFF || getClass() == 0x7FFE) {
- return getSize();
- } else if (getClass() < 0x7FFE) {
- return getCount1() + getCount2();
} else {
- // should never reach here
- error("Unknown object class");
- return 0; // for compilers that don't support NORETURN
+ warning("setString(%s) called on non-byte-array object (%04X)", str, getClass());
}
}
-int16 Object::getVectorItem(int16 index) {
- if (getClass() == 0x7FFF) {
- byte *vector = (byte *)getData();
+int16 Object::getVectorItem(int16 index) const {
+ if (isByteArray()) {
+ const byte *vector = getData();
return vector[index];
- } else if (getClass() <= 0x7FFE) {
- int16 *vector = (int16 *)getData();
- return READ_LE_UINT16(&vector[index]);
+ } else if (isWordArray()) {
+ const int16 *vector = (const int16 *)getData();
+ return READ_LE_INT16(&vector[index]);
} else {
- // should never reach here
- error("Unknown object class");
- return 0; // for compilers that don't support NORETURN
+ warning("getVectorItem(%d) called on non-vector object (%04X)", index, getClass());
+ return 0;
}
}
void Object::setVectorItem(int16 index, int16 value) {
- if (getClass() == 0x7FFF) {
+ if (isByteArray()) {
byte *vector = (byte *)getData();
vector[index] = value;
- } else if (getClass() <= 0x7FFE) {
+ } else if (isWordArray()) {
int16 *vector = (int16 *)getData();
- WRITE_LE_UINT16(&vector[index], value);
+ WRITE_LE_INT16(&vector[index], value);
+ } else {
+ warning("setVectorItem(%d, %d) called on non-vector object (%04X)", index, value, getClass());
}
}
-void Object::dump(const Common::String &filename) {
+void Object::dump(const Common::String &filename) const {
/*
FILE *o = fopen(filename, "wb");
fwrite(_objData, _objSize, 1, o);
@@ -112,99 +124,113 @@ void Object::dump(const Common::String &filename) {
*/
}
-int ObjectV2::load(Common::SeekableReadStream &source) {
-
- if (_freeData && _objData)
- delete[] _objData;
-
- _freeData = true;
+// Version-specific object definitions follow
+//
+uint16 ObjectV1::calcSize(const byte *source) {
+ uint16 type = READ_LE_UINT16(source);
+ if (type == 0x7FFF) {
+ // array of byte
+ return 4 + READ_LE_UINT16(source + 2);
+ } else if (type == 0x7FFE) {
+ // array of word
+ return 4 + READ_LE_UINT16(source + 2) * 2;
+ } else {
+ // object: sum of keys and values, each word-sized
+ byte count1 = source[2];
+ byte count2 = source[3];
+ return 4 + (count1 + count2) * 2;
+ }
+}
+int ObjectV1::load(Common::SeekableReadStream &source) {
byte header[4];
source.read(header, 4);
+ uint16 objSize = calcSize(header);
+
+ if (_objData) {
+ // loading over existing object - verify size matches first!
+ if (objSize != _objSize)
+ error("ObjectV1::load: New object size does not match current!");
+ } else {
+ _objSize = objSize;
+ _objData = new byte[_objSize];
+ _freeData = true;
+ }
- uint16 type = READ_LE_UINT16(header);
- if (type == 0x7FFF) {
- _objSize = READ_LE_UINT16(header + 2);
- } else if (type == 0x7FFE) {
- _objSize = READ_LE_UINT16(header + 2) * 2;
- } else if (type < 0x7FFE) {
- byte count1 = header[2];
- byte count2 = header[3];
- _objSize = (count1 + count2) * 2;
- }
- _objSize += 4;
- _objData = new byte[_objSize];
memcpy(_objData, header, 4);
source.read(_objData + 4, _objSize - 4);
return _objSize;
-
-}
-
-int ObjectV2::load(byte *source) {
- // Not implemented/used for version 2 objects
- return 0;
}
-int ObjectV2::save(Common::WriteStream &dest) {
+int ObjectV1::save(Common::WriteStream &dest) const {
dest.write(_objData, _objSize);
- return 0;
-}
-
-uint16 ObjectV2::getFlags() {
- return 1;
+ return _objSize;
}
-uint16 ObjectV2::getClass() {
+uint16 ObjectV1::getClass() const {
return READ_LE_UINT16(_objData);
}
-uint16 ObjectV2::getSize() {
+uint16 ObjectV1::getCount() const {
return READ_LE_UINT16(_objData + 2);
}
-byte ObjectV2::getCount1() {
+// v1 objects have the two property counts reversed from v2 / v3
+byte ObjectV1::getKeyCount() const {
return _objData[2];
}
-byte ObjectV2::getCount2() {
+byte ObjectV1::getValueCount() const {
return _objData[3];
}
-byte *ObjectV2::getData() {
+const byte *ObjectV1::getData() const {
return _objData + 4;
}
-int ObjectV1::load(Common::SeekableReadStream &source) {
- ObjectV2::load(source);
- // Manhole EGA has the two property counts reversed
- SWAP(_objData[2], _objData[3]);
- return _objSize;
+//
+byte ObjectV2::getKeyCount() const {
+ return _objData[3];
}
-int ObjectV3::load(Common::SeekableReadStream &source) {
-
- if (_freeData && _objData)
- delete[] _objData;
+byte ObjectV2::getValueCount() const {
+ return _objData[2];
+}
- _freeData = true;
+//
+uint16 ObjectV3::calcSize(const byte *source) {
+ // uint16 flags = READ_LE_UINT16(header);
+ uint16 type = READ_LE_UINT16(source + 2);
+ if (type == 0x7FFF) {
+ // array of byte
+ return 6 + READ_LE_UINT16(source + 4);
+ } else if (type == 0x7FFE) {
+ // array of word
+ return 6 + READ_LE_UINT16(source + 4) * 2;
+ } else {
+ // object: sum of keys and values, each word-sized
+ byte count1 = source[4];
+ byte count2 = source[5];
+ return 6 + (count1 + count2) * 2;
+ }
+}
+int ObjectV3::load(Common::SeekableReadStream &source) {
byte header[6];
source.read(header, 6);
+ uint16 objSize = calcSize(header);
+
+ if (_objData) {
+ // loading over existing object - verify size matches first!
+ if (objSize != _objSize)
+ error("ObjectV3::load: New object size does not match current!");
+ } else {
+ _objSize = objSize;
+ _objData = new byte[_objSize];
+ _freeData = true;
+ }
- // uint16 flags = READ_LE_UINT16(header);
- uint16 type = READ_LE_UINT16(header + 2);
- if (type == 0x7FFF) {
- _objSize = READ_LE_UINT16(header + 4);
- } else if (type == 0x7FFE) {
- _objSize = READ_LE_UINT16(header + 4) * 2;
- } else if (type < 0x7FFE) {
- byte count1 = header[4];
- byte count2 = header[5];
- _objSize = (count1 + count2) * 2;
- }
- _objSize += 6;
- _objData = new byte[_objSize];
memcpy(_objData, header, 6);
source.read(_objData + 6, _objSize - 6);
@@ -212,110 +238,64 @@ int ObjectV3::load(Common::SeekableReadStream &source) {
}
int ObjectV3::load(byte *source) {
+ if (_freeData)
+ delete[] _objData;
+
+ _objSize = calcSize(source);
_objData = source;
_freeData = false;
- if (getClass() < 0x7FFE) {
- _objSize = (getCount1() + getCount2()) * 2;
- } else {
- _objSize = getSize();
- }
- _objSize += 6;
- return _objSize;
-}
-int ObjectV3::save(Common::WriteStream &dest) {
- // Not implemented/used for version 3 objects
- return 0;
+ return _objSize;
}
-uint16 ObjectV3::getFlags() {
+uint16 ObjectV3::getFlags() const {
return READ_LE_UINT16(_objData);
}
-uint16 ObjectV3::getClass() {
+uint16 ObjectV3::getClass() const {
return READ_LE_UINT16(_objData + 2);
}
-uint16 ObjectV3::getSize() {
+uint16 ObjectV3::getCount() const {
return READ_LE_UINT16(_objData + 4);
}
-byte ObjectV3::getCount1() {
- return _objData[4];
+byte ObjectV3::getKeyCount() const {
+ return _objData[5];
}
-byte ObjectV3::getCount2() {
- return _objData[5];
+byte ObjectV3::getValueCount() const {
+ return _objData[4];
}
-byte *ObjectV3::getData() {
+const byte *ObjectV3::getData() const {
return _objData + 6;
}
-
-int ObjectV3_1::load(Common::SeekableReadStream &source) {
-
- if (_freeData && _objData)
- delete[] _objData;
-
- _freeData = true;
-
- byte header[6];
- source.read(header, 6);
-
+//
+uint16 ObjectV3_1::calcSize(const byte *source) {
// uint16 flags = READ_LE_UINT16(header);
- uint16 type = READ_LE_UINT16(header + 2);
+ uint16 type = READ_LE_UINT16(source + 2);
if (type == 0x7FFF) {
// array of Bytes
- _objSize = READ_LE_UINT16(header + 4);
+ return 6 + READ_LE_UINT16(source + 4);
} else if (type == 0x7FFE) {
// array of Words
- _objSize = READ_LE_UINT16(header + 4) * 2;
- } else if (type < 0x7FFE) {
- // Object (array of Word -> Word)
- _objSize = READ_LE_UINT16(header + 4) * 4;
- }
- _objSize += 6;
- _objData = new byte[_objSize];
- memcpy(_objData, header, 6);
- source.read(_objData + 6, _objSize - 6);
-
- return _objSize;
-}
-
-int ObjectV3_1::load(byte *source) {
- _objData = source;
- _freeData = false;
- if (getClass() < 0x7FFE) {
- _objSize = getSize() * 4;
- } else if (getClass() == 0x7FFE) {
- _objSize = getSize() * 2;
+ return 6 + READ_LE_UINT16(source + 4) * 2;
} else {
- _objSize = getSize();
+ // Object (array of Word -> Word)
+ return 6 + READ_LE_UINT16(source + 4) * 4;
}
- _objSize += 6;
- return _objSize;
}
-
/* GameDatabase */
-GameDatabase::GameDatabase(MadeEngine *vm) : _vm(vm) {
- _gameState = nullptr;
- _gameStateSize = 0;
- _mainCodeObjectIndex = 0;
- _isRedSource = false;
-}
-
-GameDatabase::~GameDatabase() {
- delete[] _gameState;
-}
+GameDatabase::GameDatabase() : _mainCodeObjectIndex(0) {}
void GameDatabase::open(const char *filename) {
debug(1, "GameDatabase::open() Loading from %s", filename);
- _isRedSource = false;
_filename = filename;
- _redFilename = "";
+ _redFilename.clear();
Common::File fd;
if (!fd.open(filename))
error("GameDatabase::open() Could not open %s", filename);
@@ -325,7 +305,6 @@ void GameDatabase::open(const char *filename) {
void GameDatabase::openFromRed(const char *redFilename, const char *filename) {
debug(1, "GameDatabase::openFromRed() Loading from %s->%s", redFilename, filename);
- _isRedSource = true;
_filename = filename;
_redFilename = redFilename;
Common::SeekableReadStream *fileS = RedReader::loadFromRed(redFilename, filename);
@@ -336,7 +315,7 @@ void GameDatabase::openFromRed(const char *redFilename, const char *filename) {
}
void GameDatabase::reload() {
- if (!_isRedSource) {
+ if (_redFilename.empty()) {
Common::File fd;
if (!fd.open(_filename.c_str()))
error("GameDatabase::reload() Could not open %s", _filename.c_str());
@@ -350,20 +329,41 @@ void GameDatabase::reload() {
}
}
-int16 GameDatabase::getVar(int16 index) {
- return (int16)READ_LE_UINT16(_gameState + index * 2);
+// Variable and Object lookups are technically 1-based, but
+// we create an array with a dummy entry at idx = 0 (see GameDatabase::load())
+int16 GameDatabase::getVar(int16 index) const {
+ if (index < 1) {
+ warning("Request to get variable %d", index);
+ return 0;
+ }
+
+ return READ_LE_INT16((const int16 *)_gameState.data() + index);
}
void GameDatabase::setVar(int16 index, int16 value) {
- WRITE_LE_UINT16(_gameState + index * 2, value);
+ if (index < 1) {
+ warning("Request to set variable %d", index);
+ return;
+ }
+
+ WRITE_LE_INT16((int16 *)_gameState.data() + index, value);
}
-const char *GameDatabase::getObjectString(int16 index) {
+Object *GameDatabase::getObject(int16 index) const {
+ if (index < 1) {
+ warning("Request to get object %d", index);
+ return nullptr;
+ }
+
+ return _objects[index - 1];
+}
+
+const char *GameDatabase::getObjectString(int16 index) const {
Object *obj = getObject(index);
if (obj)
return obj->getString();
else
- return "";
+ return nullptr;
}
void GameDatabase::setObjectString(int16 index, const char *str) {
@@ -372,31 +372,30 @@ void GameDatabase::setObjectString(int16 index, const char *str) {
obj->setString(str);
}
-int16 *GameDatabase::findObjectPropertyCached(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
+int16 *GameDatabase::findObjectPropertyCached(int16 objectIndex, int16 propertyId, int16 &writableFlag) {
uint32 id = (objectIndex << 16) | propertyId;
ObjectPropertyCacheMap::iterator iter = _objectPropertyCache.find(id);
int16 *propertyPtr = nullptr;
if (iter != _objectPropertyCache.end()) {
propertyPtr = iter->_value;
} else {
- propertyPtr = findObjectProperty(objectIndex, propertyId, propertyFlag);
+ propertyPtr = findObjectProperty(objectIndex, propertyId, writableFlag);
_objectPropertyCache[id] = propertyPtr;
}
- propertyFlag = 1;
+ writableFlag = 1;
return propertyPtr;
}
int16 GameDatabase::getObjectProperty(int16 objectIndex, int16 propertyId) {
-
- if (objectIndex == 0)
+ if (objectIndex < 1)
return 0;
int16 propertyFlag;
- //int16 *property = findObjectProperty(objectIndex, propertyId, propertyFlag);
+ // int16 *property = findObjectProperty(objectIndex, propertyId, writableFlag);
int16 *property = findObjectPropertyCached(objectIndex, propertyId, propertyFlag);
if (property) {
- return (int16)READ_LE_UINT16(property);
+ return READ_LE_INT16(property);
} else {
return 0;
}
@@ -404,17 +403,16 @@ int16 GameDatabase::getObjectProperty(int16 objectIndex, int16 propertyId) {
}
int16 GameDatabase::setObjectProperty(int16 objectIndex, int16 propertyId, int16 value) {
-
- if (objectIndex == 0)
+ if (objectIndex < 1)
return 0;
- int16 propertyFlag;
- //int16 *property = findObjectProperty(objectIndex, propertyId, propertyFlag);
- int16 *property = findObjectPropertyCached(objectIndex, propertyId, propertyFlag);
+ int16 writableFlag;
+ // int16 *property = findObjectProperty(objectIndex, propertyId, writableFlag);
+ int16 *property = findObjectPropertyCached(objectIndex, propertyId, writableFlag);
if (property) {
- if (propertyFlag == 1) {
- WRITE_LE_UINT16(property, value);
+ if (writableFlag == 1) {
+ WRITE_LE_INT16(property, value);
} else {
warning("GameDatabase::setObjectProperty(%04X, %04X, %04X) Trying to set constant property",
objectIndex, propertyId, value);
@@ -426,163 +424,131 @@ int16 GameDatabase::setObjectProperty(int16 objectIndex, int16 propertyId, int16
}
-void GameDatabase::dumpObject(int16 index) {
+void GameDatabase::dumpObject(int16 index) const {
Object *obj = getObject(index);
- obj->dump(Common::String::format("obj%04X.0", index));
-}
-
-
-/* GameDatabaseV2 */
-
-GameDatabaseV2::GameDatabaseV2(MadeEngine *vm) : GameDatabase(vm), _gameText(nullptr) {
+ if (obj)
+ obj->dump(Common::String::format("obj%04X.0", index));
}
-GameDatabaseV2::~GameDatabaseV2() {
- delete[] _gameText;
-}
+/* GameDatabaseV1 */
-void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) {
+void GameDatabaseV1::load(Common::SeekableReadStream &sourceS) {
int16 version = sourceS.readUint16LE();
- // Manhole:NE, Rodney's Funscreen and LGOP2 are version 54
// The earlier EGA version of Manhole is version 40
- if (version != 54 && version != 40)
- warning("Unknown database version, known versions are 54 and 40");
+ if (version != 40)
+ warning("Unknown database version, known version is 40");
char header[6];
sourceS.read(header, 6);
if (strncmp(header, "ADVSYS", 6))
- warning ("Unexpected database header, expected ADVSYS");
-
- uint32 textOffs = 0, objectsOffs = 0, objectsSize = 0, textSize;
- uint16 objectCount = 0, varObjectCount = 0;
+ warning("Unexpected database header, expected ADVSYS");
uint16 subVersion = sourceS.readUint16LE();
char dbName[19] = "";
sourceS.read(dbName, 18);
debug(2, "databaseVersion = %d, databaseSubVersion = %d, databaseName = %s", version, subVersion, dbName);
- if (version == 40) {
- sourceS.readUint16LE(); // skip unused
- objectCount = sourceS.readUint16LE();
- _gameStateSize = sourceS.readUint16LE() * 2;
- objectsOffs = sourceS.readUint16LE() * 512;
- textOffs = sourceS.readUint16LE() * 512;
- _mainCodeObjectIndex = sourceS.readUint16LE();
- varObjectCount = 0; // unused in V1
- objectsSize = 0; // unused in V1
- } else if (version == 54) {
- textOffs = sourceS.readUint16LE() * 512;
- objectCount = sourceS.readUint16LE();
- varObjectCount = sourceS.readUint16LE();
- _gameStateSize = sourceS.readUint16LE() * 2;
- sourceS.readUint16LE(); // unknown
- objectsOffs = sourceS.readUint16LE() * 512;
- sourceS.readUint16LE(); // unknown
- _mainCodeObjectIndex = sourceS.readUint16LE();
- sourceS.readUint16LE(); // unknown
- objectsSize = sourceS.readUint32LE() * 2;
- }
-
- textSize = objectsOffs - textOffs;
+ sourceS.readUint16LE(); // skip unused (always 1)
+ uint16 objectCount = sourceS.readUint16LE();
+ uint16 gameStateSize = sourceS.readUint16LE() * 2;
+ uint32 objectsOffs = sourceS.readUint16LE() * 512;
+ uint32 textOffs = sourceS.readUint16LE() * 512;
+ _mainCodeObjectIndex = sourceS.readUint16LE();
- debug(0, "textOffs = %08X; textSize = %08X; objectCount = %d; varObjectCount = %d; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d; _mainCodeObjectIndex = %04X\n", textOffs, textSize, objectCount, varObjectCount, _gameStateSize, objectsOffs, objectsSize, _mainCodeObjectIndex);
+ uint32 textSize = objectsOffs - textOffs;
+ debug(0, "textOffs = %08X; textSize = %08X; objectCount = %d; gameStateSize = %d; objectsOffs = %08X; _mainCodeObjectIndex = %04X\n", textOffs, textSize, objectCount, gameStateSize, objectsOffs, _mainCodeObjectIndex);
- _gameState = new byte[_gameStateSize + 2]();
+ // V1 gamestate is initialized to all 0, and with a dummy element at idx = 0
+ _gameState.resize(gameStateSize + 2, 0);
setVar(1, objectCount);
sourceS.seek(textOffs);
- _gameText = new char[textSize];
- sourceS.read(_gameText, textSize);
- // "Decrypt" the text data
+ _gameText.reserve(textSize);
+ // Read and "decrypt" the text data
for (uint32 i = 0; i < textSize; i++)
- _gameText[i] += 0x1E;
+ _gameText.push_back(sourceS.readSByte() + 0x1E);
sourceS.seek(objectsOffs);
-
- if (version == 40) {
- // Initialize the object array
- for (uint32 i = 0; i < objectCount; i++)
- _objects.push_back(NULL);
- // Read two "sections" of objects
- // It seems the first section is data while the second one is code.
- // The interpreter however doesn't care which section the objects come from.
- for (int section = 0; section < 2; section++) {
- while (!sourceS.eos()) {
- int16 objIndex = sourceS.readUint16LE();
- debug(1, "objIndex = %04X; section = %d", objIndex, section);
- if (objIndex == 0)
- break;
- Object *obj = new ObjectV1();
- obj->load(sourceS);
- _objects[objIndex - 1] = obj;
- }
- }
- } else if (version == 54) {
- for (uint32 i = 0; i < objectCount; i++) {
- Object *obj = new ObjectV2();
- int objSize = obj->load(sourceS);
- // Objects are aligned on 2-byte-boundaries, skip unused bytes
- sourceS.skip(objSize % 2);
- _objects.push_back(obj);
+ // Initialize the object array
+ _objects.resize(objectCount, nullptr);
+ // Read two "sections" of objects
+ // It seems the first section is data while the second one is code.
+ // The interpreter however doesn't care which section the objects come from.
+ for (int section = 0; section < 2; section++) {
+ while (!sourceS.eos()) {
+ int16 objIndex = sourceS.readUint16LE();
+ debug(1, "objIndex = %04X; section = %d", objIndex, section);
+ if (objIndex == 0)
+ break;
+ ObjectV1 *obj = new ObjectV1();
+ obj->load(sourceS);
+ _objects[objIndex - 1] = obj;
}
}
-
}
-void GameDatabaseV2::reloadFromStream(Common::SeekableReadStream &sourceS) {
- // Not used in version 2 games
+void GameDatabaseV1::reloadFromStream(Common::SeekableReadStream &sourceS) {
+ // Not used in version 1 / 2 games
}
-bool GameDatabaseV2::getSavegameDescription(const char *filename, Common::String &description, int16 version) {
- // Not used in version 2 games
+bool GameDatabaseV1::getSavegameDescription(const char *filename, Common::String &description, int16 version) {
+ // Not used in version 1 / 2 games
return false;
}
-int16 GameDatabaseV2::savegame(const char *filename, const char *description, int16 version) {
+int16 GameDatabaseV1::savegame(const char *filename, const char *description, int16 version) {
Common::OutSaveFile *out;
int16 result = 0;
if (!(out = g_system->getSavefileManager()->openForSaving(filename))) {
warning("Can't create file '%s', game not saved", filename);
return 6;
}
+
// Variable 0 is not saved
- out->write(_gameState + 2, _gameStateSize - 2);
- for (uint i = 0; i < _objects.size(); i++)
- _objects[i]->save(*out);
+ out->write(_gameState.data() + 2, _gameState.size() - 2);
+ for (uint i = 0; i < _objects.size(); i++) {
+ int objSize = _objects[i]->save(*out);
+ // objects in the original savefiles are word-aligned
+ if (objSize % 2)
+ out->writeByte(0);
+ }
out->finalize();
delete out;
return result;
}
-int16 GameDatabaseV2::loadgame(const char *filename, int16 version) {
- Common::InSaveFile *in;
- int16 result = 0;
- if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
+int16 GameDatabaseV1::loadgame(const char *filename, int16 version) {
+ Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
+ if (in == nullptr) {
warning("Can't open file '%s', game not loaded", filename);
return 1;
}
+
// Variable 0 is not loaded
- in->read(_gameState + 2, _gameStateSize - 2);
+ in->read(_gameState.data() + 2, _gameState.size() - 2);
for (uint i = 0; i < _objects.size(); i++) {
- _objects[i]->load(*in);
+ int objSize = _objects[i]->load(*in);
+ // objects in the original savefiles are word-aligned
+ if (objSize % 2)
+ in->skip(1);
}
delete in;
_objectPropertyCache.clear(); // make sure to clear cache
- return result;
+ return 0;
}
-int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
+int16 *GameDatabaseV1::findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
Object *obj = getObject(objectIndex);
- if (obj->getClass() >= 0x7FFE) {
+ if (!obj->isObject()) {
error("GameDatabaseV2::findObjectProperty(%04X, %04X) Not an object (type=%04x)", objectIndex, propertyId, obj->getClass());
}
int16 *prop = (int16 *)obj->getData();
- byte count1 = obj->getCount1();
- byte count2 = obj->getCount2();
+ byte count1 = obj->getValueCount();
+ byte count2 = obj->getKeyCount();
int16 *propPtr1 = prop + count1;
int16 *propPtr2 = prop + count2;
@@ -590,7 +556,7 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
// First see if the property exists in the given object
while (count2--) {
if ((READ_LE_UINT16(prop) & 0x7FFF) == propertyId) {
- propertyFlag = obj->getFlags() & 1;
+ propertyFlag = 1;
return propPtr1;
}
prop++;
@@ -604,8 +570,8 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
obj = getObject(parentObjectIndex);
prop = (int16 *)obj->getData();
- count1 = obj->getCount1();
- count2 = obj->getCount2();
+ count1 = obj->getValueCount();
+ count2 = obj->getKeyCount();
propPtr1 = propPtr2 + count1 - count2;
int16 *propertyPtr = prop + count1;
@@ -613,14 +579,14 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
while (count2--) {
if ((READ_LE_UINT16(prop) & 0x8000) == 0) {
if ((READ_LE_UINT16(prop) & 0x7FFF) == propertyId) {
- propertyFlag = obj->getFlags() & 1;
+ propertyFlag = 1;
return propPtr1;
} else {
propPtr1++;
}
} else {
if ((READ_LE_UINT16(prop) & 0x7FFF) == propertyId) {
- propertyFlag = obj->getFlags() & 1;
+ propertyFlag = 1;
return propertyPtr;
}
}
@@ -637,23 +603,77 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
}
-const char *GameDatabaseV2::getString(uint16 offset) {
+const char *GameDatabaseV1::getString(uint16 offset) {
return (const char*)&_gameText[offset * 4];
}
+/* GameDatabaseV2 */
-/* GameDatabaseV3 */
+void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) {
+ int16 version = sourceS.readUint16LE();
+
+ // Manhole:NE, Rodney's Funscreen and LGOP2 are version 54
+ if (version != 54)
+ warning("Unknown database version, known version is 54");
+
+ char header[6];
+ sourceS.read(header, 6);
+ if (strncmp(header, "ADVSYS", 6))
+ warning("Unexpected database header, expected ADVSYS");
+
+ uint32 textOffs = 0, objectsOffs = 0, objectsSize = 0, textSize;
+ uint16 objectCount = 0, varObjectCount = 0;
+
+ uint16 subVersion = sourceS.readUint16LE();
+ char dbName[19] = "";
+ sourceS.read(dbName, 18);
+ debug(2, "databaseVersion = %d, databaseSubVersion = %d, databaseName = %s", version, subVersion, dbName);
-GameDatabaseV3::GameDatabaseV3(MadeEngine *vm) : GameDatabase(vm) {
- _gameText = nullptr;
- _gameStateOffs = 0;
+ textOffs = sourceS.readUint16LE() * 512;
+ objectCount = sourceS.readUint16LE();
+ varObjectCount = sourceS.readUint16LE();
+ uint16 _gameStateSize = sourceS.readUint16LE() * 2;
+ sourceS.readUint16LE(); // unknown
+ objectsOffs = sourceS.readUint16LE() * 512;
+ sourceS.readUint16LE(); // unknown
+ _mainCodeObjectIndex = sourceS.readUint16LE();
+ sourceS.readUint16LE(); // unknown
+ objectsSize = sourceS.readUint32LE() * 2;
+
+ textSize = objectsOffs - textOffs;
+
+ debug(0, "textOffs = %08X; textSize = %08X; objectCount = %d; varObjectCount = %d; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d; _mainCodeObjectIndex = %04X\n", textOffs, textSize, objectCount, varObjectCount, _gameStateSize, objectsOffs, objectsSize, _mainCodeObjectIndex);
+
+ // V2 gamestate is initialized to all 0, and with a dummy element at idx = 0
+ _gameState.resize(_gameStateSize + 2, 0);
+ setVar(1, objectCount);
+
+ sourceS.seek(textOffs);
+ _gameText.reserve(textSize);
+ // Read and "decrypt" the text data
+ for (uint32 i = 0; i < textSize; i++)
+ _gameText.push_back(sourceS.readSByte() + 0x1E);
+
+ sourceS.seek(objectsOffs);
+ for (uint32 i = 0; i < objectCount; i++) {
+ ObjectV2 *obj = new ObjectV2();
+ int objSize = obj->load(sourceS);
+ // Objects are aligned on 2-byte-boundaries, skip unused bytes
+ if (objSize % 2)
+ sourceS.skip(1);
+ _objects.push_back(obj);
+ }
}
+/* GameDatabaseV3 */
+
+GameDatabaseV3::GameDatabaseV3() : GameDatabase(), _gameStateOffs(0) {}
+
void GameDatabaseV3::load(Common::SeekableReadStream &sourceS) {
char header[6];
sourceS.read(header, 6);
if (strncmp(header, "ADVSYS", 6))
- warning ("Unexpected database header, expected ADVSYS");
+ warning("Unexpected database header, expected ADVSYS");
uint16 version = sourceS.readUint16LE();
uint16 subVersion = sourceS.readUint16LE();
@@ -671,16 +691,15 @@ void GameDatabaseV3::load(Common::SeekableReadStream &sourceS) {
uint32 objectIndexOffs = sourceS.readUint32LE();
uint16 objectCount = sourceS.readUint16LE();
_gameStateOffs = sourceS.readUint32LE();
- _gameStateSize = sourceS.readUint32LE();
+ uint32 _gameStateSize = sourceS.readUint32LE();
uint32 objectsOffs = sourceS.readUint32LE();
uint32 objectsSize = sourceS.readUint32LE();
_mainCodeObjectIndex = sourceS.readUint16LE();
debug(2, "objectIndexOffs = %08X; objectCount = %d; gameStateOffs = %08X; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d; _mainCodeObjectIndex = %04X\n", objectIndexOffs, objectCount, _gameStateOffs, _gameStateSize, objectsOffs, objectsSize, _mainCodeObjectIndex);
- _gameState = new byte[_gameStateSize];
- sourceS.seek(_gameStateOffs);
- sourceS.read(_gameState, _gameStateSize);
+ _gameState.resize(_gameStateSize, 0);
+ reloadFromStream(sourceS);
Common::Array<uint32> objectOffsets;
sourceS.seek(objectIndexOffs);
@@ -688,7 +707,7 @@ void GameDatabaseV3::load(Common::SeekableReadStream &sourceS) {
objectOffsets.push_back(sourceS.readUint32LE());
for (uint32 i = 0; i < objectCount; i++) {
- Object *obj;
+ ObjectV3 *obj;
if (version == 210)
obj = new ObjectV3_1();
else
@@ -700,25 +719,23 @@ void GameDatabaseV3::load(Common::SeekableReadStream &sourceS) {
sourceS.seek(objectsOffs + (objectOffsets[i] ^ 1));
obj->load(sourceS);
} else {
- obj->load(_gameState + objectOffsets[i]);
+ obj->load(_gameState.data() + objectOffsets[i]);
}
_objects.push_back(obj);
}
-
}
void GameDatabaseV3::reloadFromStream(Common::SeekableReadStream &sourceS) {
sourceS.seek(_gameStateOffs);
- sourceS.read(_gameState, _gameStateSize);
+ sourceS.read(_gameState.data(), _gameState.size());
_objectPropertyCache.clear(); // make sure to clear cache
}
bool GameDatabaseV3::getSavegameDescription(const char *filename, Common::String &description, int16 version) {
- Common::InSaveFile *in;
- char desc[64];
+ Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
- if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
+ if (in == nullptr) {
return false;
}
@@ -744,6 +761,7 @@ bool GameDatabaseV3::getSavegameDescription(const char *filename, Common::String
return false;
}
+ char desc[64];
in->read(desc, 64);
description = desc;
@@ -755,7 +773,7 @@ int16 GameDatabaseV3::savegame(const char *filename, const char *description, in
Common::OutSaveFile *out;
char desc[64];
int16 result = 0;
- uint32 size = 4 + 4 + 2 + _gameStateSize;
+ uint32 size = 4 + 4 + 2 + _gameState.size();
if (!(out = g_system->getSavefileManager()->openForSaving(filename))) {
warning("Can't create file '%s', game not saved", filename);
return 6;
@@ -765,7 +783,7 @@ int16 GameDatabaseV3::savegame(const char *filename, const char *description, in
out->writeUint32LE(size);
out->writeUint16LE(version);
out->write(desc, 64);
- out->write(_gameState, _gameStateSize);
+ out->write(_gameState.data(), _gameState.size());
out->finalize();
delete out;
return result;
@@ -773,7 +791,7 @@ int16 GameDatabaseV3::savegame(const char *filename, const char *description, in
int16 GameDatabaseV3::loadgame(const char *filename, int16 version) {
Common::InSaveFile *in;
- uint32 expectedSize = 4 + 4 + 2 + _gameStateSize;
+ uint32 expectedSize = 4 + 4 + 2 + _gameState.size();
if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
warning("Can't open file '%s', game not loaded", filename);
@@ -803,7 +821,7 @@ int16 GameDatabaseV3::loadgame(const char *filename, int16 version) {
}
in->skip(64); // skip savegame description
- in->read(_gameState, _gameStateSize);
+ in->read(_gameState.data(), _gameState.size());
delete in;
_objectPropertyCache.clear(); // make sure to clear cache
@@ -818,8 +836,8 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
}
int16 *prop = (int16 *)obj->getData();
- byte count1 = obj->getCount1();
- byte count2 = obj->getCount2();
+ byte count1 = obj->getValueCount();
+ byte count2 = obj->getKeyCount();
int16 *propPtr1 = prop + count1;
int16 *propPtr2 = prop + count2;
@@ -829,9 +847,9 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
if ((READ_LE_UINT16(prop) & 0x3FFF) == propertyId) {
if (READ_LE_UINT16(prop) & 0x4000) {
propertyFlag = 1;
- return (int16 *)_gameState + READ_LE_UINT16(propPtr1);
+ return (int16 *)_gameState.data() + READ_LE_UINT16(propPtr1);
} else {
- propertyFlag = obj->getFlags() & 1;
+ propertyFlag = obj->isWritable();
return propPtr1;
}
}
@@ -846,8 +864,8 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
obj = getObject(parentObjectIndex);
prop = (int16 *)obj->getData();
- count1 = obj->getCount1();
- count2 = obj->getCount2();
+ count1 = obj->getValueCount();
+ count2 = obj->getKeyCount();
propPtr1 = propPtr2 + count1 - count2;
int16 *propertyPtr = prop + count1;
@@ -857,9 +875,9 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
if ((READ_LE_UINT16(prop) & 0x3FFF) == propertyId) {
if (READ_LE_UINT16(prop) & 0x4000) {
propertyFlag = 1;
- return (int16 *)_gameState + READ_LE_UINT16(propPtr1);
+ return (int16 *)_gameState.data() + READ_LE_UINT16(propPtr1);
} else {
- propertyFlag = obj->getFlags() & 1;
+ propertyFlag = obj->isWritable();
return propPtr1;
}
} else {
@@ -869,9 +887,9 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
if ((READ_LE_UINT16(prop) & 0x3FFF) == propertyId) {
if (READ_LE_UINT16(prop) & 0x4000) {
propertyFlag = 1;
- return (int16 *)_gameState + READ_LE_UINT16(propertyPtr);
+ return (int16 *)_gameState.data() + READ_LE_UINT16(propertyPtr);
} else {
- propertyFlag = obj->getFlags() & 1;
+ propertyFlag = obj->isWritable();
return propertyPtr;
}
}
@@ -907,7 +925,7 @@ int16 *GameDatabaseV3_1::findObjectProperty(int16 objectIndex, int16 propertyId,
}
// 3.1 objects are a set of int16 (key) -> int16 (value) entries
- uint16 count = obj->getSize();
+ uint16 count = obj->getCount();
// Check each "key" on the object for a match.
while (count-- > 0) {
@@ -920,11 +938,11 @@ int16 *GameDatabaseV3_1::findObjectProperty(int16 objectIndex, int16 propertyId,
// A match w/ high-bit set indicates you go look in the Gamestate.
// "Value" is an index into the gamestate... return a ptr into gamestate.
propertyFlag = 1;
- return (int16 *)_gameState + READ_LE_UINT16(prop + 1);
+ return (int16 *)_gameState.data() + READ_LE_UINT16(prop + 1);
} else {
// A match without high-bit indicates the value is right here (literal).
// Return a ptr to the value.
- propertyFlag = obj->getFlags() & 1;
+ propertyFlag = obj->isWritable();
return (prop + 1);
}
}
diff --git a/engines/made/database.h b/engines/made/database.h
index bf343cc7ba3..1be84083165 100644
--- a/engines/made/database.h
+++ b/engines/made/database.h
@@ -39,31 +39,32 @@ class MadeEngine;
class Object {
public:
-
Object();
- virtual ~Object();
+ ~Object();
virtual int load(Common::SeekableReadStream &source) = 0;
- virtual int load(byte *source) = 0;
- virtual int save(Common::WriteStream &dest) = 0;
- virtual uint16 getFlags() = 0;
- virtual uint16 getClass() = 0;
- virtual uint16 getSize() = 0;
- virtual byte getCount1() = 0;
- virtual byte getCount2() = 0;
- virtual byte *getData() = 0;
- virtual bool isConstant() = 0;
-
- const char *getString();
- void setString(const char *str);
+ virtual int save(Common::WriteStream &dest) const;
+
+ virtual uint16 getFlags() const;
+ virtual uint16 getClass() const = 0;
+ virtual uint16 getCount() const = 0;
+ virtual byte getKeyCount() const = 0;
+ virtual byte getValueCount() const = 0;
+ virtual const byte *getData() const = 0;
- bool isObject();
+ bool isByteArray() const;
+ bool isWordArray() const;
+ bool isObject() const;
- int16 getVectorSize();
- int16 getVectorItem(int16 index);
+ bool isWritable() const;
+
+ const char *getString() const;
+ void setString(const char *str);
+
+ int16 getVectorItem(int16 index) const;
void setVectorItem(int16 index, int16 value);
- void dump(const Common::String &filename);
+ void dump(const Common::String &filename) const;
protected:
bool _freeData;
@@ -71,50 +72,46 @@ protected:
byte *_objData;
};
-class ObjectV2 : public Object {
+class ObjectV1 : public Object {
public:
int load(Common::SeekableReadStream &source) override;
- int load(byte *source) override;
- int save(Common::WriteStream &dest) override;
- uint16 getFlags() override;
- uint16 getClass() override;
- uint16 getSize() override;
- byte getCount1() override;
- byte getCount2() override;
- byte *getData() override;
-
- bool isConstant() override {
- return false;
- }
+ int save(Common::WriteStream &dest) const override;
+
+ uint16 getClass() const override;
+ uint16 getCount() const override;
+ byte getKeyCount() const override;
+ byte getValueCount() const override;
+ const byte *getData() const override;
+
+protected:
+ static uint16 calcSize(const byte *source);
};
-class ObjectV1 : public ObjectV2 {
+class ObjectV2 : public ObjectV1 {
public:
- int load(Common::SeekableReadStream &source) override;
+ byte getValueCount() const override;
+ byte getKeyCount() const override;
};
class ObjectV3 : public Object {
public:
- virtual int load(Common::SeekableReadStream &source) override;
- virtual int load(byte *source) override;
- int save(Common::WriteStream &dest) override;
- uint16 getFlags() override;
- uint16 getClass() override;
- uint16 getSize() override;
- byte getCount1() override;
- byte getCount2() override;
- byte *getData() override;
-
- bool isConstant() override {
- return !(getFlags() & 1);
- }
+ int load(Common::SeekableReadStream &source) override;
+ int load(byte *source);
+ uint16 getFlags() const override;
+ uint16 getClass() const override;
+ uint16 getCount() const override;
+ byte getKeyCount() const override;
+ byte getValueCount() const override;
+ const byte *getData() const override;
+
+protected:
+ virtual uint16 calcSize(const byte *source);
};
class ObjectV3_1 : public ObjectV3 {
-public:
- int load(Common::SeekableReadStream &source) override;
- int load(byte *source) override;
+protected:
+ uint16 calcSize(const byte *source) override;
};
@@ -123,33 +120,27 @@ public:
class GameDatabase {
public:
- GameDatabase(MadeEngine *vm);
- virtual ~GameDatabase();
+ GameDatabase();
+ virtual ~GameDatabase() = default;
void open(const char *filename);
void openFromRed(const char *redFilename, const char *filename);
void reload();
- Object *getObject(int16 index) const {
- if (index >= 1)
- return _objects[index - 1];
- else
- return NULL;
- }
+ int16 getVar(int16 index) const;
+ void setVar(int16 index, int16 value);
+ Object *getObject(int16 index) const;
uint getObjectCount() const { return _objects.size(); }
int16 getMainCodeObjectIndex() const { return _mainCodeObjectIndex; }
- int16 getVar(int16 index);
- void setVar(int16 index, int16 value);
-
- const char *getObjectString(int16 index);
+ const char *getObjectString(int16 index) const;
void setObjectString(int16 index, const char *str);
virtual int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) = 0;
- int16 *findObjectPropertyCached(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
+ int16 *findObjectPropertyCached(int16 objectIndex, int16 propertyId, int16 &writableFlag);
virtual const char *getString(uint16 offset) = 0;
virtual bool getSavegameDescription(const char *filename, Common::String &description, int16 version) = 0;
virtual int16 savegame(const char *filename, const char *description, int16 version) = 0;
@@ -158,47 +149,51 @@ public:
int16 getObjectProperty(int16 objectIndex, int16 propertyId);
int16 setObjectProperty(int16 objectIndex, int16 propertyId, int16 value);
- void dumpObject(int16 index);
+ void dumpObject(int16 index) const;
protected:
+ virtual void load(Common::SeekableReadStream &sourceS) = 0;
+ virtual void reloadFromStream(Common::SeekableReadStream &sourceS) = 0;
+
+ Common::String _filename, _redFilename;
+
typedef Common::HashMap<uint32, int16 *> ObjectPropertyCacheMap;
- MadeEngine *_vm;
Common::Array<Object *> _objects;
ObjectPropertyCacheMap _objectPropertyCache;
- byte *_gameState;
- uint32 _gameStateSize;
+
+ Common::Array<byte> _gameState;
int16 _mainCodeObjectIndex;
- bool _isRedSource;
- Common::String _filename, _redFilename;
- virtual void load(Common::SeekableReadStream &sourceS) = 0;
- virtual void reloadFromStream(Common::SeekableReadStream &sourceS) = 0;
};
-class GameDatabaseV2 : public GameDatabase {
+class GameDatabaseV1 : public GameDatabase {
public:
- GameDatabaseV2(MadeEngine *vm);
- ~GameDatabaseV2() override;
int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) override;
const char *getString(uint16 offset) override;
bool getSavegameDescription(const char *filename, Common::String &description, int16 version) override;
int16 savegame(const char *filename, const char *description, int16 version) override;
int16 loadgame(const char *filename, int16 version) override;
+
protected:
- char *_gameText;
void load(Common::SeekableReadStream &sourceS) override;
void reloadFromStream(Common::SeekableReadStream &sourceS) override;
+
+ Common::Array<char> _gameText;
+};
+
+class GameDatabaseV2 : public GameDatabaseV1 {
+protected:
+ void load(Common::SeekableReadStream &sourceS) override;
};
class GameDatabaseV3 : public GameDatabase {
public:
- GameDatabaseV3(MadeEngine *vm);
+ GameDatabaseV3();
virtual int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) override;
const char *getString(uint16 offset) override;
bool getSavegameDescription(const char *filename, Common::String &description, int16 version) override;
int16 savegame(const char *filename, const char *description, int16 version) override;
int16 loadgame(const char *filename, int16 version) override;
protected:
- char *_gameText;
uint32 _gameStateOffs;
void load(Common::SeekableReadStream &sourceS) override;
void reloadFromStream(Common::SeekableReadStream &sourceS) override;
@@ -206,10 +201,9 @@ protected:
class GameDatabaseV3_1 : public GameDatabaseV3 {
public:
- GameDatabaseV3_1(MadeEngine *vm) : GameDatabaseV3(vm) {}
int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) override;
};
} // End of namespace Made
-#endif /* MADE_H */
+#endif /* MADE_DATABASE_H */
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index 95038200586..a850a45007a 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -69,12 +69,15 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
_res = new ResourceReader();
_screen = new Screen(this);
- if (getGameID() == GID_LGOP2 || getGameID() == GID_MANHOLE || getGameID() == GID_RODNEY) {
- _dat = new GameDatabaseV2(this);
- } else if (getGameID() == GID_RTZ) {
- _dat = new GameDatabaseV3(this);
- } else if (getGameID() == GID_RSBESTNDE || getGameID() == GID_RSBUSYNDE) {
- _dat = new GameDatabaseV3_1(this);
+ if (getVersion() == 1)
+ _dat = new GameDatabaseV1();
+ else if (getVersion() == 2)
+ _dat = new GameDatabaseV2();
+ else if (getVersion() == 3) {
+ if (getSubVersion() == 1)
+ _dat = new GameDatabaseV3_1();
+ else
+ _dat = new GameDatabaseV3();
} else {
error("Unknown GameID");
}
diff --git a/engines/made/script.cpp b/engines/made/script.cpp
index 0827ffdd4c4..c92721bd9cf 100644
--- a/engines/made/script.cpp
+++ b/engines/made/script.cpp
@@ -379,7 +379,7 @@ void ScriptInterpreter::cmd_vsize() {
int16 size = 0;
if (objectIndex > 0) {
Object *obj = _vm->_dat->getObject(objectIndex);
- size = obj->getVectorSize();
+ size = obj->getCount();
}
_stack.setTop(size);
}
@@ -645,7 +645,7 @@ void ScriptInterpreter::dumpScript(int16 objectIndex, int *opcodeStats, int *ext
debug(1, "Dumping code for object %04X", objectIndex);
Object *obj = _vm->_dat->getObject(objectIndex);
- byte *code = obj->getData(), *codeStart = code, *codeEnd = code + obj->getSize();
+ const byte *code = obj->getData(), *codeStart = code, *codeEnd = code + obj->getCount();
while (code < codeEnd) {
byte opcode = *code++;
@@ -723,15 +723,15 @@ void ScriptInterpreter::dumpObject(int16 objectIndex) {
debug(1, "Dumping object %04X", objectIndex);
Object *obj = _vm->_dat->getObject(objectIndex);
- debug(1, "Flags = %d[%04x], Size = %d[%04x]", obj->getFlags(), obj->getFlags(), obj->getSize(), obj->getSize());
+ debug(1, "Flags = %d[%04x], Size = %d[%04x]", obj->getFlags(), obj->getFlags(), obj->getCount(), obj->getCount());
debug(1, "Class = %d[%04x]", obj->getClass(), obj->getClass());
if (obj->getClass() == 0x7FFF) {
// byte array
bool looksLikeAscii = true;
Common::String bArray = "byteArray = [";
- for (int i = 0; i < obj->getVectorSize(); i++) {
+ for (int i = 0; i < obj->getCount(); i++) {
int16 c = obj->getVectorItem(i);
- if (i == obj->getVectorSize() - 1) {
+ if (i == obj->getCount() - 1) {
if (c != 0)
looksLikeAscii = false;
} else {
@@ -748,21 +748,21 @@ void ScriptInterpreter::dumpObject(int16 objectIndex) {
} else if (obj->getClass() == 0x7FFE) {
// word array
Common::String bArray = "wordArray = [";
- for (int i = 0; i < obj->getVectorSize(); i++)
+ for (int i = 0; i < obj->getCount(); i++)
bArray += Common::String::format("%d,", obj->getVectorItem(i));
bArray += " ]";
debug(1, "%s", bArray.c_str());
} else {
- debug(1, "Raw Data for object %04X (count1 = %d, count2 = %d)", objectIndex, obj->getCount1(), obj->getCount2());
+ debug(1, "Raw Data for object %04X (count1 = %d, count2 = %d)", objectIndex, obj->getKeyCount(), obj->getValueCount());
Common::String bArray = "";
- byte *limit;
+ const byte *limit;
if (_vm->getVersion() == 3 && _vm->getSubVersion() == 1)
- limit = obj->getData() + obj->getSize() * 4;
+ limit = obj->getData() + obj->getCount() * 4;
else
- limit = obj->getData() + (obj->getCount1() + obj->getCount2()) * 2;
+ limit = obj->getData() + (obj->getKeyCount() + obj->getValueCount()) * 2;
- for (byte *i = obj->getData(); i < limit; i++)
+ for (const byte *i = obj->getData(); i < limit; i++)
bArray += Common::String::format("%02X", *i);
debug(1, "%s", bArray.c_str());
}
@@ -789,7 +789,7 @@ void ScriptInterpreter::dumpAllScripts() {
}
// Code objects aren't excplicitly marked as such, we need to check if
// the last byte is a cmd_return opcode.
- byte *retByte = obj->getData() + obj->getSize() - 1;
+ const byte *retByte = obj->getData() + obj->getCount() - 1;
if (*retByte == 0x1F) {
dumpScript(objectIndex, opcodeStats, externStats);
} else {
diff --git a/engines/made/script.h b/engines/made/script.h
index a303859bcdc..0149f475203 100644
--- a/engines/made/script.h
+++ b/engines/made/script.h
@@ -103,7 +103,7 @@ protected:
ScriptStack _stack;
int16 _entryStackPos, _localStackPos;
int16 _runningScriptObjectIndex;
- byte *_codeBase, *_codeIp;
+ const byte *_codeBase, *_codeIp;
bool _running;
ScriptFunctions *_functions;
@@ -188,4 +188,4 @@ protected:
} // End of namespace Made
-#endif /* MADE_H */
+#endif /* MADE_SCRIPT_H */
Commit: 5ff939b5e3c5420933c6bc1aff6d06dfcd098647
https://github.com/scummvm/scummvm/commit/5ff939b5e3c5420933c6bc1aff6d06dfcd098647
Author: Greg Kennedy (kennedy.greg at gmail.com)
Date: 2026-11-20T03:49:35+02:00
Commit Message:
MADE: Reorganize detection tables
Cleanup detection tables, order games by release date and fix version numbers of data files. This also splits Manhole, Manhole: NE and Manhole: ME into separate games.
Changed paths:
engines/made/detection.cpp
engines/made/detection.h
engines/made/detection_tables.h
engines/made/made.cpp
engines/made/screen.cpp
engines/made/scriptfuncs.cpp
diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp
index ac5f6ea5eba..8ad7c7957ce 100644
--- a/engines/made/detection.cpp
+++ b/engines/made/detection.cpp
@@ -28,9 +28,11 @@
static const PlainGameDescriptor madeGames[] = {
{"manhole", "The Manhole"},
- {"rtz", "Return to Zork"},
- {"lgop2", "Leather Goddesses of Phobos 2"},
+ {"manholene", "The Manhole: New and Enhanced!"},
+ {"manholeme", "The Manhole: Masterpiece Edition"},
{"rodney", "Rodney's Funscreen"},
+ {"lgop2", "Leather Goddesses of Phobos 2"},
+ {"rtz", "Return to Zork"},
{"rsbestnde", "Richard Scarry's Best Neighborhood Disc Ever!"},
{"rsbusynde", "Richard Scarry's Busiest Neighborhood Disc Ever!"},
{nullptr, nullptr}
diff --git a/engines/made/detection.h b/engines/made/detection.h
index 7e43841011b..90264b9000e 100644
--- a/engines/made/detection.h
+++ b/engines/made/detection.h
@@ -27,12 +27,14 @@
namespace Made {
enum MadeGameID {
- GID_RTZ = 0,
+ GID_NONE = 0,
GID_MANHOLE = 1,
- GID_LGOP2 = 2,
+ GID_MANHOLE_NE = 2,
GID_RODNEY = 3,
- GID_RSBESTNDE = 4,
- GID_RSBUSYNDE = 5
+ GID_LGOP2 = 4,
+ GID_RTZ = 5,
+ GID_RSBESTNDE = 6,
+ GID_RSBUSYNDE = 7
};
enum MadeGameFeatures {
@@ -48,7 +50,6 @@ struct MadeGameDescription {
ADGameDescription desc;
int gameID;
- int gameType;
uint32 features;
uint8 version;
uint8 subVersion;
diff --git a/engines/made/detection_tables.h b/engines/made/detection_tables.h
index a37f746b46e..042f0cc972f 100644
--- a/engines/made/detection_tables.h
+++ b/engines/made/detection_tables.h
@@ -30,6 +30,218 @@ namespace Made {
static const MadeGameDescription gameDescriptions[] = {
+ /* ************* The Manhole ************* */
+
+ {
+ // The Manhole (EGA, 5.25")
+ {
+ "manhole",
+ "",
+ AD_ENTRY1s("manhole.dat", "2b1658292599a861c4cd3cf6cdb3c581", 127541),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_MANHOLE,
+ GF_FLOPPY,
+ 1, 0,
+ },
+
+ {
+ // The Manhole (EGA, CD-ROM)
+ // Bugreport #5855
+ {
+ "manhole",
+ "CD",
+ AD_ENTRY1s("manhole.dat", "df77ad5232757d7149342fb6471de4ed", 99317),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_CD | ADGF_UNSTABLE,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_MANHOLE,
+ GF_CD,
+ 1, 0,
+ },
+
+ {
+ // The Manhole (PC-98, 5.25")
+ {
+ "manhole",
+ "",
+ AD_ENTRY1s("manhole.dat", "d99dd0a92c09ff313e92feb49ab64115", 102285),
+ Common::JA_JPN,
+ Common::kPlatformPC98,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_MANHOLE,
+ GF_FLOPPY,
+ 1, 0,
+ },
+
+ {
+ // The Manhole (FM Towns, CD-ROM) 1990
+ // In fact, this is the NE version, but not labeled as such
+ {
+ "manhole",
+ "",
+ AD_ENTRY1s("manhole.dat", "2f14b5d87a862aad25701514dc282475", 119667),
+ Common::JA_JPN,
+ Common::kPlatformFMTowns,
+ ADGF_CD | ADGF_UNSTABLE,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_MANHOLE,
+ GF_CD,
+ 1, 0,
+ },
+
+ {
+ // The Manhole: New and Enhanced (MS-DOS) 1992
+ // MS-DOS, Win16 and Tandy VIS all share the same resource but a different player.
+ {
+ "manholene",
+ "",
+ AD_ENTRY1s("manhole.dat", "cb21e31ed35c963208343bc995225b73", 107028),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_CD,
+ GUIO2(GUIO_NOSPEECH, GAMEOPTION_WINDOWS_CURSORS)
+ },
+ GID_MANHOLE_NE,
+ GF_CD,
+ 2, 0,
+ },
+
+ {
+ // The Manhole: NE, DOS/V, file dates 2/21/1992
+ // Platform: IBM PS-55, Sega TeraDrive or DOS/V-compatibles
+ // MADE v2.00a JAPAN PC - Copyright (c) 1990, MEDIAGENIC
+ {
+ "manholene",
+ "DOS-V",
+ AD_ENTRY1s("manhole.dat", "14522ee9139ca0823ac0cc15805e1fcc", 112303),
+ Common::JA_JPN,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_MANHOLE_NE,
+ GF_FLOPPY,
+ 1, 0,
+ },
+
+ // The Manhole: Masterpiece Edition is not a MADE engine and cannot be
+ // supported by MADE. It is a HyperCard-like engine
+ {
+ // The Manhole: Masterpiece Edition (GOG/CD)
+ {
+ "manholeme",
+ _s("The game is using an unsupported engine"),
+ AD_ENTRY1s("manhole.dat", "e8cec9bf21e4c50a7ebc193a4e0b48f5", 181390),
+ // AD_ENTRY1s("manhole.dat", "4141a19a4a51e8b96bf26255fcee6fa9", 181394),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSUPPORTED,
+ GUIO0()
+ },
+ GID_NONE,
+ 0,
+ 0, 0,
+ },
+
+ /* ************* Rodney's Funscreen ************* */
+
+ {
+ // Rodney's Funscreen
+ // MS-DOS, Win16 and Tandy VIS all share the same resource but a different player.
+ {
+ "rodney",
+ "",
+ AD_ENTRY1s("rodneys.dat", "a79887dbaa47689facd7c6f09258ba5a", 92990),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GAMEOPTION_WINDOWS_CURSORS)
+ },
+ GID_RODNEY,
+ GF_FLOPPY,
+ 2, 0,
+ },
+
+ /* ************* Leather Goddesses of Phobos 2 ************* */
+
+ {
+ // Leather Goddesses of Phobos 2 (English)
+ {
+ "lgop2",
+ "",
+ AD_ENTRY1s("lgop2.dat", "8137996db200ff67e8f172ff106f2e48", 280280),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_LGOP2,
+ GF_FLOPPY,
+ 2, 0,
+ },
+
+ {
+ // Leather Goddesses of Phobos 2 (German)
+ // Supplied by windlepoons (bug tracker #4218)
+ {
+ "lgop2",
+ "",
+ AD_ENTRY1s("lgop2.dat", "a0ffea6a3b7e39bd861edd00c397641c", 299466),
+ Common::DE_DEU,
+ Common::kPlatformDOS,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_LGOP2,
+ GF_FLOPPY,
+ 2, 0,
+ },
+
+ {
+ // Leather Goddesses of Phobos 2 (French)
+ // Supplied by goodoldgeorg (bug tracker #4219)
+ {
+ "lgop2",
+ "",
+ AD_ENTRY1s("lgop2.dat", "f9e974087af7cf4b7ec2d8dc45d01e0c", 295366),
+ Common::FR_FRA,
+ Common::kPlatformDOS,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_LGOP2,
+ GF_FLOPPY,
+ 2, 0,
+ },
+
+ {
+ // Leather Goddesses of Phobos 2 (Spanish)
+ // Supplied by goodoldgeorg (bug tracker #4219)
+ {
+ "lgop2",
+ "",
+ AD_ENTRY1s("lgop2.dat", "96eb95b4d75b9a3da0b0d67e3b4a787d", 288984),
+ Common::ES_ESP,
+ Common::kPlatformDOS,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_LGOP2,
+ GF_FLOPPY,
+ 2, 0,
+ },
+
+ /* ************* Return to Zork ************* */
+
{
// NOTE: Return to Zork entries with *.dat are used to detect the game via rtzcd.dat,
// which is packed inside rtzcd.red. Entries with *.red refer to the packed file
@@ -47,7 +259,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD,
3, 0,
},
@@ -65,7 +276,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
@@ -82,7 +292,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD,
3, 0,
},
@@ -99,7 +308,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
@@ -116,7 +324,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
@@ -134,7 +341,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD,
3, 0,
},
@@ -155,7 +361,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
@@ -173,7 +378,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD,
3, 0,
},
@@ -191,7 +395,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
@@ -209,7 +412,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD,
3, 0,
},
@@ -227,7 +429,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
@@ -245,7 +446,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD,
3, 0,
},
@@ -263,7 +463,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
@@ -286,7 +485,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
@@ -303,7 +501,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GUIO_NOSPEECH)
},
GID_RTZ,
- 0,
GF_FLOPPY,
3, 0,
},
@@ -324,7 +521,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO0()
},
GID_RTZ,
- 0,
GF_DEMO,
3, 0,
},
@@ -341,7 +537,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
@@ -359,11 +554,26 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
3, 0,
},
+ {
+ // Return to Zork - English MacOS CD version 1.1.1? 8/20/93
+ {
+ "rtz",
+ "V1.1.1, 8/20/93, CD",
+ AD_ENTRY1s("rtz.dat", "f5488cf4156603e25ebf21786ea51a98", 606720),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_CD,
+ GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
+ },
+ GID_RTZ,
+ GF_CD,
+ 3, 1,
+ },
+
{
// Return to Zork - Mac Demo from Zork Anthology CD
// Same disc as DOS version (on ISO-9660)
@@ -378,9 +588,8 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GAMEOPTION_INTRO_MUSIC_DIGITAL)
},
GID_RTZ,
- 0,
GF_CD_COMPRESSED,
- 3, 0,
+ 3, 1,
},
{
@@ -396,7 +605,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO0()
},
GID_RTZ,
- 0,
GF_CD,
3, 0,
},
@@ -414,7 +622,6 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO1(GUIO_NOASPECT)
},
GID_RTZ,
- 0,
GF_CD,
3, 0,
},
@@ -432,205 +639,11 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO0()
},
GID_RTZ,
- 0,
- GF_CD,
- 3, 0,
- },
-
- // The Manhole: Masterpiece Edition is not a MADE engine and cannot be
- // supported by MADE. It is a HyperCard-like engine
- {
- // The Manhole: Masterpiece Edition (GOG/CD)
- {
- "manhole",
- _s("The game is using unsupported engine"),
- AD_ENTRY1("manhole.dat", "e8cec9bf21e4c50a7ebc193a4e0b48f5"),
- Common::EN_ANY,
- Common::kPlatformDOS,
- ADGF_UNSUPPORTED,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_MANHOLE,
- 0,
- GF_CD,
- 2, 0,
- },
-
- // Bugreport #5855
- {
- {
- "manhole",
- _s("The game is using unsupported engine"),
- AD_ENTRY1s("manhole.dat", "df77ad5232757d7149342fb6471de4ed", 99317),
- Common::EN_ANY,
- Common::kPlatformDOS,
- ADGF_UNSUPPORTED,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_MANHOLE,
- 0,
GF_CD,
- 2, 0,
- },
-
- {
- // The Manhole: New and Enhanced
- {
- "manhole",
- "",
- AD_ENTRY1("manhole.dat", "cb21e31ed35c963208343bc995225b73"),
- Common::EN_ANY,
- Common::kPlatformDOS,
- ADGF_CD,
- GUIO2(GUIO_NOSPEECH, GAMEOPTION_WINDOWS_CURSORS)
- },
- GID_MANHOLE,
- 0,
- GF_CD,
- 2, 0,
- },
-
- {
- // The Manhole (EGA, 5.25")
- {
- "manhole",
- "EGA",
- AD_ENTRY1("manhole.dat", "2b1658292599a861c4cd3cf6cdb3c581"),
- Common::EN_ANY,
- Common::kPlatformDOS,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_MANHOLE,
- 0,
- GF_FLOPPY,
- 1, 0,
- },
-
- {
- // The Manhole
- {
- "manhole",
- "",
- AD_ENTRY1s("manhole.dat", "2f14b5d87a862aad25701514dc282475", 119667),
- Common::JA_JPN,
- Common::kPlatformFMTowns,
- ADGF_CD | ADGF_UNSTABLE,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_MANHOLE,
- 0,
- GF_CD,
- 3, 0,
- },
-
- {
- // The Manhole DOS/V
- // Platform: IBM PS-55, Sega TeraDrive or DOS/V-compatibles
- // MADE v2.00a JAPAN PC - Copyright (c) 1990, MEDIAGENIC
- {
- "manhole",
- "DOS-V",
- AD_ENTRY1s("manhole.dat", "14522ee9139ca0823ac0cc15805e1fcc", 112303),
- Common::JA_JPN,
- Common::kPlatformDOS,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_MANHOLE,
- 0,
- GF_FLOPPY,
3, 0,
},
- {
- // Leather Goddesses of Phobos 2 (English)
- {
- "lgop2",
- "",
- AD_ENTRY1s("lgop2.dat", "8137996db200ff67e8f172ff106f2e48", 280280),
- Common::EN_ANY,
- Common::kPlatformDOS,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_LGOP2,
- 0,
- GF_FLOPPY,
- 2, 0,
- },
-
- {
- // Leather Goddesses of Phobos 2 (German)
- // Supplied by windlepoons (bug tracker #4218)
- {
- "lgop2",
- "",
- AD_ENTRY1s("lgop2.dat", "a0ffea6a3b7e39bd861edd00c397641c", 299466),
- Common::DE_DEU,
- Common::kPlatformDOS,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_LGOP2,
- 0,
- GF_FLOPPY,
- 2, 0,
- },
-
- {
- // Leather Goddesses of Phobos 2 (French)
- // Supplied by goodoldgeorg (bug tracker #4219)
- {
- "lgop2",
- "",
- AD_ENTRY1s("lgop2.dat", "f9e974087af7cf4b7ec2d8dc45d01e0c", 295366),
- Common::FR_FRA,
- Common::kPlatformDOS,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_LGOP2,
- 0,
- GF_FLOPPY,
- 2, 0,
- },
-
- {
- // Leather Goddesses of Phobos 2 (Spanish)
- // Supplied by goodoldgeorg (bug tracker #4219)
- {
- "lgop2",
- "",
- AD_ENTRY1s("lgop2.dat", "96eb95b4d75b9a3da0b0d67e3b4a787d", 288984),
- Common::ES_ESP,
- Common::kPlatformDOS,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_LGOP2,
- 0,
- GF_FLOPPY,
- 2, 0,
- },
-
- {
- // Rodney's Funscreen
- // MS-DOS, Win16 and Tandy VIS all share the same resource but a different player.
- {
- "rodney",
- "",
- AD_ENTRY1s("rodneys.dat", "a79887dbaa47689facd7c6f09258ba5a", 92990),
- Common::EN_ANY,
- Common::kPlatformDOS,
- ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GAMEOPTION_WINDOWS_CURSORS)
- },
- GID_RODNEY,
- 0,
- GF_FLOPPY,
- 2, 0,
- },
+ /* ************* Richard Scarry's Best... ************* */
{
// Richard Scarry's Best Neighborhood Disc Ever!
@@ -646,7 +659,6 @@ static const MadeGameDescription gameDescriptions[] = {
},
GID_RSBESTNDE,
0,
- 0,
3, 1,
},
@@ -663,11 +675,12 @@ static const MadeGameDescription gameDescriptions[] = {
GUIO0()
},
GID_RSBESTNDE,
- 0,
GF_DEMO,
3, 1,
},
+ /* ************* Richard Scarry's Busiest... ************* */
+
{
// Richard Scarry's Busiest Neighborhood Disc Ever!
// MS-DOS version
@@ -682,11 +695,10 @@ static const MadeGameDescription gameDescriptions[] = {
},
GID_RSBUSYNDE,
0,
- 0,
3, 1,
},
- { AD_TABLE_END_MARKER, 0, 0, 0, 0, 0 }
+ { AD_TABLE_END_MARKER, GID_NONE, 0, 0, 0 }
};
/**
@@ -703,8 +715,7 @@ static MadeGameDescription g_fallbackDesc = {
ADGF_NO_FLAGS,
GUIO0()
},
- 0,
- 0,
+ GID_NONE,
0,
0, 0,
};
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index a850a45007a..63b7cc0952f 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -79,7 +79,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
else
_dat = new GameDatabaseV3();
} else {
- error("Unknown GameID");
+ error("Unknown Game Version");
}
_script = new ScriptInterpreter(this);
@@ -106,10 +106,9 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
// Set default sound frequency
switch (getGameID()) {
- case GID_RODNEY:
- _soundRate = 11025;
- break;
case GID_MANHOLE:
+ case GID_MANHOLE_NE:
+ case GID_RODNEY:
_soundRate = 11025;
break;
case GID_LGOP2:
@@ -460,12 +459,10 @@ Common::Error MadeEngine::run() {
}
} else if (getGameID() == GID_MANHOLE) {
_dat->open("manhole.dat");
-
- if (getVersion() == 2) {
- _res->open("manhole.prj");
- } else {
- _res->openResourceBlocks();
- }
+ _res->openResourceBlocks();
+ } else if (getGameID() == GID_MANHOLE_NE) {
+ _dat->open("manhole.dat");
+ _res->open("manhole.prj");
if (ConfMan.hasKey("windows_cursors") && ConfMan.getBool("windows_cursors"))
loadWin16Cursor("manhole");
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index 2d9b64ea1fd..6e20faa9dc1 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -67,13 +67,14 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) {
_workScreenDrawCtx.destSurface = _workScreen;
_clipArea.destSurface = _workScreen;
- // Screen mask is only needed in v2 games
- if (_vm->getGameID() != GID_RTZ && _vm->getGameID() != GID_RSBESTNDE && _vm->getGameID() != GID_RSBUSYNDE) {
+ // Screen mask is only needed in v1 / v2 games
+ if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_RODNEY) {
_screenMask = new Graphics::Surface();
_screenMask->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
_maskDrawCtx.clipRect = Common::Rect(320, 200);
_maskDrawCtx.destSurface = _screenMask;
- }
+ } else
+ _screenMask = nullptr;
for (int i = 0; i <= 3; i++)
_excludeClipAreaEnabled[i] = false;
@@ -123,15 +124,14 @@ Screen::~Screen() {
delete _backgroundScreen;
delete _workScreen;
- if (_vm->getGameID() != GID_RTZ && _vm->getGameID() != GID_RSBESTNDE && _vm->getGameID() != GID_RSBUSYNDE)
- delete _screenMask;
+ delete _screenMask;
delete _fx;
}
void Screen::clearScreen() {
_backgroundScreen->fillRect(Common::Rect(0, 0, 320, 200), 0);
_workScreen->fillRect(Common::Rect(0, 0, 320, 200), 0);
- if (_vm->getGameID() != GID_RTZ && _vm->getGameID() != GID_RSBESTNDE && _vm->getGameID() != GID_RSBUSYNDE)
+ if (_screenMask)
_screenMask->fillRect(Common::Rect(0, 0, 320, 200), 0);
_mask = 0;
_needPalette = true;
@@ -203,7 +203,7 @@ void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 f
source = (byte *)sourceSurface->getBasePtr(0, startY);
dest = (byte *)clipInfo.destSurface->getBasePtr(x, y);
// only set up maskp if game uses masking and mask requested in f.call
- if (mask && (_vm->getGameID() != GID_RTZ && _vm->getGameID() != GID_RSBESTNDE && _vm->getGameID() != GID_RSBUSYNDE))
+ if (mask && _screenMask)
maskp = (byte *)_maskDrawCtx.destSurface->getBasePtr(x, y);
int32 sourcePitch, linePtrAdd, sourceAdd;
@@ -906,7 +906,7 @@ void Screen::printTextEx(const char *text, int16 x, int16 y, int16 fontNum, int1
setFont(oldFontNum);
_fontDrawCtx = oldFontDrawCtx;
- if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RODNEY) {
+ if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_RODNEY) {
_vm->sayText(text);
}
}
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index 48f49843e24..09cffe934cc 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -135,7 +135,7 @@ void ScriptFunctions::setupExternalsTable() {
External(sfSetSpriteGround);
External(sfLoadResText);
- if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_RODNEY) {
+ if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_RODNEY) {
External(sfAddScreenMask);
External(sfSetSpriteMask);
} else if (_vm->getGameID() == GID_RTZ || _vm->getGameID() == GID_RSBESTNDE || _vm->getGameID() == GID_RSBUSYNDE) {
@@ -147,7 +147,7 @@ void ScriptFunctions::setupExternalsTable() {
External(sfStopSound);
External(sfPlayVoice);
- if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RTZ ||
+ if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_RTZ ||
_vm->getGameID() == GID_RODNEY || _vm->getGameID() == GID_RSBESTNDE || _vm->getGameID() == GID_RSBUSYNDE) {
External(sfPlayCd);
External(sfStopCd);
@@ -446,7 +446,7 @@ int16 ScriptFunctions::sfSetScreenLock(int16 argc, int16 *argv) {
}
int16 ScriptFunctions::sfAddSprite(int16 argc, int16 *argv) {
- if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RODNEY) {
+ if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_RODNEY) {
return _vm->_screen->addToSpriteList(argv[2], argv[1], argv[0]);
} else {
// Unused in RTZ, RSBESTNDE, RSBUSYNDE
@@ -456,7 +456,7 @@ int16 ScriptFunctions::sfAddSprite(int16 argc, int16 *argv) {
int16 ScriptFunctions::sfFreeAnim(int16 argc, int16 *argv) {
_vm->_screen->clearChannels();
- if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RODNEY) {
+ if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_RODNEY) {
_vm->_screen->clearSpriteList();
}
return 0;
@@ -465,7 +465,7 @@ int16 ScriptFunctions::sfFreeAnim(int16 argc, int16 *argv) {
int16 ScriptFunctions::sfDrawSprite(int16 argc, int16 *argv) {
if (_vm->getGameID() == GID_RTZ) {
return _vm->_screen->drawSprite(argv[2], argv[1], argv[0]);
- } else if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RODNEY) {
+ } else if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_RODNEY) {
SpriteListItem item = _vm->_screen->getFromSpriteList(argv[2]);
int16 channelIndex = _vm->_screen->drawSprite(item.index, argv[1] - item.xofs, argv[0] - item.yofs);
_vm->_screen->setChannelUseMask(channelIndex);
@@ -536,7 +536,7 @@ int16 ScriptFunctions::sfDrawText(int16 argc, int16 *argv) {
if (_vm->getGameID() == GID_RTZ) {
text = _vm->_dat->getObjectString(argv[argc - 1]);
- } else if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RODNEY) {
+ } else if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_RODNEY) {
text = _vm->_dat->getString(argv[argc - 1]);
}
// Unused in RSBESTNDE, RSBUSYNDE
Commit: 461cbfcb27162c0f1801e8a4964ad3a1f1f82e90
https://github.com/scummvm/scummvm/commit/461cbfcb27162c0f1801e8a4964ad3a1f1f82e90
Author: Greg Kennedy (kennedy.greg at gmail.com)
Date: 2026-11-20T03:49:35+02:00
Commit Message:
MADE: Add support for The Manhole (English CD)
Additionally, FM TOWNS and DOS-V Japanese ports can run, though less
tested.
This is accomplished by breaking up the V1 openResourceBlocks function
to separate per-block functions and calling them individually as needed.
Also reorganized ScriptFuncs to an early-return flow instead of the
stacked if(), which seemed harder to follow.
Changed paths:
engines/made/made.cpp
engines/made/resource.cpp
engines/made/resource.h
engines/made/scriptfuncs.cpp
engines/made/scriptfuncs.h
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index 63b7cc0952f..4f0160455fc 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -459,14 +459,45 @@ Common::Error MadeEngine::run() {
}
} else if (getGameID() == GID_MANHOLE) {
_dat->open("manhole.dat");
- _res->openResourceBlocks();
+
+ // the various Manhole versions have different combinations of dependencies
+ if (getPlatform() == Common::kPlatformDOS) {
+ if (getFeatures() & GF_FLOPPY) {
+ // English DOS Floppy version
+ _res->openPicsBlock(false);
+ _res->openMusicBlock();
+ _res->openSndsBlock();
+ } else {
+ // English DOS CD version - snds come from the CD tracks
+ _res->openPicsBlock(true);
+ _res->openMusicBlock();
+ }
+ } else if (getPlatform() == Common::kPlatformFMTowns) {
+ // Japanese FM Towns version - music comes from the CD tracks
+ _res->openPicsBlock(true);
+ _res->openSndsBlock();
+ } else {
+ // Japanese PC-98 version - PICS block is split in two with a separate Index
+ // This file is also packed, and thus unsupported at all.
+ _res->openPicsBlock(false);
+ _res->openMusicBlock();
+ _res->openSndsBlock();
+ }
} else if (getGameID() == GID_MANHOLE_NE) {
_dat->open("manhole.dat");
- _res->open("manhole.prj");
- if (ConfMan.hasKey("windows_cursors") && ConfMan.getBool("windows_cursors"))
- loadWin16Cursor("manhole");
+ if (getLanguage() == Common::JA_JPN) {
+ // Japanese DOS-V version
+ _res->openPicsBlock(true);
+ _res->openMusicBlock();
+ _res->openSndsBlock();
+ } else {
+ // English DOS / Windows / VIS
+ _res->open("manhole.prj");
+ if (ConfMan.hasKey("windows_cursors") && ConfMan.getBool("windows_cursors"))
+ loadWin16Cursor("manhole");
+ }
} else if (getGameID() == GID_LGOP2) {
_dat->open("lgop2.dat");
_res->open("lgop2.prj");
diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp
index e6a0ef9d979..a66c859212b 100644
--- a/engines/made/resource.cpp
+++ b/engines/made/resource.cpp
@@ -81,7 +81,7 @@ void PictureResource::loadRaw(byte *source, int size) {
uint16 width = sourceS->readUint16LE();
uint16 height = sourceS->readUint16LE();
- if (cmdFlags || pixelFlags || maskFlags) {
+ if (cmdFlags || (pixelFlags & 0xFD) || (maskFlags & 0xFD)) {
warning("PictureResource::loadRaw() Graphic has flags set (%d, %d, %d)", cmdFlags, pixelFlags, maskFlags);
}
@@ -439,18 +439,25 @@ void ResourceReader::open(const char *filename) {
}
// V1
-void ResourceReader::openResourceBlocks() {
+void ResourceReader::openPicsBlock(bool altFormat) {
_isV1 = true;
_fdPics = new Common::File();
- _fdSounds = new Common::File();
+ openResourceBlock("pics.blk", _fdPics, kResFLEX, altFormat);
+}
+
+void ResourceReader::openMusicBlock() {
+ _isV1 = true;
_fdMusic = new Common::File();
+ openResourceBlock("music.blk", _fdMusic, kResMIDI, false);
+}
- openResourceBlock("pics.blk", _fdPics, kResFLEX);
- openResourceBlock("snds.blk", _fdSounds, kResSNDS);
- openResourceBlock("music.blk", _fdMusic, kResMIDI);
+void ResourceReader::openSndsBlock() {
+ _isV1 = true;
+ _fdSounds = new Common::File();
+ openResourceBlock("snds.blk", _fdSounds, kResSNDS, false);
}
-void ResourceReader::openResourceBlock(const char *filename, Common::File *blockFile, uint32 resType) {
+void ResourceReader::openResourceBlock(const char *filename, Common::File *blockFile, uint32 resType, bool altFormat) {
if (!blockFile->open(filename))
error("Failed to open '%s'", filename);
@@ -468,8 +475,13 @@ void ResourceReader::openResourceBlock(const char *filename, Common::File *block
for (uint16 i = 0; i < count; i++) {
uint32 offset = blockFile->readUint32LE();
- blockFile->readUint32LE();
+ blockFile->readUint32LE(); // always 0
uint32 size = blockFile->readUint32LE();
+ if (altFormat) {
+ // always a duplicate of Size -
+ // maybe there were once plans for a compression scheme here
+ blockFile->readUint32LE();
+ }
_resSlots[resType]->push_back(ResourceSlot(offset, size));
}
}
diff --git a/engines/made/resource.h b/engines/made/resource.h
index 469157a74b8..4072a43d948 100644
--- a/engines/made/resource.h
+++ b/engines/made/resource.h
@@ -191,7 +191,10 @@ public:
~ResourceReader();
void open(const char *filename);
- void openResourceBlocks();
+
+ void openPicsBlock(bool altFormat);
+ void openMusicBlock();
+ void openSndsBlock();
PictureResource *getPicture(int index);
AnimationResource *getAnimation(int index);
@@ -211,7 +214,7 @@ protected:
typedef Common::Array<ResourceSlot> ResourceSlots;
typedef Common::HashMap<uint32, ResourceSlots *> ResMap;
- void openResourceBlock(const char *filename, Common::File *blockFile, uint32 resType);
+ void openResourceBlock(const char *filename, Common::File *blockFile, uint32 resType, bool altFormat);
ResMap _resSlots;
int _cacheCount;
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index 09cffe934cc..dda003c474a 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -87,6 +87,7 @@ typedef Common::Functor2Mem<int16, int16*, int16, ScriptFunctions> ExternalScrip
_externalFuncNames.push_back(#x);
void ScriptFunctions::setupExternalsTable() {
+ // ALL MADE engines have these first functions
External(sfSystemCall);
External(sfInitGraf);
External(sfRestoreGraf);
@@ -111,12 +112,41 @@ void ScriptFunctions::setupExternalsTable() {
External(sfHideMouseCursor);
External(sfShowMouseCursor);
External(sfGetMusicBeat);
+
+ // MANHOLE Floppy has nothing further.
+ if (_vm->getGameID() == GID_MANHOLE && (_vm->getFeatures() & GF_FLOPPY))
+ return;
+
+ // all others have at least this:
External(sfSetScreenLock);
+
+ if (_vm->getGameID() == GID_MANHOLE) {
+ if (_vm->getPlatform() == Common::kPlatformDOS) {
+ // MANHOLE CD has cd playback functions next:
+ External(sfPlayCd);
+ External(sfStopCd);
+ External(sfGetCdStatus);
+ External(sfGetCdTime);
+ } else {
+ // FM TOWNS ver. has its own special funcs here
+ External(sfPlayMusic); // again??
+ External(sfUnknown); // LoadPCM
+ External(sfUnknown); // FlushPCM
+ External(sfPlayMusic); // a third one...
+ }
+ return;
+ }
+
+ // V2+ games follow.
External(sfAddSprite);
External(sfFreeAnim);
External(sfDrawSprite);
External(sfEraseSprites);
External(sfUpdateSprites);
+ // MANHOLE:NE DOS-V exits here.
+ if (_vm->getGameID() == GID_MANHOLE_NE && _vm->getLanguage() == Common::JA_JPN)
+ return;
+
External(sfGetTimer);
External(sfSetTimer);
External(sfResetTimer);
@@ -147,66 +177,71 @@ void ScriptFunctions::setupExternalsTable() {
External(sfStopSound);
External(sfPlayVoice);
- if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_RTZ ||
- _vm->getGameID() == GID_RODNEY || _vm->getGameID() == GID_RSBESTNDE || _vm->getGameID() == GID_RSBUSYNDE) {
- External(sfPlayCd);
- External(sfStopCd);
- External(sfGetCdStatus);
- External(sfGetCdTime);
- External(sfPlayCdSegment);
- }
-
- if (_vm->getGameID() == GID_RTZ || _vm->getGameID() == GID_RSBESTNDE || _vm->getGameID() == GID_RSBUSYNDE) {
- External(sfPrintf);
- External(sfClearMono);
- External(sfGetSoundEnergy);
- External(sfClearText);
- External(sfAnimText);
- External(sfGetTextWidth);
- External(sfPlayMovie);
- External(sfLoadSound);
- External(sfLoadMusic);
- External(sfLoadPicture);
- External(sfSetMusicVolume);
- External(sfRestartEvents);
- External(sfPlaceSprite);
- External(sfPlaceText);
- External(sfDeleteChannel);
- External(sfGetChannelType);
- External(sfSetChannelState);
- External(sfSetChannelLocation);
- External(sfSetChannelContent);
- External(sfSetExcludeArea);
- External(sfSetSpriteExclude);
- External(sfGetChannelState);
- External(sfPlaceAnim);
- External(sfSetAnimFrame);
- External(sfGetAnimFrame);
- External(sfGetAnimFrameCount);
- External(sfGetPictureWidth);
- External(sfGetPictureHeight);
- External(sfSetSoundRate);
- External(sfDrawAnimPic);
- External(sfLoadAnim);
- External(sfReadText);
- External(sfReadMenu);
- External(sfDrawMenu);
- External(sfGetMenuCount);
- External(sfSaveGame);
- External(sfLoadGame);
- External(sfGetGameDescription);
- External(sfShakeScreen);
- External(sfPlaceMenu);
- External(sfSetSoundVolume);
- External(sfGetSynthType);
- External(sfIsSlowSystem);
- }
-
- if (_vm->getGameID() == GID_RSBESTNDE || _vm->getGameID() == GID_RSBUSYNDE) {
- External(sfMovieCall);
- External(sfCursorXY);
- External(sfSoundFile);
- }
+ // LGOP2 has no CD functions.
+ if (_vm->getGameID() == GID_LGOP2)
+ return;
+
+ External(sfPlayCd);
+ External(sfStopCd);
+ External(sfGetCdStatus);
+ External(sfGetCdTime);
+ External(sfPlayCdSegment);
+
+ // return here for RODNEY and MANHOLE_NE
+ if (_vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_RODNEY)
+ return;
+
+ External(sfPrintf);
+ External(sfClearMono);
+ External(sfGetSoundEnergy);
+ External(sfClearText);
+ External(sfAnimText);
+ External(sfGetTextWidth);
+ External(sfPlayMovie);
+ External(sfLoadSound);
+ External(sfLoadMusic);
+ External(sfLoadPicture);
+ External(sfSetMusicVolume);
+ External(sfRestartEvents);
+ External(sfPlaceSprite);
+ External(sfPlaceText);
+ External(sfDeleteChannel);
+ External(sfGetChannelType);
+ External(sfSetChannelState);
+ External(sfSetChannelLocation);
+ External(sfSetChannelContent);
+ External(sfSetExcludeArea);
+ External(sfSetSpriteExclude);
+ External(sfGetChannelState);
+ External(sfPlaceAnim);
+ External(sfSetAnimFrame);
+ External(sfGetAnimFrame);
+ External(sfGetAnimFrameCount);
+ External(sfGetPictureWidth);
+ External(sfGetPictureHeight);
+ External(sfSetSoundRate);
+ External(sfDrawAnimPic);
+ External(sfLoadAnim);
+ External(sfReadText);
+ External(sfReadMenu);
+ External(sfDrawMenu);
+ External(sfGetMenuCount);
+ External(sfSaveGame);
+ External(sfLoadGame);
+ External(sfGetGameDescription);
+ External(sfShakeScreen);
+ External(sfPlaceMenu);
+ External(sfSetSoundVolume);
+ External(sfGetSynthType);
+ External(sfIsSlowSystem);
+
+ // v3 finished
+ if (_vm->getGameID() == GID_RTZ && _vm->getPlatform() == Common::kPlatformDOS)
+ return;
+
+ External(sfMovieCall);
+ External(sfCursorXY);
+ External(sfSoundFile);
}
#undef External
@@ -1236,4 +1271,15 @@ int16 ScriptFunctions::sfSoundFile(int16 argc, int16 *argv) {
return 0;
}
+// ///////////////////////////////////////
+
+int16 ScriptFunctions::sfUnknown(int16 argc, int16 *argv) {
+ // This is a placeholder for an unknown function.
+ // It prints argc and argv.
+ warning("Unknown script function called: argc=%d", argc);
+ for (int i = 0; i < argc; i++)
+ warning(" argv[%d] = %d", i, argv[i]);
+ return 0;
+}
+
} // End of namespace Made
diff --git a/engines/made/scriptfuncs.h b/engines/made/scriptfuncs.h
index 82df6b936c8..cd032fc70f6 100644
--- a/engines/made/scriptfuncs.h
+++ b/engines/made/scriptfuncs.h
@@ -180,6 +180,8 @@ protected:
int16 sfMovieCall(int16 argc, int16 *argv);
int16 sfCursorXY(int16 argc, int16 *argv);
int16 sfSoundFile(int16 argc, int16 *argv);
+
+ int16 sfUnknown(int16 argc, int16 *argv);
};
} // End of namespace Made
Commit: 8b6e7fb75d74987ea68f798b29ba9567f3343699
https://github.com/scummvm/scummvm/commit/8b6e7fb75d74987ea68f798b29ba9567f3343699
Author: Greg Kennedy (kennedy.greg at gmail.com)
Date: 2026-11-20T03:49:35+02:00
Commit Message:
MADE: clean objects in database destruction, Manhole changes
Some fixes based on PR feedback:
* Delete game object classes when tearing down the GameDatabase
* Move "The Manhole" DOS/V to `manhole` game ID, all v1.0 games should be grouped together
* Fix "unknown" script functions for FM Towns version (CD playback)
Changed paths:
engines/made/database.cpp
engines/made/database.h
engines/made/detection_tables.h
engines/made/made.cpp
engines/made/scriptfuncs.cpp
diff --git a/engines/made/database.cpp b/engines/made/database.cpp
index 945958743e7..74dae62d0c0 100644
--- a/engines/made/database.cpp
+++ b/engines/made/database.cpp
@@ -75,7 +75,7 @@ const char *Object::getString() const {
return (const char *)getData();
else {
warning("getString() called on non-byte-array object (%04X)", getClass());
- return nullptr;
+ return "";
}
}
@@ -292,6 +292,11 @@ uint16 ObjectV3_1::calcSize(const byte *source) {
GameDatabase::GameDatabase() : _mainCodeObjectIndex(0) {}
+GameDatabase::~GameDatabase() {
+ for (uint i = 0; i < _objects.size(); ++i)
+ delete _objects[i];
+}
+
void GameDatabase::open(const char *filename) {
debug(1, "GameDatabase::open() Loading from %s", filename);
_filename = filename;
@@ -363,7 +368,7 @@ const char *GameDatabase::getObjectString(int16 index) const {
if (obj)
return obj->getString();
else
- return nullptr;
+ return "";
}
void GameDatabase::setObjectString(int16 index, const char *str) {
@@ -520,7 +525,7 @@ int16 GameDatabaseV1::savegame(const char *filename, const char *description, in
int16 GameDatabaseV1::loadgame(const char *filename, int16 version) {
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
- if (in == nullptr) {
+ if (!in) {
warning("Can't open file '%s', game not loaded", filename);
return 1;
}
@@ -632,7 +637,7 @@ void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) {
textOffs = sourceS.readUint16LE() * 512;
objectCount = sourceS.readUint16LE();
varObjectCount = sourceS.readUint16LE();
- uint16 _gameStateSize = sourceS.readUint16LE() * 2;
+ uint16 gameStateSize = sourceS.readUint16LE() * 2;
sourceS.readUint16LE(); // unknown
objectsOffs = sourceS.readUint16LE() * 512;
sourceS.readUint16LE(); // unknown
@@ -642,10 +647,10 @@ void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) {
textSize = objectsOffs - textOffs;
- debug(0, "textOffs = %08X; textSize = %08X; objectCount = %d; varObjectCount = %d; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d; _mainCodeObjectIndex = %04X\n", textOffs, textSize, objectCount, varObjectCount, _gameStateSize, objectsOffs, objectsSize, _mainCodeObjectIndex);
+ debug(0, "textOffs = %08X; textSize = %08X; objectCount = %d; varObjectCount = %d; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d; _mainCodeObjectIndex = %04X\n", textOffs, textSize, objectCount, varObjectCount, gameStateSize, objectsOffs, objectsSize, _mainCodeObjectIndex);
// V2 gamestate is initialized to all 0, and with a dummy element at idx = 0
- _gameState.resize(_gameStateSize + 2, 0);
+ _gameState.resize(gameStateSize + 2, 0);
setVar(1, objectCount);
sourceS.seek(textOffs);
@@ -691,14 +696,14 @@ void GameDatabaseV3::load(Common::SeekableReadStream &sourceS) {
uint32 objectIndexOffs = sourceS.readUint32LE();
uint16 objectCount = sourceS.readUint16LE();
_gameStateOffs = sourceS.readUint32LE();
- uint32 _gameStateSize = sourceS.readUint32LE();
+ uint32 gameStateSize = sourceS.readUint32LE();
uint32 objectsOffs = sourceS.readUint32LE();
uint32 objectsSize = sourceS.readUint32LE();
_mainCodeObjectIndex = sourceS.readUint16LE();
- debug(2, "objectIndexOffs = %08X; objectCount = %d; gameStateOffs = %08X; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d; _mainCodeObjectIndex = %04X\n", objectIndexOffs, objectCount, _gameStateOffs, _gameStateSize, objectsOffs, objectsSize, _mainCodeObjectIndex);
+ debug(2, "objectIndexOffs = %08X; objectCount = %d; gameStateOffs = %08X; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d; _mainCodeObjectIndex = %04X\n", objectIndexOffs, objectCount, _gameStateOffs, gameStateSize, objectsOffs, objectsSize, _mainCodeObjectIndex);
- _gameState.resize(_gameStateSize, 0);
+ _gameState.resize(gameStateSize, 0);
reloadFromStream(sourceS);
Common::Array<uint32> objectOffsets;
@@ -735,7 +740,7 @@ void GameDatabaseV3::reloadFromStream(Common::SeekableReadStream &sourceS) {
bool GameDatabaseV3::getSavegameDescription(const char *filename, Common::String &description, int16 version) {
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
- if (in == nullptr) {
+ if (!in) {
return false;
}
diff --git a/engines/made/database.h b/engines/made/database.h
index 1be84083165..7e599c606b5 100644
--- a/engines/made/database.h
+++ b/engines/made/database.h
@@ -40,7 +40,7 @@ class MadeEngine;
class Object {
public:
Object();
- ~Object();
+ virtual ~Object();
virtual int load(Common::SeekableReadStream &source) = 0;
virtual int save(Common::WriteStream &dest) const;
@@ -121,7 +121,7 @@ class GameDatabase {
public:
GameDatabase();
- virtual ~GameDatabase() = default;
+ virtual ~GameDatabase();
void open(const char *filename);
void openFromRed(const char *redFilename, const char *filename);
diff --git a/engines/made/detection_tables.h b/engines/made/detection_tables.h
index 042f0cc972f..08069ec5a9d 100644
--- a/engines/made/detection_tables.h
+++ b/engines/made/detection_tables.h
@@ -83,7 +83,7 @@ static const MadeGameDescription gameDescriptions[] = {
{
// The Manhole (FM Towns, CD-ROM) 1990
- // In fact, this is the NE version, but not labeled as such
+ // This version was later relabeled "New & Enhanced" and re-released in the US
{
"manhole",
"",
@@ -98,6 +98,24 @@ static const MadeGameDescription gameDescriptions[] = {
1, 0,
},
+ {
+ // The Manhole, DOS/V, file dates 2/21/1992
+ // Platform: IBM PS-55, Sega TeraDrive or DOS/V-compatibles
+ // MADE v2.00a JAPAN PC - Copyright (c) 1990, MEDIAGENIC
+ {
+ "manhole",
+ "DOS-V",
+ AD_ENTRY1s("manhole.dat", "14522ee9139ca0823ac0cc15805e1fcc", 112303),
+ Common::JA_JPN,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOSPEECH)
+ },
+ GID_MANHOLE,
+ GF_FLOPPY,
+ 1, 0,
+ },
+
{
// The Manhole: New and Enhanced (MS-DOS) 1992
// MS-DOS, Win16 and Tandy VIS all share the same resource but a different player.
@@ -115,24 +133,6 @@ static const MadeGameDescription gameDescriptions[] = {
2, 0,
},
- {
- // The Manhole: NE, DOS/V, file dates 2/21/1992
- // Platform: IBM PS-55, Sega TeraDrive or DOS/V-compatibles
- // MADE v2.00a JAPAN PC - Copyright (c) 1990, MEDIAGENIC
- {
- "manholene",
- "DOS-V",
- AD_ENTRY1s("manhole.dat", "14522ee9139ca0823ac0cc15805e1fcc", 112303),
- Common::JA_JPN,
- Common::kPlatformDOS,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NOSPEECH)
- },
- GID_MANHOLE_NE,
- GF_FLOPPY,
- 1, 0,
- },
-
// The Manhole: Masterpiece Edition is not a MADE engine and cannot be
// supported by MADE. It is a HyperCard-like engine
{
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index 4f0160455fc..6dc1e7f790d 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -461,7 +461,7 @@ Common::Error MadeEngine::run() {
_dat->open("manhole.dat");
// the various Manhole versions have different combinations of dependencies
- if (getPlatform() == Common::kPlatformDOS) {
+ if (getLanguage() == Common::EN_ANY) {
if (getFeatures() & GF_FLOPPY) {
// English DOS Floppy version
_res->openPicsBlock(false);
@@ -472,32 +472,30 @@ Common::Error MadeEngine::run() {
_res->openPicsBlock(true);
_res->openMusicBlock();
}
- } else if (getPlatform() == Common::kPlatformFMTowns) {
- // Japanese FM Towns version - music comes from the CD tracks
- _res->openPicsBlock(true);
- _res->openSndsBlock();
} else {
- // Japanese PC-98 version - PICS block is split in two with a separate Index
- // This file is also packed, and thus unsupported at all.
- _res->openPicsBlock(false);
- _res->openMusicBlock();
- _res->openSndsBlock();
+ if (getPlatform() == Common::kPlatformDOS) {
+ // Japanese DOS-V version
+ _res->openPicsBlock(true);
+ _res->openMusicBlock();
+ _res->openSndsBlock();
+ } else if (getPlatform() == Common::kPlatformFMTowns) {
+ // Japanese FM Towns version - music comes from the CD tracks
+ _res->openPicsBlock(true);
+ _res->openSndsBlock();
+ } else {
+ // Japanese PC-98 version - PICS block is split in two with a separate Index
+ // This file is also packed, and thus unsupported at all.
+ _res->openPicsBlock(false);
+ _res->openMusicBlock();
+ _res->openSndsBlock();
+ }
}
} else if (getGameID() == GID_MANHOLE_NE) {
_dat->open("manhole.dat");
+ _res->open("manhole.prj");
- if (getLanguage() == Common::JA_JPN) {
- // Japanese DOS-V version
- _res->openPicsBlock(true);
- _res->openMusicBlock();
- _res->openSndsBlock();
- } else {
- // English DOS / Windows / VIS
- _res->open("manhole.prj");
-
- if (ConfMan.hasKey("windows_cursors") && ConfMan.getBool("windows_cursors"))
- loadWin16Cursor("manhole");
- }
+ if (ConfMan.hasKey("windows_cursors") && ConfMan.getBool("windows_cursors"))
+ loadWin16Cursor("manhole");
} else if (getGameID() == GID_LGOP2) {
_dat->open("lgop2.dat");
_res->open("lgop2.prj");
@@ -507,7 +505,6 @@ Common::Error MadeEngine::run() {
if (ConfMan.hasKey("windows_cursors") && ConfMan.getBool("windows_cursors"))
loadWin16Cursor("rodneys");
-
} else if (getGameID() == GID_RSBESTNDE) {
if (getFeatures() & GF_DEMO) {
_dat->open("bestdemo.dat");
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index dda003c474a..acb9ce9d25e 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -113,27 +113,22 @@ void ScriptFunctions::setupExternalsTable() {
External(sfShowMouseCursor);
External(sfGetMusicBeat);
- // MANHOLE Floppy has nothing further.
- if (_vm->getGameID() == GID_MANHOLE && (_vm->getFeatures() & GF_FLOPPY))
+ // MANHOLE ENG Floppy has nothing further.
+ if (_vm->getGameID() == GID_MANHOLE && _vm->getLanguage() == Common::EN_ANY && (_vm->getFeatures() & GF_FLOPPY))
return;
// all others have at least this:
External(sfSetScreenLock);
- if (_vm->getGameID() == GID_MANHOLE) {
- if (_vm->getPlatform() == Common::kPlatformDOS) {
- // MANHOLE CD has cd playback functions next:
- External(sfPlayCd);
- External(sfStopCd);
- External(sfGetCdStatus);
- External(sfGetCdTime);
- } else {
- // FM TOWNS ver. has its own special funcs here
- External(sfPlayMusic); // again??
- External(sfUnknown); // LoadPCM
- External(sfUnknown); // FlushPCM
- External(sfPlayMusic); // a third one...
- }
+ if (_vm->getGameID() == GID_MANHOLE && (_vm->getFeatures() & GF_CD)) {
+ // MANHOLE CD versions have cd playback functions next:
+ External(sfPlayCd);
+ External(sfStopCd);
+ External(sfGetCdStatus);
+ External(sfGetCdTime);
+
+ // some versions (e.g. FM Towns) use sfPlayCDSegment for interruptable sounds (?)
+ External(sfPlayCdSegment);
return;
}
@@ -143,8 +138,8 @@ void ScriptFunctions::setupExternalsTable() {
External(sfDrawSprite);
External(sfEraseSprites);
External(sfUpdateSprites);
- // MANHOLE:NE DOS-V exits here.
- if (_vm->getGameID() == GID_MANHOLE_NE && _vm->getLanguage() == Common::JA_JPN)
+ // MANHOLE DOS-V exits here. (Should be no other GID_MANHOLE left to handle)
+ if (_vm->getGameID() == GID_MANHOLE)
return;
External(sfGetTimer);
@@ -165,7 +160,7 @@ void ScriptFunctions::setupExternalsTable() {
External(sfSetSpriteGround);
External(sfLoadResText);
- if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_RODNEY) {
+ if (_vm->getGameID() == GID_MANHOLE_NE || _vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_RODNEY) {
External(sfAddScreenMask);
External(sfSetSpriteMask);
} else if (_vm->getGameID() == GID_RTZ || _vm->getGameID() == GID_RSBESTNDE || _vm->getGameID() == GID_RSBUSYNDE) {
@@ -827,9 +822,9 @@ int16 ScriptFunctions::sfGetCdTime(int16 argc, int16 *argv) {
}
int16 ScriptFunctions::sfPlayCdSegment(int16 argc, int16 *argv) {
- // Never used in LGOP2, RTZ, Manhole:NE, Rodney
- warning("Unimplemented opcode: sfPlayCdSegment");
- return 0;
+ // Used in (at least) The Manhole for FM Towns
+ // This seems to also play a CD track, unknown what (if any) other differences exist.
+ return sfPlayCd(argc, argv);
}
int16 ScriptFunctions::sfPrintf(int16 argc, int16 *argv) {
More information about the Scummvm-git-logs
mailing list