Example #1
0
        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;
            }
        }
Example #2
0
 internal override void Load(Snes snes)
 {
     throw new NotImplementedException();
 }
Example #3
0
        internal override void Load(Snes snes)
        {
            clr_snes_load_cartridge_normal(MakeUtf8Array(_romXml), _romData, (uint)_romData.Length);

            int size = (int)clr_snes_get_memory_size((uint)SnesMemoryType.CartridgeRam);
            if (size > 0 && _sram != null)
            {
                using (var _sramStream = new DataStream(clr_snes_get_memory_data((uint)SnesMemoryType.CartridgeRam), size, false, true))
                {
                    _sramStream.Write(_sram, 0, Math.Min(_sram.Length, size));
                }
            }

            size = (int)clr_snes_get_memory_size((uint)SnesMemoryType.CartridgeRtc);
            if (size > 0 && _rtc != null)
            {
                using (var _rtcStream = new DataStream(clr_snes_get_memory_data((uint)SnesMemoryType.CartridgeRtc), size, false, true))
                {
                    _rtcStream.Write(_rtc, 0, Math.Min(_sram.Length, size));
                }
            }
        }
Example #4
0
 internal abstract void Load(Snes snes);