Beispiel #1
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Executes the hover tip operation. </summary>
        ///
        /// <remarks> 10/09/2018. </remarks>
        ///
        /// <param name="s">    A Scintilla to process. </param>
        /// <param name="pos">  The position. </param>
        /// <param name="word"> The word. </param>
        /// -------------------------------------------------------------------------------------------------
        public void DoHoverTip(Scintilla s, int pos, string word)
        {
            HoverTipScintilla = s;
            Hoverpos          = pos;

            HoverLabel = Labels.FindLabel(word);

            //string tip = word;
            if (HoverLabel != null)
            {
                if (HoverLabel.function)
                {
                    //its a function label
                    HoverTipScintilla.CallTipShow(Hoverpos, "Function :" + HoverLabel.label + " @ $" + HoverLabel.address.ToString("X4"));
                }
                else
                {
                    Program.telnetConnection.SendCommand("read-memory " + HoverLabel.address.ToString() + " 2", HoverCallback);
                }



                //found a label
                //tip = tip + " $" + HoverLabel.address.ToString("X4");
            }
            else
            {
                //no label lets not display anything
                //s.CallTipShow(pos,tip);
            }
        }
Beispiel #2
0
 public void SetInitialDataFromLabelName(string labelname)
 {
     Labels.Label geolabel = new Labels.Label();
     geolabel = Labels.Utils.LabelUtil.findLabelFromName(labelname, "", LakiTool.MISC.Game.gamePath, true);
     if (geolabel.labelFound)
     {
         lines        = System.IO.File.ReadAllLines(geolabel.labelFile);
         geoLabelName = geolabel.labelName;
     }
 }
Beispiel #3
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Event handler. Called by addbutton for click events. </summary>
        ///
        /// <remarks> 12/09/2018. </remarks>
        ///
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e">	  Event information. </param>
        /// -------------------------------------------------------------------------------------------------
        private void addbutton_Click(object sender, EventArgs e)
        {
            string s = labeladdtext.Text.TrimStart(' ').TrimEnd(' ');

            Labels.Label l = Labels.FindLabel(s);
            if (l != null)
            {
                AddWatchLabel(l);
            }
        }
Beispiel #4
0
        private void ContextGotoAddress(object sender, EventArgs e)
        {
            CustomMenuItem customMenuItem = sender as CustomMenuItem;

            Labels.Label l = (Labels.Label)customMenuItem.value;

            if (l != null)
            {
                TraceFile.FocusAddr(l.nextAddress.GetAddr(), l.nextAddress.GetBank());
            }
        }
Beispiel #5
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Context add to watch. </summary>
        ///
        /// <remarks> 19/09/2018. </remarks>
        ///
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e">	  Event information. </param>
        /// -------------------------------------------------------------------------------------------------
        private void ContextAddToWatch(object sender, EventArgs e)
        {
            CustomMenuItem customMenuItem = sender as CustomMenuItem;

            Labels.Label l = (Labels.Label)customMenuItem.value;

            if (l != null)
            {
                MainForm.myWatches.AddWatchLabel(l);
            }
        }
 public void SetInitialDataFromLabelName(string labelname)
 {
     Labels.Label f3dlabel = new Labels.Label();
     f3dlabel = Labels.Utils.LabelUtil.findLabelFromName(labelname, "", LakiTool.MISC.Game.gamePath, true);
     if (f3dlabel.labelFound)
     {
         fileName     = f3dlabel.labelFile;
         lines        = System.IO.File.ReadAllLines(f3dlabel.labelFile);
         startCommand = F3DUtils.getIndexFromLineData(f3dlabel.labelLine, lines);
     }
 }
Beispiel #7
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Query if 'l' has label. </summary>
        ///
        /// <remarks> 12/09/2018. </remarks>
        ///
        /// <param name="l"> The l control. </param>
        ///
        /// <returns> True if label, false if not. </returns>
        /// -------------------------------------------------------------------------------------------------
        private VarWatchData HasLabel(Labels.Label l)
        {
            foreach (VarWatchData vmd in varWatchData)
            {
                if (vmd.label == l)
                {
                    return(vmd);
                }
            }

            return(null);
        }
Beispiel #8
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Adds a watch label. </summary>
        ///
        /// <remarks> 19/09/2018. </remarks>
        ///
        /// <param name="l"> The l control. </param>
        /// -------------------------------------------------------------------------------------------------
        public void AddWatchLabel(Labels.Label l)
        {
            if (HasLabel(l) == null)
            {
                VarWatchData vwd = new VarWatchData();
                vwd.label = l;
                varWatchData.Insert(0, vwd);
                vwd.local = false;

                Update();
            }
        }
