public ScriptFile(Stream scriptStream, bool Console) { ConsoleVer = Console; file = scriptStream; Header = ScriptHeader.Generate(scriptStream, Console); StringTable = new StringTable(scriptStream, Header.StringTableOffsets, Header.StringBlocks, Header.StringsSize); if (Console) { NativeTable = new NativeTable(scriptStream, Header.NativesOffset + Header.RSC7Offset, Header.NativesCount); } else { X64NativeTable = new X64NativeTable(scriptStream, Header.NativesOffset + Header.RSC7Offset, Header.NativesCount, Header.CodeLength); } name = Header.ScriptName; CodeTable = new List <byte>(); for (int i = 0; i < Header.CodeBlocks; i++) { int tablesize = ((i + 1) * 0x4000 >= Header.CodeLength) ? Header.CodeLength % 0x4000 : 0x4000; byte[] working = new byte[tablesize]; scriptStream.Position = Header.CodeTableOffsets[i]; scriptStream.Read(working, 0, tablesize); CodeTable.AddRange(working); } GetStaticInfo(); Functions = new List <Function>(); FunctionLoc = new Dictionary <int, FunctionName>(); GetFunctions(); foreach (Function func in Functions) { func.PreDecode(); } Statics.checkvars(); foreach (Function func in Functions) { func.Decode(); } }