Beispiel #1
0
        static bool IsConflictCheck(uint addr)
        {
            if (ImageUtilMagic.IsMagicArea(ref addr))
            {//魔法領域として使われているならだめ
                return(true);
            }
            if (IsSkillReserve(ref addr))
            {
                return(true);
            }
            if (EventUnitForm.IsEventUnitReserve(ref addr))
            {
                return(true);
            }
            //                if (IsTextAreaReserrve(ref addr))
            //                {
            //                    return break;
            //                }
            uint a = Program.ROM.p32(Program.ROM.RomInfo.item_pointer());

            if (a == addr)
            {
                return(true);
            }
            a = Program.ROM.p32(Program.ROM.RomInfo.class_pointer());
            if (a == addr)
            {
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        //空き領域の探索
        static uint SearchFreeSpaceOneLow(uint newSize, uint searchStart)
        {
            uint addr;
            //00=ファイル末尾
            //01=0x09000000以降の拡張領域で、0x00が規定数+必要データ数連続している領域
            //02=0x09000000以降の拡張領域で、0xFFが規定数+必要データ数連続している領域
            //03=0x08000000以降の通常領域で、0x00が規定数+必要データ数連続している領域
            //04=0x08000000以降の通常領域で、0xFFが規定数+必要データ数連続している領域
            const int LTRIM_SPACE_SIZE = 8;
            uint      needSize         = U.Padding4(FREE_SPACE_SIZE + newSize);

            addr = Program.ROM.FindFreeSpace(searchStart, needSize);
            if (addr != U.NOT_FOUND)
            {
                if (ImageUtilMagic.IsMagicArea(ref addr))
                {//魔法領域として使われているなら振り直し
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
                if (IsSkillReserve(ref addr))
                {
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }

                return(addr + LTRIM_SPACE_SIZE);
            }

            return(AppendEndOfFile(newSize));
        }
Beispiel #3
0
        //空き領域の探索
        static uint SearchFreeSpaceOneLow(uint newSize, uint searchStart)
        {
            uint addr;
            //00=ファイル末尾
            //01=0x09000000以降の拡張領域で、0x00が規定数+必要データ数連続している領域
            //02=0x09000000以降の拡張領域で、0xFFが規定数+必要データ数連続している領域
            //03=0x08000000以降の通常領域で、0x00が規定数+必要データ数連続している領域
            //04=0x08000000以降の通常領域で、0xFFが規定数+必要データ数連続している領域
            const int LTRIM_SPACE_SIZE = 16;
            uint      needSize         = U.Padding4(FREE_SPACE_SIZE + newSize);

            addr = Program.ROM.FindFreeSpace(searchStart, needSize);
            if (addr != U.NOT_FOUND)
            {
                if (ImageUtilMagic.IsMagicArea(ref addr))
                {//魔法領域として使われているなら振り直し
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
                if (IsSkillReserve(ref addr))
                {
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
                if (EventUnitForm.IsEventUnitReserve(ref addr))
                {
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
//                if (IsTextAreaReserrve(ref addr))
//                {
//                    return SearchFreeSpaceOneLow(newSize, addr);
//                }
                if (IsUnknownCollision(ref addr, newSize))
                {//未知の衝突防止
                    return(SearchFreeSpaceOneLow(newSize, addr));
                }
                uint a = Program.ROM.p32(Program.ROM.RomInfo.item_pointer());
                if (a >= addr && a < addr + newSize)
                {
                    return(SearchFreeSpaceOneLow(newSize, addr + 0x100));
                }
                a = Program.ROM.p32(Program.ROM.RomInfo.class_pointer());
                if (a >= addr && a < addr + newSize)
                {
                    return(SearchFreeSpaceOneLow(newSize, addr + 0x100));
                }

                return(addr + LTRIM_SPACE_SIZE);
            }

            return(AppendEndOfFile(newSize));
        }