diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index 80e9b23406d..e7391c33459 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -255,12 +255,26 @@ DetectedGames AdvancedMetaEngineDetection::detectGames(const Common::FSList &fsl if (!foundKnownGames) { // Use fallback detector if there were no matches by other means - ADDetectedGame fallbackDetectionResult = fallbackDetect(allFiles, fslist); + ADDetectedGameExtraInfo *extraInfo = nullptr; + ADDetectedGame fallbackDetectionResult = fallbackDetect(allFiles, fslist, &extraInfo); if (fallbackDetectionResult.desc) { DetectedGame fallbackDetectedGame = toDetectedGame(fallbackDetectionResult); fallbackDetectedGame.preferredTarget += "-fallback"; + // if we have extraInfo here + if (extraInfo != nullptr) { + // if we have specified game name or targetID, then we replace the original one + // maybe we need to use generatePreferredTarget to generate it + if (!extraInfo->gameName.empty()) + fallbackDetectedGame.description = extraInfo->gameName; + if (!extraInfo->targetID.empty()) + fallbackDetectedGame.preferredTarget = extraInfo->targetID; + + // then it's our duty to free it + delete extraInfo; + } + detectedGames.push_back(fallbackDetectedGame); } } diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index dff8f9474f5..64eb74d3493 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -164,8 +164,8 @@ struct ADGameDescription { * struct which saved extra information for detected games */ struct ADDetectedGameExtraInfo { - const char *gameName; /*!< Extra info which saved game name */ - const char *targetID; /*!< targetID which will be used on preferred target id */ + Common::String gameName; /*!< Extra info which saved game name */ + Common::String targetID; /*!< targetID which will be used on preferred target id */ }; /**