Beispiel #1
0
        private string LoadCustomRegister(int address)
        {
            string memory   = GameBoyRevampedBLL.GetMemoryValue(address).Substring(2);
            int    register = int.Parse(memory, NumberStyles.HexNumber, NumberFormatInfo.CurrentInfo);

            return(Convert.ToString(register, 2));
        }
Beispiel #2
0
        private void RefreshCurrentInstruction()
        {
            string PC = GameBoyRevampedBLL.GetRegister(Register.PC);

            GoToAddress(PC);
            _currentLine = listView.SelectedIndices[0];
        }
Beispiel #3
0
        private void GoToAddress(string text)
        {
            int    address = int.Parse(text, NumberStyles.HexNumber);
            OpCode opCode  = OpCodes.Find(code => code.Address == address);

            if (opCode != null)
            {
                int index = opCode.Index;
                ListView.SelectedIndexCollection selected = listView.SelectedIndices;

                for (int i = 0; i < selected.Count; i++)
                {
                    int currentSelected = selected[i];
                    listView.Items[currentSelected].Selected = false;
                    listView.Items[currentSelected].Focused  = false;
                }

                listView.Items[index].Selected = true;
                listView.Items[index].Focused  = true;
                listView.EnsureVisible(index);
            }

            OpCodes = GameBoyRevampedBLL.LoadOpCodes();
            listView.VirtualListSize = OpCodes.Count;
        }
Beispiel #4
0
        private void listView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            int romNumber = GameBoyRevampedBLL.GetRomNumber();

            OpCode     item = OpCodes[e.ItemIndex];
            OpCodeData data = GameBoyRevampedBLL.GetOpCode(item.Address);

            item.Code  = data.Code;
            item.Bytes = data.Bytes;
            e.Item     = item.ToListViewItem();


            if (e.ItemIndex == _currentLine)
            {
                e.Item.BackColor = Color.Yellow;
            }
            else if (_breakPoints.Contains(e.ItemIndex))
            {
                e.Item.BackColor = Color.DarkRed;
                e.Item.ForeColor = Color.White;
            }
            else
            {
                e.Item.BackColor = Color.White;
                e.Item.ForeColor = Color.Black;
            }
        }
Beispiel #5
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (_romPath != null)
     {
         GameBoyRevampedBLL.StopEmulation();
         GameBoyRevampedBLL.SaveGame();
     }
 }
Beispiel #6
0
        private void chargerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string savepath = "saves\\" + Path.GetFileName(_romPath).Split('.')[0] + ".dump";

            if (File.Exists(savepath))
            {
                GameBoyRevampedBLL.LoadMemory(savepath);
            }
        }
Beispiel #7
0
        private void GameBoyRevampedBLL_Redraw(object sender, EventArgs e)
        {
            try
            {
                pictureBoxMainScreen.Image = GameBoyRevampedBLL.DrawScreen();
            } catch { }

            GameBoyRevampedBLL.UpdateCheats(Cheats);
        }
Beispiel #8
0
        private void sauvegarderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string savepath = "saves\\" + Path.GetFileName(_romPath).Split('.')[0] + ".dump";

            if (File.Exists(savepath))
            {
                File.Delete(savepath);
            }
            GameBoyRevampedBLL.SaveMemory(savepath);
        }
Beispiel #9
0
 private void MainForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode != Keys.F12)
     {
         GameBoyRevampedBLL.SendKeys(e.KeyCode, true);
     }
     else
     {
         PrintScreen();
     }
 }
        private void ChangeOffset()
        {
            int start = rad8000.Checked ? 0x8000 : 0x8800;

            try
            {
                pictureBoxVRAM.Image = GameBoyRevampedBLL.GetVideoMemory(start);
            }
            catch
            {
            }
        }
Beispiel #11
0
        private void UpdateBreakPoints()
        {
            List <int> breakpoints = new List <int>();

            for (int i = 0; i < _breakPoints.Count; i++)
            {
                ListViewItem item = listView.Items[_breakPoints[i]];
                breakpoints.Add(int.Parse(item.Text.Substring(2), NumberStyles.HexNumber, NumberFormatInfo.CurrentInfo));
            }

            GameBoyRevampedBLL.UpdateBreakPoints(breakpoints);
        }
