GNOME Bugzilla – Bug 781334
Untie game resource detection and game object creation
Last modified: 2017-05-07 12:19:39 UTC
Currently, Games has GameSource classes whose job is to look for game resources (ROM files…) and build Game objects from them. It works well but it's a bit rigid: we can't create games from resources coming from outside of this game source object. For that to work, the game object factories need to accept a unique type of resource, using URIs should work well enough.
Created attachment 351074 [details] [review] core: Make Plugin.get_game_source() nullable This allow plugins to return no GameSource and will be used in a next commit to allow them to directly expose URI sources and game factories.
Created attachment 351075 [details] [review] core: Make Plugin.get_game_source() nullable This allow plugins to return no GameSource and will be used in a next commit to allow them to directly expose URI sources and game factories.
Created attachment 351076 [details] [review] core: Add UriSource This will be used in some next commit to split the concern of discovering potential game resources and turning them into usable game objects.
Created attachment 351077 [details] [review] tracker: Add TrackerUriSource This will be used in some next commit to split the concern of discovering potential game resources and turning them into usable game objects.
Created attachment 351078 [details] [review] generic: Add GenericUriGameFacory.get_mime_types ()
Created attachment 351079 [details] [review] playstation: Add PlayStationGameFacory.get_mime_types ()
Created attachment 351080 [details] [review] core: Add UriGameFacory.get_mime_types ()
Created attachment 351081 [details] [review] core: Add Plugin.get_mime_types () This will allow plugins to describe MIME types which should be registered for file URI search.
Created attachment 351082 [details] [review] core: Add Plugin.get_uri_sources () This will allow plugins to expose URI sources.
Created attachment 351083 [details] [review] core: Add Plugin.get_uri_game_factories () This will allow plugins to expose factories to build games from URIs.
Created attachment 351084 [details] [review] generic: Add GenericUriGameSource This will be used in the next commit as a temporary transition helper between the game source model and the uri source and game factory model.
Created attachment 351085 [details] [review] ui: Use MIME types and factories froom plugins Use the MIME types and URI game factories provided by plugins in the application to search for game resources and to build games. This will be used in the next commits to allow plugins to stop providing game sources, helping to split the conerns of looking for game resources and building games from them.
Created attachment 351086 [details] [review] amiga: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351087 [details] [review] atari-2600: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351088 [details] [review] atari-7800: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351089 [details] [review] desktop: Provide MIME types, URI sources and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351090 [details] [review] doom: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351091 [details] [review] dreamcast: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351092 [details] [review] game-boy: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351093 [details] [review] game-boy-advance: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351094 [details] [review] game-cube: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351095 [details] [review] love: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351096 [details] [review] mame: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351097 [details] [review] master-system: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351098 [details] [review] mega-drive: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351099 [details] [review] neo-geo-pocket: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351100 [details] [review] nes: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351101 [details] [review] nintendo-64: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351102 [details] [review] nintendo-ds: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351103 [details] [review] pc-engine: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351104 [details] [review] playstation: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351105 [details] [review] sega-saturn: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351106 [details] [review] snes: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351107 [details] [review] wii: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351108 [details] [review] wii-ware: Provide MIME types and URI game factories Also stop providing a GameSource. This helps splitting the conerns of looking for game resources and building games from them.
Created attachment 351109 [details] [review] tracker: Remove unused Tracker types Remove unused TrackerGameSource, TrackerQuery, MimeTypeTrackerQuery and TrackerError.
Created attachment 351110 [details] [review] libretro: Drop tracker-sparql-1.0 requirement Remove the useless tracker-sparql-1.0 requirement which probably ended up there by accident.
Created attachment 351111 [details] [review] playstation: Remove PlayStationGameFactory.is_cursor_valid() Remove it as it wasn't used anymore.
Attachment 351075 [details] pushed as ea07c74 - core: Make Plugin.get_game_source() nullable Attachment 351076 [details] pushed as 9a25c7d - core: Add UriSource Attachment 351077 [details] pushed as 7074f2e - tracker: Add TrackerUriSource Attachment 351078 [details] pushed as 95e02a7 - generic: Add GenericUriGameFacory.get_mime_types () Attachment 351079 [details] pushed as 2abb88a - playstation: Add PlayStationGameFacory.get_mime_types () Attachment 351080 [details] pushed as 1191ca3 - core: Add UriGameFacory.get_mime_types () Attachment 351081 [details] pushed as 2c07a42 - core: Add Plugin.get_mime_types () Attachment 351082 [details] pushed as 0dafc65 - core: Add Plugin.get_uri_sources () Attachment 351083 [details] pushed as f6269d9 - core: Add Plugin.get_uri_game_factories () Attachment 351084 [details] pushed as 4efeb39 - generic: Add GenericUriGameSource Attachment 351085 [details] pushed as 4a7eeca - ui: Use MIME types and factories froom plugins Attachment 351086 [details] pushed as 8a70dec - amiga: Provide MIME types and URI game factories Attachment 351087 [details] pushed as aaec14a - atari-2600: Provide MIME types and URI game factories Attachment 351088 [details] pushed as e306d0d - atari-7800: Provide MIME types and URI game factories Attachment 351089 [details] pushed as c9a90eb - desktop: Provide MIME types, URI sources and URI game factories Attachment 351090 [details] pushed as c956a7d - doom: Provide MIME types and URI game factories Attachment 351091 [details] pushed as 6af17c9 - dreamcast: Provide MIME types and URI game factories Attachment 351092 [details] pushed as 9248460 - game-boy: Provide MIME types and URI game factories Attachment 351093 [details] pushed as b04c1a2 - game-boy-advance: Provide MIME types and URI game factories Attachment 351094 [details] pushed as b82fcc9 - game-cube: Provide MIME types and URI game factories Attachment 351095 [details] pushed as a98ffc4 - love: Provide MIME types and URI game factories Attachment 351096 [details] pushed as c5679d4 - mame: Provide MIME types and URI game factories Attachment 351097 [details] pushed as a48ac8c - master-system: Provide MIME types and URI game factories Attachment 351098 [details] pushed as 76f67af - mega-drive: Provide MIME types and URI game factories Attachment 351099 [details] pushed as a6e184e - neo-geo-pocket: Provide MIME types and URI game factories Attachment 351100 [details] pushed as 0ebaf7e - nes: Provide MIME types and URI game factories Attachment 351101 [details] pushed as c1c149f - nintendo-64: Provide MIME types and URI game factories Attachment 351102 [details] pushed as 9e61383 - nintendo-ds: Provide MIME types and URI game factories Attachment 351103 [details] pushed as a77bc4d - pc-engine: Provide MIME types and URI game factories Attachment 351104 [details] pushed as 8b3b87f - playstation: Provide MIME types and URI game factories Attachment 351105 [details] pushed as bbe92ce - sega-saturn: Provide MIME types and URI game factories Attachment 351106 [details] pushed as fc5879e - snes: Provide MIME types and URI game factories Attachment 351107 [details] pushed as 7beb9eb - wii: Provide MIME types and URI game factories Attachment 351108 [details] pushed as 78867e7 - wii-ware: Provide MIME types and URI game factories Attachment 351109 [details] pushed as 94e5d39 - tracker: Remove unused Tracker types Attachment 351110 [details] pushed as 91fc84a - libretro: Drop tracker-sparql-1.0 requirement Attachment 351111 [details] pushed as 6ad6b20 - playstation: Remove PlayStationGameFactory.is_cursor_valid()
Reopening as the GameSource model is still there.
Created attachment 351152 [details] [review] core: Add PluginRegisterIterator Allow to loop through the content of PluginRegister in a synchronous or asynchronous way.
Created attachment 351153 [details] [review] Replace old plugin register iteration Drop PluginRegister.foreach_plugin_registrar() and replace it with PluginRegisterIterator. This will allow to use asynchronous calls while looping through the plugin registrars.
Created attachment 351154 [details] [review] Remove unused UriGameFactory.is_uri_valid()
Created attachment 351155 [details] [review] Rename GenericSyncGameUriAdapter into GenericGameUriAdapter Because characters are expensive.
Attachment 351152 [details] pushed as bd88258 - core: Add PluginRegisterIterator Attachment 351153 [details] pushed as 99b5de7 - Replace old plugin register iteration Attachment 351154 [details] pushed as 1c9af10 - Remove unused UriGameFactory.is_uri_valid() Attachment 351155 [details] pushed as 34c413e - Rename GenericSyncGameUriAdapter into GenericGameUriAdapter
Created attachment 351156 [details] [review] mame: Yield on MameGameUriAdapter.game_for_uri() Yields before returning a new game. This is a safe default as the method is async and hence is expected to yield at some point.
Created attachment 351157 [details] [review] generic: Yield on GenericGameUriAdapter.game_for_uri() Yields before making the game from the URI. This is a safe default as the callback can't do it and the method is async and hence is expected to yield at some point.
Created attachment 351158 [details] [review] tracker: Move TrackerError to its own file
Attachment 351156 [details] pushed as bafa1b7 - mame: Yield on MameGameUriAdapter.game_for_uri() Attachment 351157 [details] pushed as a8cc2ab - generic: Yield on GenericGameUriAdapter.game_for_uri() Attachment 351158 [details] pushed as 47b6282 - tracker: Move TrackerError to its own file
Closed by accident: reopening.
Created attachment 351173 [details] [review] Make UriGameFactory.add_uri() async This will be used in the next commits to help doing complex operations in this method.
Created attachment 351174 [details] [review] core: Add UriGameFactory.game_added() signal This will allow URI game factories to notify of the creation of a game.
Created attachment 351175 [details] [review] generic: Refactor GenericUriGameFactory game creation Make GenericUriGameFactory directly try to build games directly when a URI is added. This will be used to add URIs to the factory and to ask fo the games just after.
Created attachment 351176 [details] [review] generic: Add GenericUriGameSource.get_factories_for_uri() This will be useful to avoid code duplication in future commits.
Attachment 351173 [details] pushed as 06f818f - Make UriGameFactory.add_uri() async Attachment 351174 [details] pushed as 6ee0b73 - core: Add UriGameFactory.game_added() signal Attachment 351175 [details] pushed as b43c5d0 - generic: Refactor GenericUriGameFactory game creation Attachment 351176 [details] pushed as f72dcbc - generic: Add GenericUriGameSource.get_factories_for_uri()
Created attachment 351230 [details] [review] generic: Add GenericUriGameSource.game_added() This will be used in the next commit to add games to the collection directly when they are found by a generic URI game source.
Created attachment 351231 [details] [review] ui: Add games when found by the GenericUriGameSource Connect to the GenericUriGameSource.game_added() signal to add games to the collection directly when they are found by the generic URI game source.
Created attachment 351232 [details] [review] Allow a media to have any number of URIs This will be used to make MediaSet more flexible.
Created attachment 351233 [details] [review] playstation: Build PlayStationUid from disc ID Give more plexibility when building a PlayStationUid as the disc ID doesn't have to come from a disc header. This is needed to build UIDs from disc set IDs coming from the PlayStation game database.
Created attachment 351234 [details] [review] gameinfo: Add GameinfoDoc.get_disc_set_ids_for_disc_id() This will be used in the next commit.
Created attachment 351235 [details] [review] playstation: Make game creation more flexible
Attachment 351230 [details] pushed as f711e94 - generic: Add GenericUriGameSource.game_added() Attachment 351231 [details] pushed as 05c3ff6 - ui: Add games when found by the GenericUriGameSource Attachment 351232 [details] pushed as 75e1fa7 - Allow a media to have any number of URIs Attachment 351233 [details] pushed as 94b5dc6 - playstation: Build PlayStationUid from disc ID Attachment 351234 [details] pushed as c1b1d4c - gameinfo: Add GameinfoDoc.get_disc_set_ids_for_disc_id() Attachment 351235 [details] pushed as e0d89ec - playstation: Make game creation more flexible
Created attachment 351247 [details] [review] utils: Add the Uri class This allows to handle URIs more easily, avoids some useless string copies and makes the type checking stronger.
Created attachment 351248 [details] [review] Use the new Uri type Replace usage of string in favor of the new Uri type to represent URIs wherever possible.
Created attachment 351249 [details] [review] desktop: Catch error in DesktopPlugin.get_uri_sources() This fixes a compile time error.
Attachment 351247 [details] pushed as 1dee7c3 - utils: Add the Uri class Attachment 351248 [details] pushed as 1b85607 - Use the new Uri type Attachment 351249 [details] pushed as 4d68c98 - desktop: Catch error in DesktopPlugin.get_uri_sources()
Created attachment 351274 [details] [review] core: Add UriGameFactory.get_schemes() This will allow game factories to declare the kind of URI schemes they accept.
Created attachment 351275 [details] [review] generic: Make GenericUriGameFactory handle schemes Add get_schemes() and add_scheme() to GenericUriGameFactory to allow its users to declare the kind of URI schemes they accept.
Created attachment 351276 [details] [review] generic: Make GenericUriGameSource handle schemes
Created attachment 351277 [details] [review] utils: Add Uri.from_uri_and_scheme() This will be used by game factories to adapt a URI scheme to their needs.
Created attachment 351278 [details] [review] steam: Add SteamUriIterator This will be used to iterate through the available Steam game resources.
Created attachment 351279 [details] [review] steam: Add SteamUriSource
Created attachment 351280 [details] [review] steam: Use SteamUriSource and a generic game factory Replace usage of SteamGameSource by a SteamUriSource and a GenericUriGameFactory accepting the steam+file URI scheme.
Created attachment 351281 [details] [review] steam: Remove now unused SteamGameSource
Attachment 351274 [details] pushed as e71c56d - core: Add UriGameFactory.get_schemes() Attachment 351275 [details] pushed as b12d611 - generic: Make GenericUriGameFactory handle schemes Attachment 351276 [details] pushed as 2c3df36 - generic: Make GenericUriGameSource handle schemes Attachment 351277 [details] pushed as 5843eb3 - utils: Add Uri.from_uri_and_scheme() Attachment 351278 [details] pushed as 20c5448 - steam: Add SteamUriIterator Attachment 351279 [details] pushed as c4e8dd9 - steam: Add SteamUriSource Attachment 351280 [details] pushed as 6ec89ca - steam: Use SteamUriSource and a generic game factory Attachment 351281 [details] pushed as 4ec9259 - steam: Remove now unused SteamGameSource
Created attachment 351285 [details] [review] libretro: Add LibretroUriIterator This will be used to iterate through the available Libretro games.
Created attachment 351286 [details] [review] libretro: Add LibretroUriSource This will be used to iterate through the available Libretro games.
Created attachment 351287 [details] [review] libretro: Add LibretroError This will be used in the next commit to express failure when building a Libretro game.
Created attachment 351288 [details] [review] libretro: Use LibretroUriSource and a generic game factory Replace usage of LibretroGameSource by a LibretroUriSource and a GenericUriGameFactory accepting the libretro+file URI scheme.
Created attachment 351289 [details] [review] libretro: Remove now unused LibretroGameSource
Created attachment 351290 [details] [review] ui: Stop using game sources from the plugins
Created attachment 351291 [details] [review] Rename GenericUriGameSource to GameCollection Also don't make it implement GameSource. This makes this class' curent role in the application more clear.
Created attachment 351292 [details] [review] dummy: Remove DummyGameSource This is needed to remove GameSource.
Created attachment 351293 [details] [review] core: Remove Plugin.get_game_source() This is needed to remove GameSource.
Created attachment 351294 [details] [review] core: Move GameCallback to its own file This is needed to remove GameSource.
Created attachment 351295 [details] [review] core: Remove unused GameSource This completes the move from the GameSource game discovery model to the UriSource, UriGameFactory and GameCollection one.
Created attachment 351296 [details] [review] utils: Make Uri.from_uri_and_scheme() throw errors This avoids a compile time warning and potential runtime errors.
Attachment 351285 [details] pushed as a2fc3be - libretro: Add LibretroUriIterator Attachment 351286 [details] pushed as a74e97f - libretro: Add LibretroUriSource Attachment 351287 [details] pushed as e289b89 - libretro: Add LibretroError Attachment 351288 [details] pushed as 05e110c - libretro: Use LibretroUriSource and a generic game factory Attachment 351289 [details] pushed as b257d7d - libretro: Remove now unused LibretroGameSource Attachment 351290 [details] pushed as 7d1d221 - ui: Stop using game sources from the plugins Attachment 351291 [details] pushed as 481cacf - Rename GenericUriGameSource to GameCollection Attachment 351292 [details] pushed as 00a3e68 - dummy: Remove DummyGameSource Attachment 351293 [details] pushed as b019050 - core: Remove Plugin.get_game_source() Attachment 351294 [details] pushed as ee394fe - core: Move GameCallback to its own file Attachment 351295 [details] pushed as 66d89c7 - core: Remove unused GameSource Attachment 351296 [details] pushed as b3dc557 - utils: Make Uri.from_uri_and_scheme() throw errors