Exemplo n.º 1
0
        void RefreshLibretroCore(bool bootstrap)
        {
            txtLibretroCore.Text            = "";
            btnLibretroLaunchNoGame.Enabled = false;
            btnLibretroLaunchGame.Enabled   = false;

            var core = Global.Config.LibretroCore;

            if (string.IsNullOrEmpty(core))
            {
                return;
            }

            txtLibretroCore.Text = core;
            CurrentDescription   = null;

            //scan the current libretro core to see if it can be launched with NoGame,and other stuff
            try
            {
                //OLD COMMENTS:
                ////a stub corecomm. to reinforce that this won't touch the frontend at all!
                ////LibRetroEmulator should be able to survive having this stub corecomm
                //NEW COMMENTS:
                //nope, we need to navigate to the dll path. this was a bad idea anyway. so many dlls get loaded, something to resolve them is needed
                var coreComm = new BizHawk.Emulation.Common.CoreComm(null, null);
                CoreFileProvider.SyncCoreCommInputSignals(coreComm);
                using (var retro = new LibretroCore(coreComm, core))
                {
                    btnLibretroLaunchGame.Enabled = true;
                    if (retro.Description.SupportsNoGame)
                    {
                        btnLibretroLaunchNoGame.Enabled = true;
                    }

                    //print descriptive information
                    var descr = retro.Description;
                    CurrentDescription = descr;
                    Console.WriteLine("core name: {0} version {1}", descr.LibraryName, descr.LibraryVersion);
                    Console.WriteLine("extensions: ", descr.ValidExtensions);
                    Console.WriteLine("NeedsRomAsPath: {0}", descr.NeedsRomAsPath);
                    Console.WriteLine("AcceptsArchives: {0}", descr.NeedsArchives);
                    Console.WriteLine("SupportsNoGame: {0}", descr.SupportsNoGame);

                    foreach (var v in descr.Variables.Values)
                    {
                        Console.WriteLine(v);
                    }
                }
            }
            catch (Exception ex)
            {
                if (!bootstrap)
                {
                    MessageBox.Show("Couldn't load the selected Libretro core for analysis. It won't be available.\n\nError:\n\n" + ex.ToString());
                }
            }
        }
Exemplo n.º 2
0
        private void RefreshLibretroCore(bool bootstrap)
        {
            txtLibretroCore.Text            = "";
            btnLibretroLaunchNoGame.Enabled = false;
            btnLibretroLaunchGame.Enabled   = false;

            var core = _config.LibretroCore;

            if (string.IsNullOrEmpty(core))
            {
                return;
            }

            txtLibretroCore.Text = core;
            _currentDescription  = null;

            // scan the current libretro core to see if it can be launched with NoGame,and other stuff
            try
            {
                var cfp = new CoreFileProvider(
                    Console.WriteLine,
                    Global.FirmwareManager,
                    Global.Config.PathEntries,
                    Global.Config.FirmwareUserSpecifications);
                var coreComm = new CoreComm(Console.WriteLine, Console.WriteLine, cfp);
                using var retro = new LibretroCore(coreComm, Global.Game, core);
                btnLibretroLaunchGame.Enabled = true;
                if (retro.Description.SupportsNoGame)
                {
                    btnLibretroLaunchNoGame.Enabled = true;
                }

                //print descriptive information
                var descr = retro.Description;
                _currentDescription = descr;
                Console.WriteLine($"core name: {descr.LibraryName} version {descr.LibraryVersion}");
                Console.WriteLine($"extensions: {descr.ValidExtensions}");
                Console.WriteLine($"{nameof(descr.NeedsRomAsPath)}: {descr.NeedsRomAsPath}");
                Console.WriteLine($"{nameof(descr.NeedsArchives)}: {descr.NeedsArchives}");
                Console.WriteLine($"{nameof(descr.SupportsNoGame)}: {descr.SupportsNoGame}");

                foreach (var v in descr.Variables.Values)
                {
                    Console.WriteLine(v);
                }
            }
            catch (Exception ex)
            {
                if (!bootstrap)
                {
                    MessageBox.Show($"Couldn't load the selected Libretro core for analysis. It won't be available.\n\nError:\n\n{ex}");
                }
            }
        }