예제 #1
0
        public static string GetName(int index)
        {
            if (index < 0x100)
            {
                return(TextCharNames.GetName(index));
            }

            else if ((index >= 0x100) && (index < 0x26C))
            {
                return(TextEnemyNames.GetName(index - 0x100));
            }

            else if ((index >= 0x26C) && (index < 0x2BB))
            {
                if (index == 0x287)
                {
                    return("Kumatora (Pigmask in water)");
                }

                else if (index == 0x289)
                {
                    return("Lucas (holding a hammer)");
                }

                else if (index == 0x28A)
                {
                    return("Flint (injured, no hat)");
                }

                else
                {
                    index -= 0x16C;
                    short ch = 0;
                    for (int i = 0; ; i++)
                    {
                        ch = Rom.ReadShort(0xCDB8BC + (i << 2));
                        if (ch == -1)
                        {
                            break;
                        }
                        else if (ch == index)
                        {
                            return(TextPCharNames.GetName(Rom.ReadUShort(0xCDB8BE + (i << 2))));
                        }
                    }
                    return(TextCharNames.GetName(index));
                }
            }

            else if (index == 0x2CF)
            {
                return("Flint (picking himself up)");
            }

            else
            {
                return("(Empty)");
            }
        }
예제 #2
0
        public static int LoadRom(string filename)
        {
            if (!File.Exists(filename))
            {
                return(-1);
            }

            try
            {
                Rom = File.ReadAllBytes(filename);
            }
            catch
            {
                return(-2);
            }

            if (Rom.Length != 0x2000000)
            {
                return(-3);
            }

            string header     = "MOTHER3\0\0\0\0\0A3UJ";
            string headerTest = string.Empty;

            for (int i = 0xA0; i < 0xB0; i++)
            {
                headerTest += (char)Rom[i];
            }
            if (!header.Equals(headerTest))
            {
                return(-4);
            }

            IsLoaded = true;

            switch (Rom[0x124C18])
            {
            case 0x9C:
                Version = RomVersion.English;
                break;

            case 0x1C:
                Version = RomVersion.Englishv12;
                break;

            default:
                Version = RomVersion.Japanese;
                break;
            }

            if (Rom[0x1DB4] == 0x73)
            {
                DecodeAddress = 0x13C5F2;
                DecodeMod     = 0x10E;
            }
            else
            {
                DecodeAddress = 0x13C5D8;
                DecodeMod     = 0x126;
            }

            GfxProvider.RomTileCache.Clear();

            M3CC.Init();
            TextProvider.Init();
            TextItemNames.Init();
            TextEnemyNames.Init();
            TextEnemyShortNames.Init();
            TextMusicNames.Init();
            TextItemDescriptions.Init();
            TextEnemyDescriptions.Init();
            TextBattle.Init();
            TextMain.Init();
            TextMapNames.Init();
            TextPsiNames.Init();
            TextCharNames.Init();
            TextDontCareNames.Init();

            GfxBattleTable.Init();
            GfxBattleSprites.Init();
            GfxItems.Init();
            GfxBattleAnimations.Init();
            GfxBattleBgTable.Init();
            GfxBattleBg.Init();
            GfxTownMaps.Init();
            GfxLogoTitle.Init();

            SpriteData.Init();

            MusicPlayerTable.Init();
            ActionTable.Init();

            SongTable.Init();

            return(0);
        }