public QuickNES(CoreComm comm, byte[] file, object Settings, object SyncSettings) { using (FP.Save()) { ServiceProvider = new BasicServiceProvider(this); CoreComm = comm; Context = QN.qn_new(); if (Context == IntPtr.Zero) { throw new InvalidOperationException("qn_new() returned NULL"); } try { file = fix_ines_header(file); unsafe { fixed(byte *p = file) { Console.WriteLine((IntPtr)p); LibQuickNES.ThrowStringError(QN.qn_loadines(Context, file, file.Length)); } } InitSaveRamBuff(); InitSaveStateBuff(); InitAudio(); InitMemoryDomains(); int mapper = 0; string mappername = Marshal.PtrToStringAnsi(QN.qn_get_mapper(Context, ref mapper)); Console.WriteLine("QuickNES: Booted with Mapper #{0} \"{1}\"", mapper, mappername); BoardName = mappername; CoreComm.VsyncNum = 39375000; CoreComm.VsyncDen = 655171; PutSettings((QuickNESSettings)Settings ?? new QuickNESSettings()); _syncSettings = (QuickNESSyncSettings)SyncSettings ?? new QuickNESSyncSettings(); _syncSettingsNext = _syncSettings.Clone(); SetControllerDefinition(); ComputeBootGod(); ConnectTracer(); } catch { Dispose(); throw; } } }
public QuickNES(CoreComm nextComm, byte[] Rom, object Settings) { using (FP.Save()) { CoreComm = nextComm; Context = LibQuickNES.qn_new(); if (Context == IntPtr.Zero) { throw new InvalidOperationException("qn_new() returned NULL"); } try { LibQuickNES.ThrowStringError(LibQuickNES.qn_loadines(Context, Rom, Rom.Length)); InitSaveRamBuff(); InitSaveStateBuff(); InitVideo(); InitAudio(); InitMemoryDomains(); int mapper = 0; string mappername = Marshal.PtrToStringAnsi(LibQuickNES.qn_get_mapper(Context, ref mapper)); Console.WriteLine("QuickNES: Booted with Mapper #{0} \"{1}\"", mapper, mappername); BoardName = mappername; CoreComm.VsyncNum = 39375000; CoreComm.VsyncDen = 655171; PutSettings(Settings ?? new QuickNESSettings()); ComputeBootGod(); } catch { Dispose(); throw; } } }