[Scummvm-git-logs] scummvm master -> 27e339c171f095c04004868d66b8160be4fa7b64
sluicebox
noreply at scummvm.org
Thu Apr 11 14:53:09 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
27e339c171 SCI32: Remove unused SCI3 big endian handling
Commit: 27e339c171f095c04004868d66b8160be4fa7b64
https://github.com/scummvm/scummvm/commit/27e339c171f095c04004868d66b8160be4fa7b64
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-04-11T07:52:15-07:00
Commit Message:
SCI32: Remove unused SCI3 big endian handling
This code anticipated Macintosh SCI3 games, but they do not exist.
Mac versions of SCI3 games are all SCI2.1 Late.
Changed paths:
engines/sci/metaengine.cpp
engines/sci/resource/resource.cpp
engines/sci/resource/resource.h
engines/sci/sci.cpp
diff --git a/engines/sci/metaengine.cpp b/engines/sci/metaengine.cpp
index 05b576f0a48..36c045ac195 100644
--- a/engines/sci/metaengine.cpp
+++ b/engines/sci/metaengine.cpp
@@ -678,7 +678,7 @@ ADDetectedGame SciMetaEngine::fallbackDetectExtern(uint md5Bytes, const FileMap
platform = Common::kPlatformAmiga;
// Determine the game id
- const Common::String sierraGameId = resMan.findSierraGameId(platform == Common::kPlatformMacintosh);
+ const Common::String sierraGameId = resMan.findSierraGameId();
// If we don't have a game id, the game is not SCI
if (sierraGameId.empty())
diff --git a/engines/sci/resource/resource.cpp b/engines/sci/resource/resource.cpp
index 7f280b7718f..442eb5722e7 100644
--- a/engines/sci/resource/resource.cpp
+++ b/engines/sci/resource/resource.cpp
@@ -2983,19 +2983,15 @@ static SciSpan<const byte>::const_iterator findSci0ExportsBlock(const SciSpan<co
// This code duplicates Script::relocateOffsetSci3, but we can't use
// that here since we can't instantiate scripts at this point.
-static int relocateOffsetSci3(const SciSpan<const byte> &buf, uint32 offset, const bool isBE) {
+static int relocateOffsetSci3(const SciSpan<const byte> &buf, uint32 offset) {
int relocStart = buf.getUint32LEAt(8);
int relocCount = buf.getUint16LEAt(18);
SciSpan<const byte>::const_iterator seeker = buf.cbegin() + relocStart;
for (int i = 0; i < relocCount; ++i) {
- const uint32 candidateOffset = isBE ? seeker.getUint32BE() : seeker.getUint32LE();
+ const uint32 candidateOffset = seeker.getUint32LE();
if (candidateOffset == offset) {
- if (isBE) {
- return buf.getUint16BEAt(offset) + (seeker + 4).getUint32BE();
- } else {
- return buf.getUint16LEAt(offset) + (seeker + 4).getUint32LE();
- }
+ return buf.getUint16LEAt(offset) + (seeker + 4).getUint32LE();
}
seeker += 10;
}
@@ -3003,7 +2999,7 @@ static int relocateOffsetSci3(const SciSpan<const byte> &buf, uint32 offset, con
return -1;
}
-reg_t ResourceManager::findGameObject(const bool addSci11ScriptOffset, const bool isBE) {
+reg_t ResourceManager::findGameObject(const bool addSci11ScriptOffset) {
Resource *script = findResource(ResourceId(kResourceTypeScript, 0), false);
if (!script)
@@ -3035,11 +3031,11 @@ reg_t ResourceManager::findGameObject(const bool addSci11ScriptOffset, const boo
return make_reg(1, offset);
} else {
- return make_reg(1, relocateOffsetSci3(*script, 22, isBE));
+ return make_reg(1, relocateOffsetSci3(*script, 22));
}
}
-Common::String ResourceManager::findSierraGameId(const bool isBE) {
+Common::String ResourceManager::findSierraGameId() {
// In SCI0-SCI1, the heap is embedded in the script. In SCI1.1 - SCI2.1,
// it's in a separate heap resource
Resource *heap = nullptr;
@@ -3058,17 +3054,10 @@ Common::String ResourceManager::findSierraGameId(const bool isBE) {
if (!vocab)
return "";
- const uint16 numSelectors = isBE ? vocab->getUint16BEAt(0) : vocab->getUint16LEAt(0);
+ const uint16 numSelectors = vocab->getUint16LEAt(0);
for (uint16 i = 0; i < numSelectors; ++i) {
- uint16 selectorOffset;
- uint16 selectorSize;
- if (isBE) {
- selectorOffset = vocab->getUint16BEAt((i + 1) * sizeof(uint16));
- selectorSize = vocab->getUint16BEAt(selectorOffset);
- } else {
- selectorOffset = vocab->getUint16LEAt((i + 1) * sizeof(uint16));
- selectorSize = vocab->getUint16LEAt(selectorOffset);
- }
+ uint16 selectorOffset = vocab->getUint16LEAt((i + 1) * sizeof(uint16));
+ uint16 selectorSize = vocab->getUint16LEAt(selectorOffset);
Common::String selectorName = Common::String((const char *)vocab->getUnsafeDataAt(selectorOffset + 2, selectorSize), selectorSize);
if (selectorName == "name") {
@@ -3081,14 +3070,14 @@ Common::String ResourceManager::findSierraGameId(const bool isBE) {
if (!heap || nameSelector == -1)
return "";
- int16 gameObjectOffset = findGameObject(false, isBE).getOffset();
+ int16 gameObjectOffset = findGameObject(false).getOffset();
if (!gameObjectOffset)
return "";
int32 offset;
if (getSciVersion() == SCI_VERSION_3) {
- offset = relocateOffsetSci3(*heap, gameObjectOffset + /* base selector offset */ 0x110 + nameSelector * sizeof(uint16), isBE);
+ offset = relocateOffsetSci3(*heap, gameObjectOffset + /* base selector offset */ 0x110 + nameSelector * sizeof(uint16));
} else {
// Seek to the name selector of the first export
SciSpan<const byte>::const_iterator offsetPtr = heap->cbegin() + gameObjectOffset + nameSelector * sizeof(uint16);
diff --git a/engines/sci/resource/resource.h b/engines/sci/resource/resource.h
index cb956a161c2..d0d6a991723 100644
--- a/engines/sci/resource/resource.h
+++ b/engines/sci/resource/resource.h
@@ -469,7 +469,7 @@ public:
/**
* Finds the internal Sierra ID of the current game from script 0.
*/
- Common::String findSierraGameId(const bool isBE);
+ Common::String findSierraGameId();
/**
* Finds the location of the game object from script 0.
@@ -477,7 +477,7 @@ public:
* games. Needs to be false when the heap is accessed directly inside
* findSierraGameId().
*/
- reg_t findGameObject(const bool addSci11ScriptOffset, const bool isBE);
+ reg_t findGameObject(const bool addSci11ScriptOffset);
/**
* Converts a map resource type to our type
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 691b78d62da..52e4664b4a8 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -285,7 +285,7 @@ Common::Error SciEngine::run() {
// Add the after market patches for the specified game, if they exist
_resMan->addNewGMPatch(_gameId);
_resMan->addNewD110Patch(_gameId);
- _gameObjectAddress = _resMan->findGameObject(true, isBE());
+ _gameObjectAddress = _resMan->findGameObject(true);
_scriptPatcher = new ScriptPatcher();
SegManager *segMan = new SegManager(_resMan, _scriptPatcher);
More information about the Scummvm-git-logs
mailing list