Beispiel #9
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Event handler. Called by Codewindow for mouse down events. </summary>
        ///
        /// <remarks> 18/09/2018. </remarks>
        ///
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e">	  Mouse event information. </param>
        /// -------------------------------------------------------------------------------------------------
        private void Codewindow_MouseDown(object sender,
                                          System.Windows.Forms.MouseEventArgs e)
        {
            Scintilla s = (Scintilla)sender;

            if (e.Button == MouseButtons.Right)
            {
                ContextMenu cm = new ContextMenu();

                int position = s.CharPositionFromPoint(e.X, e.Y);


                int linenum = s.LineFromPosition(position);
                var line    = s.Lines[linenum];

                TraceFile tf = TraceFile.FindTraceFile((string)s.Tag);
                if (tf != null)
                {
                    LineData ld   = tf.GetLine(linenum);
                    string   word = s.GetWordFromPosition(position);

                    //step mode and on valid line add a set pc option
                    if (tf.IsLineLegal(linenum) && Program.InStepMode)
                    {
                        cm.MenuItems.Add(new CustomMenuItem("Set PC to $" + ld.address.ToString("X4"), new EventHandler(ContextSetPC), (object)ld.address));
                    }

                    if (!string.IsNullOrEmpty(word))
                    {
                        Labels.Label l = Labels.FindLabel(word);
                        if (l != null)
                        {
                            if (!l.function)
                            {
                                cm.MenuItems.Add(new CustomMenuItem("Add Variable " + l.label + " to Watch", new EventHandler(ContextAddToWatch), (object)l));
                            }
                        }
                    }


                    cm.MenuItems.Add("item2");
                    //ContextMenu cm = new ContextMenu();
                    //{
                    //	MenuItem mi = new MenuItem("coming soon2 "+word);//  ,   (s, ea) => this.UndoRedo.Undo());
                    //	cm.MenuItems.Add(mi);
                    //}
                    tf.codefile.codewindow.ContextMenu = cm;
                }
            }

            Console.WriteLine("hello");
        }
Beispiel #10
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Context add to watch. </summary>
        ///
        /// <remarks> 19/09/2018. </remarks>
        ///
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e">	  Event information. </param>
        /// -------------------------------------------------------------------------------------------------
        private void ContextAddToWatch(object sender, EventArgs e)
        {
            CustomMenuItem customMenuItem = sender as CustomMenuItem;

            Labels.Label l = (Labels.Label)customMenuItem.value;

            if (l != null)
            {
                MainForm.myWatches.AddWatchLabel(l);
            }

            //CustomMenuItem customMenuItem = sender as CustomMenuItem;
            //int pc = (int) customMenuItem.value;

            //Console.WriteLine("hello "+pc.ToString("X4"));
        }
Beispiel #11
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Adds a local watch. </summary>
        ///
        /// <remarks> 12/09/2018. </remarks>
        ///
        /// <param name="l"> The l control. </param>
        /// -------------------------------------------------------------------------------------------------
        public void AddLocalWatch(Labels.Label l)
        {
            VarWatchData vmd = HasLabel(l);

            if (vmd != null)
            {
                vmd.localcount = 1;
            }
            else
            {
                vmd            = new VarWatchData();
                vmd.localcount = 1;
                vmd            = new VarWatchData();
                vmd.label      = l;
                varWatchData.Add(vmd);
                vmd.local = true;
            }
        }
Beispiel #12
0
        public static void GotoLabel(Labels.Label l)
        {
            if (traceFiles == null)
            {
                return;
            }


            foreach (TraceFile t in traceFiles)
            {
                LineData ld = t.DoesFileHaveAddress(l.address, l.bank);
                if (ld != null)
                {
                    var line = t.codefile.codewindow.Lines[CurrentExecuteLine];

                    MainForm.mySourceWindow.FocusLine(t.codefile, ld.lineNumber);
                }
            }
        }
Beispiel #13
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Event handler. Called by Codewindow for mouse down events. </summary>
        ///
        /// <remarks> 18/09/2018. </remarks>
        ///
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e">	  Mouse event information. </param>
        /// -------------------------------------------------------------------------------------------------
        private void Codewindow_MouseDown(object sender,
                                          System.Windows.Forms.MouseEventArgs e)
        {
            Scintilla s = (Scintilla)sender;

            if (e.Button == MouseButtons.Right)
            {
                ContextMenu cm = new ContextMenu();

                int position = s.CharPositionFromPoint(e.X, e.Y);


                int linenum = s.LineFromPosition(position);
                var line    = s.Lines[linenum];

                TraceFile tf = TraceFile.FindTraceFile((string)s.Tag);
                if (tf != null)
                {
                    LineData ld   = tf.GetLine(linenum);
                    string   word = s.GetWordFromPosition(position);

                    //step mode and on valid line add a set pc option
                    if (tf.IsLineLegal(linenum) && Program.InStepMode)
                    {
                        //cm.MenuItems.Add(new CustomMenuItem( "Set PC to $"+ld.address.ToString("X4"),new EventHandler(ContextSetPC),(object)ld.address ) );

                        const uint mask = (1 << BREAKPOINT_MARKER);
                        if ((line.MarkerGet() & mask) > 0)
                        {
                            cm.MenuItems.Add(new CustomMenuItem("Clear breakpoint", new EventHandler(ContextClearBreakpoint), (object)ld.nextAddress.GetLongAddress()));
                        }
                        else
                        {
                            cm.MenuItems.Add(new CustomMenuItem("Set breakpoint", new EventHandler(ContextSetBreakpoint), (object)ld.nextAddress.GetLongAddress()));
                        }
                    }

                    if (!string.IsNullOrEmpty(word))
                    {
                        Labels.Label l = Labels.FindLabel(word);
                        if (l != null)
                        {
                            //if (!l.function)
                            //{
                            cm.MenuItems.Add(new CustomMenuItem("ADD TO WATCH: " + l.label + " " + l.nextAddress.ToString("b") + "", new EventHandler(ContextAddToWatch), (object)l));
                            cm.MenuItems.Add(new CustomMenuItem("JUMP TO: " + l.label + " " + l.nextAddress.ToString("b"), new EventHandler(ContextGotoAddress), (object)l));
                            //}
                        }
                    }


                    //cm.MenuItems.Add("item3");
                    //ContextMenu cm = new ContextMenu();
                    //{
                    //	MenuItem mi = new MenuItem("coming soon2 "+word);//  ,   (s, ea) => this.UndoRedo.Undo());
                    //	cm.MenuItems.Add(mi);
                    //}
                    tf.codefile.codewindow.ContextMenu = cm;
                }
            }
        }