public int[] GetVideoBuffer()
 {
     LibMSX.MSX_get_video(MSX_Pntr, _vidbuffer);
     return(_vidbuffer);
 }
Beispiel #2
0
        public bool FrameAdvance(IController controller, bool render, bool rendersound)
        {
            _controller = controller;

            byte ctrl1_byte = 0xFF;

            if (_controller.IsPressed("P1 Up"))
            {
                ctrl1_byte -= 0x01;
            }
            if (_controller.IsPressed("P1 Down"))
            {
                ctrl1_byte -= 0x02;
            }
            if (_controller.IsPressed("P1 Left"))
            {
                ctrl1_byte -= 0x04;
            }
            if (_controller.IsPressed("P1 Right"))
            {
                ctrl1_byte -= 0x08;
            }
            if (_controller.IsPressed("P1 B1"))
            {
                ctrl1_byte -= 0x10;
            }
            if (_controller.IsPressed("P1 B2"))
            {
                ctrl1_byte -= 0x20;
            }

            byte ctrl2_byte = 0xFF;

            if (_controller.IsPressed("P2 Up"))
            {
                ctrl2_byte -= 0x01;
            }
            if (_controller.IsPressed("P2 Down"))
            {
                ctrl2_byte -= 0x02;
            }
            if (_controller.IsPressed("P2 Left"))
            {
                ctrl2_byte -= 0x04;
            }
            if (_controller.IsPressed("P2 Right"))
            {
                ctrl2_byte -= 0x08;
            }
            if (_controller.IsPressed("P2 B1"))
            {
                ctrl2_byte -= 0x10;
            }
            if (_controller.IsPressed("P2 B2"))
            {
                ctrl2_byte -= 0x20;
            }

            if (current_controller == MSXControllerKB)
            {
                kb_rows_check(controller);
            }

            if (Tracer.IsEnabled())
            {
                tracecb = MakeTrace;
            }
            else
            {
                tracecb = null;
            }

            LibMSX.MSX_settracecallback(MSX_Pntr, tracecb);

            LibMSX.MSX_frame_advance(MSX_Pntr, ctrl1_byte, ctrl2_byte, kb_rows, true, true);

            LibMSX.MSX_get_video(MSX_Pntr, _vidbuffer);

            /*
             * int msg_l = LibMSX.MSX_getmessagelength(MSX_Pntr);
             * StringBuilder new_msg = new StringBuilder(msg_l);
             * LibMSX.MSX_getmessage(MSX_Pntr, new_msg, msg_l - 1);
             * Console.WriteLine(new_msg);
             */

            _frame++;

            return(true);
        }