Esempio n. 1
0
        public DmgDebugConsole(DmgSystem dmg)
        {
            this.dmg = dmg;
            DmgMode  = Mode.BreakPoint;

            Breakpoints = new List <Breakpoint>();

            // PPU profiler is expensive! Remember to disconnect the ppu profiler if you are not using it
            //ppuProfiler = new PpuProfiler(dmg);

            ConsoleText     = new List <string>();
            ConsoleCodeText = new List <string>();

            NextInstructions = new List <StoredInstruction>();

            // SB : b $64 if [IO_LY] == 2
            //breakpoints.Add(new Breakpoint(0x0));
            //breakpoints.Add(new Breakpoint(0x40));
            //breakpoints.Add(new Breakpoint(0x50));

            //breakpoints.Add(new Breakpoint(0xFE));

            //breakpoints.Add(new Breakpoint(0x64, new ConditionalExpression(dmg.memory, 0xFF44, ConditionalExpression.EqualityCheck.Equal, 143)));


            BreakpointStepAvailable = false;
        }
Esempio n. 2
0
        public PpuProfiler(DmgSystem dmg)
        {
            this.dmg = dmg;

            FrameHistory = new Dictionary <UInt32, PpuFrameMetaData>();

            dmg.OnFrameStart        = OnStartFrame;
            dmg.OnFrameEnd          = OnEndFrame;
            dmg.OnOamSearchComplete = OnOamSearchComplete;
        }
Esempio n. 3
0
        void Reset(string romFilename)
        {
            // Gameboy itself doesn't support reset so i see no reason to contrive one. Just create a fresh one

            // Wait for previous frame to finish drawing
            while (drawFrame)
            {
            }
            drawFrame = false;

            bool consoleWndVisibile = (consoleWindow != null) ? consoleWindow.Visible : false;
            bool bgWndVisibile      = (bgWnd != null) ? bgWnd.Visible : false;

            string rom = romFilename;

            dmg         = new DmgSystem();
            dmg.OnFrame = () => this.Draw();

            // Bit hacky, maintain breakpoints between reset
            List <Breakpoint> breakpoints = null;

            if (dbgConsole != null)
            {
                breakpoints = dbgConsole.Breakpoints;
            }
            dbgConsole = new DmgDebugConsole(dmg);
            if (breakpoints != null)
            {
                dbgConsole.Breakpoints = breakpoints;
            }

            if (consoleWindow != null)
            {
                consoleWindow.Dispose();
            }
            consoleWindow          = new DmgConsoleWindow(dmg, dbgConsole);
            consoleWindow.Visible  = consoleWndVisibile;
            consoleWindow.Location = new Point(Location.X + Width + 20, Location.Y);

            if (bgWnd != null)
            {
                bgWnd.Dispose();
            }
            bgWnd         = new BgWindow(dmg);
            bgWnd.Visible = bgWndVisibile;

            dmg.PowerOn(rom);

            this.Text = dmg.rom.RomName;
            dbgConsole.PeekSequentialInstructions();
            dbgConsole.DmgMode = DmgDebugConsole.Mode.Running;
        }
Esempio n. 4
0
        public DmgConsoleWindow(DmgSystem dmg, DmgDebugConsole dbgConsole)
        {
            this.dmg        = dmg;
            this.dbgConsole = dbgConsole;

            InitializeComponent();

            this.ClientSize      = new System.Drawing.Size(880, 775);
            this.Text            = "DMG Console";
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            this.FormBorderStyle = FormBorderStyle.FixedDialog;

            // This is the only way i found to stop the annoying bong sound effect when pressing enter on a text box!
            this.Controls.Add(okButton);
            okButton.Visible  = false;
            this.AcceptButton = okButton;

            codeWnd.Location  = new System.Drawing.Point(10, 10);
            codeWnd.Multiline = true;
            codeWnd.ReadOnly  = true;
            codeWnd.Width     = 500;
            codeWnd.Height    = 350;
            codeWnd.Enabled   = true;
            codeWnd.Font      = new Font(FontFamily.GenericMonospace, console.Font.Size);
            this.Controls.Add(codeWnd);

            console.Location  = new System.Drawing.Point(10, 370);
            console.Multiline = true;
            console.ReadOnly  = true;
            console.Width     = 500;
            console.Height    = 350;
            console.Enabled   = true;
            console.Font      = new Font(FontFamily.GenericMonospace, console.Font.Size);
            this.Controls.Add(console);

            commandInput.Location = new System.Drawing.Point(10, console.Location.Y + console.Height + 10);
            commandInput.Width    = ClientSize.Width - 20;
            commandInput.KeyUp   += CommandInput_KeyUp;
            this.Controls.Add(commandInput);
            commandInput.Focus();

            dmgSnapshot.Location  = new System.Drawing.Point(console.Location.X + console.Width + 10, 10);
            dmgSnapshot.Multiline = true;
            dmgSnapshot.Width     = 350;
            dmgSnapshot.Height    = 720;
            dmgSnapshot.Enabled   = false;
            dmgSnapshot.Font      = new Font(FontFamily.GenericMonospace, console.Font.Size);
            this.Controls.Add(dmgSnapshot);

            RefreshDmgSnapshot();
        }
Esempio n. 5
0
        public BgWindow(DmgSystem dmg)
        {
            InitializeComponent();

            this.dmg = dmg;

            this.ClientSize      = new System.Drawing.Size(512, 512);
            this.Text            = "DMG Bg Viewer";
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            this.FormBorderStyle = FormBorderStyle.FixedDialog;

            bgBmp = new Bitmap(256, 256);
        }
Esempio n. 6
0
        public GameBoySpu(DmgSystem device)
        {
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }
            Device = device;
            var channels = new List <ISoundChannel>();

            channels.Add(new SquareSweepChannel(this));
            channels.Add(new SquareChannel(this));
            channels.Add(Wave = new WaveSoundChannel(this));
            channels.Add(new NoiseChannel(this));
            Channels = channels.AsReadOnly();
            ActivateAllChannels();
        }