Example #1
0
        void AddRecycle(uint id, List <Address> list)
        {
            //無効なID
            if (id <= 0)
            {
                return;
            }
            if (id < this.MaxTextCount)
            {
                uint addr  = this.TextBaseAddress + (id * 4);
                uint paddr = Program.ROM.u32(addr);
                if (TextForm.Is_RAMPointerArea(paddr))
                {
                    return;
                }
                uint data_addr;

                int length;
                if (FETextEncode.IsUnHuffmanPatchPointer(paddr))
                {//un-huffman patch?
                    uint unhuffman_addr = U.toOffset(FETextEncode.ConvertUnHuffmanPatchToPointer(paddr));
                    data_addr = unhuffman_addr;
                    TextDecode.UnHffmanPatchDecode(unhuffman_addr, out length);
                }
                else if (U.isPointer(paddr))
                {
                    data_addr = U.toOffset(paddr);
                    TextDecode.huffman_decode(data_addr, out length);
                }
                else
                {
                    return;
                }

                if (length <= 0)
                {
                    return;
                }
                if (data_addr == this.TextID0Addr)
                {
                    return;
                }
                FEBuilderGBA.Address.AddAddress(list
                                                , data_addr
                                                , (uint)length
                                                , U.NOT_FOUND
                                                , "text " + U.ToHexString(id)
                                                , FEBuilderGBA.Address.DataTypeEnum.BIN);
            }
//CStringに対しては、リサイクルバッファを利用する方式を利用しない
//なぜなら、FE6には大量のポインタ参照があるためです。
//容量も大きくないので、メリットよりデメリットの方が上回る
//            else if (U.isSafetyPointer(id))
//            {
//                uint p = U.toOffset(id);
//                FEBuilderGBA.Address.AddCString(list, p);
//            }
        }
Example #2
0
        void WriteTextUnHffman(uint id, string text, Undo.UndoData undodata)
        {
            uint addr  = this.TextBaseAddress + (id * 4);
            uint paddr = Program.ROM.u32(addr);

            if (TextForm.Is_RAMPointerArea(paddr))
            {//iw-ram / ew-ram にデータをおいている人がいるらしい
                return;
            }

            byte[] encode;
            Program.FETextEncoder.UnHuffmanEncode(text, out encode);

            string undoname = "Text:" + U.ToHexString(id);
            uint   newaddr  = this.Recycle.Write(encode, undodata);

            if (newaddr == U.NOT_FOUND)
            {
                return;
            }
            newaddr = U.toPointer(newaddr);
            newaddr = FETextEncode.ConvertPointerToUnHuffmanPatchPointer(newaddr);
            Program.ROM.write_u32(addr, newaddr, undodata);
        }
Example #3
0
        void AddRecycle(uint id, List <Address> recycle)
        {
            //無効なID
            if (id <= 0)
            {
                return;
            }
            if (id < this.MaxTextCount)
            {
                uint addr  = this.TextBaseAddress + (id * 4);
                uint paddr = Program.ROM.u32(addr);
                if (TextForm.Is_RAMPointerArea(paddr))
                {
                    return;
                }
                uint data_addr;

                int length;
                if (FETextEncode.IsUnHuffmanPatchPointer(paddr))
                {//un-huffman patch?
                    uint unhuffman_addr = U.toOffset(FETextEncode.ConvertUnHuffmanPatchToPointer(paddr));
                    data_addr = unhuffman_addr;
                    TextDecode.UnHffmanPatchDecode(unhuffman_addr, out length);
                }
                else if (U.isPointer(paddr))
                {
                    data_addr = U.toOffset(paddr);
                    TextDecode.huffman_decode(data_addr, out length);
                }
                else
                {
                    return;
                }

                if (length <= 0)
                {
                    return;
                }
                if (data_addr == this.TextID0Addr)
                {
                    return;
                }
                FEBuilderGBA.Address.AddAddress(recycle
                                                , data_addr
                                                , (uint)length
                                                , U.NOT_FOUND
                                                , "text " + U.ToHexString(id)
                                                , FEBuilderGBA.Address.DataTypeEnum.BIN);
            }
            else if (U.isSafetyPointer(id))
            {
                uint data_addr = Program.ROM.p32(U.toOffset(id));
                if (!U.isSafetyOffset(id))
                {
                    return;
                }

                int    length = 0;
                string str    = Program.ROM.getString(data_addr, out length);

                FEBuilderGBA.Address.AddAddress(recycle
                                                , data_addr
                                                , (uint)length
                                                , U.NOT_FOUND
                                                , "CString " + U.To0xHexString(id)
                                                , FEBuilderGBA.Address.DataTypeEnum.BIN);
            }
        }