public static string GetDescription(int index)
        {
            int a    = Address + (index << 1);
            int addr = Rom.ReadUShort(a);

            addr += Address + (Entries << 1);

            return(TextProvider.GetText(addr, 1024,
                                        (Version == RomVersion.Japanese) ? TextType.Japanese : TextType.EnglishWide, true));
        }
        public static string GetText(int index)
        {
            int a = Address + 12 + (index << 1);

            int addr = Rom.ReadUShort(a);

            if (Version != RomVersion.Japanese)
            {
                addr <<= 1;
            }

            addr += Address;

            return(TextProvider.GetText(addr, 1024,
                                        (Version == RomVersion.Japanese) ? TextType.Japanese : TextType.EnglishWide, true));
        }
        public static string GetLine(int room, int line)
        {
            if (Lines[room] == -1)
            {
                return(null);
            }

            // Get the main pointer
            int a = Rom.ReadInt(Address + 4 + (room << 3));

            if (a == 0)
            {
                return(null);
            }
            a += Address;

            int addr = Rom.ReadUShort(a + (line << 1));

            addr += a + (Lines[room] << 1);

            TextType tt;

            switch (M3Rom.Version)
            {
            case RomVersion.Japanese:
            default:
                tt = TextType.Japanese;
                break;

            case RomVersion.English:
                tt = TextType.EnglishShort;
                break;

            case RomVersion.Englishv12:
                tt = TextType.EnglishShortRaw;
                break;
            }

            return(TextProvider.GetText(addr, 0x7FFFFFFF, tt, false));
        }
Esempio n. 4
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);
        }
 public static void SetName(int index, string str)
 {
     TextProvider.SetText(Address + 4 + (index * Length * 2), Length,
                          (Version == RomVersion.Japanese) ? TextType.Japanese : TextType.EnglishWide, str);
 }
 public static string GetName(int index)
 {
     return(TextProvider.GetText(Address + 4 + (index * Length * 2), Length,
                                 (Version == RomVersion.Japanese) ? TextType.Japanese : TextType.EnglishWide, true));
 }