Exemplo n.º 1
0
        public static LibRetroEmulator CreateDebug(CoreComm nextComm, byte[] debugfile)
        {
            System.IO.TextReader tr = new System.IO.StreamReader(new System.IO.MemoryStream(debugfile, false));
            string modulename       = tr.ReadLine();
            string romname          = tr.ReadLine();

            byte[] romdata = System.IO.File.ReadAllBytes(romname);

            var emu = new LibRetroEmulator(nextComm, modulename);

            try
            {
                if (!emu.Load(romdata))
                {
                    throw new Exception("LibRetroEmulator.Load() failed");
                }
                // ...
            }
            catch
            {
                emu.Dispose();
                throw;
            }
            return(emu);
        }
Exemplo n.º 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
			{
				//a stub corecomm. to reinforce that this won't touch the frontend at all!
				//LibRetroEmulator should be able to survive having this stub corecomm
				var coreComm = new BizHawk.Emulation.Common.CoreComm(null, null);
				using (var retro = new LibRetroEmulator(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
			{
				if (!bootstrap)
					MessageBox.Show("Couldn't load the selected Libretro core for analysis. It won't be available.");
			}
		}
Exemplo n.º 3
0
        public static LibRetroEmulator CreateDebug(CoreComm nextComm, byte[] debugfile)
        {
            System.IO.TextReader tr = new System.IO.StreamReader(new System.IO.MemoryStream(debugfile, false));
            string modulename = tr.ReadLine();
            string romname = tr.ReadLine();

            byte[] romdata = System.IO.File.ReadAllBytes(romname);

            var emu = new LibRetroEmulator(nextComm, modulename);
            try
            {
                if (!emu.Load(romdata))
                    throw new Exception("LibRetroEmulator.Load() failed");
                // ...
            }
            catch
            {
                emu.Dispose();
                throw;
            }
            return emu;
        }