public bool PutSettings(QuickNESSettings o)
        {
            _settings = o;
            QN.qn_set_sprite_limit(Context, _settings.NumSprites);
            RecalculateCrops();
            CalculatePalette();

            CoreComm.ScreenLogicalOffsetX = o.ClipLeftAndRight ? 8 : 0;
            CoreComm.ScreenLogicalOffsetY = o.ClipTopAndBottom ? 8 : 0;

            return(false);
        }
        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;
                }
            }
        }
Beispiel #3
0
		public bool PutSettings(object o)
		{
			_Settings = (QuickNESSettings)o;
			LibQuickNES.qn_set_sprite_limit(Context, _Settings.NumSprites);
			RecalculateCrops();
			return false;
		}