public EmulatorStartingEvent(Guid emulationRunnerId, IEmulationRunner emulationRunner, Game game, EmulationMode mode)
 {
     EmulationRunnerId = emulationRunnerId;
     EmulationRunner = emulationRunner;
     Game = game;
     Mode = mode;
 }
Пример #2
0
        public GameEventAggregator(IEventAggregator eventAggregator, IEmulationRunner emulationRunner)
        {
            _eventAggregator = eventAggregator;
            _emulationRunner = emulationRunner;
            _gameStartedActions = new List<Action>();
            _gameEndedActions = new List<Action>();
            _memoryChangedActions = new Dictionary<Int32, IList<Action<GameMemoryChangedEvent>>>();

            eventAggregator.Subscribe<MemoryValueChangedEvent>(ValueChanged);
            eventAggregator.Subscribe<EmulatorStartedEvent>(EmulatorStarted);
            eventAggregator.Subscribe<EmulatorQuitEvent>(EmulatorQuit);
        }
Пример #3
0
        public Window1()
        {
            InitializeComponent();
          
            _runner = null;
            _ev = new EmulatorView();
            _ev.VerticalAlignment = VerticalAlignment.Stretch;
            _ev.HorizontalAlignment = HorizontalAlignment.Stretch;
            main.Content = _ev;
            var helperElement = new FrameworkElement();
            helperElement.Loaded += new RoutedEventHandler(_ev_Loaded);
            helper.Content = helperElement;
            
            RavenDbPersistenceProvider runRavenDbStaticConstructor = new RavenDbPersistenceProvider();

            _gameChangeTimer = new DispatcherTimer(DispatcherPriority.ApplicationIdle, this.Dispatcher);
            _gameChangeTimer.Interval = TimeSpan.FromMilliseconds(500);
            _gameChangeTimer.Tick += new EventHandler(timer_Tick);
            
            _inputTimer = new DispatcherTimer(DispatcherPriority.Normal, this.Dispatcher);
            _inputTimer.Interval = TimeSpan.FromMilliseconds(50);
            _inputTimer.Tick += new EventHandler(inputTimer_Tick);
            
            Boolean fullScreen = false;

            if (fullScreen)
            {
                WindowState = WindowState.Normal;
                WindowStyle = WindowStyle.None;
                Topmost = true;
                WindowState = WindowState.Maximized;
            }

            WrenWindows.MemoryFilterViewModel = new MemoryFilterViewModel();
            WrenWindows.MemoryFilterWindow = new MemoryFilter(WrenWindows.MemoryFilterViewModel);

            WrenCore.Initialize();

            _serviceLocator = WrenCore.GetServiceLocator();

            var settingsManager = _serviceLocator.GetInstance<ISettingsManager>();
            settingsManager.RegisterSettings<LogOnSettings>();
            settingsManager.Load();

            _serviceLocator.RegisterSingleton<IEmulatorSurfaces, EmulatorSurfaces>();
            ObjectFactory.Configure(c =>
            {
                c.ForRequestedType<Image>().TheDefault.Is.ConstructedBy(() => this._ev.renderSurface);
                c.ForRequestedType<Dispatcher>().TheDefault.Is.ConstructedBy(() => this.Dispatcher);
            });

            var eventAggregator = _serviceLocator.GetInstance<IEventAggregator>();

            eventAggregator.Subscribe<LoggedOnEvent>(LogOn);
            eventAggregator.Subscribe<SettingsAppliedEvent>(SettingsApplied);
            popupPresenter.Content = new LogOnView(new LogOnViewModel(eventAggregator, settingsManager));

            SmsEmulator sms = new SmsEmulator();
            sms.Initialize(eventAggregator);

            RegisterEventHandlers(eventAggregator);
        }
Пример #4
0
        private void RunEmulator()
        {
            GameInfo gi = gamesList.SelectedItem as GameInfo;

            if (_runner != null)
                _runner.SendCommand(new QuitCommand());

            _runner = _serviceLocator.GetInstance<IEmulationRunner>();

            var eContext = new EmulationContext(gi.Game, new EmulatedSystem((String)gi.GetValue("System")));
            var eventAggregator = _serviceLocator.GetInstance<IEventAggregator>();

            if (_isInGameMode)
            {
                /*var statisticsManager = _serviceLocator.GetInstance<IStatisticsManager>();
                statisticsManager.UpdateStatisticDefinitions(eContext.Game);
                statisticsManager.InitializeStatistics(eContext.Game, new GameEventAggregator(eventAggregator, _runner));*/
            }
            
            _runner.Start(eContext, eventAggregator, _isInGameMode ? EmulationMode.Playing : EmulationMode.Preview);
            _fullScreenEmulationRunner = _runner.InstanceId;
        }