示例#1
0
        private static NES CreateCore()
        {
            string xmlPath      = Path.Combine(PathUtils.ExeDirectoryPath, "NesCarts.xml");
            var    bootGodBytes = File.ReadAllBytes(xmlPath);

            BootGodDb.GetDatabaseBytes = () => bootGodBytes;

            var rom      = GetRom();
            var gameInfo = GameInfo.NullInstance;

            var pathEntries = new PathEntryCollection();

            pathEntries.ResolveWithDefaults();

            var cfp      = new CoreFileProvider(Console.WriteLine, new FirmwareManager(), pathEntries, new Dictionary <string, string>());
            var coreComm = new CoreComm(Console.WriteLine, Console.WriteLine, cfp);

            var settings     = new NES.NESSettings();
            var syncSettings = new NES.NESSyncSettings();
            var nes          = new NES(coreComm, gameInfo, rom, settings, syncSettings);

            for (int i = 0; i < 200; i++)
            {
                nes.FrameAdvance(EmptyController, true, true);
            }

            return(nes);
        }
示例#2
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());
                }
            }
        }
示例#3
0
        public BatchRunner(IEnumerable <string> files, int numframes)
        {
            this.files     = new List <string>(files);
            this.numframes = numframes;

            ldr               = new RomLoader();
            ldr.OnLoadError  += OnLoadError;
            ldr.ChooseArchive = ChooseArchive;
            Comm              = new CoreComm(CommMessage, CommMessage);
            CoreFileProvider.SyncCoreCommInputSignals(Comm);
        }
        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}");
                }
            }
        }
示例#5
0
        public BatchRunner(MainForm mainForm, IEnumerable <string> files, int numFrames)
        {
            _files     = new List <string>(files);
            _numFrames = numFrames;

            _ldr               = new RomLoader();
            _ldr.OnLoadError  += OnLoadError;
            _ldr.ChooseArchive = ChooseArchive;
            var cfp = new CoreFileProvider(CommMessage, Global.FirmwareManager, Global.Config.PathEntries, Global.Config.FirmwareUserSpecifications);

            _comm = mainForm.CreateCoreComm();
        }
示例#6
0
        public void Benchmark_Findings()
        {
            var hostingEnvironment = new Mock <IHostingEnvironment>();

            hostingEnvironment.Setup(x => x.ContentRootPath).Returns(System.Reflection.Assembly.GetExecutingAssembly().Location);
            hostingEnvironment.Setup(x => x.WebRootPath).Returns(System.IO.Directory.GetCurrentDirectory());
            ICoreFileProvider coreFileProvider = new CoreFileProvider(hostingEnvironment.Object);
            var finder = new AppDomainTypeFinder(coreFileProvider);
            var type   = finder.FindClassesOfType <ITransientService>().ToList();

            Assert.Equal(4, type.Count);
            Assert.True(typeof(ITransientService).IsAssignableFrom(type.FirstOrDefault()));
        }