Example #1
0
        public bool PutSyncSettings(QuickNESSyncSettings o)
        {
            bool ret = QuickNESSyncSettings.NeedsReboot(_syncSettings, o);

            _syncSettingsNext = o;
            return(ret);
        }
Example #2
0
        public PutSettingsDirtyBits PutSyncSettings(QuickNESSyncSettings o)
        {
            bool ret = QuickNESSyncSettings.NeedsReboot(_syncSettings, o);

            _syncSettingsNext = o;
            return(ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None);
        }
        public QuickNES(byte[] file, QuickNESSettings settings, QuickNESSyncSettings syncSettings)
        {
            FP = OSTailoredCode.IsUnixHost
                                ? (IFPCtrl) new Unix_FPCtrl()
                                : new Win32_FPCtrl();

            using (FP.Save())
            {
                ServiceProvider = new BasicServiceProvider(this);
                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;
                }
            }
        }
Example #4
0
 public static bool NeedsReboot(QuickNESSyncSettings x, QuickNESSyncSettings y)
 {
     // the core can handle dynamic plugging and unplugging, but that changes
     // the controllerdefinition, and we're not ready for that
     return(!DeepEquality.DeepEquals(x, y));
 }