Ejemplo n.º 1
0
        public void FastUpdateAfter()
        {
            if (Global.Config.RunLuaDuringTurbo && Has <LuaConsole>())
            {
                LuaConsole.ResumeScripts(true);
            }

            GlobalWin.API.NewFrame();

            var afterList = _tools.Where(t => !t.UpdateBefore);

            foreach (var tool in afterList)
            {
                if (!tool.IsDisposed ||
                    (tool is RamWatch && Global.Config.DisplayRamWatch))                        // RAM Watch hack, on screen display should run even if RAM Watch is closed
                {
                    tool.FastUpdate();
                }
            }

            if (Global.Config.RunLuaDuringTurbo && Has <LuaConsole>())
            {
                LuaConsole.LuaImp.EndLuaDrawing();
            }
        }
Ejemplo n.º 2
0
		public EmuLuaLibrary(LuaConsole passed)
			: this()
		{
			LuaWait = new AutoResetEvent(false);
			Docs.Clear();
			_caller = passed.Get();

			// Register lua libraries
			var libs = Assembly
				.Load("BizHawk.Client.Common")
				.GetTypes()
				.Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
				.Where(t => t.IsSealed)
				.ToList();

			libs.AddRange(
				Assembly
				.GetAssembly(typeof(EmuLuaLibrary))
				.GetTypes()
				.Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
				.Where(t => t.IsSealed)
			);

			foreach (var lib in libs)
			{
				var instance = (LuaLibraryBase)Activator.CreateInstance(lib, _lua);
				instance.LuaRegister(lib, Docs);
				Libraries.Add(lib, instance);
			}

			_lua.RegisterFunction("print", this, GetType().GetMethod("Print"));

			EmulatorLuaLibrary.FrameAdvanceCallback = Frameadvance;
			EmulatorLuaLibrary.YieldCallback = EmuYield;
		}
Ejemplo n.º 3
0
        public EmuLuaLibrary(LuaConsole passed)
            : this()
        {
            LuaWait = new AutoResetEvent(false);
            Docs.Clear();
            _caller = passed.Get();

            // Register lua libraries
            var libs = Assembly
                       .Load("BizHawk.Client.Common")
                       .GetTypes()
                       .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
                       .Where(t => t.IsSealed)
                       .ToList();

            libs.AddRange(
                Assembly
                .GetAssembly(typeof(EmuLuaLibrary))
                .GetTypes()
                .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
                .Where(t => t.IsSealed)
                );

            foreach (var lib in libs)
            {
                var instance = (LuaLibraryBase)Activator.CreateInstance(lib, _lua);
                instance.LuaRegister(lib, Docs);
                Libraries.Add(lib, instance);
            }

            _lua.RegisterFunction("print", this, GetType().GetMethod("Print"));

            EmulatorLuaLibrary.FrameAdvanceCallback = Frameadvance;
            EmulatorLuaLibrary.YieldCallback        = EmuYield;
        }
Ejemplo n.º 4
0
        public void UpdateToolsBefore(bool fromLua = false)
        {
            if (Has <LuaConsole>())
            {
                if (!fromLua)
                {
                    LuaConsole.StartLuaDrawing();
                }
            }

            UpdateBefore();
        }
