Beispiel #1
0
        public static unsafe PPCOpCode[] Disassemble(VoidPtr ptr, int count, bool bigEndian)
        {
            if (count < 0)
            {
                throw new ArgumentException();
            }

            PPCOpCode[] result = new PPCOpCode[count];
            if (bigEndian)
            {
                for (int i = 0; i < count; i++)
                {
                    result[i] = Disassemble(((buint *)ptr)[i]);
                }
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    result[i] = Disassemble(((uint *)ptr)[i]);
                }
            }

            return(result);
        }
 public void SetCode(PPCOpCode code)
 {
     propertyGrid1.SelectedObject = _code = (uint)code;
     btnGoToBranch.Visible        = _canFollowBranch && _code is PPCBranch;
     _updating = true;
     //cboOpCode.SelectedIndex =
     _updating = false;
 }
 public void SetCode(int index, PPCOpCode code)
 {
     *((buint *)DataNode._dataBuffer.Address + index + _referenceIndex) = (uint)code;
     if (_data._linkedEditor != null)
     {
         _data._linkedEditor.hexBox1.Invalidate();
     }
 }
Beispiel #4
0
 public PPCOperand(PPCOpCode owner, OperandType type, int shift, uint mask, uint negBit, string name)
 {
     _owner    = owner;
     _opType   = type;
     _bitShift = shift;
     _bitMask  = mask & ~negBit;
     _negBit   = negBit;
     _name     = name;
 }
Beispiel #5
0
 public DialogResult ShowDialog(Relocation relocation, SectionEditor mainWindow)
 {
     _mainWindow                  = mainWindow;
     _targetRelocation            = relocation;
     oldValue                     = _targetRelocation.RawValue;
     propertyGrid1.SelectedObject = _code = _targetRelocation.Code;
     label3.Text                  = "0x" + (_targetRelocation._index * 4).ToString("X");
     return(base.ShowDialog());
 }
Beispiel #6
0
 void ppcOpCodeEditControl1_OnOpChanged()
 {
     if (_editor != null && grdDisassembler.SelectedRows.Count > 0)
     {
         int       index = grdDisassembler.SelectedRows[0].Index;
         PPCOpCode code  = ppcOpCodeEditControl1._code;
         _editor._manager.SetCode(_sectionOffset / 4 + index, code);
         _editor.hexBox1.Invalidate();
     }
 }
        void UpdateRow(int i)
        {
            DataGridViewRow row    = grdDisassembler.Rows[i];
            PPCOpCode       opcode = _relocations[i].Code;

            row.Cells[0].Value = PPCFormat.Offset(_baseOffset + (uint)i * 4);
            row.Cells[1].Value = opcode.Name;
            row.Cells[2].Value = opcode.GetFormattedOperands();

            row.DefaultCellStyle.BackColor = _relocations[i]._section.GetStatusColorFromIndex(_relocations[i]._index);
        }
 private void lstLinked_DrawItem(object sender, DrawItemEventArgs e)
 {
     e.DrawBackground();
     if (e.Index >= 0)
     {
         RelocationTarget r = lstLinked.Items[e.Index] as RelocationTarget;
         if (r != null && r.Section != null)
         {
             PPCOpCode code = r.Section._manager.GetCode(r._index);
             Color     c    = code is PPCBranch ? Color.Blue : Color.Red;
             e.Graphics.DrawString(r.ToString(), lstLinked.Font, new SolidBrush(c), e.Bounds);
         }
     }
     e.DrawFocusRectangle();
 }
Beispiel #9
0
        public void UpdateRow(int i)
        {
            if (_codes == null)
            {
                return;
            }

            DataGridViewRow row    = grdDisassembler.Rows[i];
            PPCOpCode       opcode = _codes[i];

            int index = _sectionOffset / 4 + i;

            row.Cells[0].Value = PPCFormat.Offset(_baseOffset + _sectionOffset + (i * 4));
            row.Cells[1].Value = opcode.Name;
            row.Cells[2].Value = opcode.GetFormattedOperands();

            var s = _manager.GetTags(index);

            row.Cells[3].Value = s == null ? "" : String.Join("; ", s);

            row.DefaultCellStyle.BackColor = _manager.GetStatusColorFromIndex(index);
        }
Beispiel #10
0
 public PPCOperand(PPCOpCode owner, OperandType type, int shift, uint mask, uint negBit) : this(owner, type,
                                                                                                shift, mask, negBit, "")
 {
 }
Beispiel #11
0
 public PPCOperand(PPCOpCode owner, OperandType type, int shift, uint mask) : this(owner, type, shift, mask,
                                                                                   0x0)
 {
 }