Beispiel #1
0
        private Dictionary<int, string> ReadTableText(Mother3Rom rom, int offset, int bugContext = 0)
        {
            if (offset == 0)
            {
                return null;
            }

            Mother3Reader reader = new Mother3Reader(rom);
            reader.Position = offset;

            FixedTableHeader header = reader.ReadFixedTableHeader();

            if (bugContext == 1)
            {
                // Bug in English versions 1.0 through 1.2 -- one of the entries is
                // missing from the table, so the header's entry count is too high by one
                switch (rom.Settings.Version)
                {
                    case Mother3Version.English10:
                    case Mother3Version.English11:
                    case Mother3Version.English12:
                        header = new FixedTableHeader(header.EntryLength, header.Count - 1);
                        break;
                }
            }

            Dictionary<int, string> text = new Dictionary<int, string>();

            for (int i = 0; i < header.Count; i++)
            {
                text.Add(i, reader.ReadCodedString(header.EntryLength));
            }

            return text;
        }
Beispiel #2
0
        private Dictionary<int, string> ReadOffsetText(Mother3Rom rom, int tableOffset, int textOffset, bool dialog)
        {
            Mother3Reader reader = new Mother3Reader(rom);

            reader.Position = tableOffset;
            int[] pointers = reader.ReadMiniOffsetTable(textOffset);

            Dictionary<int, string> text = new Dictionary<int, string>();

            for (int i = 0; i < pointers.Length; i++)
            {
                reader.Position = pointers[i];

                if (pointers[i] != 0)
                {
                    if (dialog)
                    {
                        text.Add(i, reader.ReadDialogString());
                    }
                    else
                    {
                        text.Add(i, reader.ReadCodedString());
                    }
                }
            }

            return text;
        }