Esempio n. 1
0
        static void Main()
        {
            ushort[] display = new ushort[240 * 160];
            GBA      gba     = new GBA(display);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            gba.vis = new Visual(gba);

            Application.Run(gba.vis);
        }
Esempio n. 2
0
        public Visual(GBA gba)
        {
            InitializeComponent();
            MenuStrip ms = new MenuStrip();

            MenuStripHeight = ms.Bounds.Height;

            this.ClientSize = new Size((int)(scale * width), (int)(scale * height) + MenuStripHeight);

            this.gba         = gba;
            this.Tick        = new TickDelegate(TickDisplay);
            this.DebugScreen = new Debug(gba);
            this._display    = new ushort[width * height];

            // disable resizing
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MinimizeBox     = false;
            this.MaximizeBox     = false;

            this.SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.DoubleBuffer, true
                );

            this.Text = "GBAC-";

            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Interval = interval;
            timer.Tick    += new EventHandler(TickDebug);
            timer.Start();

            this.FPSTimer = Stopwatch.StartNew();

            this.InitMenustrip(ms);

            this.Load  += new EventHandler(Visual_CreateBackBuffer);
            this.Paint += new PaintEventHandler(Visual_Paint);

            this.KeyDown += new KeyEventHandler(Visual_KeyDown);

            // Keyboard input handling
            this.KeyDown += this.gba.mem.IO.KEYINPUT.keyboard.KeyDown;
            this.KeyUp   += this.gba.mem.IO.KEYINPUT.keyboard.KeyUp;


            if (!Directory.Exists(ScreenshotFolder))
            {
                Directory.CreateDirectory(ScreenshotFolder);
            }
            this.Icon = Properties.Resources.dillonbeeg_icon;
        }
Esempio n. 3
0
        public Debug(GBA gba)
        {
            InitializeComponent();

            // disable resizing
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MinimizeBox     = false;
            this.MaximizeBox     = false;

            this.TimerCounters = new Label[4] {
                Timer0Counter, Timer1Counter, Timer2Counter, Timer3Counter
            };
            this.TimerReloads = new Label[4] {
                Timer0Reload, Timer1Reload, Timer2Reload, Timer3Reload
            };
            this.TimerPrescalers = new Label[4] {
                Timer0Prescaler, Timer1Prescaler, Timer2Prescaler, Timer3Prescaler
            };
            this.TimerIRQEnables = new Label[4] {
                Timer0IRQEnable, Timer1IRQEnable, Timer2IRQEnable, Timer3IRQEnable
            };
            this.TimerEnables = new Label[4] {
                Timer0Enabled, Timer1Enabled, Timer2Enabled, Timer3Enabled
            };
            this.TimerCountUps = new Label[4] {
                null, Timer1CountUp, Timer2CountUp, Timer3CountUp
            };

            this.DMASAD = new Label[4] {
                DMA0SAD, DMA1SAD, DMA2SAD, DMA3SAD
            };
            this.DMADAD = new Label[4] {
                DMA0DAD, DMA1DAD, DMA2DAD, DMA3DAD
            };
            this.DMAUnitCount = new Label[4] {
                DMA0UnitCount, DMA1UnitCount, DMA2UnitCount, DMA3UnitCount
            };
            this.DMADestAddrControl = new Label[4] {
                DMA0DestAddrControl, DMA1DestAddrControl, DMA2DestAddrControl, DMA3DestAddrControl
            };
            this.DMASourceAddrControl = new Label[4] {
                DMA0SourceAddrControl, DMA1SourceAddrControl, DMA2SourceAddrControl, DMA3SourceAddrControl
            };
            this.DMARepeat = new Label[4] {
                DMA0Repeat, DMA1Repeat, DMA2Repeat, DMA3Repeat
            };
            this.DMAUnitLength = new Label[4] {
                DMA0UnitLength, DMA1UnitLength, DMA2UnitLength, DMA3UnitLength
            };
            this.DMAStartTiming = new Label[4] {
                DMA0Timing, DMA1Timing, DMA2Timing, DMA3Timing
            };
            this.DMAIRQ = new Label[4] {
                DMA0IRQ, DMA1IRQ, DMA2IRQ, DMA3IRQ
            };
            this.DMAEnabled = new Label[4] {
                DMA0Enabled, DMA1Enabled, DMA2Enabled, DMA3Enabled
            };

            this.gba        = gba;
            this.CharBlocks = new PictureBox[4] {
                this.CharBlock0, this.CharBlock1, this.CharBlock2, this.CharBlock3
            };
            this.CharBlockColorModes = new RadioButton[4] {
                this.CharBlock04bpp, this.CharBlock14bpp, this.CharBlock24bpp, this.CharBlock34bpp
            };
            this.RawCharBlock = new ushort[CharBlockSize * CharBlockSize];
        }