AD: Implemented AGDF_WARNING flag

This commit is contained in:
Eugene Sandulenko 2021-04-16 14:14:40 +02:00
parent 0739c1a165
commit ec2a50b746
No known key found for this signature in database
GPG key ID: 014D387312D34F08
5 changed files with 22 additions and 12 deletions

View file

@ -171,7 +171,7 @@ DetectedGame AdvancedMetaEngineDetection::toDetectedGame(const ADDetectedGame &a
extra = desc->extra;
}
DetectedGame game(getEngineId(), desc->gameId, title, desc->language, desc->platform, extra, desc->flags & ADGF_UNSUPPORTED);
DetectedGame game(getEngineId(), desc->gameId, title, desc->language, desc->platform, extra, ((desc->flags & (ADGF_UNSUPPORTED | ADGF_WARNING)) != 0));
game.hasUnknownFiles = adGame.hasUnknownFiles;
game.matchedFiles = adGame.matchedFiles;
game.preferredTarget = generatePreferredTarget(desc, _maxAutogenLength);
@ -183,6 +183,8 @@ DetectedGame AdvancedMetaEngineDetection::toDetectedGame(const ADDetectedGame &a
game.gameSupportLevel = kTestingGame;
else if (desc->flags & ADGF_UNSUPPORTED)
game.gameSupportLevel = kUnsupportedGame;
else if (desc->flags & ADGF_WARNING)
game.gameSupportLevel = kWarningGame;
game.setGUIOptions(desc->guiOptions + _guiOptions);
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(desc->language));
@ -378,7 +380,11 @@ Common::Error AdvancedMetaEngineDetection::createInstance(OSystem *syst, Engine
if (((gameDescriptor.gameSupportLevel == kUnstableGame
|| (gameDescriptor.gameSupportLevel == kTestingGame
&& showTestingWarning)))
&& !Engine::warnUserAboutUnsupportedGame())
&& !Engine::warnUserAboutUnsupportedGame(""))
return Common::kUserCanceled;
if (gameDescriptor.gameSupportLevel == kWarningGame
&& !Engine::warnUserAboutUnsupportedGame(gameDescriptor.extra))
return Common::kUserCanceled;
if (gameDescriptor.gameSupportLevel == kUnsupportedGame) {

View file

@ -84,13 +84,15 @@ struct ADGameFileDescription {
*/
enum ADGameFlags {
ADGF_NO_FLAGS = 0, ///< No flags.
ADGF_REMASTERED = (1 << 18), ///< Add "-remastered' to gameid.
ADGF_AUTOGENTARGET = (1 << 19), ///< Automatically generate gameid from @ref ADGameDescription::extra.
ADGF_UNSTABLE = (1 << 20), ///< Flag to designate not yet officially supported games that are not fit for public testing.
ADGF_TESTING = (1 << 21), ///< Flag to designate not yet officially supported games that are fit for public testing.
ADGF_PIRATED = (1 << 22), ///< Flag to designate well-known pirated versions with cracks.
ADGF_UNSUPPORTED = (1 << 23), /*!< Flag to mark certain versions (like badly protected full games as demos) not to be run for various reasons.
ADGF_REMASTERED = (1 << 17), ///< Add "-remastered' to gameid.
ADGF_AUTOGENTARGET = (1 << 18), ///< Automatically generate gameid from @ref ADGameDescription::extra.
ADGF_UNSTABLE = (1 << 19), ///< Flag to designate not yet officially supported games that are not fit for public testing.
ADGF_TESTING = (1 << 20), ///< Flag to designate not yet officially supported games that are fit for public testing.
ADGF_PIRATED = (1 << 21), ///< Flag to designate well-known pirated versions with cracks.
ADGF_UNSUPPORTED = (1 << 22), /*!< Flag to mark certain versions (like badly protected full games as demos) not to be run for various reasons.
A custom message can be provided in the @ref ADGameDescription::extra field. */
ADGF_WARNING = (1 << 23), /*!< Flag to mark certain versions to show confirmation warning before proceeding.
A custom message should be provided in the @ref ADGameDescription::extra field. */
ADGF_ADDENGLISH = (1 << 24), ///< Always add English as a language option.
ADGF_MACRESFORK = (1 << 25), ///< Calculate the MD5 for this entry from the resource fork.
ADGF_USEEXTRAASTITLE = (1 << 26), ///< Use @ref ADGameDescription::extra as the main game title, not gameid.

View file

@ -644,9 +644,10 @@ void Engine::openMainMenuDialog() {
syncSoundSettings();
}
bool Engine::warnUserAboutUnsupportedGame() {
bool Engine::warnUserAboutUnsupportedGame(Common::String msg) {
if (ConfMan.getBool("enable_unsupported_game_warning")) {
GUI::MessageDialog alert(_("WARNING: The game you are about to start is"
GUI::MessageDialog alert(!msg.empty() ? _("WARNING: ") + Common::U32String(msg) + _(" Shall we still run the game?") :
_("WARNING: The game you are about to start is"
" not yet fully supported by ScummVM. As such, it is likely to be"
" unstable, and any saved game you make might not work in future"
" versions of ScummVM."), _("Start anyway"), _("Cancel"));

View file

@ -546,7 +546,7 @@ public:
*
* @return True if the user chooses to start anyway, false otherwise.
*/
static bool warnUserAboutUnsupportedGame();
static bool warnUserAboutUnsupportedGame(Common::String msg);
/**
* Display an error message to the user that the game is not supported.

View file

@ -94,7 +94,8 @@ enum GameSupportLevel {
kStableGame = 0, // the game is fully supported
kTestingGame, // the game is not supposed to end up in releases yet but is ready for public testing
kUnstableGame, // the game is not even ready for public testing yet
kUnsupportedGame // we don't want to support the game
kUnsupportedGame, // we don't want to support the game
kWarningGame // we want to ask user to proceed and provide them with an explanation
};