[gnome-games/wip/exalm/loading: 17/29] ms-dos: Add runner factory



commit e6cb91ad1bbac0f8b8c87b55e6a1a0c4c61cae2a
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Nov 12 01:32:56 2019 +0500

    ms-dos: Add runner factory

 plugins/ms-dos/src/ms-dos-plugin.vala | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/plugins/ms-dos/src/ms-dos-plugin.vala b/plugins/ms-dos/src/ms-dos-plugin.vala
index c1cfe7da..512b86a1 100644
--- a/plugins/ms-dos/src/ms-dos-plugin.vala
+++ b/plugins/ms-dos/src/ms-dos-plugin.vala
@@ -24,6 +24,13 @@ private class Games.MsDosPlugin : Object, Plugin {
                return { factory };
        }
 
+       public RunnerFactory[] get_runner_factories () {
+               var factory = new GenericRunnerFactory (create_runner);
+               factory.add_platform (platform);
+
+               return { factory };
+       }
+
        private static Game game_for_uri (Uri uri) throws Error {
                var uid = new FingerprintUid (uri, PLATFORM_UID_PREFIX);
                var title = new FilenameTitle (uri);
@@ -48,6 +55,21 @@ private class Games.MsDosPlugin : Object, Plugin {
 
                return game;
        }
+
+       private static Runner? create_runner (Game game) throws Error {
+               var core_source = new RetroCoreSource (platform);
+               var input_capabilities = new MsDosInputCapabilities ();
+
+               var builder = new RetroRunnerBuilder ();
+               builder.core_source = core_source;
+               builder.uri = game.get_uri ();
+               builder.uid = game.get_uid ();
+               builder.title = game.name;
+               builder.input_capabilities = input_capabilities;
+               var runner = builder.to_runner ();
+
+               return runner;
+       }
 }
 
 [ModuleInit]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]