Пример #1
0
 public static void SetInOutPoint(int i, InOutPoint point)
 {
     table[i].Point |= point;
 }
Пример #2
0
 public void SetInOutPoint(int i, InOutPoint point) => RomBytes[i].Point |= point;
Пример #3
0
        public void PaintCell(int offset, DataGridViewCellStyle style, int column, int selOffset)
        {
            // editable cells show up green
            if (column == 0 || column == 8 || column == 9 || column == 12)
            {
                style.SelectionBackColor = Color.Chartreuse;
            }

            switch (Project.Data.GetSnesApi().GetFlag(offset))
            {
            case FlagType.Unreached:
                style.BackColor = Color.LightGray;
                style.ForeColor = Color.DarkSlateGray;
                break;

            case FlagType.Opcode:
                int opcode = Project.Data.GetRomByte(offset) ?? 0x0;
                switch (column)
                {
                case 4:         // <*>
                    InOutPoint point = Project.Data.GetSnesApi().GetInOutPoint(offset);
                    int        r = 255, g = 255, b = 255;
                    if ((point & (InOutPoint.EndPoint | InOutPoint.OutPoint)) != 0)
                    {
                        g -= 50;
                    }
                    if ((point & (InOutPoint.InPoint)) != 0)
                    {
                        r -= 50;
                    }
                    if ((point & (InOutPoint.ReadPoint)) != 0)
                    {
                        b -= 50;
                    }
                    style.BackColor = Color.FromArgb(r, g, b);
                    break;

                case 5:                                                                      // Instruction
                    if (opcode == 0x40 || opcode == 0xCB || opcode == 0xDB || opcode == 0xF8 ||      // RTI WAI STP SED
                        opcode == 0xFB || opcode == 0x00 || opcode == 0x02 || opcode == 0x42 // XCE BRK COP WDM
                        )
                    {
                        style.BackColor = Color.Yellow;
                    }
                    break;

                case 8:                                                     // Data Bank
                    if (opcode == 0xAB || opcode == 0x44 || opcode == 0x54) // PLB MVP MVN
                    {
                        style.BackColor = Color.OrangeRed;
                    }
                    else if (opcode == 0x8B)         // PHB
                    {
                        style.BackColor = Color.Yellow;
                    }
                    break;

                case 9:                                   // Direct Page
                    if (opcode == 0x2B || opcode == 0x5B) // PLD TCD
                    {
                        style.BackColor = Color.OrangeRed;
                    }
                    if (opcode == 0x0B || opcode == 0x7B)         // PHD TDC
                    {
                        style.BackColor = Color.Yellow;
                    }
                    break;

                case 10:         // M Flag
                case 11:         // X Flag
                    int mask = column == 10 ? 0x20 : 0x10;
                    if (opcode == 0x28 || ((opcode == 0xC2 || opcode == 0xE2) &&      // PLP SEP REP
                                           (Project.Data.GetRomByte(offset + 1) & mask) != 0)) // relevant bit set
                    {
                        style.BackColor = Color.OrangeRed;
                    }
                    if (opcode == 0x08)         // PHP
                    {
                        style.BackColor = Color.Yellow;
                    }
                    break;
                }
                break;

            case FlagType.Operand:
                style.ForeColor = Color.LightGray;
                break;

            case FlagType.Graphics:
                style.BackColor = Color.LightPink;
                break;

            case FlagType.Music:
                style.BackColor = Color.PowderBlue;
                break;

            case FlagType.Data8Bit:
            case FlagType.Data16Bit:
            case FlagType.Data24Bit:
            case FlagType.Data32Bit:
                style.BackColor = Color.NavajoWhite;
                break;

            case FlagType.Pointer16Bit:
            case FlagType.Pointer24Bit:
            case FlagType.Pointer32Bit:
                style.BackColor = Color.Orchid;
                break;

            case FlagType.Text:
                style.BackColor = Color.Aquamarine;
                break;

            case FlagType.Empty:
                style.BackColor = Color.DarkSlateGray;
                style.ForeColor = Color.LightGray;
                break;
            }

            if (selOffset >= 0 && selOffset < Project.Data.GetRomSize())
            {
                if (column == 1
                    //&& (Project.Data.GetFlag(selOffset) == Data.FlagType.Opcode || Project.Data.GetFlag(selOffset) == Data.FlagType.Unreached)
                    && Project.Data.ConvertSnesToPc(Project.Data.GetSnesApi().GetIntermediateAddressOrPointer(selOffset)) == offset
                    )
                {
                    style.BackColor = Color.DeepPink;
                }

                if (column == 6
                    //&& (Project.Data.GetFlag(offset) == Data.FlagType.Opcode || Project.Data.GetFlag(offset) == Data.FlagType.Unreached)
                    && Project.Data.ConvertSnesToPc(Project.Data.GetSnesApi().GetIntermediateAddressOrPointer(offset)) == selOffset
                    )
                {
                    style.BackColor = Color.DeepPink;
                }
            }
        }