public CoreDriver(UIWindow uiWindow, Configuration config) { IsDisposed = false; try { _config = config; _inputAggregator = new InputAggregator(); _buttonStates = SnesJoypadButtons.None; _workerThread = new WorkerThread(); _workerThread.DoWork(() => { _uiWindow = uiWindow; _snes = new Snes(); _snes.VideoUpdated += Snes_VideoUpdated; _snes.AudioUpdated += Snes_AudioUpdated; _snes.SetControllerPortDevice(1, SnesDevice.Joypad); _inputAggregator.InputReceived += InputAggregator_InputReceived; _isAudioSynced = true; _isVideoSynced = false; _isRunning = false; _stopwatch = new Stopwatch(); _stopwatch.Start(); _frameCount = 0; }); _workerThread.WaitFor(); } catch { Dispose(); throw; } }