Exemple #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();
        }
Exemple #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;
        }