コード例 #1
0
        public static void load(Filesystem fs)
        {
            filename = fs.getRomPath();
            FS       = fs;
            if (fs is NitroROMFilesystem)
            {
                romfile = new System.IO.FileInfo(filename);
            }

            arm9binFile = FS.getFileByName("arm9.bin");
            arm9ovFile  = FS.getFileByName("arm9ovt.bin");
            arm9ovs     = loadOvTable(arm9ovFile);
            arm9ovs2    = loadOvTable2(arm9ovFile);
            arm7binFile = FS.getFileByName("arm7.bin");
            arm7ovFile  = FS.getFileByName("arm7ovt.bin");
            arm7ovs     = loadOvTable(arm7ovFile);
            rsaSigFile  = FS.getFileByName("rsasig.bin");
            headerFile  = FS.getFileByName("header.bin");

            arm9RAMAddress = headerFile.getUintAt(0x28);

            ByteArrayInputStream header = new ByteArrayInputStream(headerFile.getContents());

            romInternalName = header.ReadString(12);
            romGamecode     = header.ReadString(4);
            ASMOffset       = 0xE00;
            // New Super Mario Bros.
            if (romGamecode == "A2DE") // English
            {
                Region = Origin.US;
            }
            else if (romGamecode == "A2DP") // European
            {
                Region       = Origin.EU;
                OverlayCount = 134;
            }
            else if (romGamecode == "A2DJ") // Japanese
            {
                Region = Origin.JP;
            }
            else if (romGamecode == "A2DK") // Korean
            {
                Region = Origin.KR;
            }
            else if (romGamecode == "A2DC") // Chinese
            {
                Region = Origin.CH;
            }
            else
            {
                isNSMBRom = false;
                Region    = Origin.UNK;
                // Pokémon Diamond Version
                if (romGamecode == "ADAE") // English
                {
                    ASMOffset = 0x106770;
                }
                else if (romGamecode == "ADAJ") // Japanese
                {
                    ASMOffset = 0x108070;
                }
                else if (romGamecode == "ADAF") // French
                {
                    ASMOffset = 0x1068F0;
                }
                else if (romGamecode == "ADAS") // Spanish
                {
                    ASMOffset = 0x106910;
                }
                else if (romGamecode == "ADAI") // Italian
                {
                    ASMOffset = 0x106850;
                }
                else if (romGamecode == "ADAD") // German
                {
                    ASMOffset = 0x1068B0;
                }
                else if (romGamecode == "ADAK") // Korean
                {
                    ASMOffset = 0x103C70;
                }
                // Pokémon Pearl Version
                else if (romGamecode == "APAE") // English
                {
                    ASMOffset = 0x106770;
                }
                else if (romGamecode == "APAJ") // Japanese
                {
                    ASMOffset = 0x1081B0;
                }
                else if (romGamecode == "APAF") // French
                {
                    ASMOffset = 0x1068F0;
                }
                else if (romGamecode == "APAS") // Spanish
                {
                    ASMOffset = 0x106910;
                }
                else if (romGamecode == "APAI") // Italian
                {
                    ASMOffset = 0x106850;
                }
                else if (romGamecode == "APAD") // German
                {
                    ASMOffset = 0x1068B0;
                }
                else if (romGamecode == "APAK") // Korean
                {
                    ASMOffset = 0x103C80;
                }
                // Pokémon Platinum Version
                else if (romGamecode == "CPUE") // English
                {
                    ASMOffset = 0x1010A0;
                }
                else if (romGamecode == "CPUJ") // Japanese
                {
                    ASMOffset = 0x100490;
                }
                else if (romGamecode == "CPUF") // French
                {
                    ASMOffset = 0x101280;
                }
                else if (romGamecode == "CPUS") // Spanish
                {
                    ASMOffset = 0x1012A0;
                }
                else if (romGamecode == "CPUI") // Italian
                {
                    ASMOffset = 0x101200;
                }
                else if (romGamecode == "CPUD") // German
                {
                    ASMOffset = 0x101240;
                }
                else if (romGamecode == "CPUK") // Korean
                {
                    ASMOffset = 0x101F90;
                }
                // Pokémon HeartGold Version
                else if (romGamecode == "IPKE") // English
                {
                    ASMOffset = 0x110BE0;
                }
                else if (romGamecode == "IPKJ") // Japanese
                {
                    ASMOffset = 0x110110;
                }
                else if (romGamecode == "IPKF") // French
                {
                    ASMOffset = 0x110C00;
                }
                else if (romGamecode == "IPKS") // Spanish
                {
                    ASMOffset = 0x110C00;
                }
                else if (romGamecode == "IPKI") // Italian
                {
                    ASMOffset = 0x110B80;
                }
                else if (romGamecode == "IPKD") // German
                {
                    ASMOffset = 0x110BC0;
                }
                else if (romGamecode == "IPKK") // Korean
                {
                    ASMOffset = 0x1115D0;
                }
                // Pokémon SoulSilver Version
                else if (romGamecode == "IPGE") // English
                {
                    ASMOffset = 0x110BE0;
                }
                else if (romGamecode == "IPGJ") // Japanese
                {
                    ASMOffset = 0x110110;
                }
                else if (romGamecode == "IPGF") // French
                {
                    ASMOffset = 0x110C00;
                }
                else if (romGamecode == "IPGS") // Spanish
                {
                    ASMOffset = 0x110C20;
                }
                else if (romGamecode == "IPGI") // Italian
                {
                    ASMOffset = 0x110B80;
                }
                else if (romGamecode == "IPGD") // German
                {
                    ASMOffset = 0x110BC0;
                }
                else if (romGamecode == "IPGK") // Korean
                {
                    ASMOffset = 0x1115D0;
                }
            }

            if (isNSMBRom)
            {
                headerFile.setByteAt(0x1D, 0x00);
                UserInfo = new ROMUserInfo(filename);
                LoadOverlay0();
            }
        }