[Scummvm-git-logs] scummvm master -> 36f016876d230db78d144afb447ce0e9e37c1825

mduggan mgithub at guarana.org
Thu Jul 22 09:54:42 UTC 2021


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

Summary:
5c3fc6b146 ULTIMA8: Add more sanity checks on Flex file loading
5fbb40aa08 ULTIMA8: Correct intrinsic mappings for Remorse ES and Demo versions
36f016876d ULTIMA: Add detection entries for other Crusader No Remorse variants


Commit: 5c3fc6b14665b38cc4e406ea02a5ece57789fdc4
    https://github.com/scummvm/scummvm/commit/5c3fc6b14665b38cc4e406ea02a5ece57789fdc4
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-22T17:29:14+09:00

Commit Message:
ULTIMA8: Add more sanity checks on Flex file loading

Also define some constants to reduce the magic numbers in this file.

Changed paths:
    engines/ultima/ultima8/filesys/flex_file.cpp


diff --git a/engines/ultima/ultima8/filesys/flex_file.cpp b/engines/ultima/ultima8/filesys/flex_file.cpp
index 43aede1dc1..1657f59ab3 100644
--- a/engines/ultima/ultima8/filesys/flex_file.cpp
+++ b/engines/ultima/ultima8/filesys/flex_file.cpp
@@ -26,13 +26,29 @@
 namespace Ultima {
 namespace Ultima8 {
 
+static const int FLEX_TABLE_OFFSET = 0x80;
+static const int FLEX_HDR_SIZE = 0x52;
+static const char FLEX_HDR_PAD = 0x1A;
+
 FlexFile::FlexFile(Common::SeekableReadStream *rs) : _rs(rs), _count(0) {
 	_valid = isFlexFile(_rs);
 
 	if (_valid) {
-		_rs->seek(0x54);
+		_rs->seek(FLEX_HDR_SIZE + 2);
 		_count = _rs->readUint32LE();
 	}
+	if (_count > 4095) {
+		// In practice the largest flex in either Crusader or U8 games has
+		// 3074 entries, so this seems invalid.
+		warning("Flex invalid: improbable number of entries %d", _count);
+		_valid = false;
+		_count = 0;
+	}
+	if (rs->size() < FLEX_TABLE_OFFSET + 8 * _count) {
+		warning("Flex invalid: stream not long enough for offset table");
+		_valid = false;
+		_count = 0;
+	}
 }
 
 FlexFile::~FlexFile() {
@@ -43,16 +59,16 @@ FlexFile::~FlexFile() {
 bool FlexFile::isFlexFile(Common::SeekableReadStream *_rs) {
 	_rs->seek(0);
 	int i;
-	char buf[0x52];
-	_rs->read(buf, 0x52);
+	char buf[FLEX_HDR_SIZE];
+	_rs->read(buf, FLEX_HDR_SIZE);
 
-	for (i = 0; i < 0x52; ++i) {
-		if (buf[i] == 0x1A) break;
+	for (i = 0; i < FLEX_HDR_SIZE; ++i) {
+		if (buf[i] == FLEX_HDR_PAD) break;
 	}
 
-	if (i < 0x52) {
-		for (++i; i < 0x52; ++i) {
-			if (buf[i] != 0x1A) return false;
+	if (i < FLEX_HDR_SIZE) {
+		for (++i; i < FLEX_HDR_SIZE; ++i) {
+			if (buf[i] != FLEX_HDR_PAD) return false;
 		}
 		return true;
 	}
@@ -60,7 +76,7 @@ bool FlexFile::isFlexFile(Common::SeekableReadStream *_rs) {
 }
 
 uint32 FlexFile::getOffset(uint32 index) {
-	_rs->seek(0x80 + 8 * index);
+	_rs->seek(FLEX_TABLE_OFFSET + 8 * index);
 	return _rs->readUint32LE();
 }
 
@@ -86,7 +102,7 @@ uint8 *FlexFile::getObject(uint32 index, uint32 *sizep) {
 uint32 FlexFile::getSize(uint32 index) const {
 	if (index >= _count) return 0;
 
-	_rs->seek(0x84 + 8 * index);
+	_rs->seek(FLEX_TABLE_OFFSET + 4 + 8 * index);
 	uint32 length = _rs->readUint32LE();
 
 	return length;


Commit: 5fbb40aa0867f550fc90231d45ae5d8a16904303
    https://github.com/scummvm/scummvm/commit/5fbb40aa0867f550fc90231d45ae5d8a16904303
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-22T18:44:30+09:00

Commit Message:
ULTIMA8: Correct intrinsic mappings for Remorse ES and Demo versions

Changed paths:
    engines/ultima/ultima8/usecode/remorse_intrinsics.h


diff --git a/engines/ultima/ultima8/usecode/remorse_intrinsics.h b/engines/ultima/ultima8/usecode/remorse_intrinsics.h
index 8ebd305e6c..bb91dda2f2 100644
--- a/engines/ultima/ultima8/usecode/remorse_intrinsics.h
+++ b/engines/ultima/ultima8/usecode/remorse_intrinsics.h
@@ -567,7 +567,7 @@ Intrinsic RemorseDemoIntrinsics[] = {
 	World::I_setAlertActive,
 	Item::I_equip,
 	World::I_clrAlertActive,
-	Ultima8Engine::I_setAvatarInStasis,
+	Ultima8Engine::I_getAvatarInStasis,
 	MainActor::I_addItemCru,
 	Actor::I_getLastAnimSet,
 	Item::I_setQuality,
@@ -720,6 +720,7 @@ Intrinsic RemorseEsIntrinsics[] = {
 	AudioProcess::I_playSFXCru,
 	World::I_getAlertActive,
 	Item::I_getStatus,
+	// 0x010
 	Item::I_orStatus,
 	Item::I_equip,
 	Item::I_isPartlyOnScreen,
@@ -736,6 +737,7 @@ Intrinsic RemorseEsIntrinsics[] = {
 	Item::I_explode,
 	Item::I_legalCreateAtCoords,
 	Item::I_andStatus,
+	// 0x020
 	World::I_getControlledNPCNum,
 	Actor::I_getDir,
 	Actor::I_getLastAnimSet,
@@ -752,6 +754,7 @@ Intrinsic RemorseEsIntrinsics[] = {
 	Item::I_hurl,
 	World::I_gameDifficulty,
 	AudioProcess::I_playAmbientSFXCru,
+	// 0x030
 	Item::I_isCompletelyOn,
 	UCMachine::I_true,
 	Container::I_destroyContents,
@@ -768,6 +771,7 @@ Intrinsic RemorseEsIntrinsics[] = {
 	Actor::I_isKneeling,
 	Actor::I_doAnim,
 	MainActor::I_addItemCru,
+	// 0x040
 	AudioProcess::I_stopSFXCru,
 	Actor::I_isDead,
 	AudioProcess::I_isSFXPlayingForObject,
@@ -784,6 +788,7 @@ Intrinsic RemorseEsIntrinsics[] = {
 	Item::I_isOn,
 	Item::I_getQHi,
 	Item::I_isOn,
+	// 0x050
 	Item::I_getQHi,
 	Item::I_isOn,
 	Item::I_getQHi,
@@ -891,7 +896,7 @@ Intrinsic RemorseEsIntrinsics[] = {
 	World::I_setAlertActive,
 	Item::I_equip,
 	World::I_clrAlertActive,
-	Ultima8Engine::I_setAvatarInStasis,
+	Ultima8Engine::I_getAvatarInStasis,
 	MainActor::I_addItemCru,
 	Actor::I_getLastAnimSet,
 	Item::I_setQuality,


Commit: 36f016876d230db78d144afb447ce0e9e37c1825
    https://github.com/scummvm/scummvm/commit/36f016876d230db78d144afb447ce0e9e37c1825
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-22T18:48:19+09:00

Commit Message:
ULTIMA: Add detection entries for other Crusader No Remorse variants

Both probably don't work properly - it seems that different variants often have
different ucoffset tables.

Changed paths:
    engines/ultima/detection_tables.h


diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index b5f983fcfa..4fccfad638 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -375,8 +375,8 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 		0
 	},
 
-	// Crusader games use basically the same engine as ultima8, but still
-	// need a lot of work.  All are unstable, some simply crash on startup.
+	// Crusader games use basically the same engine as ultima8, but
+	// are less complete.
 
 	// GOG Crusader - No Remorse (V1.21)
 	{
@@ -408,6 +408,36 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 		0
 	},
 
+	// Crusader - No Remorse (V1.01), unpatched data on the GOG CD image
+	{
+		{
+			"remorse",
+			"",
+			AD_ENTRY1s("eusecode.flx", "8c74327e30088ce93f08a15a7f85b3ce", 418556),
+			Common::EN_ANY,
+			Common::kPlatformDOS,
+			ADGF_UNSTABLE,
+			GUIO1(GUIO_NOMIDI)
+		},
+		GAME_CRUSADER_REM,
+		0
+	},
+
+	// Crusader - No Remorse (French) provided by BeWorld2018
+	{
+		{
+			"remorse",
+			"",
+			AD_ENTRY1s("eusecode.flx", "efbd33d6a5e8f14e9c57f963c3fbe939", 423051),
+			Common::FR_FRA,
+			Common::kPlatformDOS,
+			ADGF_UNSTABLE,
+			GUIO1(GUIO_NOMIDI)
+		},
+		GAME_CRUSADER_REM,
+		0
+	},
+
 	// Crusader - No Remorse (Spanish) provided by Wesker
 	{
 		{




More information about the Scummvm-git-logs mailing list