Exemple #1
0
        private void OneLineDisassembler()
        {
            int i;

            if (this.ASMTextBox.Text.Length < 8)
            {//命令は最低でも8バイトでないとダメ.
                for (i = this.ASMTextBox.Text.Length; i < 8; i++)
                {
                    this.ASMTextBox.Text += "0";
                }
            }

            //文字列からバイト列に
            byte[] selectedByteData = U.convertStringDumpToByte(this.ASMTextBox.Text);
            if (selectedByteData.Length < 4)
            {
                return;
            }
            string hint = this.ScriptCodeName.Text;

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

            //命令を選択.
            this.ScriptCodeName.Text = EventScript.makeCommandComboText(code.Script, false);

            //引数
            int n = 0;

            for (i = 0; i < 2; i++, n++)
            {
                if (n >= code.Script.Args.Length)
                {
                    break;
                }
                EventScript.Arg arg = code.Script.Args[n];
                uint            v   = EventScript.GetArgValue(code, arg);

                if (EventScript.IsFixedArg(arg))
                {//固定長になっているところは入力できないようにする.
                    i--;
                    continue;
                }

                EventScriptForm.SetOneScriptEditSetTables(ScriptEditSetTables[i], arg, v);
            }

            for (; i < 2; i++)
            {
                //使わないパラメータはあっかりーんする
                EventScriptForm.HideOneScriptEditSetTables(ScriptEditSetTables[i]);
            }
            int y = ShowFloatingControlpanelInner(code, this.Script.SelectedIndex);

            ControlPanel.Location = new Point(ControlPanel.Location.X, y);
        }
Exemple #2
0
        bool Get_Select_ParamSrc_Object(object sender
                                        , out EventScript.OneCode outCode //編集しているコード
                                        , out int outSelectID             //選択されたNumboxのindex(label等に関連づく)
                                        , out int outArg                  //引数の数(FIxed等非表示の引数があるので調べる)
                                        )
        {
            outCode     = null;
            outSelectID = 0;
            outArg      = 0;
            if (this.Script.SelectedIndex < 0 || this.Script.SelectedIndex >= this.ProcsScript.Count)
            {
                return(false);
            }

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

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

            Control senderobject = ((Control)sender);

            int selectID = (int)U.atoi(senderobject.Name.Substring("ParamSrc".Length));

            if (selectID <= 0)
            {
                selectID = (int)U.atoi(senderobject.Name.Substring("ParamLabel".Length));
                if (selectID <= 0)
                {
                    selectID = (int)U.atoi(senderobject.Name.Substring("ParamImage".Length));
                    if (selectID <= 0)
                    {
                        return(false);
                    }
                }
            }
            selectID = selectID - 1;
            EventScript.Arg arg;
            int             i = 0;
            int             n = 0;

            for (; i < code.Script.Args.Length; i++)
            {
                arg = code.Script.Args[i];
                if (EventScript.IsFixedArg(arg))
                {//固定長になっているところは入力できないようにする.
                    continue;
                }
                if (n < selectID)
                {
                    n++;
                    continue;
                }
                break;
            }

            if (i >= code.Script.Args.Length)
            {
                return(false);
            }
            outCode     = code;     //編集しているコード
            outSelectID = selectID; //選択されたNumboxのindex(label等に関連づく)
            outArg      = i;        //引数の数(FIxed等非表示の引数があるので調べる)
            return(true);
        }
        private string EventToTextOne(int number)
        {
            StringBuilder sb = new StringBuilder();

            EventScript.OneCode code = this.ProcsScript[number];
            for (int n = 0; n < code.ByteData.Length; n++)
            {
                sb.Append(U.ToHexString(code.ByteData[n]));
            }
            sb.Append("\t//");

            //スクリプト名.
            sb.Append(code.Script.Info[0]);

            for (int i = 1; i < code.Script.Info.Length; i += 2)
            {
                char symbol = ' ';
                if (code.Script.Info[i].Length > 2)
                {// [X みたいな文字列が入る. 2文字目のXが シンボル名.
                    symbol = code.Script.Info[i][1];
                }

                for (int n = 0; n < code.Script.Args.Length; n++)
                {
                    EventScript.Arg arg = code.Script.Args[n];
                    if (EventScript.IsFixedArg(arg))
                    {
                        continue;
                    }
                    if (symbol != arg.Symbol)
                    {
                        continue;
                    }

                    sb.Append("[");

                    uint   v;
                    string hexstring = EventScript.GetArg(code, n, out v);
                    sb.Append(arg.Name);
                    sb.Append(":");

                    sb.Append(hexstring);

                    if (arg.Type == EventScript.ArgType.TEXT ||
                        arg.Type == EventScript.ArgType.CONVERSATION_TEXT ||
                        arg.Type == EventScript.ArgType.SYSTEM_TEXT ||
                        arg.Type == EventScript.ArgType.ONELINE_TEXT ||
                        arg.Type == EventScript.ArgType.POINTER_TEXT
                        )
                    {
                        sb.Append(" ");
                        string text = TextForm.DirectAndStripAllCode((v));
                        if (text.Length > 30)
                        {//長いテキストは省略
                            sb.Append(U.escape_return(U.strimwidth(text, 0, 20)));
                        }
                        else
                        {//長くないテキストはすぐ横に表示
                            sb.Append(U.escape_return(text));
                        }
                    }
                    else if (arg.Type == EventScript.ArgType.UNIT)
                    {
                        sb.Append(" ");
                        sb.Append(UnitForm.GetUnitName(v));
                    }
                    else if (arg.Type == EventScript.ArgType.CLASS)
                    {
                        sb.Append(" ");
                        sb.Append(ClassForm.GetClassName(v));
                    }
                    else if (arg.Type == EventScript.ArgType.POINTER_PROCS)
                    {
                        sb.Append(" ");
                        string dummy;
                        sb.Append(Program.AsmMapFileAsmCache.GetASMName(v, true, out dummy));
                    }
                    else if (arg.Type == EventScript.ArgType.POINTER_ASM)
                    {
                        sb.Append(" ");
                        string dummy;
                        sb.Append(Program.AsmMapFileAsmCache.GetASMName(v, false, out dummy));
                    }
                    else if (arg.Type == EventScript.ArgType.FSEC)
                    {//FSEC
                        sb.Append(" ");
                        sb.Append(InputFormRef.GetFSEC(v));
                    }
                    sb.Append("]");
                    break;
                }
            }
            sb.AppendLine("");

            return(sb.ToString());
        }