aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/detection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/detection.cpp')
-rw-r--r--engines/sci/detection.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index d44835c8c4..62099c1b6b 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -121,7 +121,7 @@ static const PlainGameDescriptor SciGameTitles[] = {
/**
* The fallback game descriptor used by the SCI engine's fallbackDetector.
- * Contents of this struct are to be overwritten by the fallbackDetector.
+ * Contents of this struct are overwritten by the fallbackDetector.
*/
static ADGameDescription s_fallbackDesc = {
"",
@@ -133,6 +133,8 @@ static ADGameDescription s_fallbackDesc = {
Common::GUIO_NONE
};
+static char s_fallbackGameIdBuf[256];
+
static const ADParams detectionParams = {
// Pointer to ADGameDescription or its superset structure
@@ -314,9 +316,12 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
return 0;
}
reg_t game_obj = segMan->lookupScriptExport(0, 0);
- const char *gameId = segMan->getObjectName(game_obj);
- debug(2, "Detected ID: \"%s\" at %04x:%04x", gameId, PRINT_REG(game_obj));
- s_fallbackDesc.gameid = convertSierraGameId(gameId, &s_fallbackDesc.flags, resMan);
+ const char *sierraGameId = segMan->getObjectName(game_obj);
+ debug(2, "Detected ID: \"%s\" at %04x:%04x", sierraGameId, PRINT_REG(game_obj));
+ Common::String gameId = convertSierraGameId(sierraGameId, &s_fallbackDesc.flags, resMan);
+ strncpy(s_fallbackGameIdBuf, gameId.c_str(), sizeof(s_fallbackGameIdBuf) - 1);
+ s_fallbackGameIdBuf[sizeof(s_fallbackGameIdBuf) - 1] = 0; // Make sure string is NULL terminated
+ s_fallbackDesc.gameid = s_fallbackGameIdBuf;
delete segMan;
// Try to determine the game language