예제 #1
0
파일: QuickNES.cs 프로젝트: radtek/BizHawk
        public bool FrameAdvance(IController controller, bool render, bool rendersound = true)
        {
            CheckDisposed();
            using (FP.Save())
            {
                if (controller.IsPressed("Power"))
                {
                    QN.qn_reset(Context, true);
                }
                if (controller.IsPressed("Reset"))
                {
                    QN.qn_reset(Context, false);
                }

                int j1, j2;
                SetPads(controller, out j1, out j2);

                if (Tracer.Enabled)
                {
                    QN.qn_set_tracecb(Context, _tracecb);
                }
                else
                {
                    QN.qn_set_tracecb(Context, null);
                }

                Frame++;
                LibQuickNES.ThrowStringError(QN.qn_emulate_frame(Context, j1, j2));
                IsLagFrame = QN.qn_get_joypad_read_count(Context) == 0;
                if (IsLagFrame)
                {
                    LagCount++;
                }

                if (render)
                {
                    Blit();
                }
                if (rendersound)
                {
                    DrainAudio();
                }

                if (CB1 != null)
                {
                    CB1();
                }
                if (CB2 != null)
                {
                    CB2();
                }
            }

            return(true);
        }
예제 #2
0
        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;
                }
            }
        }
예제 #3
0
파일: QuickNES.cs 프로젝트: budzikt/BizHawk
        public void FrameAdvance(bool render, bool rendersound = true)
        {
            CheckDisposed();
            using (FP.Save())
            {
                if (Controller["Power"])
                {
                    LibQuickNES.qn_reset(Context, true);
                }
                if (Controller["Reset"])
                {
                    LibQuickNES.qn_reset(Context, false);
                }

                int j1, j2;
                SetPads(out j1, out j2);

                Frame++;
                LibQuickNES.ThrowStringError(LibQuickNES.qn_emulate_frame(Context, j1, j2));
                IsLagFrame = LibQuickNES.qn_get_joypad_read_count(Context) == 0;
                if (IsLagFrame)
                {
                    LagCount++;
                }

                if (render)
                {
                    Blit();
                }
                if (rendersound)
                {
                    DrainAudio();
                }

                if (CB1 != null)
                {
                    CB1();
                }
                if (CB2 != null)
                {
                    CB2();
                }
            }
        }