public QuickNES(CoreComm comm, byte[] file, object settings, object syncSettings) { FP = OSTailoredCode.IsUnixHost ? (IFPCtrl) new Unix_FPCtrl() : new Win32_FPCtrl(); using (FP.Save()) { ServiceProvider = new BasicServiceProvider(this); CoreComm = comm; Context = QN.qn_new(); if (Context == IntPtr.Zero) { throw new InvalidOperationException($"{nameof(QN.qn_new)}() returned NULL"); } try { file = FixInesHeader(file); 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; PutSettings((QuickNESSettings)settings ?? new QuickNESSettings()); _syncSettings = (QuickNESSyncSettings)syncSettings ?? new QuickNESSyncSettings(); _syncSettingsNext = _syncSettings.Clone(); SetControllerDefinition(); ComputeBootGod(); ConnectTracer(); } catch { Dispose(); throw; } } }