[gnome-games/wip/exalm/platform-preferences: 51/65] retro-core-source: Use RetroCoreManager for finding cores



commit cdf7ada9ff125a31f1310776988d35dcf2e32be6
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Thu Sep 27 22:45:57 2018 +0500

    retro-core-source: Use RetroCoreManager for finding cores

 src/retro/retro-core-source.vala | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)
---
diff --git a/src/retro/retro-core-source.vala b/src/retro/retro-core-source.vala
index 21d10d2b..d2874cce 100644
--- a/src/retro/retro-core-source.vala
+++ b/src/retro/retro-core-source.vala
@@ -48,32 +48,12 @@ public class Games.RetroCoreSource : Object {
        }
 
        private void search_module () throws Error {
-               var modules = new Retro.ModuleQuery (true);
-               foreach (var core_descriptor in modules) {
-                       try {
-                               var platform_id = platform.get_id ();
-                               var mime_types = platform.get_mime_types ();
+               var core_manager = RetroCoreManager.get_instance ();
 
-                               if (!core_descriptor.get_is_emulator ())
-                                       continue;
+               var core_descriptors = core_manager.get_cores_for_platform (platform);
 
-                               if (!core_descriptor.has_platform (platform_id))
-                                       continue;
-
-                               if (!core_descriptor.get_platform_supports_mime_types (platform_id, 
mime_types))
-                                       continue;
-
-                               if (core_descriptor.get_module_file () == null)
-                                       continue;
-
-                               this.core_descriptor = core_descriptor;
-
-                               break;
-                       }
-                       catch (Error e) {
-                               debug (e.message);
-                       }
-               }
+               if (core_descriptors.length > 0)
+                       core_descriptor = core_descriptors[0];
        }
 
        private void check_firmware_is_valid (string firmware) throws Error {


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