コード例 #1
0
        private void Load(StructureValueCollection values, IReader reader, MetaAddressConverter addrConverter, IStringIDSource stringIDs, BuildInformation buildInfo)
        {
            StringTableReader stringReader = new StringTableReader();
            ScriptExpressions = LoadScriptExpressions(values, reader, addrConverter, stringReader, buildInfo.GetLayout("script expression entry"));
            ScriptObjects = LoadScriptObjects(values, reader, addrConverter, stringIDs, buildInfo.GetLayout("script object entry"));
            ScriptGlobals = LoadScriptGlobals(values, reader, addrConverter, ScriptExpressions, buildInfo.GetLayout("script global entry"));
            Scripts = LoadScripts(values, reader, addrConverter, stringIDs, ScriptExpressions, buildInfo.GetLayout("script entry"), buildInfo);

            CachedStringTable strings = LoadStrings(values, reader, stringReader, addrConverter);
            foreach (IExpression expr in ScriptExpressions)
            {
                // FIXME: hax
                if (expr != null)
                    ((ThirdGenExpression)expr).ResolveStrings(strings);
            }
        }
コード例 #2
0
 public ThirdGenLanguage(ThirdGenLanguageGlobals languageGlobals, StructureValueCollection values, IndexOffsetConverter converter, BuildInformation buildInfo)
 {
     _languageGlobals = languageGlobals;
     _pointerLayout = buildInfo.GetLayout("locale index table entry");
     _encryptionKey = buildInfo.LocaleKey;
     _symbols = buildInfo.LocaleSymbols;
     _converter = converter;
     _pageSize = buildInfo.LocaleAlignment;
     Load(values, converter);
 }
コード例 #3
0
        private IList<IScriptParameter> LoadParameters(IReader reader, StructureValueCollection values, MetaAddressConverter addrConverter, BuildInformation buildInfo)
        {
            int paramCount = (int)values.GetNumber("number of parameters");
            Pointer paramListLocation = new Pointer(values.GetNumber("address of parameter list"), addrConverter);

            StructureLayout layout = buildInfo.GetLayout("script parameter entry");
            List<IScriptParameter> result = new List<IScriptParameter>();

            reader.SeekTo(paramListLocation.AsOffset());
            for (int i = 0; i < paramCount; i++)
            {
                StructureValueCollection paramValues = StructureReader.ReadStructure(reader, layout);
                result.Add(new ThirdGenScriptParameter(paramValues));
            }
            return result;
        }
コード例 #4
0
 private ThirdGenTagTable LoadTags(IReader reader, BuildInformation buildInfo)
 {
     reader.SeekTo(_header.IndexHeaderLocation.AsOffset());
     StructureValueCollection values = StructureReader.ReadStructure(reader, buildInfo.GetLayout("index header"));
     return new ThirdGenTagTable(reader, values, _header.MetaPointerConverter, buildInfo);
 }
コード例 #5
0
        private ThirdGenScenarioMeta LoadScenario(IReader reader, BuildInformation buildInfo)
        {
            if (!buildInfo.HasLayout("scnr"))
                return null;
            ITag scnr = FindTagByClass(ScnrMagic);
            if (scnr == null)
                throw new InvalidOperationException("The cache file is missing a scnr tag.");

            reader.SeekTo(scnr.MetaLocation.AsOffset());
            StructureValueCollection values = StructureReader.ReadStructure(reader, buildInfo.GetLayout("scnr"));
            return new ThirdGenScenarioMeta(values, reader, _header.MetaPointerConverter, _stringIds, buildInfo);
        }
コード例 #6
0
        private List<ILocaleGroup> LoadLocaleGroups(IReader reader, BuildInformation buildInfo)
        {
            List<ILocaleGroup> result = new List<ILocaleGroup>();

            // Locale groups are stored in unic tags
            StructureLayout layout = buildInfo.GetLayout("unic");
            foreach (ITag tag in _tags.Tags)
            {
                if (tag != null && tag.Class != null && tag.Class.Magic == UnicMagic && tag.MetaLocation.AsAddress() > 0)
                {
                    reader.SeekTo(tag.MetaLocation.AsOffset());
                    StructureValueCollection values = StructureReader.ReadStructure(reader, layout);
                    result.Add(new ThirdGenLocaleGroup(values, tag.Index));
                }
            }

            return result;
        }
コード例 #7
0
 private ThirdGenHeader LoadHeader(IReader reader, BuildInformation buildInfo, string buildString)
 {
     reader.SeekTo(0);
     StructureValueCollection values = StructureReader.ReadStructure(reader, buildInfo.GetLayout("header"));
     return new ThirdGenHeader(values, buildInfo, buildString);
 }
コード例 #8
0
 private void FindLanguageTable(BuildInformation buildInfo, out ITag tag, out StructureLayout layout)
 {
     // Check for a PATG tag, and if one isn't found, then use MATG
     tag = null;
     layout = null;
     if (buildInfo.HasLayout("patg"))
     {
         tag = FindTagByClass(PatgMagic);
         layout = buildInfo.GetLayout("patg");
     }
     if (tag == null)
     {
         tag = FindTagByClass(MatgMagic);
         layout = buildInfo.GetLayout("matg");
     }
     if (tag == null || layout == null)
         throw new InvalidOperationException("The cache file is missing locale information.");
 }
コード例 #9
0
        private List<ITagClass> ReadClasses(IReader reader, Pointer classTableLocation, int numClasses, BuildInformation buildInfo)
        {
            StructureLayout layout = buildInfo.GetLayout("class entry");

            List<ITagClass> result = new List<ITagClass>();
            reader.SeekTo(classTableLocation.AsOffset());
            for (int i = 0; i < numClasses; i++)
            {
                StructureValueCollection values = StructureReader.ReadStructure(reader, layout);
                result.Add(new ThirdGenTagClass(values));
            }
            return result;
        }
コード例 #10
0
        private List<ITag> ReadTags(IReader reader, Pointer tagTableLocation, int numTags, BuildInformation buildInfo, MetaAddressConverter converter)
        {
            StructureLayout layout = buildInfo.GetLayout("tag entry");

            List<ITag> result = new List<ITag>();
            reader.SeekTo(tagTableLocation.AsOffset());
            for (int i = 0; i < numTags; i++)
            {
                StructureValueCollection values = StructureReader.ReadStructure(reader, layout);
                result.Add(new ThirdGenTag(values, (ushort)i, converter, _classes));
            }
            return result;
        }