Ejemplo n.º 5
0
        public EmuLuaLibrary(LuaConsole passed)
            : this()
        {
            LuaWait = new AutoResetEvent(false);
            Docs.Clear();
            _caller = passed.Get();

            // Register lua libraries
            var libs = Assembly
                .Load("BizHawk.Client.Common")
                .GetTypes()
                .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
                .Where(t => t.IsSealed)
                .Where(t => ServiceInjector.IsAvailable(Global.Emulator.ServiceProvider, t))
                .ToList();

            libs.AddRange(
                Assembly
                .GetAssembly(typeof(EmuLuaLibrary))
                .GetTypes()
                .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
                .Where(t => t.IsSealed)
                .Where(t => ServiceInjector.IsAvailable(Global.Emulator.ServiceProvider, t))
            );

            foreach (var lib in libs)
            {
                bool addLibrary = true;
                var attributes = lib.GetCustomAttributes(typeof(LuaLibraryAttributes), false);
                if (attributes.Any())
                {
                    addLibrary = VersionInfo.DeveloperBuild || (attributes.First() as LuaLibraryAttributes).Released;
                }

                if (addLibrary)
                {
                    var instance = (LuaLibraryBase)Activator.CreateInstance(lib, _lua);
                    instance.LuaRegister(lib, Docs);
                    instance.LogOutputCallback = ConsoleLuaLibrary.LogOutput;
                    ServiceInjector.UpdateServices(Global.Emulator.ServiceProvider, instance);
                    Libraries.Add(lib, instance);
                }
            }

            _lua.RegisterFunction("print", this, GetType().GetMethod("Print"));

            EmulatorLuaLibrary.FrameAdvanceCallback = Frameadvance;
            EmulatorLuaLibrary.YieldCallback = EmuYield;
        }
Ejemplo n.º 6
0
        public EmuLuaLibrary(LuaConsole passed, IEmulatorServiceProvider serviceProvider)
            : this()
        {
            LuaWait = new AutoResetEvent(false);
            Docs.Clear();
            _caller = passed.Get();

            // Register lua libraries
            var libs = Assembly
                       .Load("BizHawk.Client.Common")
                       .GetTypes()
                       .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
                       .Where(t => t.IsSealed)
                       .Where(t => ServiceInjector.IsAvailable(serviceProvider, t))
                       .ToList();

            libs.AddRange(
                Assembly
                .GetAssembly(typeof(EmuLuaLibrary))
                .GetTypes()
                .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
                .Where(t => t.IsSealed)
                .Where(t => ServiceInjector.IsAvailable(serviceProvider, t))
                );

            foreach (var lib in libs)
            {
                bool addLibrary = true;
                var  attributes = lib.GetCustomAttributes(typeof(LuaLibraryAttributes), false);
                if (attributes.Any())
                {
                    addLibrary = VersionInfo.DeveloperBuild || (attributes.First() as LuaLibraryAttributes).Released;
                }

                if (addLibrary)
                {
                    var instance = (LuaLibraryBase)Activator.CreateInstance(lib, _lua);
                    instance.LuaRegister(lib, Docs);
                    instance.LogOutputCallback = ConsoleLuaLibrary.LogOutput;
                    ServiceInjector.UpdateServices(serviceProvider, instance);
                    Libraries.Add(lib, instance);
                }
            }

            _lua.RegisterFunction("print", this, GetType().GetMethod("Print"));

            EmulatorLuaLibrary.FrameAdvanceCallback = Frameadvance;
            EmulatorLuaLibrary.YieldCallback        = EmuYield;
        }
Ejemplo n.º 7
0
        public void UpdateToolsAfter(bool fromLua = false)
        {
            if (!fromLua && Has <LuaConsole>())
            {
                LuaConsole.ResumeScripts(true);
            }

            GlobalWin.Tools.UpdateAfter();

            if (Has <LuaConsole>())
            {
                if (!fromLua)
                {
                    LuaConsole.LuaImp.EndLuaDrawing();
                }
            }
        }
Ejemplo n.º 8
0
        public void FastUpdateAfter()
        {
            if (Global.Config.RunLuaDuringTurbo && Has <LuaConsole>())
            {
                LuaConsole.ResumeScripts(true);
            }

            var afterList = _tools.Where(x => !x.UpdateBefore);

            foreach (var tool in afterList)
            {
                if (!tool.IsDisposed ||
                    (tool is RamWatch && Global.Config.DisplayRamWatch))                     // Ram Watch hack, on screen display should run even if Ram Watch is closed
                {
                    tool.FastUpdate();
                }
            }
        }