Beispiel #1
0
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            InputFormRef.WriteButtonToYellow(this.AllWriteButton, true);
            PushUndo();

            if (this.Script.SelectedIndex < 0 || this.Script.SelectedIndex >= this.ProcsScript.Count)
            {//追加で処理する.
                NewButton.PerformClick();
                return;
            }
            OneLineDisassembler();

            //文字列からバイト列に
            byte[] selectedByteData = U.convertStringDumpToByte(this.ASMTextBox.Text);

            //バイト列をイベント命令としてDisassembler.
            EventScript.OneCode code = Program.ProcsScript.DisAseemble(selectedByteData, 0);
            code.Comment = this.CommentTextBox.Text;

            //選択されているコードを入れ替える.
            this.ProcsScript[this.Script.SelectedIndex] = code;

            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, -1);

            HideFloatingControlpanel();
        }
Beispiel #2
0
        private void TextToEvent(string str, int insertPoint = -1, bool isClear = false)
        {
            this.PushUndo();

            if (isClear)
            {
                this.ProcsScript.Clear();
            }

            string[] lines = str.Split('\n');
            for (int i = 0; i < lines.Length; i++)
            {
                byte[] bin = LineToEventByte(lines[i]);
                if (bin.Length < 4)
                {//壊れているか違うコード
                    continue;
                }

                EventScript.OneCode code = Program.ProcsScript.DisAseemble(bin, 0);
                if (insertPoint <= -1)
                {//末尾に追加.
                    this.ProcsScript.Add(code);
                }
                else
                {//特定場所に追加.
                    this.ProcsScript.Insert(insertPoint, code);
                }
            }

            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, this.Script.SelectedIndex);
        }
Beispiel #3
0
        void RunUndoRollback(UndoData u)
        {
            this.ProcsScript = EventScript.CloneEventList(u.EventAsm);

            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, this.Script.SelectedIndex);
        }
Beispiel #4
0
        private void N_ReloadListButton_Click(object sender, EventArgs e)
        {
            this.ProcsScript.Clear();

            uint addr = (uint)this.Address.Value;

            addr = U.toOffset(addr);

            if (sender == null ||
                this.N_ReadCount.Value == 0)
            {
                if (U.isSafetyOffset(addr))
                {
                    uint length = CalcLength(addr);
                    U.ForceUpdate(this.N_ReadCount, length);
                }
                else
                {
                    U.ForceUpdate(this.N_ReadCount, 0);
                }
            }

            //変更通知.
            if (Navigation != null)
            {
                NavigationEventArgs arg = new NavigationEventArgs();
                arg.Address = addr;
                Navigation(this, arg);
            }

            uint bytecount = (uint)this.N_ReadCount.Value;
            uint limit     = Math.Min(addr + bytecount, (uint)Program.ROM.Data.Length);

            while (addr < limit)
            {
                EventScript.OneCode code = Program.ProcsScript.DisAseemble(Program.ROM.Data, addr);
                this.ProcsScript.Add(code);
                addr += (uint)code.Script.Size;
            }
            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, -1);
        }
Beispiel #5
0
        private void RemoveButton_Click(object sender, EventArgs e)
        {
            if (this.Script.SelectedIndex < 0 || this.Script.SelectedIndex >= this.ProcsScript.Count)
            {
                return;
            }
            InputFormRef.WriteButtonToYellow(this.AllWriteButton, true);
            PushUndo();

            this.ProcsScript.RemoveAt(this.Script.SelectedIndex);

            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, this.Script.SelectedIndex - 1);

            //コントロールパネルを閉じる.
            HideFloatingControlpanel();
        }
Beispiel #6
0
        private void NewButton_Click(object sender, EventArgs e)
        {
            if (this.ProcsScript == null)
            {
                return;
            }
            InputFormRef.WriteButtonToYellow(this.AllWriteButton, true);
            PushUndo();

            OneLineDisassembler();

            //文字列からバイト列に
            byte[] selectedByteData = U.convertStringDumpToByte(this.ASMTextBox.Text);

            //バイト列をイベント命令としてDisassembler.
            EventScript.OneCode code = Program.ProcsScript.DisAseemble(selectedByteData, 0);
            code.Comment = this.CommentTextBox.Text;

            int selected;

            //選択されている部分に追加
            if (this.Script.SelectedIndex < 0)
            {
                this.ProcsScript.Add(code);
                selected = this.ProcsScript.Count - 1;
            }
            else
            {
                this.ProcsScript.Insert(this.Script.SelectedIndex + 1, code);
                selected = this.Script.SelectedIndex + 1;
            }

            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, selected);

            //コントロールパネルを閉じる.
            HideFloatingControlpanel();
        }
Beispiel #7
0
 private void Script_SelectedIndexChanged(object sender, EventArgs e)
 {
     HideFloatingControlpanel();
     EventScriptUtil.UpdateRelatedLine(this.Script, this.ProcsScript);
 }