public override bool OnInitialize() { base.OnInitialize(); GCTCodeLine *lines = (GCTCodeLine *)Data + 1; while (true) { GCTCodeLine line = *lines++; if (line._1 == GCTCodeLine.End._1 && line._2 == GCTCodeLine.End._2) { break; } } _header = (GCTHeader *)lines; if (((uint)_header - (uint)Data) < WorkingUncompressed.Length) { if (_header->_nameOffset > 0) { _gameName = _header->GameName; } _name = _header->GameID; } if (_name == null) { _name = Path.GetFileNameWithoutExtension(_origPath); } return(WorkingUncompressed.Length > 16 && _header->_count > 0); }
public override void OnRebuild(VoidPtr address, int length, bool force) { List <GCTCodeEntryNode> enabledChildren = Children.Select(e => ((GCTCodeEntryNode)e)).Where(e => e._enabled).ToList(); GCTCodeLine *line = (GCTCodeLine *)address; *line++ = GCTCodeLine.Tag; foreach (GCTCodeEntryNode n in enabledChildren) { foreach (GCTCodeLine l in n._lines) { *line++ = l; } } *line++ = GCTCodeLine.End; if (_writeInfo) { GCTHeader *hdr = (GCTHeader *)line; hdr->_count = (uint)enabledChildren.Count; int offset = 12 + enabledChildren.Count * 16; _stringTable.WriteTable((VoidPtr)hdr + offset); hdr->_idOffset = (uint)_stringTable[_name] - (uint)hdr; if (!String.IsNullOrEmpty(_gameName)) { hdr->_nameOffset = (uint)_stringTable[_gameName] - (uint)hdr; } else { hdr->_nameOffset = 0; } GCTCodeEntry *entry = (GCTCodeEntry *)(hdr + 1); uint codeOffset = 8; foreach (GCTCodeEntryNode n in enabledChildren) { entry->_codeOffset = codeOffset; codeOffset += (uint)n._lines.Length * 8; entry->_lineCount = (uint)n._lines.Length; entry->_nameOffset = (uint)_stringTable[n._name] - (uint)entry; if (!String.IsNullOrEmpty(n._description)) { entry->_descOffset = (uint)_stringTable[n._description] - (uint)entry; } else { entry->_descOffset = 0; } entry++; } } }
public override bool OnInitialize() { base.OnInitialize(); GCTCodeLine* lines = (GCTCodeLine*)Data + 1; while (true) { GCTCodeLine line = *lines++; if (line._1 == GCTCodeLine.End._1 && line._2 == GCTCodeLine.End._2) break; } _header = (GCTHeader*)lines; if (((uint)_header - (uint)Data) < WorkingUncompressed.Length) { if (_header->_nameOffset > 0) _gameName = _header->GameName; _name = _header->GameID; } if (_name == null) _name = Path.GetFileNameWithoutExtension(_origPath); return WorkingUncompressed.Length > 16 && _header->_count > 0; }