public NESEmulator(byte[] rom, ProcessFrameDelegate processFrameDelegate, enumEmulatorSpeed emulatorSpeed = enumEmulatorSpeed.Normal) { //Setup Emulator Components Controller1 = new NESController(); _cartridge = new NESCartridge(rom); _ppu = new PPU.Core(_cartridge.MemoryMapper, DMATransfer); _cpu = new CPU.Core(_cartridge.MemoryMapper, Controller1); _enumEmulatorSpeed = emulatorSpeed; _processFrame = processFrameDelegate; }
/// <summary> /// Form Load Event Handler, initializes the Auga video engine and loads a 1x1 layout. /// </summary> private void MainForm_Load(object sender, EventArgs e) { _procFrame += new ProcessFrameDelegate(ProcessFrameImpl); _procFrameCallbackPtr = Marshal.GetFunctionPointerForDelegate(_procFrame); // initialize the Auga Video Engine axAuga.Init("0"); axAuga.SetSourcePrivilegeValue("videohooks", "deferredmode", 1); }
/// <summary> /// Form Closing Event Handler, shutdown the Auga video engine, log out of the adapter. /// </summary> private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { _procFrame -= new ProcessFrameDelegate(ProcessFrameImpl); try { axAuga.VideoHookPTZCommand2(_iStreamID, 101 /*STOP_LIVE*/, 0, 0, 0); axAuga.StopStreamingToProcessor(_iStreamID); } catch (Exception ex) { MessageBox.Show("Exception on Stop Streaming: " + ex.Message); } try { if (axAuga != null) { axAuga.ShutDown(); } } catch (Exception ex) { MessageBox.Show("Exception in ShutDown: " + ex.Message); } try { if (_adapter != null) { _adapter.Logout(); } } catch (Exception ex) { MessageBox.Show("Exception on Logout: " + ex.Message); } }