Пример #1
0
        public void FrameAdvance(bool render, bool rendersound)
        {
            if (CoreComm.Tracer.Enabled)
            {
                cpu.TraceCallback = (s) => CoreComm.Tracer.Put(s);
            }
            else
            {
                cpu.TraceCallback = null;
            }

            lagged = true;
            if (resetSignal)
            {
                board.NESSoftReset();
                cpu.NESSoftReset();
                apu.NESSoftReset();
                //need to study what happens to ppu and apu and stuff..
            }
            else if (hardResetSignal)
            {
                HardReset();
            }

            Frame++;

            //if (resetSignal)
            //Controller.UnpressButton("Reset");   TODO fix this
            resetSignal     = Controller["Reset"];
            hardResetSignal = Controller["Power"];

            if (board is FDS)
            {
                var b = board as FDS;
                if (Controller["FDS Eject"])
                {
                    b.Eject();
                }
                for (int i = 0; i < b.NumSides; i++)
                {
                    if (Controller["FDS Insert " + i])
                    {
                        b.InsertSide(i);
                    }
                }
            }

            ppu.FrameAdvance();
            if (lagged)
            {
                _lagcount++;
                islag = true;
            }
            else
            {
                islag = false;
            }

            videoProvider.FillFrameBuffer();
        }
Пример #2
0
        public void FrameAdvance(bool render, bool rendersound)
        {
            if (Tracer.Enabled)
            {
                cpu.TraceCallback = (s) => Tracer.Put(s);
            }
            else
            {
                cpu.TraceCallback = null;
            }

            lagged = true;
            if (resetSignal)
            {
                Board.NESSoftReset();
                cpu.NESSoftReset();
                apu.NESSoftReset();
                ppu.NESSoftReset();
            }
            else if (hardResetSignal)
            {
                HardReset();
            }

            Frame++;

            //if (resetSignal)
            //Controller.UnpressButton("Reset");   TODO fix this
            resetSignal     = Controller.IsPressed("Reset");
            hardResetSignal = Controller.IsPressed("Power");

            if (Board is FDS)
            {
                var b = Board as FDS;
                if (Controller.IsPressed("FDS Eject"))
                {
                    b.Eject();
                }
                for (int i = 0; i < b.NumSides; i++)
                {
                    if (Controller.IsPressed("FDS Insert " + i))
                    {
                        b.InsertSide(i);
                    }
                }
            }

            if (_isVS)
            {
                if (controller.IsPressed("Service Switch"))
                {
                    VS_service = 1;
                }
                else
                {
                    VS_service = 0;
                }

                if (controller.IsPressed("Insert Coin P1"))
                {
                    VS_coin_inserted |= 1;
                }
                else
                {
                    VS_coin_inserted &= 2;
                }

                if (controller.IsPressed("Insert Coin P2"))
                {
                    VS_coin_inserted |= 2;
                }
                else
                {
                    VS_coin_inserted &= 1;
                }
            }

            ppu.FrameAdvance();
            if (lagged)
            {
                _lagcount++;
                islag = true;
            }
            else
            {
                islag = false;
            }

            videoProvider.FillFrameBuffer();

            //turn off all cheats
            for (int d = 0; d < num_cheats; d++)
            {
                RemoveGameGenie(cheat_indexes[d]);
            }
            num_cheats = 0;
        }
Пример #3
0
        public void FrameAdvance(IController controller, bool render, bool rendersound)
        {
            _controller = controller;

            if (Tracer.Enabled)
            {
                cpu.TraceCallback = (s) => Tracer.Put(s);
            }
            else
            {
                cpu.TraceCallback = null;
            }

            lagged = true;
            if (resetSignal)
            {
                Board.NESSoftReset();
                cpu.NESSoftReset();
                apu.NESSoftReset();
                ppu.NESSoftReset();
            }
            else if (hardResetSignal)
            {
                HardReset();
            }

            Frame++;

            //if (resetSignal)
            //Controller.UnpressButton("Reset");   TODO fix this
            resetSignal     = controller.IsPressed("Reset");
            hardResetSignal = controller.IsPressed("Power");

            if (Board is FDS)
            {
                var b = Board as FDS;
                if (controller.IsPressed("FDS Eject"))
                {
                    b.Eject();
                }
                for (int i = 0; i < b.NumSides; i++)
                {
                    if (controller.IsPressed("FDS Insert " + i))
                    {
                        b.InsertSide(i);
                    }
                }
            }

            if (_isVS)
            {
                if (controller.IsPressed("Service Switch"))
                {
                    VS_service = 1;
                }
                else
                {
                    VS_service = 0;
                }

                if (controller.IsPressed("Insert Coin P1"))
                {
                    VS_coin_inserted |= 1;
                }
                else
                {
                    VS_coin_inserted &= 2;
                }

                if (controller.IsPressed("Insert Coin P2"))
                {
                    VS_coin_inserted |= 2;
                }
                else
                {
                    VS_coin_inserted &= 1;
                }
            }

            FrameGo = true;

            if (ppu.ppudead > 0)
            {
                while (ppu.ppudead > 0)
                {
                    ppu.NewDeadPPU();
                }
            }
            else
            {
                ppu.ppu_init_frame();

                ppu.do_vbl       = true;
                ppu.do_active_sl = true;
                ppu.do_pre_vbl   = true;

                // do the vbl ticks seperate, that will save us a few checks that don't happen in active region
                while (ppu.do_vbl)
                {
                    ppu.TickPPU_VBL();
                }

                // now do the rest of the frame
                while (ppu.do_active_sl)
                {
                    ppu.TickPPU_active();
                }

                // now do the pre-NMI lines
                while (ppu.do_pre_vbl)
                {
                    ppu.TickPPU_preVBL();
                }
            }

            if (lagged)
            {
                _lagcount++;
                islag = true;
            }
            else
            {
                islag = false;
            }

            videoProvider.FillFrameBuffer();

            //turn off all cheats
            for (int d = 0; d < num_cheats; d++)
            {
                RemoveGameGenie(cheat_indexes[d]);
            }
            num_cheats = 0;
        }