[gnome-games/wip/exalm/rebrand: 30/102] ms-dos: Use RetroRunnerFactory




commit 2abcd611076e393684faf6a22496a4cc2aa4a24e
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Mar 29 21:46:08 2021 +0500

    ms-dos: Use RetroRunnerFactory
    
    Introduce a helper runner to set the input capabilities.

 plugins/ms-dos/src/meson.build        |  1 +
 plugins/ms-dos/src/ms-dos-plugin.vala | 12 +-----------
 plugins/ms-dos/src/ms-dos-runner.vala | 11 +++++++++++
 3 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/plugins/ms-dos/src/meson.build b/plugins/ms-dos/src/meson.build
index 95dcc559..4f59e84f 100644
--- a/plugins/ms-dos/src/meson.build
+++ b/plugins/ms-dos/src/meson.build
@@ -1,5 +1,6 @@
 vala_sources = [
   'ms-dos-plugin.vala',
+  'ms-dos-runner.vala',
 ]
 
 c_args = [
diff --git a/plugins/ms-dos/src/ms-dos-plugin.vala b/plugins/ms-dos/src/ms-dos-plugin.vala
index fb2ed78a..aa1f771e 100644
--- a/plugins/ms-dos/src/ms-dos-plugin.vala
+++ b/plugins/ms-dos/src/ms-dos-plugin.vala
@@ -25,8 +25,7 @@ private class Games.MsDosPlugin : Object, Plugin {
        }
 
        public RunnerFactory[] get_runner_factories () {
-               var factory = new GenericRunnerFactory (create_runner);
-               factory.add_platform (platform);
+               var factory = new RetroRunnerFactory (platform, typeof (MsDosRunner));
 
                return { factory };
        }
@@ -44,15 +43,6 @@ private class Games.MsDosPlugin : Object, Plugin {
 
                return game;
        }
-
-       private static Runner? create_runner (Game game) throws Error {
-               var core_source = new RetroCoreSource (platform);
-               var runner = new Runner (game, core_source);
-
-               runner.input_capabilities = new GenericInputCapabilities (true, false);
-
-               return runner;
-       }
 }
 
 [ModuleInit]
diff --git a/plugins/ms-dos/src/ms-dos-runner.vala b/plugins/ms-dos/src/ms-dos-runner.vala
new file mode 100644
index 00000000..a14c7d4f
--- /dev/null
+++ b/plugins/ms-dos/src/ms-dos-runner.vala
@@ -0,0 +1,11 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+private class Games.MsDosRunner : Runner {
+       public MsDosRunner (Game game, RetroCoreSource source) {
+               base (game, source);
+       }
+
+       construct {
+               input_capabilities = new GenericInputCapabilities (true, false);
+       }
+}


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