Exemplo n.º 1
0
        public static void AddProcsAddress(List <Address> list, uint addr, uint pointer, string info, bool isPointerOnly)
        {
            addr = U.toOffset(addr);
            if (!U.isSafetyOffset(addr))
            {
                return;
            }
            if (pointer != U.NOT_FOUND)
            {
                pointer = U.toOffset(pointer);
                if (!U.isSafetyOffset(pointer))
                {
                    return;
                }
            }

            uint length;

            if (isPointerOnly)
            {
                length = 0;
            }
            else
            {
                length = ProcsScriptForm.CalcLengthAndCheck(addr);
            }
            list.Add(new Address(addr, length, pointer, info, DataTypeEnum.PROCS));
        }
Exemplo n.º 2
0
        //全データの取得
        public static void MakeAllDataLength(List <Address> list)
        {
            string name = "ItemWeaponEffect";

            InputFormRef InputFormRef = Init(null);

            FEBuilderGBA.Address.AddAddress(list, InputFormRef, name, new uint[] { 8 });
            uint addr = InputFormRef.BaseAddress;

            for (int i = 0; i < InputFormRef.DataCount; i++, addr += InputFormRef.BlockSize)
            {
                uint mapAnime = Program.ROM.p32(addr + 8);
                if (!U.isSafetyOffset(mapAnime))
                {
                    continue;
                }
                uint   itemid    = Program.ROM.u8(addr + 0);
                string proc_name = name + "_PROC_" + U.ToHexString(itemid) + " " + ItemForm.GetItemName(itemid);

                FEBuilderGBA.Address.AddPointer(list
                                                , addr + 8
                                                , ProcsScriptForm.CalcLengthAndCheck(mapAnime)
                                                , proc_name
                                                , FEBuilderGBA.Address.DataTypeEnum.PROCS
                                                );
            }
        }
Exemplo n.º 3
0
        //長さを求める.
        static uint CalcLength(uint addr)
        {
            uint start = addr;
            uint limit = (uint)Program.ROM.Data.Length;

            while (addr + 8 <= limit)
            {
                uint code = Program.ROM.u16(addr + 0);
                uint sarg = Program.ROM.u16(addr + 2);
                uint parg = Program.ROM.u32(addr + 4);
                addr += 8; //命令は8バイト固定.
                if (addr + 8 > limit)
                {
                    break;
                }

                if (code == 0x0C)
                {     //parg is null
                    if (sarg == 0)
                    { //GOTO LABEL 0があった
                     //Goto 0の時だけは、pargにゴミが入るときがある.

                        //先読みをしてみる.
                        uint sakiyomi = ProcsScriptForm.CalcLengthAndCheck(addr + 8);
                        if (sakiyomi == U.NOT_FOUND)
                        {     //この先が壊れているなら、自分が終端.
                            if (start == addr)
                            { //自分が終端なのに、それが最初に出てくるのはおかしいよね.
                                return(U.NOT_FOUND);
                            }
                            break;
                        }
                    }
                    else if (parg != 0)
                    {//規約違反
                        return(U.NOT_FOUND);
                    }
                }

                if (code == 0x800)
                {//EXIT その3
                    break;
                }

                if (code == 0x00)
                {//EXIT
                    break;
                }
            }
            return(addr - start);
        }
Exemplo n.º 4
0
        void TypeToLengthAndName(AsmMapSt p, uint pointer, ROM rom)
        {
            string type = p.TypeName;

            if (type == "LZ77")
            {
                p.Length = LZ77.getCompressedSize(rom.Data, U.toOffset(pointer));
            }
            else if (type == "OAMREGS")
            {
                p.Length = U.OAMREGSLength(U.toOffset(pointer), rom);
                p.Name  += " Count_" + ((p.Length - 2) / (3 * 2));
            }
            else if (type == "OAMREGS_ARRAY")
            {
                p.Length = ScanOAMREGSTable(pointer, p.Name, rom);
            }
            else if (type == "TEXTBATCH")
            {
                p.Length = U.TextBatchLength(U.toOffset(pointer), rom);
                p.Name  += " Count_" + ((p.Length) / 8);
            }
            else if (type == "TEXTBATCHSHORT")
            {
                p.Length = U.TextBatchShortLength(U.toOffset(pointer), rom);
                p.Name  += " Count_" + ((p.Length) / 2);
            }
            else if (type == "EVENT")
            {
                p.Length = EventScript.SearchEveneLength(rom.Data, U.toOffset(pointer));
                p.Name  += " Count_" + ((p.Length - 2) / (3 * 2));
            }
            else if (type == "HEADERTSA")
            {
                p.Length = ImageUtil.CalcByteLengthForHeaderTSAData(rom.Data, (int)U.toOffset(pointer));
            }
            else if (type == "ROMPALETTEANIMEFRAME")
            {
                p.Length = ImageRomAnimeForm.GetPaletteFrameCountLow(rom.Data, U.toOffset(pointer)) * 2;
            }
            else if (type == "PALETTE")
            {
                p.Length = 0x20;
            }
            else if (type == "PALETTE2")
            {
                p.Length = 0x20 * 2;
            }
            else if (type == "PALETTE3")
            {
                p.Length = 0x20 * 3;
            }
            else if (type == "PALETTE4")
            {
                p.Length = 0x20 * 4;
            }
            else if (type == "PALETTE8")
            {
                p.Length = 0x20 * 8;
            }
            else if (type == "PALETTE7")
            {
                p.Length = 0x20 * 7;
            }
            else if (type == "PALETTE16")
            {
                p.Length = 0x20 * 16;
            }
            else if (type == "ROMTCS")
            {
                p.Length = ImageUtilAP.CalcROMTCSLength(U.toOffset(pointer), rom);
            }
            else if (type == "NAZO60")
            {
                p.Length = 60;
            }
            else if (type == "FONTCOLOR0x200")
            {
                p.Length = 0x200;
            }
            else if (type == "NewPopupSimple")
            {
                p.Length = ImageUtilAP.CalcPopupSimpleLength(U.toOffset(pointer), rom);
            }
            else if (type == "SECONDARYOAM")
            {
                p.Length = 14;
            }
            else if (type == "SECONDARYOAM_ARRAY")
            {
                p.Length = ScanSECONDARYOAMTable(pointer, p.Name, rom);
            }
            else if (type == "CSTRING")
            {
                int    length;
                string strname = rom.getString(U.toOffset(pointer), out length);
                p.Length = (uint)length;
                p.Name  += " => " + strname;
            }
            else if (type == "SOUND_85COMMAND_POINTER_ARRAY")
            {
                p.Length = ScanSOUND85COMMANDPointerTable(pointer, p.Name, rom);
            }
            else if (type == "ASM_POINTER_ARRAY")
            {
                p.Length = ScanASMPointerTable(pointer, p.Name, rom);
            }
            else if (type == "PROC")
            {
                uint length = ProcsScriptForm.CalcLengthAndCheck(U.toOffset(pointer));
                if (length != U.NOT_FOUND)
                {
                    p.Length = length;
                }
            }
            else if (type == "NAZO8_DATA_POINTER_ARRAY")
            {
                p.Length = ScanNazo8DataPointerTable(pointer, p.Name, rom);
            }
            else if (type == "ASM")
            {
                p.Length = 0;
            }
            else if (type == "BGCONFIG")
            {
                p.Length = 10 * 2;
            }
        }