コード例 #1
0
 public static void doTest()
 {
     OneCode.OneCodeDecode("ADTAATFFFDTDTATTTADDTDADAFFDTATAFFAFTATDTDDTDDFAAAFFTFTFFDFFFFADF");
     //String bars = "00 700 905016001 174945 57325052828".OneCodeBars(), code = bars.OneCodeDecode();
     //Debug.WriteLine(bars);
     //Debug.WriteLine(code);
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: paweenwich/MyAutoIt
 private void button3_Click(object sender, EventArgs e)
 {
     Debug.WriteLine("123");
     String[] lines = File.ReadAllLines("C:\\usps.txt");
     foreach (String s in lines)
     {
         txtDebug.AppendText(s + "," + OneCode.OneCodeDecode(s) + "\n");
     }
 }
コード例 #3
0
ファイル: NewEventASM.cs プロジェクト: maritlage/FEBuilderGBA
        public OneCode DisAseemble(byte[] data, uint startaddr)
        {
            OneCode code     = new OneCode();
            uint    leftsize = ((uint)data.Length) - startaddr;

            for (int i = 0; i < Scripts.Length; i++)
            {
                if (leftsize < Scripts[i].Size)
                {//長さが足りないのだから、マッチするわけない.
                    continue;
                }

                //マッチテスト
                int pos = 0;
                int n   = 0;
                for ( ; n < Scripts[i].Args.Length; n++)
                {
                    if (Scripts[i].Args[n].Type == ArgType.ArgType_FIXED)
                    {
                        int m = 0;
                        for ( ; m < Scripts[i].Args[n].Size; m++)
                        {
                            if (data[startaddr + pos] != Scripts[i].Data[pos])
                            {
                                break;
                            }
                            pos++;
                        }
                        if (m < Scripts[i].Args[n].Size)
                        { //途中で不一致があった
                            break;
                        }
                    }
                    else
                    { //変数
                        pos += Scripts[i].Args[n].Size;
                    }
                }
                if (n >= Scripts[i].Args.Length)
                {//マッチ
                    code.ByteData    = ROM.getBinaryData(data, startaddr, (uint)Scripts[i].Size);
                    code.Script      = Scripts[i];
                    code.JisageCount = 0;
                    return(code);
                }
            }

            //見つからない不明な命令.
            code.ByteData    = ROM.getBinaryData(data, startaddr, (uint)this.Unknown.Size);
            code.Script      = this.Unknown;
            code.JisageCount = 0;
            return(code);
        }
コード例 #4
0
ファイル: NewEventASM.cs プロジェクト: maritlage/FEBuilderGBA
        public static uint GetArgValue(OneCode code, int arg_count)
        {
            Arg arg = code.Script.Args[arg_count];

            if (arg.Size == 1)
            {//1バイト
                return(ROM.u8(code.ByteData, (uint)arg.Position));
            }
            else if (arg.Size == 2)
            {//2バイト
                return(ROM.u16(code.ByteData, (uint)arg.Position));
            }
            else //if (arg.Size == 4)
            {//4バイト
                return(ROM.u32(code.ByteData, (uint)arg.Position));
            }
        }
コード例 #5
0
ファイル: NewEventASM.cs プロジェクト: maritlage/FEBuilderGBA
        public static string GetArg(OneCode code, int arg_count, out uint v)
        {
            Arg arg = code.Script.Args[arg_count];

            if (arg.Size == 1)
            {//1バイト
                v = ROM.u8(code.ByteData, (uint)arg.Position);
            }
            else if (arg.Size == 2)
            {//2バイト
                v = ROM.u16(code.ByteData, (uint)arg.Position);
            }
            else //if (arg.Size == 4)
            {//4バイト
                v = ROM.u32(code.ByteData, (uint)arg.Position);
            }

            if (arg.Size == 1)
            {//1バイト
                if (arg.Type == ArgType.ArgType_X || arg.Type == ArgType.ArgType_Y)
                {
                    return(v.ToString());
                }
                return("0x" + v.ToString("X"));
            }
            else if (arg.Size == 2)
            {//2バイト
                if (arg.Type == ArgType.ArgType_X || arg.Type == ArgType.ArgType_Y)
                {
                    return(v.ToString());
                }
                return("0x" + v.ToString("X"));
            }
            else //if (arg.Size == 4)
            {//4バイト
                if (arg.Type == ArgType.ArgType_X || arg.Type == ArgType.ArgType_Y)
                {
                    return(v.ToString());
                }
                return("0x" + v.ToString("X"));
            }
            //return v.ToString();
        }