/// <summary> /// Decompiles part1 of CarParts block, extracts all strings and gets the array to memory. /// </summary> /// <param name="byteptr_t">Pointer to the ID of the part1 of CarParts block.</param> /// <param name="length">Lenght of the part1 of CarParts block including ID and size.</param> /// <returns>Part1 data as a byte array.</returns> private static unsafe byte[] CPE_Part1(byte *byteptr_t, uint length) { byte[] data = new byte[length]; uint offset = 8; while (offset < length) { string debug = ScriptX.NullTerminatedString(byteptr_t + offset); if (debug == null) { offset += 1; } else { offset += (uint)debug.Length + 1; } Map.BinKeys[Bin.Hash(debug)] = debug; } fixed(byte *dataptr_t = &data[0]) { for (int a1 = 0; a1 < length; ++a1) { *(dataptr_t + a1) = *(byteptr_t + a1); } } return(data); }
public bool IsStartTag(string tag) { var type = typeof(StartTags); var sett = typeof(SettingTags); if (tag.StartsWith("!--") && tag.EndsWith("--")) { return(true); } foreach (var field in type.GetFields()) { if ((string)field.GetValue(type) == tag) { return(true); } } tag = ScriptX.RemoveWhiteSpace(tag); foreach (var field in sett.GetFields()) { string nfield = (string)field.GetValue(sett) + Rule.Equal + Rule.Quote; if (tag.StartsWith(nfield) && tag.EndsWith(Rule.Quote)) { return(true); } } return(false); }
protected unsafe void Disassemble(byte *ptr_header, byte *ptr_string) { ushort pointer = 0; // used for reading pointer data uint key = 0; // for reading keys and comparison // Collection Name pointer = *(ushort *)ptr_header; this._collection_name = ScriptX.NullTerminatedString(ptr_string + pointer); // Challenge Trigger pointer = *(ushort *)(ptr_header + 2); this._world_trigger = ScriptX.NullTerminatedString(ptr_string + pointer); // Stage and Unlock settings this.BelongsToStage = *(ptr_header + 4); this._padding0 = *(ptr_header + 5); this.UseOutrunsAsReqRaces = (*(ptr_header + 6) == 2) ? eBoolean.True : eBoolean.False; this.RequiredRacesWon = *(ptr_header + 7); // Hashes key = *(uint *)(ptr_header + 0x8); this._sms_label = Map.Lookup(key, true) ?? $"0x{key:X8}"; key = *(uint *)(ptr_header + 0xC); this._chal_parent = Map.Lookup(key, true) ?? $"0x{key:X8}"; // Time Limit this.TimeLimit = *(int *)(ptr_header + 0x10); // Type and Unlockables this.WorldChallengeType = (eWorldChallengeType)(*(ptr_header + 0x14)); this.UnlockablePart1_Index = *(ptr_header + 0x15); this.UnlockablePart2_Index = *(ptr_header + 0x16); this.UnlockablePart3_Index = *(ptr_header + 0x17); }
/// <summary> /// Decompiles part1 of CarParts block, extracts all strings and gets the array to memory. /// </summary> /// <param name="byteptr_t">Pointer to the ID of the part1 of CarParts block.</param> /// <param name="length">Lenght of the part1 of CarParts block including ID and size.</param> /// <returns>Part1 data as a byte array.</returns> private static unsafe byte[] CPE_Part1(byte *byteptr_t, uint length) { if (length < Assert.CPPart1_AssertSize) { throw new FileLoadException("Detected corrupted GlobalB.lzc CarParts block. Unable to load database."); } byte[] data = new byte[Assert.CPPart1_AssertSize]; uint offset = 8; while (offset < Assert.CPPart1_AssertSize) { string debug = ScriptX.NullTerminatedString(byteptr_t + offset); if (debug == null) { offset += 1; } else { offset += (uint)debug.Length + 1; } Map.BinKeys[Bin.Hash(debug)] = debug; } for (int a1 = 0; a1 < Assert.CPPart1_AssertSize; ++a1) { data[a1] = *(byteptr_t + a1); } return(data); }
/// <summary> /// Gets tpk header information. /// </summary> /// <param name="byteptr_t">Pointer to the tpk block array.</param> /// <param name="offset">Partial 1 part1 offset in the tpk block array.</param> protected override unsafe void GetHeaderInfo(byte *byteptr_t, int offset) { if (*(uint *)(byteptr_t + offset) != TPK.INFO_PART1_BLOCKID) { return; // check Part1 ID } if (*(uint *)(byteptr_t + offset + 4) != 0x7C) { return; // check header size } // Get CollectionName if (this._use_current_cname) { this._collection_name = ScriptX.NullTerminatedString(byteptr_t + offset + 0xC, 0x1C); } else { this._collection_name = this.Index.ToString() + "_" + Comp.GetTPKName(this.Index, this.GameINT); } // Get Filename this.filename = ScriptX.NullTerminatedString(byteptr_t + offset + 0x28, 0x40); // Get the rest of the settings this.Version = *(int *)(byteptr_t + offset + 8); this.FilenameHash = *(uint *)(byteptr_t + offset + 0x68); this.PermBlockByteOffset = *(uint *)(byteptr_t + offset + 0x6C); this.PermBlockByteSize = *(uint *)(byteptr_t + offset + 0x70); this.EndianSwapped = *(int *)(byteptr_t + offset + 0x74); this.TexturePack = *(int *)(byteptr_t + offset + 0x78); this.TextureIndexEntryTable = *(int *)(byteptr_t + offset + 0x7C); this.TextureStreamEntryTable = *(int *)(byteptr_t + offset + 0x80); }
private unsafe void Disassemble(byte *ptr_header, byte *ptr_string) { // CollectionName ushort pointer = *(ushort *)ptr_header; this._collection_name = ScriptX.NullTerminatedString(ptr_string + pointer); // Unknown Yet Values this.b0x02 = *(ptr_header + 0x02); this.b0x03 = *(ptr_header + 0x03); this.b0x04 = *(ptr_header + 0x04); this.b0x05 = *(ptr_header + 0x05); this.b0x06 = *(ptr_header + 0x06); this.b0x07 = *(ptr_header + 0x07); this.b0x08 = *(ptr_header + 0x08); this.b0x09 = *(ptr_header + 0x09); this.b0x0A = *(ptr_header + 0x0A); this.b0x0B = *(ptr_header + 0x0B); // Cash and Sender this.CashValue = *(int *)(ptr_header + 0x0C); uint key = *(uint *)(ptr_header + 0x10); this.MessageSenderLabel = Map.Lookup(key, true) ?? $"0x{key:X8}"; }
private unsafe void Disassemble(byte *byteptr_t) { // CollectionName this._collection_name = ScriptX.NullTerminatedString(byteptr_t, 0x20); // Ingame Brand Name this._ingame_brand_name = ScriptX.NullTerminatedString(byteptr_t + 0x20, 0x20); }
private static unsafe void E_GlobalLibBlock(byte *byteptr_t, uint length) { int off = 0x50; // offset in data int num = 0; // number of strings int len = 0; // length of strings string blocktype = ScriptX.NullTerminatedString(byteptr_t + 0x30, 0x20); switch (blocktype) { case "Padding Block": return; case "Collision Block": num = *(int *)(byteptr_t + off); // get number of strings allocated len = *(int *)(byteptr_t + off + 4); // get total length of characters off += 8; // move last time Map.CollisionMap.Clear(); // clear collision map while (len > 0 && num > 0) { string CName = ""; int numbytes = *(byteptr_t + off); // length of the string for (int a1 = off + 1; a1 < off + 1 + numbytes; ++a1) { CName += ((char)*(byteptr_t + a1)).ToString(); } Map.CollisionMap[Vlt.Hash(CName)] = CName; --num; len -= numbytes + 1; off += numbytes + 1; } LibColBlockExists = true; break; case "Raider Block": // suspended, no longer supported num = *(int *)(byteptr_t + off); // get number of strings allocated len = *(int *)(byteptr_t + off + 4); // get total length of characters off += 8; // move last time while (len > 0 && num > 0) { string CName = ""; int numbytes = *(byteptr_t + off); // length of the string for (int a1 = off + 1; a1 < off + 1 + numbytes; ++a1) { CName += ((char)*(byteptr_t + a1)).ToString(); } Map.BinKeys[Bin.Hash(CName)] = CName; --num; len -= numbytes + 1; off += numbytes + 1; } break; default: break; } }
/// <summary> /// Disassembles labels block array into separate properties. /// </summary> /// <param name="byteptr_t">Pointer to the label block array.</param> protected override unsafe void DisperseLabels(byte *byteptr_t, int length) { int ReaderOffset = 0; uint ReaderID = 0; int BlockSize = 0; // Run through file while (ReaderOffset < length) { ReaderID = *(uint *)(byteptr_t + ReaderOffset); BlockSize = *(int *)(byteptr_t + ReaderOffset + 4); if (ReaderID == Global.STRBlocks) { var categ = ScriptX.NullTerminatedString(byteptr_t + ReaderOffset + 20, 0x10); if (categ == "Global") { this._offset = ReaderOffset; this._size = BlockSize; } } ReaderOffset += 8 + BlockSize; } // Check if string block exists if (this._offset == -1 || this._size == -1) { return; } // Initialize map with keys and indexes var key_to_index = new Dictionary <uint, int>(); for (int a1 = 0; a1 < this._stringinfo.Count; ++a1) { key_to_index[this._stringinfo[a1].Key] = a1; } // Advance position and read through header byteptr_t += this._offset + 8; this._num_entries = *(int *)(byteptr_t); this._key_offset = *(int *)(byteptr_t + 4); this._text_offset = *(int *)(byteptr_t + 8); this._category = ScriptX.NullTerminatedString(byteptr_t + 12, 0x10); // Begin reading through string records for (int a1 = 0; a1 < this._num_entries; ++a1) { var key = *(uint *)(byteptr_t + this._key_offset + a1 * 8); var pos = this._text_offset + *(int *)(byteptr_t + this._key_offset + a1 * 8 + 4); var label = ScriptX.NullTerminatedString(byteptr_t + pos); if (key_to_index.TryGetValue(key, out int index)) { this._stringinfo[index].Label = label; } } }
/// <summary> /// Disassembles frontend group array into separate properties. /// </summary> /// <param name="byteptr_t">Pointer to the frontend group array.</param> protected override unsafe void Disassemble(byte[] data) { this._DATA = new byte[data.Length]; Buffer.BlockCopy(data, 0, this._DATA, 0, data.Length); fixed(byte *byteptr_t = &this._DATA[0]) { this.Size = *(uint *)(byteptr_t + 4); // For some reason HUFF compression has the same ID as FEng files if (*(uint *)(byteptr_t + 8) == 0x46465548) { this.Destroy = true; return; } // Read CollectionName this.CollectionName = ScriptX.NullTerminatedString(byteptr_t + 0x30, this._DATA.Length - 0x30); if (this.CollectionName.EndsWith(".fng")) { this.CollectionName = FormatX.GetString(this.CollectionName, "{X}.fng"); } for (uint offset = 0x30; offset < this._DATA.Length; offset += 4) { byte b1 = *(byteptr_t + offset); byte b2 = *(byteptr_t + offset + 1); byte b3 = *(byteptr_t + offset + 2); byte b4 = *(byteptr_t + offset + 3); // SAT, SAD, SA(0x90) or 1111 if ((b1 == 'S' && b2 == 'A') || (b1 == 0xFF && b2 == 0xFF && b3 == 0xFF && b4 == 0xFF)) { uint Blue = *(uint *)(byteptr_t + offset + 4); uint Green = *(uint *)(byteptr_t + offset + 8); uint Red = *(uint *)(byteptr_t + offset + 12); uint Alpha = *(uint *)(byteptr_t + offset + 16); // If it is a color, add to the list if (Resolve.IsColor(Alpha, Red, Green, Blue)) { var TempColor = new FEngColor(this); TempColor.Offset = offset; TempColor.Alpha = (byte)Alpha; TempColor.Red = (byte)Red; TempColor.Green = (byte)Green; TempColor.Blue = (byte)Blue; this._colorinfo.Add(TempColor); } offset += 0x14; } } } }
private void SendToLink(RichTextBox box, int index) { if (box.SelectionColor != LinkColor) { return; } var linkfont = new Font(box.SelectionFont, FontStyle.Underline); if (!Resolve.EqualFonts(box.SelectionFont, linkfont)) { return; } int selectionstart = index; int selectionend = index; for (int c = index - 1; c >= 0; --c) { box.SelectionStart = c; if (!Resolve.EqualFonts(box.SelectionFont, linkfont) || box.SelectionColor != LinkColor) { selectionstart = c; break; } if (c == 0) { selectionstart = 0; } } for (int c = index + 1; c < box.Text.Length; ++c) { box.SelectionStart = c; if (!Resolve.EqualFonts(box.SelectionFont, linkfont) || box.SelectionColor != LinkColor) { selectionend = c - 1; break; } } box.SelectionStart = index; if (selectionstart == selectionend) { return; } var key = box.Text.Substring(selectionstart, selectionend - selectionstart); key = ScriptX.RemoveNewLines(key); if (!_linkmap.TryGetValue(key, out string result)) { return; } var e = new LinkClickedEventArgs(result); RichTextBox_LinkClickedEvent(box, e); }
/// <summary> /// Disassembles string block array into separate properties. /// </summary> /// <param name="byteptr_t">Pointer to the string block array.</param> protected override unsafe void Disassemble(byte *byteptr_t, int length) { int ReaderOffset = 0; uint ReaderID = 0; int BlockSize = 0; bool found = false; // Run through file while (ReaderOffset < length) { ReaderID = *(uint *)(byteptr_t + ReaderOffset); BlockSize = *(int *)(byteptr_t + ReaderOffset + 4); if (!found && ReaderID == Global.STRBlocks) { this._offset = ReaderOffset; this._size = BlockSize; this.CollectionName = BaseArguments.GLOBAL; found = true; } ReaderOffset += 8 + BlockSize; } // Check if string block exists if (this._offset == -1 || this._size == -1) { return; } // Advance position and read through header byteptr_t += this._offset + 8; this._unk_data_offset = *(int *)byteptr_t; this._num_entries = *(int *)(byteptr_t + 4); this._key_offset = *(int *)(byteptr_t + 8); this._text_offset = *(int *)(byteptr_t + 12); // Get unknown data into memory this._unknown = new byte[this._key_offset - this._unk_data_offset]; for (int a1 = 0; a1 < this._unknown.Length; ++a1) { this._unknown[a1] = *(byteptr_t + this._unk_data_offset + a1); } // Begin reading through string records for (int a1 = 0; a1 < this._num_entries; ++a1) { var info = new StringRecord(this); info.Key = *(uint *)(byteptr_t + this._key_offset + a1 * 8); var pos = this._text_offset + *(int *)(byteptr_t + this._key_offset + a1 * 8 + 4); info.Text = ScriptX.NullTerminatedString(byteptr_t + pos); this._stringinfo.Add(info); } }
public static (string, string) SplitScriptString(string line) { if (line.Contains("//")) { line = line.Substring(0, line.IndexOf("//")); } var keyword = line.Substring(0, line.IndexOf('=')); var value = line.Substring(line.IndexOf('=') + 1); keyword = ScriptX.CleanString(keyword, true); value = ScriptX.CleanString(value, true); return(keyword, value); }
/// <summary> /// Get the material name, initialize its class and inject into Vector. /// </summary> /// <param name="byteptr_t">Pointer to the beginning of material block in Global data.</param> /// <param name="db">Database to which add classes.</param> private static unsafe void E_Material(byte *byteptr_t, Database.Carbon db) { // Get collection name of the material, starts at 0x14 string CName = ScriptX.NullTerminatedString(byteptr_t + 0x1C, 0x1C); CName = Resolve.GetPathFromCollection(CName); Resolve.GetWindowTintString(CName); Map.BinKeys[Bin.Hash(CName)] = CName; var Class = new Material((IntPtr)byteptr_t, CName, db); db.Materials.Collections.Add(Class); }
/// <summary> /// Disassembles texture header array into separate properties. /// </summary> /// <param name="byteptr_t">Pointer to the texture header array.</param> protected override unsafe void Disassemble(byte *byteptr_t) { this._collection_name = ScriptX.NullTerminatedString(byteptr_t + 0xC, 0x18); this.BinKey = *(uint *)(byteptr_t + 0x24); this._class = *(uint *)(byteptr_t + 0x28); this._unknown0 = *(int *)(byteptr_t + 0x2C); this.Offset = *(int *)(byteptr_t + 0x30); this.PaletteOffset = *(int *)(byteptr_t + 0x34); this.Size = *(int *)(byteptr_t + 0x38); this.PaletteSize = *(int *)(byteptr_t + 0x3C); this._area = *(int *)(byteptr_t + 0x40); this.Width = *(short *)(byteptr_t + 0x44); this.Height = *(short *)(byteptr_t + 0x46); this.Log_2_Width = *(byteptr_t + 0x48); this.Log_2_Height = *(byteptr_t + 0x49); this._compression = *(byteptr_t + 0x4A); this._pal_comp = *(byteptr_t + 0x4B); this._num_palettes = *(short *)(byteptr_t + 0x4C); this.Mipmaps = *(byteptr_t + 0x4E); this.TileableUV = *(byteptr_t + 0x4F); this._bias_level = *(byteptr_t + 0x50); this._rendering_order = *(byteptr_t + 0x51); this._scroll_type = *(byteptr_t + 0x52); this._used_flag = *(byteptr_t + 0x53); this._apply_alpha_sort = *(byteptr_t + 0x54); this._alpha_usage_type = *(byteptr_t + 0x55); this._alpha_blend_type = *(byteptr_t + 0x56); this._flags = *(byteptr_t + 0x57); this.MipmapBiasType = *(byteptr_t + 0x58); this._padding = *(byteptr_t + 0x59); this._scroll_timestep = *(short *)(byteptr_t + 0x5A); this._scroll_speedS = *(short *)(byteptr_t + 0x5C); this._scroll_speedT = *(short *)(byteptr_t + 0x5E); this._offsetS = *(short *)(byteptr_t + 0x60); this._offsetT = *(short *)(byteptr_t + 0x62); this._scaleS = *(short *)(byteptr_t + 0x64); this._scaleT = *(short *)(byteptr_t + 0x66); this._unknown1 = *(int *)(byteptr_t + 0x68); this._unknown2 = *(int *)(byteptr_t + 0x6C); this._unknown3 = *(int *)(byteptr_t + 0x70); this._unknown4 = *(int *)(byteptr_t + 0x74); this._unknown5 = *(int *)(byteptr_t + 0x78); // Get compression name if (this._compression == EAComp.SECRET) { this._compression = EAComp.P8_08; this._secretp8 = true; } }
/// <summary> /// Disassembles string block array into separate properties. /// </summary> /// <param name="byteptr_t">Pointer to the string block array.</param> protected override unsafe void Disassemble(byte *byteptr_t, int length) { int ReaderOffset = 0; uint ReaderID = 0; int BlockSize = 0; // Run through file while (ReaderOffset < length) { ReaderID = *(uint *)(byteptr_t + ReaderOffset); BlockSize = *(int *)(byteptr_t + ReaderOffset + 4); if (ReaderID == Global.STRBlocks) { var categ = ScriptX.NullTerminatedString(byteptr_t + ReaderOffset + 20, 0x10); if (categ == "Global") { this._offset = ReaderOffset; this._size = BlockSize; this.CollectionName = BaseArguments.GLOBAL; } } ReaderOffset += 8 + BlockSize; } // Check if string block exists if (this._offset == -1 || this._size == -1) { return; } // Advance position and read through header byteptr_t += this._offset + 8; this._num_entries = *(int *)(byteptr_t); this._key_offset = *(int *)(byteptr_t + 4); this._text_offset = *(int *)(byteptr_t + 8); this._category = ScriptX.NullTerminatedString(byteptr_t + 12, 0x10); // Begin reading through string records for (int a1 = 0; a1 < this._num_entries; ++a1) { var info = new StringRecord(this); info.Key = *(uint *)(byteptr_t + this._key_offset + a1 * 8); var pos = this._text_offset + *(int *)(byteptr_t + this._key_offset + a1 * 8 + 4); info.Text = ScriptX.NullTerminatedString(byteptr_t + pos); this._stringinfo.Add(info); } }
private unsafe void Disassemble(byte *ptr_header, byte *ptr_string) { // CollectionName ushort pointer = *(ushort *)ptr_header; this._collection_name = ScriptX.NullTerminatedString(ptr_string + pointer); // Cash Values this.CashValuePerWin = *(short *)(ptr_header + 2); this.SignCashBonus = *(short *)(ptr_header + 12); this.PotentialCashBonus = *(short *)(ptr_header + 14); // Required Sponsor Races this.ReqSponsorRace1 = (eSponsorRaceType)(*(ptr_header + 4)); this.ReqSponsorRace2 = (eSponsorRaceType)(*(ptr_header + 5)); this.ReqSponsorRace3 = (eSponsorRaceType)(*(ptr_header + 6)); }
/// <summary> /// Decompile entire acid effects block into Vector of separate elements. /// </summary> /// <param name="byteptr_t">Pointer to the beginning of acid effects block in Global data.</param> /// <param name="length">Length of the block to be read.</param> /// <param name="db">Database to which add classes.</param> private static unsafe void E_AcidEffects(byte *byteptr_t, uint length, Database.Underground2 db) { const uint size = 0xD0; for (uint loop = 0; loop < length / size; ++loop) { uint offset = 0x18 + loop * size; // current offset of the acid effect (padding included) // Get CollectionName string CName = ScriptX.NullTerminatedString(byteptr_t + offset + 0x90, 0x40); CName = Resolve.GetPathFromCollection(CName); Map.BinKeys[Bin.Hash(CName)] = CName; var Class = new AcidEffect((IntPtr)(byteptr_t + offset), CName, db); db.AcidEffects.Collections.Add(Class); } }
/// <summary> /// Decompile entire cartypeinfo block into Vector of separate elements. /// </summary> /// <param name="byteptr_t">Pointer to the beginning of cartypeinfo block in Global data.</param> /// <param name="length">Length of the block to be read.</param> /// <param name="db">Database to which add classes.</param> private static unsafe void E_CarTypeInfo(byte *byteptr_t, uint length, Database.Underground2 db) { const uint size = 0x890; for (uint loop = 0; loop < length / size; ++loop) { uint offset = 8 + loop * size; // current offset of the cartypeinfo (padding included) // Get CollectionName string CName = ScriptX.NullTerminatedString(byteptr_t + offset, 0x10); CName = Resolve.GetPathFromCollection(CName); Map.BinKeys[Bin.Hash(CName)] = CName; var Class = new CarTypeInfo((IntPtr)(byteptr_t + offset), CName, db); db.CarTypeInfos.Collections.Add(Class); } }
/// <summary> /// Decompile entire preset rides block into Vector of separate elements. /// </summary> /// <param name="byteptr_t">Pointer to the beginning of preset rides block in Global data.</param> /// <param name="length">Length of the block to be read.</param> /// <param name="db">Database to which add classes.</param> private static unsafe void E_PresetRides(byte *byteptr_t, uint length, Database.Underground2 db) { const uint size = 0x338; for (uint loop = 0; loop < length / size; ++loop) { uint offset = loop * size; // current offset of the preset ride // Get CollectionName string CName = ScriptX.NullTerminatedString(byteptr_t + offset + 0x28, 0x20); CName = Resolve.GetPathFromCollection(CName); Map.BinKeys[Bin.Hash(CName)] = CName; var Class = new PresetRide((IntPtr)(byteptr_t + offset), CName, db); db.PresetRides.Collections.Add(Class); } }
/// <summary> /// Disassembles texture header array into separate properties. /// </summary> /// <param name="byteptr_t">Pointer to the texture header array.</param> protected override unsafe void Disassemble(byte *byteptr_t) { this._cube_environment = *(uint *)byteptr_t; this.BinKey = *(uint *)(byteptr_t + 0xC); this._class = *(uint *)(byteptr_t + 0x10); this.Offset = *(int *)(byteptr_t + 0x14); this.PaletteOffset = *(int *)(byteptr_t + 0x18); this.Size = *(int *)(byteptr_t + 0x1C); this.PaletteSize = *(int *)(byteptr_t + 0x20); this._area = *(int *)(byteptr_t + 0x24); this.Width = *(short *)(byteptr_t + 0x28); this.Height = *(short *)(byteptr_t + 0x2A); this.Log_2_Width = *(byteptr_t + 0x2C); this.Log_2_Height = *(byteptr_t + 0x2D); this._compression = *(byteptr_t + 0x2E); this._pal_comp = *(byteptr_t + 0x2F); this._num_palettes = *(short *)(byteptr_t + 0x30); this.Mipmaps = *(byteptr_t + 0x32); this.TileableUV = *(byteptr_t + 0x33); this._bias_level = *(byteptr_t + 0x34); this._rendering_order = *(byteptr_t + 0x35); this._scroll_type = *(byteptr_t + 0x36); this._used_flag = *(byteptr_t + 0x37); this._apply_alpha_sort = *(byteptr_t + 0x38); this._alpha_usage_type = *(byteptr_t + 0x39); this._alpha_blend_type = *(byteptr_t + 0x3A); this._flags = *(byteptr_t + 0x3B); this.MipmapBiasType = *(byteptr_t + 0x3C); this._padding = *(byteptr_t + 0x3D); this._scroll_timestep = *(short *)(byteptr_t + 0x3E); this._scroll_speedS = *(short *)(byteptr_t + 0x40); this._scroll_speedT = *(short *)(byteptr_t + 0x42); this._offsetS = *(short *)(byteptr_t + 0x44); this._offsetT = *(short *)(byteptr_t + 0x46); this._scaleS = *(short *)(byteptr_t + 0x48); this._scaleT = *(short *)(byteptr_t + 0x4A); this._unknown1 = *(int *)(byteptr_t + 0x4C); this._unknown2 = *(int *)(byteptr_t + 0x50); this._unknown3 = *(int *)(byteptr_t + 0x54); // Get texture name this._collection_name = ScriptX.NullTerminatedString(byteptr_t + 0x59, *(byteptr_t + 0x58)); }
protected unsafe void Disassemble(byte *byteptr_t) { uint key = 0; // for reading keys and comparison // Collection Name this._collection_name = ScriptX.NullTerminatedString(byteptr_t, 0x20); // Intro Movie var str = ScriptX.NullTerminatedString(byteptr_t + 0x20, 0x18); if (!string.IsNullOrWhiteSpace(str)) { this._intro_movie = str; } // Shop Trigger key = *(uint *)(byteptr_t + 0x3C); var guess = $"TRIGGER_{this._collection_name}"; var hash = Bin.Hash(guess); if (key == hash) { this._shop_trigger = guess; } else { this._shop_trigger = Map.Lookup(key, true) ?? $"0x{key:X8}"; } // Shop Filename this._shop_filename = ScriptX.NullTerminatedString(byteptr_t + 0x40, 0x10); // Types and Unlocks this._shop_type = (eWorldShopType)(*(byteptr_t + 0x50)); this._initially_hidden = (*(byteptr_t + 0x51) == 1) ? eBoolean.True : eBoolean.False; key = *(uint *)(byteptr_t + 0x74); this._event_to_complete = Map.Lookup(key, true) ?? $"0x{key:X8}"; this._unlocked_by_event = (*(byteptr_t + 0x9C) == 1) ? eBoolean.True : eBoolean.False; this.BelongsToStage = *(byteptr_t + 0x9D); }
private static unsafe void ReadStrings(byte *byteptr_t, int[] PartOffsets) { if (PartOffsets[0] == -1) { return; // if strings block does not exist } if (*(uint *)(byteptr_t + PartOffsets[0]) != CareerInfo.STRING_BLOCK) { return; // check strings block ID } int ReaderSize = 8 + *(int *)(byteptr_t + PartOffsets[0] + 4); int current = PartOffsets[0] + 8; while (current < ReaderSize) { string str = ScriptX.NullTerminatedString(byteptr_t + current); Bin.Hash(str); current += str.Length + 1; } }
private HTMLTagType GetSettingTag(string tag, ref string setting) { string set = tag; tag = ScriptX.RemoveWhiteSpace(tag); if (tag.StartsWith("!--") && tag.EndsWith("--")) { return(HTMLTagType.Comment); } string equals = Rule.Equal + Rule.Quote; if (tag.StartsWith(SettingTags.Body + equals) && tag.EndsWith(Rule.Quote)) { setting = ScriptX.QuotedString(set); this.AppendDefaultStyling(setting); return(HTMLTagType.Body); } else if (tag.StartsWith(SettingTags.Paragraph + equals) && tag.EndsWith(Rule.Quote)) { setting = ScriptX.QuotedString(set); return(HTMLTagType.Paragraph); } else if (tag.StartsWith(SettingTags.ReferenceLink + equals) && tag.EndsWith(Rule.Quote)) { setting = ScriptX.QuotedString(set); return(HTMLTagType.ReferenceLink); } else if (tag.StartsWith(SettingTags.ImageLink + equals) && tag.EndsWith(Rule.Quote)) { this.Menu.ImagePaths.Add(ScriptX.QuotedString(set)); return(HTMLTagType.ImageLink); } else { return(HTMLTagType.Default); } }
private unsafe void Disassemble(byte *byteptr_t) { uint key = 0; // Collection Name this._collection_name = ScriptX.NullTerminatedString(byteptr_t, 0x20); // Take Photo Settings this._take_photo = (eTakePhotoMethod)(*(byteptr_t + 0x24)); this.BelongsToStage = *(byteptr_t + 0x25); this.CashValue = *(short *)(byteptr_t + 0x26); this.Unknown0x34 = *(byteptr_t + 0x34); this.Unknown0x35 = *(byteptr_t + 0x35); this.RequiredVisualRating = *(float *)(byteptr_t + 0x3C); // Showcase Strings key = *(uint *)(byteptr_t + 0x28); this._desc_string_label = Map.Lookup(key, true) ?? $"0x{key:X8}"; key = *(uint *)(byteptr_t + 0x2C); this._destination_point = Map.Lookup(key, true) ?? $"0x{key:X8}"; key = *(uint *)(byteptr_t + 0x38); this._desc_attrib = Map.Lookup(key, true) ?? $"0x{key:X8}"; }
private static unsafe void E_VaultKeys(byte *byteptr_t) { uint ID = *(uint *)byteptr_t; int size = *(int *)(byteptr_t + 4) + 8; if (ID != 0x53747245) { return; } int offset = 8; while (offset < size) { string CName = ScriptX.NullTerminatedString(byteptr_t + offset, size - offset); if (CName == null) { offset += 1; continue; } uint key = Vlt.Hash(CName); Map.VltKeys[key] = CName; offset += CName.Length + 1; } }
/// <summary> /// Disassembles cartypeinfo array into separate properties. /// </summary> /// <param name="byteptr_t">Pointer to the cartypeinfo array.</param protected override unsafe void Disassemble(byte *byteptr_t) { // Manufacturer name var name = ScriptX.NullTerminatedString(byteptr_t + 0xC0, 0x10); if (string.IsNullOrWhiteSpace(name)) { this.ManufacturerName = BaseArguments.NULL; } else { this.ManufacturerName = name; } // Secondary Properties this.HeadlightFOV = *(float *)(byteptr_t + 0xD4); this.PadHighPerformance = *(byteptr_t + 0xD8); this.NumAvailableSkinNumbers = *(byteptr_t + 0xD9); this.WhatGame = *(byteptr_t + 0xDA); this.ConvertibleFlag = *(byteptr_t + 0xDB); this.WheelOuterRadius = *(byteptr_t + 0xDC); this.WheelInnerRadiusMin = *(byteptr_t + 0xDD); this.WheelInnerRadiusMax = *(byteptr_t + 0xDE); this.Padding0 = *(byteptr_t + 0xDF); // Vectors this.HeadlightPositionX = *(float *)(byteptr_t + 0xE0); this.HeadlightPositionY = *(float *)(byteptr_t + 0xE4); this.HeadlightPositionZ = *(float *)(byteptr_t + 0xE8); this.HeadlightPositionW = *(float *)(byteptr_t + 0xEC); this.DriverRenderingOffsetX = *(float *)(byteptr_t + 0xF0); this.DriverRenderingOffsetY = *(float *)(byteptr_t + 0xF4); this.DriverRenderingOffsetZ = *(float *)(byteptr_t + 0xF8); this.DriverRenderingOffsetW = *(float *)(byteptr_t + 0xFC); this.SteeringWheelRenderingX = *(float *)(byteptr_t + 0x100); this.SteeringWheelRenderingY = *(float *)(byteptr_t + 0x104); this.SteeringWheelRenderingZ = *(float *)(byteptr_t + 0x108); this.SteeringWheelRenderingW = *(float *)(byteptr_t + 0x10C); this.UnknownVectorValX = *(float *)(byteptr_t + 0x110); this.UnknownVectorValY = *(float *)(byteptr_t + 0x114); this.UnknownVectorValZ = *(float *)(byteptr_t + 0x118); this.UnknownVectorValW = *(float *)(byteptr_t + 0x11C); // Front Left Wheel this.WHEEL_FRONT_LEFT.XValue = *(float *)(byteptr_t + 0x120); this.WHEEL_FRONT_LEFT.Springs = *(float *)(byteptr_t + 0x124); this.WHEEL_FRONT_LEFT.RideHeight = *(float *)(byteptr_t + 0x128); this.WHEEL_FRONT_LEFT.UnknownVal = *(float *)(byteptr_t + 0x12C); this.WHEEL_FRONT_LEFT.Diameter = *(float *)(byteptr_t + 0x130); this.WHEEL_FRONT_LEFT.TireSkidWidth = *(float *)(byteptr_t + 0x134); this.WHEEL_FRONT_LEFT.WheelID = *(int *)(byteptr_t + 0x138); this.WHEEL_FRONT_LEFT.YValue = *(float *)(byteptr_t + 0x13C); this.WHEEL_FRONT_LEFT.WideBodyYValue = *(float *)(byteptr_t + 0x140); // Front Left Wheel this.WHEEL_FRONT_RIGHT.XValue = *(float *)(byteptr_t + 0x150); this.WHEEL_FRONT_RIGHT.Springs = *(float *)(byteptr_t + 0x154); this.WHEEL_FRONT_RIGHT.RideHeight = *(float *)(byteptr_t + 0x158); this.WHEEL_FRONT_RIGHT.UnknownVal = *(float *)(byteptr_t + 0x15C); this.WHEEL_FRONT_RIGHT.Diameter = *(float *)(byteptr_t + 0x160); this.WHEEL_FRONT_RIGHT.TireSkidWidth = *(float *)(byteptr_t + 0x164); this.WHEEL_FRONT_RIGHT.WheelID = *(int *)(byteptr_t + 0x168); this.WHEEL_FRONT_RIGHT.YValue = *(float *)(byteptr_t + 0x16C); this.WHEEL_FRONT_RIGHT.WideBodyYValue = *(float *)(byteptr_t + 0x170); // Front Left Wheel this.WHEEL_REAR_RIGHT.XValue = *(float *)(byteptr_t + 0x180); this.WHEEL_REAR_RIGHT.Springs = *(float *)(byteptr_t + 0x184); this.WHEEL_REAR_RIGHT.RideHeight = *(float *)(byteptr_t + 0x188); this.WHEEL_REAR_RIGHT.UnknownVal = *(float *)(byteptr_t + 0x18C); this.WHEEL_REAR_RIGHT.Diameter = *(float *)(byteptr_t + 0x190); this.WHEEL_REAR_RIGHT.TireSkidWidth = *(float *)(byteptr_t + 0x194); this.WHEEL_REAR_RIGHT.WheelID = *(int *)(byteptr_t + 0x198); this.WHEEL_REAR_RIGHT.YValue = *(float *)(byteptr_t + 0x19C); this.WHEEL_REAR_RIGHT.WideBodyYValue = *(float *)(byteptr_t + 0x1A0); // Front Left Wheel this.WHEEL_REAR_LEFT.XValue = *(float *)(byteptr_t + 0x1B0); this.WHEEL_REAR_LEFT.Springs = *(float *)(byteptr_t + 0x1B4); this.WHEEL_REAR_LEFT.RideHeight = *(float *)(byteptr_t + 0x1B8); this.WHEEL_REAR_LEFT.UnknownVal = *(float *)(byteptr_t + 0x1BC); this.WHEEL_REAR_LEFT.Diameter = *(float *)(byteptr_t + 0x1C0); this.WHEEL_REAR_LEFT.TireSkidWidth = *(float *)(byteptr_t + 0x1C4); this.WHEEL_REAR_LEFT.WheelID = *(int *)(byteptr_t + 0x1C8); this.WHEEL_REAR_LEFT.YValue = *(float *)(byteptr_t + 0x1CC); this.WHEEL_REAR_LEFT.WideBodyYValue = *(float *)(byteptr_t + 0x1D0); // Base Tires Performance this.BASE_TIRES.StaticGripScale = *(float *)(byteptr_t + 0x1E0); this.BASE_TIRES.YawSpeedScale = *(float *)(byteptr_t + 0x1E4); this.BASE_TIRES.SteeringAmplifier = *(float *)(byteptr_t + 0x1E8); this.BASE_TIRES.DynamicGripScale = *(float *)(byteptr_t + 0x1EC); this.BASE_TIRES.SteeringResponse = *(float *)(byteptr_t + 0x1F0); this.BASE_TIRES.DriftYawControl = *(float *)(byteptr_t + 0x200); this.BASE_TIRES.DriftCounterSteerBuildUp = *(float *)(byteptr_t + 0x204); this.BASE_TIRES.DriftCounterSteerReduction = *(float *)(byteptr_t + 0x208); this.BASE_TIRES.PowerSlideBreakThru1 = *(float *)(byteptr_t + 0x20C); this.BASE_TIRES.PowerSlideBreakThru2 = *(float *)(byteptr_t + 0x210); // Pvehicle Values this.PVEHICLE.Massx1000Multiplier = *(float *)(byteptr_t + 0x220); this.PVEHICLE.TensorScaleX = *(float *)(byteptr_t + 0x224); this.PVEHICLE.TensorScaleY = *(float *)(byteptr_t + 0x228); this.PVEHICLE.TensorScaleZ = *(float *)(byteptr_t + 0x22C); this.PVEHICLE.TensorScaleW = *(float *)(byteptr_t + 0x230); this.PVEHICLE.InitialHandlingRating = *(float *)(byteptr_t + 0x270); this.PVEHICLE.TopSpeedUnderflow = *(float *)(byteptr_t + 0x370); this.PVEHICLE.StockTopSpeedLimiter = *(float *)(byteptr_t + 0x3A0); // Ecar Values this.ECAR.EcarUnknown1 = *(float *)(byteptr_t + 0x244); this.ECAR.EcarUnknown2 = *(float *)(byteptr_t + 0x258); this.ECAR.HandlingBuffer = *(float *)(byteptr_t + 0x710); this.ECAR.TopSuspFrontHeightReduce = *(float *)(byteptr_t + 0x714); this.ECAR.TopSuspRearHeightReduce = *(float *)(byteptr_t + 0x718); this.ECAR.NumPlayerCameras = *(int *)(byteptr_t + 0x720); this.ECAR.NumAICameras = *(int *)(byteptr_t + 0x724); this.ECAR.Cost = *(int *)(byteptr_t + 0x87C); // Base Suspension Performance this.BASE_SUSPENSION.ShockStiffnessFront = *(float *)(byteptr_t + 0x280); this.BASE_SUSPENSION.ShockExtStiffnessFront = *(float *)(byteptr_t + 0x284); this.BASE_SUSPENSION.SpringProgressionFront = *(float *)(byteptr_t + 0x288); this.BASE_SUSPENSION.ShockValvingFront = *(float *)(byteptr_t + 0x28C); this.BASE_SUSPENSION.SwayBarFront = *(float *)(byteptr_t + 0x290); this.BASE_SUSPENSION.TrackWidthFront = *(float *)(byteptr_t + 0x294); this.BASE_SUSPENSION.CounterBiasFront = *(float *)(byteptr_t + 0x298); this.BASE_SUSPENSION.ShockDigressionFront = *(float *)(byteptr_t + 0x29C); this.BASE_SUSPENSION.ShockStiffnessRear = *(float *)(byteptr_t + 0x2A0); this.BASE_SUSPENSION.ShockExtStiffnessRear = *(float *)(byteptr_t + 0x2A4); this.BASE_SUSPENSION.SpringProgressionRear = *(float *)(byteptr_t + 0x2A8); this.BASE_SUSPENSION.ShockValvingRear = *(float *)(byteptr_t + 0x2AC); this.BASE_SUSPENSION.SwayBarRear = *(float *)(byteptr_t + 0x2B0); this.BASE_SUSPENSION.TrackWidthRear = *(float *)(byteptr_t + 0x2B4); this.BASE_SUSPENSION.CounterBiasRear = *(float *)(byteptr_t + 0x2B8); this.BASE_SUSPENSION.ShockDigressionRear = *(float *)(byteptr_t + 0x2BC); // Base Transmission Performance this.BASE_TRANSMISSION.ClutchSlip = *(float *)(byteptr_t + 0x2C0); this.BASE_TRANSMISSION.OptimalShift = *(float *)(byteptr_t + 0x2C4); this.BASE_TRANSMISSION.FinalDriveRatio = *(float *)(byteptr_t + 0x2C8); this.BASE_TRANSMISSION.FinalDriveRatio2 = *(float *)(byteptr_t + 0x2CC); this.BASE_TRANSMISSION.TorqueSplit = *(float *)(byteptr_t + 0x2D0); this.BASE_TRANSMISSION.BurnoutStrength = *(float *)(byteptr_t + 0x2D4); this.BASE_TRANSMISSION.NumberOfGears = *(int *)(byteptr_t + 0x2D8); this.BASE_TRANSMISSION.GearEfficiency = *(float *)(byteptr_t + 0x2DC); this.BASE_TRANSMISSION.GearRatioR = *(float *)(byteptr_t + 0x2E0); this.BASE_TRANSMISSION.GearRatioN = *(float *)(byteptr_t + 0x2E4); this.BASE_TRANSMISSION.GearRatio1 = *(float *)(byteptr_t + 0x2E8); this.BASE_TRANSMISSION.GearRatio2 = *(float *)(byteptr_t + 0x2EC); this.BASE_TRANSMISSION.GearRatio3 = *(float *)(byteptr_t + 0x2F0); this.BASE_TRANSMISSION.GearRatio4 = *(float *)(byteptr_t + 0x2F4); this.BASE_TRANSMISSION.GearRatio5 = *(float *)(byteptr_t + 0x2F8); this.BASE_TRANSMISSION.GearRatio6 = *(float *)(byteptr_t + 0x2FC); // Base RPM Performance this.BASE_RPM.IdleRPMAdd = *(float *)(byteptr_t + 0x300); this.BASE_RPM.RedLineRPMAdd = *(float *)(byteptr_t + 0x304); this.BASE_RPM.MaxRPMAdd = *(float *)(byteptr_t + 0x308); // Base Engine Performance this.BASE_ENGINE.SpeedRefreshRate = *(float *)(byteptr_t + 0x30C); this.BASE_ENGINE.EngineTorque1 = *(float *)(byteptr_t + 0x310); this.BASE_ENGINE.EngineTorque2 = *(float *)(byteptr_t + 0x314); this.BASE_ENGINE.EngineTorque3 = *(float *)(byteptr_t + 0x318); this.BASE_ENGINE.EngineTorque4 = *(float *)(byteptr_t + 0x31C); this.BASE_ENGINE.EngineTorque5 = *(float *)(byteptr_t + 0x320); this.BASE_ENGINE.EngineTorque6 = *(float *)(byteptr_t + 0x324); this.BASE_ENGINE.EngineTorque7 = *(float *)(byteptr_t + 0x328); this.BASE_ENGINE.EngineTorque8 = *(float *)(byteptr_t + 0x32C); this.BASE_ENGINE.EngineTorque9 = *(float *)(byteptr_t + 0x330); this.BASE_ENGINE.EngineBraking1 = *(float *)(byteptr_t + 0x334); this.BASE_ENGINE.EngineBraking2 = *(float *)(byteptr_t + 0x338); this.BASE_ENGINE.EngineBraking3 = *(float *)(byteptr_t + 0x33C); // Base Turbo Performance this.BASE_TURBO.TurboBraking = *(float *)(byteptr_t + 0x340); this.BASE_TURBO.TurboVacuum = *(float *)(byteptr_t + 0x344); this.BASE_TURBO.TurboHeatHigh = *(float *)(byteptr_t + 0x348); this.BASE_TURBO.TurboHeatLow = *(float *)(byteptr_t + 0x34C); this.BASE_TURBO.TurboHighBoost = *(float *)(byteptr_t + 0x350); this.BASE_TURBO.TurboLowBoost = *(float *)(byteptr_t + 0x354); this.BASE_TURBO.TurboSpool = *(float *)(byteptr_t + 0x358); this.BASE_TURBO.TurboSpoolTimeDown = *(float *)(byteptr_t + 0x35C); this.BASE_TURBO.TurboSpoolTimeUp = *(float *)(byteptr_t + 0x360); // Base Brakes Performance this.BASE_BRAKES.FrontDownForce = *(float *)(byteptr_t + 0x374); this.BASE_BRAKES.RearDownForce = *(float *)(byteptr_t + 0x378); this.BASE_BRAKES.BumpJumpForce = *(float *)(byteptr_t + 0x37C); this.BASE_BRAKES.SteeringRatio = *(float *)(byteptr_t + 0x380); this.BASE_BRAKES.BrakeStrength = *(float *)(byteptr_t + 0x384); this.BASE_BRAKES.HandBrakeStrength = *(float *)(byteptr_t + 0x388); this.BASE_BRAKES.BrakeBias = *(float *)(byteptr_t + 0x38C); // DriftAdditionalYawControl Performance this.DRIFT_ADD_CONTROL.DriftAdditionalYawControl1 = *(float *)(byteptr_t + 0x3C0); this.DRIFT_ADD_CONTROL.DriftAdditionalYawControl2 = *(float *)(byteptr_t + 0x3C4); this.DRIFT_ADD_CONTROL.DriftAdditionalYawControl3 = *(float *)(byteptr_t + 0x3C8); this.DRIFT_ADD_CONTROL.DriftAdditionalYawControl4 = *(float *)(byteptr_t + 0x3CC); this.DRIFT_ADD_CONTROL.DriftAdditionalYawControl5 = *(float *)(byteptr_t + 0x3D0); this.DRIFT_ADD_CONTROL.DriftAdditionalYawControl6 = *(float *)(byteptr_t + 0x3D4); this.DRIFT_ADD_CONTROL.DriftAdditionalYawControl7 = *(float *)(byteptr_t + 0x3D8); this.DRIFT_ADD_CONTROL.DriftAdditionalYawControl8 = *(float *)(byteptr_t + 0x3DC); // Skip Street + Pro Engine and Street Turbo, 0x03E0 - 0x0450 // Top Weight Reduction Performance this.TOP_WEIGHT_REDUCTION.WeightReductionMassMultiplier = *(float *)(byteptr_t + 0x450); this.TOP_WEIGHT_REDUCTION.WeightReductionGripAddon = *(float *)(byteptr_t + 0x454); this.TOP_WEIGHT_REDUCTION.WeightReductionHandlingRating = *(float *)(byteptr_t + 0x458); // Street Transmission Performance this.STREET_TRANSMISSION.ClutchSlip = *(float *)(byteptr_t + 0x460); this.STREET_TRANSMISSION.OptimalShift = *(float *)(byteptr_t + 0x464); this.STREET_TRANSMISSION.FinalDriveRatio = *(float *)(byteptr_t + 0x468); this.STREET_TRANSMISSION.FinalDriveRatio2 = *(float *)(byteptr_t + 0x46C); this.STREET_TRANSMISSION.TorqueSplit = *(float *)(byteptr_t + 0x470); this.STREET_TRANSMISSION.BurnoutStrength = *(float *)(byteptr_t + 0x474); this.STREET_TRANSMISSION.NumberOfGears = *(int *)(byteptr_t + 0x478); this.STREET_TRANSMISSION.GearEfficiency = *(float *)(byteptr_t + 0x47C); this.STREET_TRANSMISSION.GearRatioR = *(float *)(byteptr_t + 0x480); this.STREET_TRANSMISSION.GearRatioN = *(float *)(byteptr_t + 0x484); this.STREET_TRANSMISSION.GearRatio1 = *(float *)(byteptr_t + 0x488); this.STREET_TRANSMISSION.GearRatio2 = *(float *)(byteptr_t + 0x48C); this.STREET_TRANSMISSION.GearRatio3 = *(float *)(byteptr_t + 0x490); this.STREET_TRANSMISSION.GearRatio4 = *(float *)(byteptr_t + 0x494); this.STREET_TRANSMISSION.GearRatio5 = *(float *)(byteptr_t + 0x498); this.STREET_TRANSMISSION.GearRatio6 = *(float *)(byteptr_t + 0x49C); // Pro Transmission Performance this.PRO_TRANSMISSION.ClutchSlip = *(float *)(byteptr_t + 0x4A0); this.PRO_TRANSMISSION.OptimalShift = *(float *)(byteptr_t + 0x4A4); this.PRO_TRANSMISSION.FinalDriveRatio = *(float *)(byteptr_t + 0x4A8); this.PRO_TRANSMISSION.FinalDriveRatio2 = *(float *)(byteptr_t + 0x4AC); this.PRO_TRANSMISSION.TorqueSplit = *(float *)(byteptr_t + 0x4B0); this.PRO_TRANSMISSION.BurnoutStrength = *(float *)(byteptr_t + 0x4B4); this.PRO_TRANSMISSION.NumberOfGears = *(int *)(byteptr_t + 0x4B8); this.PRO_TRANSMISSION.GearEfficiency = *(float *)(byteptr_t + 0x4BC); this.PRO_TRANSMISSION.GearRatioR = *(float *)(byteptr_t + 0x4C0); this.PRO_TRANSMISSION.GearRatioN = *(float *)(byteptr_t + 0x4C4); this.PRO_TRANSMISSION.GearRatio1 = *(float *)(byteptr_t + 0x4C8); this.PRO_TRANSMISSION.GearRatio2 = *(float *)(byteptr_t + 0x4CC); this.PRO_TRANSMISSION.GearRatio3 = *(float *)(byteptr_t + 0x4D0); this.PRO_TRANSMISSION.GearRatio4 = *(float *)(byteptr_t + 0x4D4); this.PRO_TRANSMISSION.GearRatio5 = *(float *)(byteptr_t + 0x4D8); this.PRO_TRANSMISSION.GearRatio6 = *(float *)(byteptr_t + 0x4DC); // Top Transmission Performance this.TOP_TRANSMISSION.ClutchSlip = *(float *)(byteptr_t + 0x4E0); this.TOP_TRANSMISSION.OptimalShift = *(float *)(byteptr_t + 0x4E4); this.TOP_TRANSMISSION.FinalDriveRatio = *(float *)(byteptr_t + 0x4E8); this.TOP_TRANSMISSION.FinalDriveRatio2 = *(float *)(byteptr_t + 0x4EC); this.TOP_TRANSMISSION.TorqueSplit = *(float *)(byteptr_t + 0x4F0); this.TOP_TRANSMISSION.BurnoutStrength = *(float *)(byteptr_t + 0x4F4); this.TOP_TRANSMISSION.NumberOfGears = *(int *)(byteptr_t + 0x4F8); this.TOP_TRANSMISSION.GearEfficiency = *(float *)(byteptr_t + 0x4FC); this.TOP_TRANSMISSION.GearRatioR = *(float *)(byteptr_t + 0x500); this.TOP_TRANSMISSION.GearRatioN = *(float *)(byteptr_t + 0x504); this.TOP_TRANSMISSION.GearRatio1 = *(float *)(byteptr_t + 0x508); this.TOP_TRANSMISSION.GearRatio2 = *(float *)(byteptr_t + 0x50C); this.TOP_TRANSMISSION.GearRatio3 = *(float *)(byteptr_t + 0x510); this.TOP_TRANSMISSION.GearRatio4 = *(float *)(byteptr_t + 0x514); this.TOP_TRANSMISSION.GearRatio5 = *(float *)(byteptr_t + 0x518); this.TOP_TRANSMISSION.GearRatio6 = *(float *)(byteptr_t + 0x51C); // Top Engine Performance this.TOP_ENGINE.SpeedRefreshRate = *(float *)(byteptr_t + 0x52C); this.TOP_ENGINE.EngineTorque1 = *(float *)(byteptr_t + 0x530); this.TOP_ENGINE.EngineTorque2 = *(float *)(byteptr_t + 0x534); this.TOP_ENGINE.EngineTorque3 = *(float *)(byteptr_t + 0x538); this.TOP_ENGINE.EngineTorque4 = *(float *)(byteptr_t + 0x53C); this.TOP_ENGINE.EngineTorque5 = *(float *)(byteptr_t + 0x540); this.TOP_ENGINE.EngineTorque6 = *(float *)(byteptr_t + 0x544); this.TOP_ENGINE.EngineTorque7 = *(float *)(byteptr_t + 0x548); this.TOP_ENGINE.EngineTorque8 = *(float *)(byteptr_t + 0x54C); this.TOP_ENGINE.EngineTorque9 = *(float *)(byteptr_t + 0x550); this.TOP_ENGINE.EngineBraking1 = *(float *)(byteptr_t + 0x554); this.TOP_ENGINE.EngineBraking2 = *(float *)(byteptr_t + 0x558); this.TOP_ENGINE.EngineBraking3 = *(float *)(byteptr_t + 0x55C); // Street RPM Performance this.STREET_RPM.IdleRPMAdd = *(float *)(byteptr_t + 0x560); this.STREET_RPM.RedLineRPMAdd = *(float *)(byteptr_t + 0x564); this.STREET_RPM.MaxRPMAdd = *(float *)(byteptr_t + 0x568); // Street ECU Performance this.STREET_ECU.ECUx1000Add = *(float *)(byteptr_t + 0x570); this.STREET_ECU.ECUx2000Add = *(float *)(byteptr_t + 0x574); this.STREET_ECU.ECUx3000Add = *(float *)(byteptr_t + 0x578); this.STREET_ECU.ECUx4000Add = *(float *)(byteptr_t + 0x57C); this.STREET_ECU.ECUx5000Add = *(float *)(byteptr_t + 0x580); this.STREET_ECU.ECUx6000Add = *(float *)(byteptr_t + 0x584); this.STREET_ECU.ECUx7000Add = *(float *)(byteptr_t + 0x588); this.STREET_ECU.ECUx8000Add = *(float *)(byteptr_t + 0x58C); this.STREET_ECU.ECUx9000Add = *(float *)(byteptr_t + 0x590); this.STREET_ECU.ECUx10000Add = *(float *)(byteptr_t + 0x594); this.STREET_ECU.ECUx11000Add = *(float *)(byteptr_t + 0x598); this.STREET_ECU.ECUx12000Add = *(float *)(byteptr_t + 0x59C); // Pro RPM Performance this.PRO_RPM.IdleRPMAdd = *(float *)(byteptr_t + 0x5A0); this.PRO_RPM.RedLineRPMAdd = *(float *)(byteptr_t + 0x5A4); this.PRO_RPM.MaxRPMAdd = *(float *)(byteptr_t + 0x5A8); // Pro ECU Performance this.PRO_ECU.ECUx1000Add = *(float *)(byteptr_t + 0x5B0); this.PRO_ECU.ECUx2000Add = *(float *)(byteptr_t + 0x5B4); this.PRO_ECU.ECUx3000Add = *(float *)(byteptr_t + 0x5B8); this.PRO_ECU.ECUx4000Add = *(float *)(byteptr_t + 0x5BC); this.PRO_ECU.ECUx5000Add = *(float *)(byteptr_t + 0x5C0); this.PRO_ECU.ECUx6000Add = *(float *)(byteptr_t + 0x5C4); this.PRO_ECU.ECUx7000Add = *(float *)(byteptr_t + 0x5C8); this.PRO_ECU.ECUx8000Add = *(float *)(byteptr_t + 0x5CC); this.PRO_ECU.ECUx9000Add = *(float *)(byteptr_t + 0x5D0); this.PRO_ECU.ECUx10000Add = *(float *)(byteptr_t + 0x5D4); this.PRO_ECU.ECUx11000Add = *(float *)(byteptr_t + 0x5D8); this.PRO_ECU.ECUx12000Add = *(float *)(byteptr_t + 0x5DC); // Top RPM Performance this.TOP_RPM.IdleRPMAdd = *(float *)(byteptr_t + 0x5E0); this.TOP_RPM.RedLineRPMAdd = *(float *)(byteptr_t + 0x5E4); this.TOP_RPM.MaxRPMAdd = *(float *)(byteptr_t + 0x5E8); // Top ECU Performance this.TOP_ECU.ECUx1000Add = *(float *)(byteptr_t + 0x5F0); this.TOP_ECU.ECUx2000Add = *(float *)(byteptr_t + 0x5F4); this.TOP_ECU.ECUx3000Add = *(float *)(byteptr_t + 0x5F8); this.TOP_ECU.ECUx4000Add = *(float *)(byteptr_t + 0x5FC); this.TOP_ECU.ECUx5000Add = *(float *)(byteptr_t + 0x600); this.TOP_ECU.ECUx6000Add = *(float *)(byteptr_t + 0x604); this.TOP_ECU.ECUx7000Add = *(float *)(byteptr_t + 0x608); this.TOP_ECU.ECUx8000Add = *(float *)(byteptr_t + 0x60C); this.TOP_ECU.ECUx9000Add = *(float *)(byteptr_t + 0x610); this.TOP_ECU.ECUx10000Add = *(float *)(byteptr_t + 0x614); this.TOP_ECU.ECUx11000Add = *(float *)(byteptr_t + 0x618); this.TOP_ECU.ECUx12000Add = *(float *)(byteptr_t + 0x61C); // Top Turbo Performance this.TOP_TURBO.TurboBraking = *(float *)(byteptr_t + 0x620); this.TOP_TURBO.TurboVacuum = *(float *)(byteptr_t + 0x624); this.TOP_TURBO.TurboHeatHigh = *(float *)(byteptr_t + 0x628); this.TOP_TURBO.TurboHeatLow = *(float *)(byteptr_t + 0x62C); this.TOP_TURBO.TurboHighBoost = *(float *)(byteptr_t + 0x630); this.TOP_TURBO.TurboLowBoost = *(float *)(byteptr_t + 0x634); this.TOP_TURBO.TurboSpool = *(float *)(byteptr_t + 0x638); this.TOP_TURBO.TurboSpoolTimeDown = *(float *)(byteptr_t + 0x63C); this.TOP_TURBO.TurboSpoolTimeUp = *(float *)(byteptr_t + 0x640); // Top Tires Performance this.TOP_TIRES.StaticGripScale = *(float *)(byteptr_t + 0x650); this.TOP_TIRES.YawSpeedScale = *(float *)(byteptr_t + 0x654); this.TOP_TIRES.SteeringAmplifier = *(float *)(byteptr_t + 0x658); this.TOP_TIRES.DynamicGripScale = *(float *)(byteptr_t + 0x65C); this.TOP_TIRES.SteeringResponse = *(float *)(byteptr_t + 0x660); this.TOP_TIRES.DriftYawControl = *(float *)(byteptr_t + 0x670); this.TOP_TIRES.DriftCounterSteerBuildUp = *(float *)(byteptr_t + 0x674); this.TOP_TIRES.DriftCounterSteerReduction = *(float *)(byteptr_t + 0x678); this.TOP_TIRES.PowerSlideBreakThru1 = *(float *)(byteptr_t + 0x67C); this.TOP_TIRES.PowerSlideBreakThru2 = *(float *)(byteptr_t + 0x680); // Top Nitrous Performance this.TOP_NITROUS.NOSCapacity = *(float *)(byteptr_t + 0x690); this.TOP_NITROUS.NOSTorqueBoost = *(float *)(byteptr_t + 0x69C); // Top Brakes Performance this.TOP_BRAKES.FrontDownForce = *(float *)(byteptr_t + 0x6B0); this.TOP_BRAKES.RearDownForce = *(float *)(byteptr_t + 0x6B4); this.TOP_BRAKES.BumpJumpForce = *(float *)(byteptr_t + 0x6B8); this.TOP_BRAKES.BrakeStrength = *(float *)(byteptr_t + 0x6C0); this.TOP_BRAKES.HandBrakeStrength = *(float *)(byteptr_t + 0x6C4); this.TOP_BRAKES.BrakeBias = *(float *)(byteptr_t + 0x6C8); this.TOP_BRAKES.SteeringRatio = *(float *)(byteptr_t + 0x6CC); // Top Suspension Performance this.TOP_SUSPENSION.ShockStiffnessFront = *(float *)(byteptr_t + 0x6D0); this.TOP_SUSPENSION.ShockExtStiffnessFront = *(float *)(byteptr_t + 0x6D4); this.TOP_SUSPENSION.SpringProgressionFront = *(float *)(byteptr_t + 0x6D8); this.TOP_SUSPENSION.ShockValvingFront = *(float *)(byteptr_t + 0x6DC); this.TOP_SUSPENSION.SwayBarFront = *(float *)(byteptr_t + 0x6E0); this.TOP_SUSPENSION.TrackWidthFront = *(float *)(byteptr_t + 0x6E4); this.TOP_SUSPENSION.CounterBiasFront = *(float *)(byteptr_t + 0x6E8); this.TOP_SUSPENSION.ShockDigressionFront = *(float *)(byteptr_t + 0x6EC); this.TOP_SUSPENSION.ShockStiffnessRear = *(float *)(byteptr_t + 0x6F0); this.TOP_SUSPENSION.ShockExtStiffnessRear = *(float *)(byteptr_t + 0x6F4); this.TOP_SUSPENSION.SpringProgressionRear = *(float *)(byteptr_t + 0x6F8); this.TOP_SUSPENSION.ShockValvingRear = *(float *)(byteptr_t + 0x6FC); this.TOP_SUSPENSION.SwayBarRear = *(float *)(byteptr_t + 0x700); this.TOP_SUSPENSION.TrackWidthRear = *(float *)(byteptr_t + 0x704); this.TOP_SUSPENSION.CounterBiasRear = *(float *)(byteptr_t + 0x708); this.TOP_SUSPENSION.ShockDigressionRear = *(float *)(byteptr_t + 0x70C); // Player Cameras this.PLAYER_CAMERA_FAR.CameraAngle = ((float)*(short *)(byteptr_t + 0x732)) * 180 / 32768; this.PLAYER_CAMERA_FAR.CameraLag = *(float *)(byteptr_t + 0x734); this.PLAYER_CAMERA_FAR.CameraHeight = *(float *)(byteptr_t + 0x738); this.PLAYER_CAMERA_FAR.CameraLatOffset = *(float *)(byteptr_t + 0x73C); this.PLAYER_CAMERA_CLOSE.CameraAngle = ((float)*(short *)(byteptr_t + 0x742)) * 180 / 32768; this.PLAYER_CAMERA_CLOSE.CameraLag = *(float *)(byteptr_t + 0x744); this.PLAYER_CAMERA_CLOSE.CameraHeight = *(float *)(byteptr_t + 0x748); this.PLAYER_CAMERA_CLOSE.CameraLatOffset = *(float *)(byteptr_t + 0x74C); this.PLAYER_CAMERA_BUMPER.CameraAngle = ((float)*(short *)(byteptr_t + 0x752)) * 180 / 32768; this.PLAYER_CAMERA_BUMPER.CameraLag = *(float *)(byteptr_t + 0x754); this.PLAYER_CAMERA_BUMPER.CameraHeight = *(float *)(byteptr_t + 0x758); this.PLAYER_CAMERA_BUMPER.CameraLatOffset = *(float *)(byteptr_t + 0x75C); this.PLAYER_CAMERA_DRIVER.CameraAngle = ((float)*(short *)(byteptr_t + 0x762)) * 180 / 32768; this.PLAYER_CAMERA_DRIVER.CameraLag = *(float *)(byteptr_t + 0x764); this.PLAYER_CAMERA_DRIVER.CameraHeight = *(float *)(byteptr_t + 0x768); this.PLAYER_CAMERA_DRIVER.CameraLatOffset = *(float *)(byteptr_t + 0x76C); this.PLAYER_CAMERA_HOOD.CameraAngle = ((float)*(short *)(byteptr_t + 0x772)) * 180 / 32768; this.PLAYER_CAMERA_HOOD.CameraLag = *(float *)(byteptr_t + 0x774); this.PLAYER_CAMERA_HOOD.CameraHeight = *(float *)(byteptr_t + 0x778); this.PLAYER_CAMERA_HOOD.CameraLatOffset = *(float *)(byteptr_t + 0x77C); this.PLAYER_CAMERA_DRIFT.CameraAngle = ((float)*(short *)(byteptr_t + 0x782)) * 180 / 32768; this.PLAYER_CAMERA_DRIFT.CameraLag = *(float *)(byteptr_t + 0x784); this.PLAYER_CAMERA_DRIFT.CameraHeight = *(float *)(byteptr_t + 0x788); this.PLAYER_CAMERA_DRIFT.CameraLatOffset = *(float *)(byteptr_t + 0x78C); // AI Cameras this.AI_CAMERA_FAR.CameraAngle = ((float)*(short *)(byteptr_t + 0x792)) * 180 / 32768; this.AI_CAMERA_FAR.CameraLag = *(float *)(byteptr_t + 0x794); this.AI_CAMERA_FAR.CameraHeight = *(float *)(byteptr_t + 0x798); this.AI_CAMERA_FAR.CameraLatOffset = *(float *)(byteptr_t + 0x79C); this.AI_CAMERA_CLOSE.CameraAngle = ((float)*(short *)(byteptr_t + 0x7A2)) * 180 / 32768; this.AI_CAMERA_CLOSE.CameraLag = *(float *)(byteptr_t + 0x7A4); this.AI_CAMERA_CLOSE.CameraHeight = *(float *)(byteptr_t + 0x7A8); this.AI_CAMERA_CLOSE.CameraLatOffset = *(float *)(byteptr_t + 0x7AC); this.AI_CAMERA_BUMPER.CameraAngle = ((float)*(short *)(byteptr_t + 0x7B2)) * 180 / 32768; this.AI_CAMERA_BUMPER.CameraLag = *(float *)(byteptr_t + 0x7B4); this.AI_CAMERA_BUMPER.CameraHeight = *(float *)(byteptr_t + 0x7B8); this.AI_CAMERA_BUMPER.CameraLatOffset = *(float *)(byteptr_t + 0x7BC); this.AI_CAMERA_DRIVER.CameraAngle = ((float)*(short *)(byteptr_t + 0x7C2)) * 180 / 32768; this.AI_CAMERA_DRIVER.CameraLag = *(float *)(byteptr_t + 0x7C4); this.AI_CAMERA_DRIVER.CameraHeight = *(float *)(byteptr_t + 0x7C8); this.AI_CAMERA_DRIVER.CameraLatOffset = *(float *)(byteptr_t + 0x7CC); this.AI_CAMERA_HOOD.CameraAngle = ((float)*(short *)(byteptr_t + 0x7D2)) * 180 / 32768; this.AI_CAMERA_HOOD.CameraLag = *(float *)(byteptr_t + 0x7D4); this.AI_CAMERA_HOOD.CameraHeight = *(float *)(byteptr_t + 0x7D8); this.AI_CAMERA_HOOD.CameraLatOffset = *(float *)(byteptr_t + 0x7DC); this.AI_CAMERA_DRIFT.CameraAngle = ((float)*(short *)(byteptr_t + 0x7E2)) * 180 / 32768; this.AI_CAMERA_DRIFT.CameraLag = *(float *)(byteptr_t + 0x7E4); this.AI_CAMERA_DRIFT.CameraHeight = *(float *)(byteptr_t + 0x7E8); this.AI_CAMERA_DRIFT.CameraLatOffset = *(float *)(byteptr_t + 0x7EC); // Rigid Controls this._rigid_controls = new ushort[40]; for (int a1 = 0; a1 < 40; ++a1) { this._rigid_controls[a1] = *(ushort *)(byteptr_t + 0x7F0 + a1 * 2); } // Secondary Properties uint key = 0; this.Index = *(int *)(byteptr_t + 0x840); this.UsageType = (eUsageType)(*(int *)(byteptr_t + 0x844)); key = *(uint *)(byteptr_t + 0x84C); this._defaultbasepaint = Map.Lookup(key, true) ?? BaseArguments.UGPAINT; key = *(uint *)(byteptr_t + 0x850); this._defaultbasepaint2 = Map.Lookup(key, true) ?? BaseArguments.UGPAINT; this.MaxInstances1 = *(byteptr_t + 0x854); this.MaxInstances2 = *(byteptr_t + 0x855); this.MaxInstances3 = *(byteptr_t + 0x856); this.MaxInstances4 = *(byteptr_t + 0x857); this.MaxInstances5 = *(byteptr_t + 0x858); this.KeepLoaded1 = *(byteptr_t + 0x859); this.KeepLoaded1 = *(byteptr_t + 0x85A); this.KeepLoaded1 = *(byteptr_t + 0x85B); this.KeepLoaded1 = *(byteptr_t + 0x85C); this.KeepLoaded1 = *(byteptr_t + 0x85D); this.Padding1 = *(short *)(byteptr_t + 0x85E); this.MinTimeBetweenUses1 = *(float *)(byteptr_t + 0x860); this.MinTimeBetweenUses2 = *(float *)(byteptr_t + 0x864); this.MinTimeBetweenUses3 = *(float *)(byteptr_t + 0x868); this.MinTimeBetweenUses4 = *(float *)(byteptr_t + 0x86C); this.MinTimeBetweenUses5 = *(float *)(byteptr_t + 0x870); this.DefaultSkinNumber = (byte)(*(int *)(byteptr_t + 0x874)); this.Padding2 = *(int *)(byteptr_t + 0x878); this.AvailableSkinNumbers01 = *(byteptr_t + 0x880); this.AvailableSkinNumbers02 = *(byteptr_t + 0x881); this.AvailableSkinNumbers03 = *(byteptr_t + 0x882); this.AvailableSkinNumbers04 = *(byteptr_t + 0x883); this.AvailableSkinNumbers05 = *(byteptr_t + 0x884); this.AvailableSkinNumbers06 = *(byteptr_t + 0x885); this.AvailableSkinNumbers07 = *(byteptr_t + 0x886); this.AvailableSkinNumbers08 = *(byteptr_t + 0x887); this.AvailableSkinNumbers09 = *(byteptr_t + 0x888); this.AvailableSkinNumbers10 = *(byteptr_t + 0x889); this._is_suv = (*(short *)(byteptr_t + 0x88A) == 1) ? eBoolean.True : eBoolean.False; this.IsSkinnable = (*(int *)(byteptr_t + 0x88C) == 0) ? eBoolean.False : eBoolean.True; }
public void LoadHTMLTextBox(string[] lines) { char[] delim = new char[] { '<', '>' }; var formatters = new List <TagFormatter>(); string variative = null; bool controlled = false; bool bodyprocess = false; foreach (var line in lines) { var nline = ScriptX.RemoveNewLines(line); nline = ScriptX.CleanString(nline, false); var words = nline.Split(delim); foreach (var word in words) { if (string.IsNullOrEmpty(word)) { continue; } if (word == StartTags.NewLine && bodyprocess) { this.RTX.AppendText(Environment.NewLine); continue; } this.DefaultAllFormats(); if (this.IsEndTag(word)) { if (!controlled && !bodyprocess) { continue; } int index = this.FindIndexByEndTag(word, formatters); if (index == -1) { this.RTX.AppendText(word); continue; } formatters[index].SelectLength = this.RTX.Text.Length - formatters[index].StartsLength; if (controlled) { formatters[index].SpecialSetting = variative; this.AppendMenuStyling(formatters[index]); variative = null; } else if (bodyprocess) { this.AppendTextStyling(formatters[index]); } else { continue; } if (formatters[index].TagType == HTMLTagType.Head) { controlled = false; } if (formatters[index].TagType == HTMLTagType.Body) { bodyprocess = false; } formatters.RemoveAt(index); } else if (this.IsStartTag(word)) { string setting = null; var tag = new TagFormatter(); tag.StartsLength = this.RTX.Text.Length; tag.SelectLength = 0; tag.TagType = this.GetTagType(word, ref setting); if (setting != null) { tag.SpecialSetting = setting; } if (tag.TagType == HTMLTagType.Head) { controlled = true; } else if (tag.TagType == HTMLTagType.Body) { bodyprocess = true; } else if (tag.TagType == HTMLTagType.Comment) { continue; } else if (tag.TagType == HTMLTagType.ImageLink) { continue; } formatters.Add(tag); } else if (controlled) { variative += word; } else if (bodyprocess) { this.RTX.AppendText(word); } else { continue; } } } }
private void AppendDefaultStyling(string setting) { if (string.IsNullOrEmpty(setting)) { return; } char[] delim = new char[] { ':', ';' }; var split = setting.Split(delim, StringSplitOptions.RemoveEmptyEntries); for (int a = 0; a < split.Length; ++a) { split[a] = ScriptX.CleanString(split[a], true); } FontStyling styling; for (int a = 0; a < split.Length / 2; ++a) { switch (split[a * 2]) { case "font-size": styling = FontStyling.FontSize; break; case "font-family": styling = FontStyling.FontFamily; break; case "color": styling = FontStyling.Color; break; case "background-color": styling = FontStyling.BackgroundColor; break; case "text-align": styling = FontStyling.Align; break; default: continue; } switch (styling) { case FontStyling.FontSize: if (int.TryParse(split[a * 2 + 1], out int size)) { Menu.DefaultFont = new Font(Menu.DefaultFont.FontFamily, size, Menu.DefaultFont.Style); } continue; case FontStyling.FontFamily: FontFamily fontfamily = null; foreach (var family in FontFamily.Families) { if (split[a * 2 + 1] == family.Name) { fontfamily = family; } } if (fontfamily != null) { Menu.DefaultFont = new Font(fontfamily, Menu.DefaultFont.Size, Menu.DefaultFont.Style); } continue; case FontStyling.Color: if (split[a * 2 + 1].StartsWith("#") || split[a * 2 + 1].Length == 7) { Menu.DefaultColor = ColorTranslator.FromHtml(split[a * 2 + 1]); } continue; case FontStyling.BackgroundColor: if (split[a * 2 + 1].StartsWith("#") || split[a * 2 + 1].Length == 7) { Menu.DefaultBackground = ColorTranslator.FromHtml(split[a * 2 + 1]); Menu.UseDefaultBackgound = true; } continue; case FontStyling.Align: switch (split[a * 2 + 1]) { case "left": Menu.DefaultAlign = HorizontalAlignment.Left; goto default; case "right": Menu.DefaultAlign = HorizontalAlignment.Right; goto default; case "center": Menu.DefaultAlign = HorizontalAlignment.Center; goto default; default: continue; } default: continue; } } }
private void AppendFontStyling(TagFormatter tag) { if (string.IsNullOrEmpty(tag.SpecialSetting)) { return; } char[] delim = new char[] { ':', ';' }; var split = tag.SpecialSetting.Split(delim, StringSplitOptions.RemoveEmptyEntries); for (int a = 0; a < split.Length; ++a) { split[a] = ScriptX.CleanString(split[a], true); } FontStyling styling; for (int a = 0; a < split.Length / 2; ++a) { switch (split[a * 2]) { case "font-size": styling = FontStyling.FontSize; break; case "font-family": styling = FontStyling.FontFamily; break; case "color": styling = FontStyling.Color; break; case "background-color": styling = FontStyling.BackgroundColor; break; case "text-align": styling = FontStyling.Align; break; default: continue; } switch (styling) { case FontStyling.FontSize: if (int.TryParse(split[a * 2 + 1], out int size)) { RTX.SelectionFont = new Font(RTX.SelectionFont.FontFamily, size, RTX.SelectionFont.Style); } continue; case FontStyling.FontFamily: FontFamily fontfamily = null; foreach (var family in FontFamily.Families) { if (split[a * 2 + 1] == family.Name) { fontfamily = family; } } if (fontfamily != null) { RTX.SelectionFont = new Font(fontfamily, RTX.SelectionFont.Size, RTX.SelectionFont.Style); } continue; case FontStyling.Color: if (Resolve.TryParseHTMLColor(split[a * 2 + 1], out var fcolor)) { RTX.SelectionColor = fcolor; } continue; case FontStyling.BackgroundColor: if (Resolve.TryParseHTMLColor(split[a * 2 + 1], out var bcolor)) { RTX.SelectionBackColor = bcolor; } continue; case FontStyling.Align: switch (split[a * 2 + 1]) { case "left": RTX.SelectionAlignment = HorizontalAlignment.Left; goto default; case "right": RTX.SelectionAlignment = HorizontalAlignment.Right; goto default; case "center": RTX.SelectionAlignment = HorizontalAlignment.Center; goto default; default: continue; } default: continue; } } }