예제 #1
0
        internal static PlugIn FromBinaryReader(BinaryReader reader, AxData parent, int index)
        {
            PlugIn ret = new PlugIn(index);

            ret.int_0 = reader.ReadInt32();
            int dllNameOffset    = reader.ReadInt32();
            int exportNameOffset = reader.ReadInt32();

            ret.int_3      = reader.ReadInt32();
            ret.dllName    = parent.ReadStringLiteral(dllNameOffset);
            ret.exportName = parent.ReadStringLiteral(exportNameOffset);
            return(ret);
        }
예제 #2
0
        internal void ReadPreprocessor(Hsp3Dictionary dictionary)
        {
            if (!isStarted)
            {
                throw new InvalidOperationException("LoadStartが呼び出されていません");
            }
            if (header == null)
            {
                throw new InvalidOperationException("ヘッダーが読み込まれていません");
            }
            if (header.RuntimeStart != 0)
            {
                string runtimeName = ReadString((int)header.RuntimeStart, (int)(header.CodeStart - header.RuntimeStart));
                if (runtimeName != null)
                {
                    runtime = new Runtime(runtimeName);
                }
            }
            uint count = header.LabelCount;

            for (int i = 0; i < count; i++)
            {
                long offset = seekOrigin + header.LabelStart + ((int)HeaderDataSize.Label * i);
                reader.BaseStream.Seek(offset, SeekOrigin.Begin);
                labels.Add(Label.FromBinaryReader(reader, this, i));
            }

            count = header.DllCount;
            for (int i = 0; i < count; i++)
            {
                long offset = seekOrigin + header.DllStart + ((int)HeaderDataSize.Dll * i);
                reader.BaseStream.Seek(offset, SeekOrigin.Begin);
                dlls.Add(Usedll.FromBinaryReader(reader, this, i));
            }

            count = header.ParameterCount;
            for (int i = 0; i < count; i++)
            {
                long offset = seekOrigin + header.ParameterStart + ((int)HeaderDataSize.Parameter * i);
                reader.BaseStream.Seek(offset, SeekOrigin.Begin);
                functionParams.Add(Param.FromBinaryReader(reader, this, i));
            }

            count = header.FunctionCount;
            for (int i = 0; i < count; i++)
            {
                long offset = seekOrigin + header.FunctionStart + ((int)HeaderDataSize.Function * i);
                reader.BaseStream.Seek(offset, SeekOrigin.Begin);
                functions.Add(Function.FromBinaryReader(reader, this, i));
            }

            count = header.PluginCount;
            for (int i = 0; i < count; i++)
            {
                long offset = seekOrigin + header.PluginStart + ((int)HeaderDataSize.Plugin * i);
                reader.BaseStream.Seek(offset, SeekOrigin.Begin);
                plugIns.Add(PlugIn.FromBinaryReader(reader, this, i));
            }
            if ((count != 0) && (header.PluginParameterCount != 0))
            {
                plugIns[0].ExtendedTypeCount = (int)header.PluginParameterCount;
            }

            foreach (Param param in functionParams)
            {
                param.SetFunction(this);
            }
            RenameFunctions(dictionary);

            ReadDebugInfo();
        }