-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENGINES: Add an engine id #1210
Conversation
base/commandLine.cpp
Outdated
@@ -1143,9 +1144,15 @@ void upgradeTargets() { | |||
// ScummVM still generates an incorrect description string. So, the description | |||
// should only be updated if the user explicitly requests this. | |||
#if 0 | |||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, this looks like it needs resolving :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed!
base/commandLine.cpp
Outdated
if (idCameFromCommandLine) | ||
ConfMan.set("id_came_from_command_line", "1"); | ||
|
||
ConfMan.set("id_came_from_command_line", "1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI, this workaround is still semi-broken (see bug #2788).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have pushed a fix for bug #2788 to master since it is a simple correction.
Without understanding how the current system exactly works and not having looked at the code in detail yet your explanation makes total sense to me and is in my opinion a desirable change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is great.
However, it is not quite clear why you're also changing the single game engine names into names of those games (besides Cryo and Xeen, where there are the inconsistencies). Also, I am worried a bit about the obsolete target upgrading. I am not sure it still works.
In general, the code looks clean, but I would like to test it before releasing, especially for it working well with non-upgraded config files.
{"fw", "Future Wars"}, | ||
{"os", "Operation Stealth"}, | ||
{0, 0} | ||
}; | ||
|
||
static const Engines::ObsoleteGameID obsoleteGameIDsTable[] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Will it still work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the obsolete engine id tables in the cases where the old obsolete gameIds are the new migrated game ids. In these cases the engineId will be found by the new target upgrade code using the gameId.
engines/cruise/detection.cpp
Outdated
} | ||
|
||
virtual const char *getOriginalCopyright() const { | ||
return "Cruise for a Corpse (C) Delphine Software"; | ||
return "Cinematique evo 2 (C) Delphine Software"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Above you were changing Chewy to the game name, and here you're doing the opposite. Is there some reasoning behind this inconsistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's to be consistent with the cine engine.
engines/cryo/detection.cpp
Outdated
} | ||
|
||
virtual const char *getOriginalCopyright() const { | ||
return "Cryo Engine (C) Cryo Interactive"; | ||
return "Cryo (C) Cryo Interactive"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes no sense. It should stay "Cryo Engine". Or, if you want to put the game name, then it is "Lost Eden".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
_maxScanDepth = 2; | ||
_directoryGlobs = directoryGlobs; | ||
} | ||
|
||
virtual const char *getEngineId() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is virtual here, but not declared virtual in the previous instances. Maybe it makes sense to normalize it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather do mass change using clang-tidy in another pull request to add the override attributes / remove the virtual attributes rather than hand editing all these files again.
engines/metaengine.h
Outdated
const PluginList &getPlugins() const; | ||
|
||
/** Find a target */ // TODO: Expand on description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, close this TODO ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
engines/xeen/detection.cpp
Outdated
} | ||
|
||
virtual const char *getOriginalCopyright() const { | ||
return "Xeen Engine (c) 1992-1993 New World Computing, Inc."; | ||
return "Xeen (c) 1992-1993 New World Computing, Inc."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The engine supports not just one game.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
This is to make the output of the With the game engines renaming:
Without the game engine renaming:
I don't care too much about that change and would not mind reverting it. |
Ah, OK. Now I see where the uniformity comes from and it makes sense. |
If I do the same thing with the current master It finds 55 games (It reported some duplicates also for Zork CD, and Labyrinth of Time). It may have missed a game as there are lots of different languages added as different games so maybe I miss counted. #0 0x0000555557a24a2c in Common::SharedPtr::operator_bool() const (this=0x8) at ./common/ptr.h:166 |
I feel like this is a bit outside of the scope of this PR. Especially since BASS was not using the singleId system. It can be changed later using the obsoleteId mechanism.
I'm not sure what you mean. sword25 appears after the other two sword games in the example output I posted above.
I've pushed a fix for this to master. It was introduced in one of my previous pull requests. |
For 2. I get a different ordering for --list-games vs. --list-engines When I run ./scummvm --list-games I get the following for the sword games: so I am seeing sword25 before sword2 For 3. If however I run mass add again on the same directory I get another crash. #0 0x00007ffff40c8e97 in __GI_raise (sig=sig@entry=6) |
Great catch, I've pushed a fix for this to master. It was introduced in one of my previous pull requests. |
I still have the crash if I use this branch. If I merge this branch into master I hit issues with pink when compiling.
|
Okay, I've updated this branch with master so you don't have to.
I don't care too much about the order in those lists, so I have removed the custom sort. The games now appear in the same order as everywhere else. |
This looks good. |
Do we want to plan a date that this PR is to get merged so devs can get ready? |
Plans to merge this in? |
Any updates on this? Would be a shame to see this PR going bitrotting. |
I'll spend some time testing this again to make sure it has not bit-rotten too badly and merge it soon after 2.1.0 is released, if nobody disagrees. |
The engine ID identifies which engine should be used to launch the target. Also remove the 'single ID' system. Different games from engines that used that system now have different game IDs. Also-By: Matthew Hoops <clone2727@gmail.com>
The target is user defined and not may not contain the game name
…names Qualified game names have the following form: engineId:gameId. Unqualified game names are still supported as long as they are not ambiguous. However they are considered deprecated and are no longer displayed by the --list-games command.
Currently games are uniquely identified by their gameId. This is good because a single value can be used to identify a game across all the engines. The gameId is stored in the configuration file under the game target section.
However, as more game engines have been added to ScummVM, the concern of gameId clashes across engines became apparent. A feature was added to the Advanced Detector to work around this issue: singleId. For engines that enable the singleId feature, the gameId is always the same for all the games supported by the engine, allowing to avoid collisions.
However, storing the singleId instead of the gameId in the configuration file is a loss of information that causes a few problems:
--list-games
command line command no longer lists all the games supported by the engines using singleId.scummvm/engines/mohawk/detection.cpp
Line 241 in 61f9398
In this PR, I propose to use a different approach. Engines have a new engineId property that can be used to uniquely identify them. That way, the gameIds for an engine are namespaced by the engineId. This removes the need for the singleId feature which I propose to remove. The engineIds are stored in the configuration file under the game targets sections along with the gameIds.
This pull request contains code allowing to automatically upgrade the game targets to add an engineId and set the appropriate gameId when trying to launch a game (and other operations that require an active game target context such as editing the game options or loading a saved game).
On the command line, I have added the ability to use qualified game names where gameIds were previously used. Qualified game names have the following form:
engineId:gameId
. It is now recommended to say:scummvm --path=/my/games/riven mohawk:riven
instead ofscummvm --path=/my/games/riven riven
.Non-qualified game names still work as long as there are no gameId conflicts but are deprecated. (They are deprecated because looking up a game by its gameId only has become a slow path when using dynamic plugins. This is because the gameId => plugin path cache stored in the configuration file has become a engineId => plugin path cache to allow the now more common operation of looking up an engine by its name to be a fast path.)
On the command line, I have also added a new
--list-engines
command allowing to print the list of compiled engines along with their ids.Please review.