Beispiel #12
0
        private void ouvrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialogRom.FileName         = "";
            openFileDialogRom.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath);
            openFileDialogRom.Filter           = "Game Boy game|*.gb;*.gbc";

            if (openFileDialogRom.ShowDialog(this) == DialogResult.OK)
            {
                _romPath = openFileDialogRom.FileName;
                EnableTools();
                ROM.SavePath = "saves\\" + Path.GetFileName(_romPath).Split('.')[0] + ".sav";
                GameBoyRevampedBLL.LoadROM(_romPath);
                GameBoyRevampedBLL.StartEmulation();
            }
        }
Beispiel #13
0
 private void buttonPlayStop_Click(object sender, EventArgs e)
 {
     if (buttonPlayStop.Text == "stopped")
     {
         GameBoyRevampedBLL.StartEmulation();
         buttonPlayStop.Image = Resources.Stop;
         buttonPlayStop.Text  = "running";
     }
     else
     {
         GameBoyRevampedBLL.StopEmulation();
         buttonPlayStop.Image = Resources.runbasic;
         buttonPlayStop.Text  = "stopped";
     }
 }
        void GameBoyRevampedBLL_Redraw(object sender, EventArgs e)
        {
            ChangeOffset();

            if (radBackground.Checked)
            {
                try
                {
                    pb_background.Image = GameBoyRevampedBLL.DrawFullBackground();
                } catch { }
            }
            else
            {
                pb_background.Image = GameBoyRevampedBLL.DrawFullWindow();
            }
        }
Beispiel #15
0
        private void listView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            string index = "0x" + (e.ItemIndex + _offset).ToString("X4");
            string value = GameBoyRevampedBLL.GetMemoryValue(e.ItemIndex + _offset);

            e.Item = new ListViewItem(new[] { index, value });

            if (value != "0x00")
            {
                e.Item.BackColor = Color.CornflowerBlue;
            }
            else
            {
                e.Item.BackColor = Color.White;
            }
        }
Beispiel #16
0
 private void LoadRegister()
 {
     labelAF.Text      = GameBoyRevampedBLL.GetRegister(Register.AF);
     labelBC.Text      = GameBoyRevampedBLL.GetRegister(Register.BC);
     labelDE.Text      = GameBoyRevampedBLL.GetRegister(Register.DE);
     labelHL.Text      = GameBoyRevampedBLL.GetRegister(Register.HL);
     labelPC.Text      = GameBoyRevampedBLL.GetRegister(Register.PC);
     labelSP.Text      = GameBoyRevampedBLL.GetRegister(Register.SP);
     labelLY.Text      = GameBoyRevampedBLL.GetRegister(Register.LY);
     labelSTAT.Text    = GameBoyRevampedBLL.GetRegister(Register.STAT);
     labelSCX.Text     = GameBoyRevampedBLL.GetRegister(Register.SCX);
     labelSCY.Text     = GameBoyRevampedBLL.GetRegister(Register.SCY);
     labelLCDC.Text    = GameBoyRevampedBLL.GetRegister(Register.LCDC);
     labelCycle.Text   = GameBoyRevampedBLL.GetCycleCount().ToString();
     labelJOYP.Text    = GameBoyRevampedBLL.GetRegister(Register.JOYP);
     labelIE.Text      = LoadCustomRegister(0xFFFF);
     labelIF.Text      = LoadCustomRegister(0xFF0F);
     labelIME.Text     = GameBoyRevampedBLL.GetIME().ToString();
     checkBoxZ.Checked = GameBoyRevampedBLL.GetRegister(Register.Z) == "0001";
     checkBoxN.Checked = GameBoyRevampedBLL.GetRegister(Register.N) == "0001";
     checkBoxH.Checked = GameBoyRevampedBLL.GetRegister(Register.H) == "0001";
     checkBoxC.Checked = GameBoyRevampedBLL.GetRegister(Register.C) == "0001";
 }
Beispiel #17
0
 private void ExecuteStep()
 {
     GameBoyRevampedBLL.ExecuteStep();
     RefreshCurrentInstruction();
 }
Beispiel #18
0
 private void toolStripItemDesassembler_Click(object sender, EventArgs e)
 {
     _disassembleForm.OpCodes = GameBoyRevampedBLL.LoadOpCodes();
     HandleForm(_disassembleForm);
 }
Beispiel #19
0
 private void MainForm_KeyUp(object sender, KeyEventArgs e)
 {
     GameBoyRevampedBLL.SendKeys(e.KeyCode, false);
 }