/// <summary> /// Loads strings from a Black Ops II Script /// </summary> public override void LoadStrings() { Reader.BaseStream.Position = Header.StringTableOffset; Strings = new List <ScriptString>(Header.StringCount + Header.DebugStringCount); for (int i = 0; i < Header.StringCount; i++) { var scriptString = new ScriptString() { Offset = Reader.ReadUInt16(), References = new List <int>() }; var referenceCount = Reader.ReadByte(); Reader.BaseStream.Position += 1; // We need to store the references as we'll use them // for resolving strings instead of using the pointers for (int j = 0; j < referenceCount; j++) { scriptString.References.Add(Reader.ReadInt32()); } scriptString.Value = Reader.PeekNullTerminatedString(scriptString.Offset); Strings.Add(scriptString); } }
/// <summary> /// Loads strings from a Black Ops III Script /// </summary> public override void LoadStrings() { Reader.BaseStream.Position = Header.StringTableOffset; Strings = new List <ScriptString>(Header.StringCount + Header.DebugStringCount); for (int i = 0; i < Header.StringCount; i++) { var scriptString = new ScriptString() { Offset = Reader.ReadInt32(), References = new List <int>() }; var referenceCount = Reader.ReadByte(); Reader.BaseStream.Position += 3; // We need to store the references as we'll use them // for resolving strings instead of using the pointers for (int j = 0; j < referenceCount; j++) { scriptString.References.Add(Reader.ReadInt32()); } // Store our current position as we'll need to return back here var offset = Reader.BaseStream.Position; Reader.BaseStream.Position = scriptString.Offset; scriptString.Value = Reader.ReadNullTerminatedString(); // Go back to the table Reader.BaseStream.Position = offset; Strings.Add(scriptString); } Reader.BaseStream.Position = Header.DebugStringTableOffset; // For dev/debug strings we only load them for the purposes // of satisifying the string look up for (int i = 0; i < Header.DebugStringCount; i++) { // Strings within dev blocks are stored in the gdb // and we don't support them var scriptString = new ScriptString() { Value = "Dev Block strings are not supported", Offset = Reader.ReadInt32(), References = new List <int>() }; var referenceCount = Reader.ReadByte(); Reader.BaseStream.Position += 3; // We need to store the references as we'll use them // for resolving strings instead of using the pointers for (int j = 0; j < referenceCount; j++) { scriptString.References.Add(Reader.ReadInt32()); } Strings.Add(scriptString); } }