Beispiel #1
0
        protected override unsafe void Disassemble(byte *byteptr_t)
        {
            // Copy array into the memory
            for (int x = 0; x < 0x338; ++x)
            {
                this.data[x] = *(byteptr_t + x);
            }

            string MODEL = "";               // MODEL of the car
            string v1    = "";               // main for class strings
            string v2    = "";               // main for system strings
            string v3    = "";               // extra for strings
            string v4    = "";               // extra for strings
            uint   a1    = 0;                // only if one hash at a time
            uint   a2    = 0;                // read hash from file only
            uint   a3    = 0;                // extra for hashes, loops
            uint   a4    = 0;                // extra for hashes, loops

            var parts  = new Concatenator(); // assign actual concatenator
            var add_on = new Add_On();       // assign actual add_on

            // Get unknown values
            this._unknown1 = *(uint *)byteptr_t;
            this._unknown2 = *(uint *)(byteptr_t + 4);

            // Get the model name
            for (int x = 8; *(byteptr_t + x) != 0; ++x)
            {
                MODEL += ((char)*(byteptr_t + x)).ToString();
            }

            // Assign MODEL string
            this.MODEL         = MODEL;
            this.OriginalModel = MODEL;

            // Begin reading
            this._performance_level = *(int *)(byteptr_t + 0x48);
            a1 = Bin.Hash(MODEL + parts._BASE); // for RaiderKeys

            // try to match _FRONT_BUMPER
            a2 = *(uint *)(byteptr_t + 0x50);
            if (a2 == 0)
            {
                this._autosculpt_frontbumper = -1;
                goto LABEL_REAR_BUMPER;
            }
            for (a3 = 0; a3 < 31; ++a3)
            {
                a1 = Bin.Hash($"{MODEL}{add_on._K10}{a3:00}{parts._FRONT_BUMPER}");
                if (a1 == a2)
                {
                    this._autosculpt_frontbumper = (sbyte)a3;
                    goto LABEL_REAR_BUMPER;
                }
            }

LABEL_REAR_BUMPER:
            // Try to match _REAR_BUMPER
            a2 = *(uint *)(byteptr_t + 0x54);
            if (a2 == 0)
            {
                this._autosculpt_rearbumper = -1;
                goto LABEL_BODY;
            }
            for (a3 = 0; a3 < 31; ++a3) // 10 rear bumper styles
            {
                a1 = Bin.Hash($"{MODEL}{add_on._K10}{a3:00}{parts._REAR_BUMPER}");
                if (a1 == a2)
                {
                    this._autosculpt_rearbumper = (sbyte)a3;
                    goto LABEL_BODY;
                }
            }

LABEL_BODY:
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._BASE_KIT); // for RaiderKeys

            // Try match _KITW_BODY
            a2 = *(uint *)(byteptr_t + 0x64);
            if (a2 == 0)
            {
                this._aftermarket_bodykit = -1;
                goto LABEL_ROOF;
            }
            for (a3 = 0; a3 < 5; ++a3) // 4 aftermarket bodykits
            {
                a1 = Bin.Hash(MODEL + add_on._KITW + a3.ToString() + parts._BASE_KIT);
                if (a1 == a2)
                {
                    this._aftermarket_bodykit = (sbyte)a3;
                    goto LABEL_ROOF;
                }
            }

LABEL_ROOF:
            // Try to match ROOF_STYLE
            a2 = *(uint *)(byteptr_t + 0x68);
            a1 = Bin.Hash(parts.ROOF_STYLE + add_on._0 + add_on._0);
            if (a2 == 0 || a1 == a2)
            {
                this._roofscoop_style = 0;
                goto LABEL_HOOD; // skip the rest of the statements
            }
            else
            {
                for (byte x1 = 1; x1 < 18; ++x1) // all 17 roof scoop styles
                {
                    string x1pad = x1.ToString("00");
                    v1 = parts.ROOF_STYLE + x1pad;
                    v3 = parts.ROOF_STYLE + x1pad + add_on._OFFSET;
                    v4 = parts.ROOF_STYLE + x1pad + add_on._DUAL;
                    a1 = Bin.Hash(v1);
                    a3 = Bin.Hash(v3);
                    a4 = Bin.Hash(v4);
                    if (a1 == a2)
                    {
                        this._roofscoop_style = x1;
                        goto LABEL_HOOD;
                    }
                    else if (a3 == a2)
                    {
                        this._roofscoop_style     = x1;
                        this._is_offset_roofscoop = eBoolean.True;
                        goto LABEL_HOOD;
                    }
                    else if (a4 == a2)
                    {
                        this._roofscoop_style   = x1;
                        this._is_dual_roofscoop = eBoolean.True;
                        goto LABEL_HOOD;
                    }
                    else
                    {
                        a1 = Bin.Hash(v1 + add_on._CF);
                        a3 = Bin.Hash(v3 + add_on._CF);
                        a4 = Bin.Hash(v4 + add_on._CF);
                        if (a1 == a2)
                        {
                            this._roofscoop_style          = x1;
                            this._is_carbonfibre_roofscoop = eBoolean.True;
                            goto LABEL_HOOD;
                        }
                        else if (a3 == a2)
                        {
                            this._roofscoop_style          = x1;
                            this._is_dual_roofscoop        = eBoolean.True;
                            this._is_carbonfibre_roofscoop = eBoolean.True;
                            goto LABEL_HOOD;
                        }
                        else if (a4 == a2)
                        {
                            this._roofscoop_style          = x1;
                            this._is_dual_roofscoop        = eBoolean.True;
                            this._is_carbonfibre_roofscoop = eBoolean.True;
                            goto LABEL_HOOD;
                        }
                    }
                }
            }

LABEL_HOOD:
            a1 = Bin.Hash(MODEL + parts._TOP); // for RaiderKeys

            // Try match _HOOD
            a2 = *(uint *)(byteptr_t + 0x70);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._HOOD);
            if (a2 == 0 || a1 == a2)
            {
                this._hood_style = 0;
                goto LABEL_SKIRT;
            }
            else
            {
                for (byte x1 = 1; x1 < 29; ++x1) // 28 hood styles
                {
                    v1 = $"{MODEL}{add_on._STYLE}{x1:00}{parts._HOOD}";
                    a1 = Bin.Hash(v1);
                    if (a1 == a2)
                    {
                        this._hood_style = x1;
                        goto LABEL_SKIRT;
                    }
                    else // try carbonfibre
                    {
                        a1 = Bin.Hash(v1 + add_on._CF);
                        if (a1 == a2)
                        {
                            this._hood_style          = x1;
                            this._is_carbonfibre_hood = eBoolean.True;
                            goto LABEL_SKIRT;
                        }
                    }
                }
            }

LABEL_SKIRT:
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._TRUNK);
            // Try to match _SKIRT
            a2 = *(uint *)(byteptr_t + 0x78);
            if (a2 == 0)
            {
                this._autosculpt_skirt = -1;
                goto LABEL_SPOILER;
            }
            for (a3 = 0; a3 < 31; ++a3) // 10 rear bumper styles
            {
                a1 = Bin.Hash($"{MODEL}{add_on._K10}{a3:00}{parts._SKIRT}");
                if (a1 == a2)
                {
                    this._autosculpt_skirt = (sbyte)a3;
                    goto LABEL_SPOILER;
                }
            }

LABEL_SPOILER:
            // Try to match spoiler
            a2 = *(uint *)(byteptr_t + 0x7C);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._SPOILER);
            if (a2 == 0)
            {
                this._spoiler_style = 0;
                this._spoiler_type  = eSTypes.NULL; // means spoiler is nulled
                goto LABEL_ENGINE;
            }
            if (a1 == a2)
            {
                this._spoiler_style = 0;
                this._spoiler_type  = eSTypes.STOCK;
            }
            else
            {
                for (byte x1 = 0; x1 < 3; ++x1)      // all 3 spoiler types
                {
                    for (byte x2 = 1; x2 < 41; ++x2) // all 40 spoiler styles
                    {
                        v3 = $"{add_on.SPOILER}{add_on._STYLE}{x2:00}{add_on._USTYPE[x1]}";
                        a3 = Bin.Hash(v3);
                        if (a3 == a2)
                        {
                            this._spoiler_style = x2;
                            v4 = add_on._USTYPE[x1];
                            goto LABEL_ENGINE; // break the whole loop
                        }
                        else // try carbonfibre
                        {
                            a3 = Bin.Hash(v3 + add_on._CF);
                            if (a3 == a2)
                            {
                                this._spoiler_style = x2;
                                v4 = add_on._USTYPE[x1];
                                this._is_carbonfibre_spoiler = eBoolean.True;
                                goto LABEL_ENGINE; // break the whole loop
                            }
                        }
                    }
                }
            }

LABEL_ENGINE:
            // fix spoiler settings first
            if (v4 == "" || v4 == string.Empty)
            {
                this._spoiler_type = eSTypes.BASE; // use BASE to make it clearer
            }
            else
            {
                System.Enum.TryParse(v4, out this._spoiler_type);
            }

            a2 = *(uint *)(byteptr_t + 0x80);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._ENGINE);
            if (a2 == 0 || a1 == a2)
            {
                this._engine_style = 0;
                goto LABEL_HEADLIGHT;
            }
            for (a3 = 0; a3 < 4; ++a3)
            {
                a1 = Bin.Hash(MODEL + add_on._STYLE + add_on._0 + a3.ToString() + parts._ENGINE);
                if (a1 == a2)
                {
                    this._engine_style = (byte)a3;
                    goto LABEL_HEADLIGHT;
                }
            }

LABEL_HEADLIGHT:
            a2 = *(uint *)(byteptr_t + 0x84);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._HEADLIGHT);
            if (a2 == 0 || a1 == a2)
            {
                this._headlight_style = 0;
                goto LABEL_BRAKELIGHT;
            }
            for (a3 = 0; a3 < 15; ++a3)
            {
                a1 = Bin.Hash($"{MODEL}{add_on._STYLE}{a3:00}{parts._HEADLIGHT}");
                if (a1 == a2)
                {
                    this._headlight_style = (byte)a3;
                    goto LABEL_BRAKELIGHT;
                }
            }

LABEL_BRAKELIGHT:
            a2 = *(uint *)(byteptr_t + 0x88);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._BRAKELIGHT);
            if (a2 == 0 || a1 == a2)
            {
                this._brakelight_style = 0;
                goto LABEL_EXHAUST;
            }
            for (a3 = 0; a3 < 15; ++a3)
            {
                a1 = Bin.Hash($"{MODEL}{add_on._STYLE}{a3:00}{parts._BRAKELIGHT}");
                if (a1 == a2)
                {
                    this._brakelight_style = (byte)a3;
                    goto LABEL_EXHAUST;
                }
            }

LABEL_EXHAUST:
            a2 = *(uint *)(byteptr_t + 0x8C);
            a1 = Bin.Hash(MODEL + parts._KIT00_EXHAUST);
            if (a2 == 0 || a1 == a2)
            {
                this._exhaust_style = 0;
                goto LABEL_HOOD_UNDER;
            }
            for (a3 = 0; a3 < 11; ++a3)
            {
                a1 = Bin.Hash($"{add_on.EXHAUST}{add_on._STYLE}{a3:00}{add_on._LEVEL1}");
                if (a1 == a2)
                {
                    this._exhaust_style = (byte)a3;
                    goto LABEL_HOOD_UNDER;
                }
            }

LABEL_HOOD_UNDER:
            a2 = *(uint *)(byteptr_t + 0xB0);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._HOOD_UNDER);
            if (a2 == 0 || a1 == a2)
            {
                this._under_hood_style = 0;
            }
            else
            {
                for (a3 = 21; a3 < 26; ++a3) // only 21-25 are valid
                {
                    a1 = Bin.Hash(MODEL + add_on._K10 + a3.ToString() + parts._HOOD_UNDER);
                    if (a1 == a2)
                    {
                        this._under_hood_style = (byte)a3;
                        break;
                    }
                }
            }

            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._TRUNK_UNDER); // for RaiderKeys

            // FRONT_BRAKE
            a2 = *(uint *)(byteptr_t + 0xB8);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._FRONT_BRAKE);
            if (a2 == 0 || a1 == a2)
            {
                this._front_brake_style = 0;
            }
            else
            {
                for (a3 = 1; a3 < 4; ++a3)
                {
                    a1 = Bin.Hash(add_on.BRAKE + add_on._STYLE + add_on._0 + a3.ToString());
                    if (a1 == a2)
                    {
                        this._front_brake_style = (byte)a3;
                        break;
                    }
                }
            }

            // REAR_BRAKE
            a2 = *(uint *)(byteptr_t + 0xBC);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._FRONT_BRAKE);
            if (a2 == 0 || a1 == a2)
            {
                this._rear_brake_style = 0;
            }
            else
            {
                for (a3 = 1; a3 < 4; ++a3)
                {
                    a1 = Bin.Hash(add_on.BRAKE + add_on._STYLE + add_on._0 + a3.ToString());
                    if (a1 == a2)
                    {
                        this._rear_brake_style = (byte)a3;
                        break;
                    }
                }
            }

            // WHEELS
            a2 = *(uint *)(byteptr_t + 0xC0);
            if (Map.BinKeys.TryGetValue(a2, out v2))
            {
                this.DisperseRimSettings(v2);
            }
            else
            {
                this._rim_brand = BaseArguments.STOCK;
            }

            // WING_MIRROR
            a2 = *(uint *)(byteptr_t + 0xCC);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._WING_MIRROR);
            if (a2 == 0 || a1 == a2)
            {
                this._wing_mirror_style = BaseArguments.STOCK;
            }
            else
            {
                this._wing_mirror_style = $"0x{a2:X8}";
            }


            // TRUNK_AUDIO
            a2 = *(uint *)(byteptr_t + 0xD4);
            for (a3 = 0; a3 < 4; ++a3)
            {
                a1 = Bin.Hash(MODEL + add_on._KIT + a3.ToString() + parts._TRUNK_AUDIO);
                if (a1 == a2)
                {
                    this._trunk_audio_style = (byte)a3;
                    break;
                }
            }

            // ALL TRUNK AUDIOS AND BUFFERS
            this.AUDIO_COMP.Read(byteptr_t + 0xD8);

            // Skip all Damage, goto decal types
            a2 = *(uint *)(byteptr_t + 0x11C);
            a3 = Bin.Hash(MODEL + parts._DECAL_HOOD_RECT_MEDIUM);
            a4 = Bin.Hash(MODEL + parts._DECAL_HOOD_RECT_SMALL);
            if (a3 == a2)
            {
                this._decaltype_hood = eDecalType.MEDIUM;
            }
            else if (a4 == a2)
            {
                this._decaltype_hood = eDecalType.SMALL;
            }
            else
            {
                this._decaltype_hood = eDecalType.NONE;
            }

            Bin.Hash(MODEL + parts._DECAL_FRONT_WINDOW_WIDE_MEDIUM);
            Bin.Hash(MODEL + parts._DECAL_REAR_WINDOW_WIDE_MEDIUM);
            Bin.Hash(MODEL + parts._DECAL_LEFT_DOOR_RECT_MEDIUM);
            Bin.Hash(MODEL + parts._DECAL_RIGHT_DOOR_RECT_MEDIUM);

            a2 = *(uint *)(byteptr_t + 0x130);
            a3 = Bin.Hash(MODEL + parts._DECAL_LEFT_QUARTER_RECT_MEDIUM);
            a4 = Bin.Hash(MODEL + parts._DECAL_LEFT_QUARTER_RECT_SMALL);
            if (a3 == a2)
            {
                this._decaltype_leftquarter = eDecalType.MEDIUM;
            }
            else if (a4 == a2)
            {
                this._decaltype_leftquarter = eDecalType.SMALL;
            }
            else
            {
                this._decaltype_leftquarter = eDecalType.NONE;
            }

            a2 = *(uint *)(byteptr_t + 0x134);
            a3 = Bin.Hash(MODEL + parts._DECAL_RIGHT_QUARTER_RECT_MEDIUM);
            a4 = Bin.Hash(MODEL + parts._DECAL_RIGHT_QUARTER_RECT_SMALL);
            if (a3 == a2)
            {
                this._decaltype_rightquarter = eDecalType.MEDIUM;
            }
            else if (a4 == a2)
            {
                this._decaltype_rightquarter = eDecalType.SMALL;
            }
            else
            {
                this._decaltype_rightquarter = eDecalType.NONE;
            }

            var widestrings = System.Enum.GetNames(typeof(eWideDecalType));

            a2 = *(uint *)(byteptr_t + 0x138);
            foreach (var wide in widestrings)
            {
                a1 = Bin.Hash($"{MODEL}_{wide}{parts._DECAL_LEFT_DOOR_RECT_MEDIUM}");
                if (a1 == a2)
                {
                    System.Enum.TryParse(wide, out this._decalwide_leftdoor);
                    break;
                }
            }
            a2 = *(uint *)(byteptr_t + 0x13C);
            foreach (var wide in widestrings)
            {
                a1 = Bin.Hash($"{MODEL}_{wide}{parts._DECAL_RIGHT_DOOR_RECT_MEDIUM}");
                if (a1 == a2)
                {
                    System.Enum.TryParse(wide, out this._decalwide_rightdoor);
                    break;
                }
            }
            a2 = *(uint *)(byteptr_t + 0x140);
            foreach (var wide in widestrings)
            {
                a1 = Bin.Hash($"{MODEL}_{wide}{parts._DECAL_LEFT_QUARTER_RECT_MEDIUM}");
                if (a1 == a2)
                {
                    System.Enum.TryParse(wide, out this._decalwide_leftquarter);
                    break;
                }
            }
            a2 = *(uint *)(byteptr_t + 0x144);
            foreach (var wide in widestrings)
            {
                a1 = Bin.Hash($"{MODEL}_{wide}{parts._DECAL_RIGHT_QUARTER_RECT_MEDIUM}");
                if (a1 == a2)
                {
                    System.Enum.TryParse(wide, out this._decalwide_rightquarter);
                    break;
                }
            }

            // Paint Types
            a2 = *(uint *)(byteptr_t + 0x148);
            this.PAINT_TYPES.BasePaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            a2 = *(uint *)(byteptr_t + 0x15C);
            this.PAINT_TYPES.EnginePaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            a2 = *(uint *)(byteptr_t + 0x160);
            this.PAINT_TYPES.SpoilerPaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            a2 = *(uint *)(byteptr_t + 0x164);
            this.PAINT_TYPES.BrakesPaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            a2 = *(uint *)(byteptr_t + 0x168);
            this.PAINT_TYPES.ExhaustPaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            a2 = *(uint *)(byteptr_t + 0x16C);
            this.PAINT_TYPES.AudioPaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            a2 = *(uint *)(byteptr_t + 0x170);
            this.PAINT_TYPES.RimsPaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            a2 = *(uint *)(byteptr_t + 0x174);
            this.PAINT_TYPES.SpinnersPaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            a2 = *(uint *)(byteptr_t + 0x178);
            this.PAINT_TYPES.RoofPaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            a2 = *(uint *)(byteptr_t + 0x17C);
            this.PAINT_TYPES.MirrorsPaintType = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            // Vinyls and Colors
            a2 = *(uint *)(byteptr_t + 0x14C);
            this.VINYL_SETS.VinylLayer0 = Map.Lookup(a2, true) ?? $"0x{a2:X8}";
            a2 = *(uint *)(byteptr_t + 0x150);
            this.VINYL_SETS.VinylLayer1 = Map.Lookup(a2, true) ?? $"0x{a2:X8}";
            a2 = *(uint *)(byteptr_t + 0x154);
            this.VINYL_SETS.VinylLayer2 = Map.Lookup(a2, true) ?? $"0x{a2:X8}";
            a2 = *(uint *)(byteptr_t + 0x158);
            this.VINYL_SETS.VinylLayer3 = Map.Lookup(a2, true) ?? $"0x{a2:X8}";

            a2 = *(uint *)(byteptr_t + 0x180);
            this.VINYL_SETS.Vinyl0_Color0 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x184);
            this.VINYL_SETS.Vinyl0_Color1 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x188);
            this.VINYL_SETS.Vinyl0_Color2 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x18C);
            this.VINYL_SETS.Vinyl0_Color3 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x190);
            this.VINYL_SETS.Vinyl1_Color0 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x194);
            this.VINYL_SETS.Vinyl1_Color1 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x198);
            this.VINYL_SETS.Vinyl1_Color2 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x19C);
            this.VINYL_SETS.Vinyl1_Color3 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x1A0);
            this.VINYL_SETS.Vinyl2_Color0 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x1A4);
            this.VINYL_SETS.Vinyl2_Color1 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x1A8);
            this.VINYL_SETS.Vinyl2_Color2 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x1AC);
            this.VINYL_SETS.Vinyl2_Color3 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x1B0);
            this.VINYL_SETS.Vinyl3_Color0 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x1B4);
            this.VINYL_SETS.Vinyl3_Color1 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x1B8);
            this.VINYL_SETS.Vinyl3_Color2 = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            a2 = *(uint *)(byteptr_t + 0x1BC);
            this.VINYL_SETS.Vinyl3_Color3 = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            // Carbonfibre Settings
            a2 = *(uint *)(byteptr_t + 0x1C0);
            if (Map.Lookup(a2, true) == parts.CARBON_FIBRE)
            {
                this.HasCarbonfibreBody = eBoolean.True;
            }
            else
            {
                this.HasCarbonfibreBody = eBoolean.False;
            }

            a2 = *(uint *)(byteptr_t + 0x1C4);
            if (Map.Lookup(a2, true) == parts.CARBON_FIBRE)
            {
                this.HasCarbonfibreHood = eBoolean.True;
            }
            else
            {
                this.HasCarbonfibreHood = eBoolean.False;
            }

            a2 = *(uint *)(byteptr_t + 0x1C8);
            if (Map.Lookup(a2, true) == parts.CARBON_FIBRE)
            {
                this.HasCarbonfibreDoors = eBoolean.True;
            }
            else
            {
                this.HasCarbonfibreDoors = eBoolean.False;
            }

            a2 = *(uint *)(byteptr_t + 0x1CC);
            if (Map.Lookup(a2, true) == parts.CARBON_FIBRE)
            {
                this.HasCarbonfibreTrunk = eBoolean.True;
            }
            else
            {
                this.HasCarbonfibreTrunk = eBoolean.False;
            }

            // Decal Arrays
            this.DECALS_HOOD.Read(byteptr_t + 0x1D0);
            this.DECALS_FRONT_WINDOW.Read(byteptr_t + 0x1F0);
            this.DECALS_REAR_WINDOW.Read(byteptr_t + 0x210);
            this.DECALS_LEFT_DOOR.Read(byteptr_t + 0x230);
            this.DECALS_RIGHT_DOOR.Read(byteptr_t + 0x250);
            this.DECALS_LEFT_QUARTER.Read(byteptr_t + 0x270);
            this.DECALS_RIGHT_QUARTER.Read(byteptr_t + 0x290);

            // WINDOW_TINT
            a2 = *(uint *)(byteptr_t + 0x2B0);
            if (a2 == 0 || a2 == Bin.Hash(parts.WINDOW_TINT_STOCK))
            {
                this._window_tint_type = BaseArguments.STOCK;
            }
            else
            {
                this._window_tint_type = Map.Lookup(a2, false) ?? BaseArguments.STOCK;
            }

            // Specialties
            a1 = Bin.Hash(parts.NEON_NONE);
            a2 = *(uint *)(byteptr_t + 0x2B4);
            if (a1 == a2)
            {
                this.SPECIALTIES.NeonBody = parts.NEON_NONE;
            }
            else
            {
                this.SPECIALTIES.NeonBody = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            }
            a2 = *(uint *)(byteptr_t + 0x2B8);
            if (a1 == a2)
            {
                this.SPECIALTIES.NeonEngine = parts.NEON_NONE;
            }
            else
            {
                this.SPECIALTIES.NeonEngine = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            }
            a2 = *(uint *)(byteptr_t + 0x2BC);
            if (a1 == a2)
            {
                this.SPECIALTIES.NeonCabin = parts.NEON_NONE;
            }
            else
            {
                this.SPECIALTIES.NeonCabin = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            }
            a2 = *(uint *)(byteptr_t + 0x2C0);
            if (a1 == a2)
            {
                this.SPECIALTIES.NeonTrunk = parts.NEON_NONE;
            }
            else
            {
                this.SPECIALTIES.NeonTrunk = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            }

            a2 = *(uint *)(byteptr_t + 0x2C4);
            if (a2 != 0)
            {
                for (a3 = 0; a3 < 4; ++a3)
                {
                    a1 = Bin.Hash(parts.CABIN_NEON_STYLE0 + a3.ToString());
                    if (a1 == a2)
                    {
                        this.SPECIALTIES.NeonCabinStyle = (byte)a3;
                        break;
                    }
                }
            }

            a1 = Bin.Hash(BaseArguments.STOCK);
            a2 = *(uint *)(byteptr_t + 0x2C8);
            if (a2 == 0 || a1 == a2)
            {
                this.SPECIALTIES.HeadlightBulbStyle = BaseArguments.STOCK;
            }
            else
            {
                this.SPECIALTIES.HeadlightBulbStyle = Map.Lookup(a2, false) ?? BaseArguments.STOCK;
            }
            a2 = *(uint *)(byteptr_t + 0x2CC);
            if (a2 == 0 || a1 == a2)
            {
                this.SPECIALTIES.DoorOpeningStyle = BaseArguments.STOCK;
            }
            else
            {
                this.SPECIALTIES.DoorOpeningStyle = Map.Lookup(a2, false) ?? BaseArguments.STOCK;
            }
            a1 = Bin.Hash(parts.NO_HYDRAULICS);
            a2 = *(uint *)(byteptr_t + 0x2D0);
            if (a1 == a2)
            {
                this.SPECIALTIES.HydraulicsStyle = parts.NO_HYDRAULICS;
            }
            else
            {
                this.SPECIALTIES.HydraulicsStyle = Map.Lookup(a2, true) ?? BaseArguments.NULL;
            }
            a2 = *(uint *)(byteptr_t + 0x2D4);
            this.SPECIALTIES.NOSPurgeStyle = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            // HUD Options
            a2 = *(uint *)(byteptr_t + 0x2D8);
            if (a2 == 0)
            {
                this._custom_hud_style = BaseArguments.STOCK;
            }
            else
            {
                this._custom_hud_style = Map.Lookup(a2, false) ?? BaseArguments.STOCK;
            }
            a2 = *(uint *)(byteptr_t + 0x2DC);
            if (a2 == 0)
            {
                this._hud_backing_color = BaseArguments.WHITE;
            }
            else
            {
                this._hud_backing_color = Map.Lookup(a2, false) ?? BaseArguments.WHITE;
            }
            a2 = *(uint *)(byteptr_t + 0x2E0);
            if (a2 == 0)
            {
                this._hud_needle_color = BaseArguments.WHITE;
            }
            else
            {
                this._hud_needle_color = Map.Lookup(a2, false) ?? BaseArguments.WHITE;
            }
            a2 = *(uint *)(byteptr_t + 0x2E4);
            if (a2 == 0)
            {
                this._hud_character_color = BaseArguments.WHITE;
            }
            else
            {
                this._hud_character_color = Map.Lookup(a2, false) ?? BaseArguments.WHITE;
            }

            // _CV
            a2 = *(uint *)(byteptr_t + 0x2F0);
            a1 = Bin.Hash(MODEL + parts._CV);
            if (a2 == 0 || a1 == a2)
            {
                this._cv_misc_style = 0;
            }
            else
            {
                for (a3 = 1; a3 < 5; ++a3)
                {
                    a1 = Bin.Hash(MODEL + add_on._KITW + a3.ToString() + parts._CV);
                    if (a1 == a2)
                    {
                        this._cv_misc_style = (byte)a3;
                        break;
                    }
                }
            }
        }
Beispiel #2
0
        public override unsafe byte[] Assemble()
        {
            var result = new byte[this.data.Length];

            Buffer.BlockCopy(this.data, 0, result, 0, this.data.Length);
            fixed(byte *byteptr_t = &result[0])
            {
                var parts  = new Concatenator();
                var add_on = new Add_On();

                // BASE PARTS
                parts._BASE = MODEL + parts._BASE;

                // _FRONT_BUMPER
                if (this._autosculpt_frontbumper == -1)
                {
                    parts._FRONT_BUMPER = string.Empty;
                }
                else
                {
                    parts._FRONT_BUMPER = MODEL + add_on._K10 + this._autosculpt_frontbumper.ToString("00") + parts._FRONT_BUMPER;
                }

                // _REAR_BUMPER
                if (this._autosculpt_rearbumper == -1)
                {
                    parts._REAR_BUMPER = string.Empty;
                }
                else
                {
                    parts._REAR_BUMPER = MODEL + add_on._K10 + this._autosculpt_rearbumper.ToString("00") + parts._REAR_BUMPER;
                }

                // _BODY
                parts._BASE_KIT = MODEL + add_on._KIT + add_on._0 + parts._BASE_KIT;

                // _KITW_BODY
                if (this._aftermarket_bodykit == -1)
                {
                    parts._KITW_BODY = string.Empty;
                }
                else
                {
                    parts._KITW_BODY = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString() + parts._KITW_BODY;
                }

                // ROOF_STYLE
                if (this._roofscoop_style == 0)
                {
                    parts.ROOF_STYLE += add_on._0 + add_on._0;
                }
                else
                {
                    parts.ROOF_STYLE += this._roofscoop_style.ToString("00");
                    if (this._is_dual_roofscoop == eBoolean.True)
                    {
                        parts.ROOF_STYLE += add_on._DUAL;
                    }
                    if (this._is_offset_roofscoop == eBoolean.True && this._is_dual_roofscoop == eBoolean.False)
                    {
                        parts.ROOF_STYLE += add_on._OFFSET;
                    }
                    if (this._is_carbonfibre_roofscoop == eBoolean.True)
                    {
                        parts.ROOF_STYLE += add_on._CF;
                    }
                }

                // _HOOD
                if (this._hood_style == 0)
                {
                    parts._HOOD = MODEL + add_on._KIT + add_on._0 + parts._HOOD;
                }
                else
                {
                    parts._HOOD = MODEL + add_on._STYLE + this._hood_style.ToString("00") + parts._HOOD;
                    if (this._is_carbonfibre_hood == eBoolean.True)
                    {
                        parts._HOOD += add_on._CF;
                    }
                }

                // _TRUNK
                parts._TRUNK = MODEL + add_on._KIT + add_on._0 + parts._TRUNK;

                // _SKIRT
                if (this._autosculpt_skirt == -1)
                {
                    parts._SKIRT = string.Empty;
                }
                else
                {
                    parts._SKIRT = MODEL + add_on._K10 + this._autosculpt_skirt.ToString("00") + parts._SKIRT;
                }

                // _SPOILER
                if (this._spoiler_type == eSTypes.NULL)
                {
                    parts._SPOILER = string.Empty;
                }
                else if (this._spoiler_style == 0 || this._spoiler_type == eSTypes.STOCK)
                {
                    parts._SPOILER = MODEL + add_on._KIT + add_on._0 + parts._SPOILER;
                }
                else
                {
                    parts._SPOILER = add_on.SPOILER + add_on._STYLE + this._spoiler_style.ToString("00");
                    if (this._spoiler_type != eSTypes.BASE)
                    {
                        parts._SPOILER += this._spoiler_type.ToString();
                    }
                    if (this._is_carbonfibre_spoiler == eBoolean.True)
                    {
                        parts._SPOILER += add_on._CF;
                    }
                }

                // _ENGINE
                if (this._engine_style == 0)
                {
                    parts._ENGINE = MODEL + add_on._KIT + add_on._0 + parts._ENGINE;
                }
                else
                {
                    parts._ENGINE = MODEL + add_on._STYLE + this._exhaust_style.ToString("00") + parts._ENGINE;
                }

                // _HEADLIGHT
                if (this._headlight_style == 0)
                {
                    parts._HEADLIGHT = MODEL + add_on._KIT + add_on._0 + parts._HEADLIGHT;
                }
                else
                {
                    parts._HEADLIGHT = MODEL + add_on._STYLE + this._headlight_style.ToString("00") + parts._HEADLIGHT;
                }

                // _BRAKELIGHT
                if (this._brakelight_style == 0)
                {
                    parts._BRAKELIGHT = MODEL + add_on._KIT + add_on._0 + parts._BRAKELIGHT;
                }
                else
                {
                    parts._BRAKELIGHT = MODEL + add_on._STYLE + this._brakelight_style.ToString("00") + parts._BRAKELIGHT;
                }

                // _EXHAUST
                if (this._exhaust_style == 0)
                {
                    parts._KIT00_EXHAUST = MODEL + parts._KIT00_EXHAUST;
                }
                else
                {
                    parts._KIT00_EXHAUST = add_on.EXHAUST + add_on._STYLE + this._exhaust_style.ToString("00") + add_on._LEVEL1;
                }

                // _DOOR / _PANEL / _SILL
                if (this._aftermarket_bodykit == -1 || this._aftermarket_bodykit == 0)
                {
                    string KIT = MODEL + add_on._KIT + add_on._0;
                    parts._DOOR_LEFT        = KIT + parts._DOOR_LEFT;
                    parts._DOOR_RIGHT       = KIT + parts._DOOR_RIGHT;
                    parts._DOOR_PANEL_LEFT  = KIT + parts._DOOR_PANEL_LEFT;
                    parts._DOOR_PANEL_RIGHT = KIT + parts._DOOR_PANEL_RIGHT;
                    parts._DOOR_SILL_LEFT   = KIT + parts._DOOR_SILL_LEFT;
                    parts._DOOR_SILL_RIGHT  = KIT + parts._DOOR_SILL_RIGHT;
                }
                else
                {
                    string KITW = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString();
                    parts._DOOR_LEFT        = KITW + parts._DOOR_LEFT;
                    parts._DOOR_RIGHT       = KITW + parts._DOOR_RIGHT;
                    parts._DOOR_PANEL_LEFT  = KITW + parts._DOOR_PANEL_LEFT;
                    parts._DOOR_PANEL_RIGHT = KITW + parts._DOOR_PANEL_RIGHT;
                    parts._DOOR_SILL_LEFT   = KITW + parts._DOOR_SILL_LEFT;
                    parts._DOOR_SILL_RIGHT  = KITW + parts._DOOR_SILL_RIGHT;
                }

                // _HOOD_UNDER
                parts._HOOD_UNDER = MODEL + add_on._K10 + this._under_hood_style.ToString("00") + parts._HOOD_UNDER;

                // _TRUNK_UNDER
                parts._TRUNK_UNDER = MODEL + add_on._KIT + add_on._0 + parts._TRUNK_UNDER;

                // _REAR_BRAKE
                if (this._rear_brake_style == 0)
                {
                    parts._REAR_BRAKE = MODEL + add_on._KIT + add_on._0 + parts._FRONT_BRAKE;
                }
                else
                {
                    parts._REAR_BRAKE = add_on.BRAKE + add_on._STYLE + this._rear_brake_style.ToString("00");
                }

                // _FRONT_BRAKE
                if (this._front_brake_style == 0)
                {
                    parts._FRONT_BRAKE = MODEL + add_on._KIT + add_on._0 + parts._FRONT_BRAKE;
                }
                else
                {
                    parts._FRONT_BRAKE = add_on.BRAKE + add_on._STYLE + this._front_brake_style.ToString("00");
                }

                // _WHEEL
                parts._WHEEL = this.GetValidRimString();

                // _MIRROR
                if (this._wing_mirror_style == BaseArguments.NULL || this._wing_mirror_style == BaseArguments.STOCK)
                {
                    parts._WING_MIRROR = MODEL + add_on._KIT + add_on._0 + parts._WING_MIRROR;
                }
                else
                {
                    parts._WING_MIRROR = this._wing_mirror_style;
                }

                // _TRUNK_AUDIO
                parts._TRUNK_AUDIO = MODEL + add_on._KIT + this._trunk_audio_style.ToString() + parts._TRUNK_AUDIO;

                // _DECAL_RECT
                parts._DECAL_HOOD_RECT_ = MODEL + parts._DECAL_HOOD_RECT_ + this._decaltype_hood.ToString();
                parts._DECAL_FRONT_WINDOW_WIDE_MEDIUM  = MODEL + parts._DECAL_FRONT_WINDOW_WIDE_MEDIUM;
                parts._DECAL_REAR_WINDOW_WIDE_MEDIUM   = MODEL + parts._DECAL_REAR_WINDOW_WIDE_MEDIUM;
                parts._DECAL_LEFT_DOOR_RECT_           = MODEL + parts._DECAL_LEFT_DOOR_RECT_;
                parts._DECAL_RIGHT_DOOR_RECT_          = MODEL + parts._DECAL_RIGHT_DOOR_RECT_;
                parts._DECAL_LEFT_QUARTER_RECT_        = MODEL + parts._DECAL_LEFT_QUARTER_RECT_ + this._decaltype_leftquarter.ToString();
                parts._DECAL_RIGHT_QUARTER_RECT_       = MODEL + parts._DECAL_RIGHT_QUARTER_RECT_ + this._decaltype_rightquarter.ToString();
                parts._DECAL_LEFT_DOOR_RECT_MEDIUM     = MODEL + "_" + this._decalwide_leftdoor.ToString() + parts._DECAL_LEFT_DOOR_RECT_MEDIUM;
                parts._DECAL_RIGHT_DOOR_RECT_MEDIUM    = MODEL + "_" + this._decalwide_rightdoor.ToString() + parts._DECAL_RIGHT_DOOR_RECT_MEDIUM;
                parts._DECAL_LEFT_QUARTER_RECT_MEDIUM  = MODEL + "_" + this._decalwide_leftquarter.ToString() + parts._DECAL_LEFT_QUARTER_RECT_MEDIUM;
                parts._DECAL_RIGHT_QUARTER_RECT_MEDIUM = MODEL + "_" + this._decalwide_rightquarter.ToString() + parts._DECAL_RIGHT_QUARTER_RECT_MEDIUM;

                // KIT_CARBON
                if (this._carbon_body == eBoolean.True)
                {
                    parts.KIT_CARBON = parts.CARBON_FIBRE;
                }
                else
                {
                    parts.KIT_CARBON = parts.CARBON_FIBRE_NONE;
                }

                // HOOD_CARBON
                if (this._carbon_hood == eBoolean.True)
                {
                    parts.HOOD_CARBON = parts.CARBON_FIBRE;
                }
                else
                {
                    parts.HOOD_CARBON = parts.CARBON_FIBRE_NONE;
                }

                // DOOR_CARBON
                if (this._carbon_doors == eBoolean.True)
                {
                    parts.DOOR_CARBON = parts.CARBON_FIBRE;
                }
                else
                {
                    parts.DOOR_CARBON = parts.CARBON_FIBRE_NONE;
                }

                // TRUNK_CARBON
                if (this._carbon_trunk == eBoolean.True)
                {
                    parts.TRUNK_CARBON = parts.CARBON_FIBRE;
                }
                else
                {
                    parts.TRUNK_CARBON = parts.CARBON_FIBRE_NONE;
                }

                // WINDOW_TINT
                if (this._window_tint_type != BaseArguments.STOCK)
                {
                    parts.WINDOW_TINT_STOCK = this._window_tint_type;
                }

                // CABIN_NEON
                parts.CABIN_NEON_STYLE0 += this.SPECIALTIES.NeonCabinStyle.ToString();

                // _CV
                if (this._cv_misc_style == 0)
                {
                    parts._CV = MODEL + parts._CV;
                }
                else
                {
                    parts._CV = MODEL + add_on._KITW + this._cv_misc_style.ToString() + parts._CV;
                }

                // Hash all strings to keys
                var keys = this.StringToKey(parts);

                // In UG2 support it does not matter if a car exists/was modified, we still
                // can write all the strings in it b/c all of them are known
                *(uint *)byteptr_t       = this._unknown1;
                *(uint *)(byteptr_t + 4) = this._unknown2;

                // Write MODEL
                for (int a1 = 8; a1 < 0x28; ++a1)
                {
                    *(byteptr_t + a1) = (byte)0;
                }
                for (int a1 = 0; a1 < this.MODEL.Length; ++a1)
                {
                    *(byteptr_t + 8 + a1) = (byte)this.MODEL[a1];
                }

                // Write CollectionName
                for (int a1 = 0x28; a1 < 0x48; ++a1)
                {
                    *(byteptr_t + a1) = (byte)0;
                }
                for (int a1 = 0; a1 < this._collection_name.Length; ++a1)
                {
                    *(byteptr_t + 0x28 + a1) = (byte)this._collection_name[a1];
                }

                // Performance Level
                *(int *)(byteptr_t + 0x48) = this._performance_level;

                // Begin Writing Keys
                *(uint *)(byteptr_t + 0x4C) = keys[0];
                *(uint *)(byteptr_t + 0x50) = keys[1];
                *(uint *)(byteptr_t + 0x54) = keys[2];
                *(uint *)(byteptr_t + 0x60) = keys[3];
                *(uint *)(byteptr_t + 0x64) = keys[4];
                *(uint *)(byteptr_t + 0x68) = keys[5];

                for (int a1 = 0; a1 < 14; ++a1)
                {
                    *(uint *)(byteptr_t + 0x70 + a1 * 4) = keys[6 + a1];
                }

                for (int a1 = 0; a1 < 5; ++a1)
                {
                    *(uint *)(byteptr_t + 0xB0 + a1 * 4) = keys[20 + a1];
                }

                *(uint *)(byteptr_t + 0xC4) = keys[24];

                for (int a1 = 0; a1 < 15; ++a1)
                {
                    *(uint *)(byteptr_t + 0xCC + a1 * 4) = keys[25 + a1];
                }

                for (int a1 = 0; a1 < 45; ++a1)
                {
                    *(uint *)(byteptr_t + 0x11C + a1 * 4) = keys[40 + a1];
                }

                // Write Decals
                this.DECALS_HOOD.Write(byteptr_t + 0x1D0);
                this.DECALS_FRONT_WINDOW.Write(byteptr_t + 0x1F0);
                this.DECALS_REAR_WINDOW.Write(byteptr_t + 0x210);
                this.DECALS_LEFT_DOOR.Write(byteptr_t + 0x230);
                this.DECALS_RIGHT_DOOR.Write(byteptr_t + 0x250);
                this.DECALS_LEFT_QUARTER.Write(byteptr_t + 0x270);
                this.DECALS_RIGHT_QUARTER.Write(byteptr_t + 0x290);

                // Finish Writing Keys
                for (int a1 = 0; a1 < 14; ++a1)
                {
                    *(uint *)(byteptr_t + 0x2B0 + a1 * 4) = keys[85 + a1];
                }

                *(uint *)(byteptr_t + 0x2F0) = keys[99];
            }

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Assembles preset ride into a byte array.
        /// </summary>
        /// <returns>Byte array of the preset ride.</returns>
        public override unsafe byte[] Assemble()
        {
            var result = new byte[this.data.Length];

            Buffer.BlockCopy(this.data, 0, result, 0, this.data.Length);
            fixed(byte *byteptr_t = &result[0])
            {
                var parts  = new Concatenator();
                var add_on = new Add_On();

                // Frontend and Pvehicle
                this._Frontend_Hash = Vlt.SmartHash(this.Frontend);
                this._Pvehicle_Hash = Vlt.SmartHash(this.Pvehicle);

                // _BASE
                parts._BASE = MODEL + parts._BASE;

                // _DAMAGE_0
                parts._DAMAGE_0_FRONT_WINDOW       = MODEL + parts._DAMAGE_0_FRONT_WINDOW;
                parts._DAMAGE_0_BODY               = MODEL + parts._DAMAGE_0_BODY;
                parts._DAMAGE_0_COP_LIGHTS         = MODEL + parts._DAMAGE_0_COP_LIGHTS;
                parts._DAMAGE_0_SPOILER            = MODEL + parts._DAMAGE_0_SPOILER;
                parts._DAMAGE_0_FRONT_WHEEL        = MODEL + parts._DAMAGE_0_FRONT_WHEEL;
                parts._DAMAGE_0_LEFT_BRAKELIGHT    = MODEL + parts._DAMAGE_0_LEFT_BRAKELIGHT;
                parts._DAMAGE_0_RIGHT_BREAKLIGHT   = MODEL + parts._DAMAGE_0_RIGHT_BREAKLIGHT;
                parts._DAMAGE_0_LEFT_HEADLIGHT     = MODEL + parts._DAMAGE_0_LEFT_HEADLIGHT;
                parts._DAMAGE_0_RIGHT_HEADLIGHT    = MODEL + parts._DAMAGE_0_RIGHT_HEADLIGHT;
                parts._DAMAGE_0_HOOD               = MODEL + parts._DAMAGE_0_HOOD;
                parts._DAMAGE_0_BUSHGUARD          = MODEL + parts._DAMAGE_0_BUSHGUARD;
                parts._DAMAGE_0_FRONT_BUMPER       = MODEL + parts._DAMAGE_0_FRONT_BUMPER;
                parts._DAMAGE_0_RIGHT_DOOR         = MODEL + parts._DAMAGE_0_RIGHT_DOOR;
                parts._DAMAGE_0_RIGHT_REAR_DOOR    = MODEL + parts._DAMAGE_0_RIGHT_REAR_DOOR;
                parts._DAMAGE_0_TRUNK              = MODEL + parts._DAMAGE_0_TRUNK;
                parts._DAMAGE_0_REAR_BUMPER        = MODEL + parts._DAMAGE_0_REAR_BUMPER;
                parts._DAMAGE_0_REAR_LEFT_WINDOW   = MODEL + parts._DAMAGE_0_REAR_LEFT_WINDOW;
                parts._DAMAGE_0_FRONT_LEFT_WINDOW  = MODEL + parts._DAMAGE_0_FRONT_LEFT_WINDOW;
                parts._DAMAGE_0_FRONT_RIGHT_WINDOW = MODEL + parts._DAMAGE_0_FRONT_RIGHT_WINDOW;
                parts._DAMAGE_0_REAR_RIGHT_WINDOW  = MODEL + parts._DAMAGE_0_REAR_RIGHT_WINDOW;
                parts._DAMAGE_0_LEFT_DOOR          = MODEL + parts._DAMAGE_0_LEFT_DOOR;
                parts._DAMAGE_0_REAR_DOOR          = MODEL + parts._DAMAGE_0_REAR_DOOR;

                // _BASE_KIT
                if (this._aftermarket_bodykit == -1)
                {
                    parts._BASE_KIT = MODEL + parts._BASE_KIT;
                }
                else
                {
                    parts._BASE_KIT = MODEL + parts._BASE_KIT + add_on._KIT + this._aftermarket_bodykit.ToString();
                }

                // Bunch of stuff
                parts._FRONT_BRAKE            = MODEL + parts._FRONT_BRAKE;
                parts._FRONT_LEFT_WINDOW      = MODEL + parts._FRONT_LEFT_WINDOW;
                parts._FRONT_RIGHT_WINDOW     = MODEL + parts._FRONT_RIGHT_WINDOW;
                parts._FRONT_WINDOW           = MODEL + parts._FRONT_WINDOW;
                parts._INTERIOR               = MODEL + parts._INTERIOR;
                parts._LEFT_BRAKELIGHT        = MODEL + parts._LEFT_BRAKELIGHT;
                parts._LEFT_BRAKELIGHT_GLASS  = MODEL + parts._LEFT_BRAKELIGHT_GLASS;
                parts._LEFT_HEADLIGHT         = MODEL + parts._LEFT_HEADLIGHT;
                parts._LEFT_HEADLIGHT_GLASS   = MODEL + parts._LEFT_HEADLIGHT_GLASS;
                parts._LEFT_SIDE_MIRROR       = MODEL + parts._LEFT_SIDE_MIRROR;
                parts._REAR_BRAKE             = MODEL + parts._REAR_BRAKE;
                parts._REAR_LEFT_WINDOW       = MODEL + parts._REAR_LEFT_WINDOW;
                parts._REAR_RIGHT_WINDOW      = MODEL + parts._REAR_RIGHT_WINDOW;
                parts._REAR_WINDOW            = MODEL + parts._REAR_WINDOW;
                parts._RIGHT_BRAKELIGHT       = MODEL + parts._RIGHT_BRAKELIGHT;
                parts._RIGHT_BRAKELIGHT_GLASS = MODEL + parts._RIGHT_BRAKELIGHT_GLASS;
                parts._RIGHT_HEADLIGHT        = MODEL + parts._RIGHT_HEADLIGHT;
                parts._RIGHT_HEADLIGHT_GLASS  = MODEL + parts._RIGHT_HEADLIGHT_GLASS;
                parts._RIGHT_SIDE_MIRROR      = MODEL + parts._RIGHT_SIDE_MIRROR;
                parts._DRIVER = MODEL + parts._DRIVER;

                // _SPOILER
                if (this._spoiler_type == eSTypes.NULL)
                {
                    parts._SPOILER = "";
                }
                else if (this._spoiler_type == eSTypes.STOCK || this._spoiler_style == 0)
                {
                    parts._SPOILER = MODEL + parts._SPOILER;
                }
                else
                {
                    parts._SPOILER = add_on.SPOILER + add_on._STYLE + this._spoiler_style.ToString("00");
                    if (this.SpoilerType != eSTypes.BASE)
                    {
                        parts._SPOILER += this._spoiler_type.ToString();
                    }
                    if (this._is_carbonfibre_spoiler == eBoolean.True)
                    {
                        parts._SPOILER += add_on._CF;
                    }
                }

                // _UNIVERSAL_SPOILER_BASE
                parts._UNIVERSAL_SPOILER_BASE = MODEL + parts._UNIVERSAL_SPOILER_BASE;

                // _DAMAGE0_FRONT and _DAMAGE0_REAR
                parts._DAMAGE0_FRONT      = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_FRONT;
                parts._DAMAGE0_FRONTLEFT  = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_FRONTLEFT;
                parts._DAMAGE0_FRONTRIGHT = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_FRONTRIGHT;
                parts._DAMAGE0_REAR       = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_REAR;
                parts._DAMAGE0_REARLEFT   = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_REARLEFT;
                parts._DAMAGE0_REARRIGHT  = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_REARRIGHT;

                // _ATTACHMENT
                parts._ATTACHMENT = MODEL + parts._ATTACHMENT;

                // ROOF_STYLE
                if (this._roofscoop_style == 0)
                {
                    parts.ROOF_STYLE += add_on._0 + add_on._0;
                }
                else
                {
                    parts.ROOF_STYLE += this._roofscoop_style.ToString("00");
                    if (this._is_dual_roofscoop == eBoolean.True)
                    {
                        parts.ROOF_STYLE += add_on._DUAL;
                    }
                    if (this._is_offset_roofscoop == eBoolean.True && this._is_dual_roofscoop == eBoolean.False)
                    {
                        parts.ROOF_STYLE += add_on._OFFSET;
                    }
                    if (this._is_carbonfibre_roofscoop == eBoolean.True)
                    {
                        parts.ROOF_STYLE += add_on._CF;
                    }
                }

                // _HOOD
                if (this._hood_style == 0)
                {
                    parts._HOOD = MODEL + add_on._KIT + add_on._0 + parts._HOOD;
                }
                else
                {
                    parts._HOOD = MODEL + add_on._STYLE + this._hood_style.ToString("00") + parts._HOOD;
                    if (this._is_carbonfibre_hood == eBoolean.True)
                    {
                        parts._HOOD += add_on._CF;
                    }
                }

                // _WHEEL
                switch (this._rim_brand)
                {
                case BaseArguments.NULL:
                case BaseArguments.STOCK:
                    parts._WHEEL = MODEL + parts._WHEEL;     // null, empty, NULL or STOCK
                    break;

                default:
                    parts._WHEEL = $"{this._rim_brand}{add_on._STYLE}{this._rim_style:00}_{this._rim_size}{add_on._25}";
                    break;
                }

                // _DECAL
                parts._DECAL_FRONT_WINDOW_WIDE_MEDIUM  = MODEL + parts._DECAL_FRONT_WINDOW_WIDE_MEDIUM;
                parts._DECAL_REAR_WINDOW_WIDE_MEDIUM   = MODEL + parts._DECAL_REAR_WINDOW_WIDE_MEDIUM;
                parts._DECAL_LEFT_DOOR_RECT_MEDIUM     = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DECAL_LEFT_DOOR_RECT_MEDIUM;
                parts._DECAL_RIGHT_DOOR_RECT_MEDIUM    = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DECAL_RIGHT_DOOR_RECT_MEDIUM;
                parts._DECAL_LEFT_QUARTER_RECT_MEDIUM  = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DECAL_LEFT_QUARTER_RECT_MEDIUM;
                parts._DECAL_RIGHT_QUARTER_RECT_MEDIUM = MODEL + add_on._KIT + this._aftermarket_bodykit.ToString() + parts._DECAL_RIGHT_QUARTER_RECT_MEDIUM;

                // PAINT
                parts.PAINT = this._body_paint;

                // RIMPAINT
                if (this.RimPaint != BaseArguments.NULL)
                {
                    parts.RIM_PAINT = this._rim_paint;
                }

                // WINDOW_TINT
                if (this.WindowTintType != BaseArguments.STOCK)
                {
                    parts.WINDOW_TINT_STOCK = this._window_tint_type;
                }

                // VINYL_LAYER
                if (this.VinylName != BaseArguments.NULL)
                {
                    parts.VINYL_LAYER = this.VinylName;
                }

                // SWATCH
                parts.SWATCH[0] = Resolve.GetVinylString(this._vinylcolor1);
                parts.SWATCH[1] = Resolve.GetVinylString(this._vinylcolor2);
                parts.SWATCH[2] = Resolve.GetVinylString(this._vinylcolor3);
                parts.SWATCH[3] = Resolve.GetVinylString(this._vinylcolor4);

                // Hash all strings to keys
                var keys = this.StringToKey(parts);

                // Write CollectionName
                for (int a1 = 0; a1 < 0x20; ++a1)
                {
                    *(byteptr_t + 0x28 + a1) = (byte)0;
                }
                for (int a1 = 0; a1 < this.CollectionName.Length; ++a1)
                {
                    *(byteptr_t + 0x28 + a1) = (byte)this.CollectionName[a1];
                }

                // Write Fronend and Pvehicle
                *(uint *)(byteptr_t + 0x48) = this._Frontend_Hash;
                *(uint *)(byteptr_t + 0x50) = this._Pvehicle_Hash;

                // If the preset already existed, it is better to internally modify its main values
                // rather than overwriting it, to avoid changing some other values; also, if the model
                // was not changed, it skips bunch of other conversions and hashing stages
                if (this.Exists && (this.MODEL == this.OriginalModel))
                {
                    if (!this.Modified) // if exists and not modified, return original array
                        return(this.data);

                    // Write settings that could have been changed
                    fixed(uint *uintptr_t = &keys[0])
                    {
                        *(uint *)(byteptr_t + 0xBC)  = *(uintptr_t + 23); // _BASE_KIT
                        *(uint *)(byteptr_t + 0x110) = *(uintptr_t + 44); // _SPOILER
                        *(uint *)(byteptr_t + 0x114) = *(uintptr_t + 45); // _UNIVERSAL_SPOILER_BASE
                        *(uint *)(byteptr_t + 0x118) = *(uintptr_t + 46); // _DAMAGE0_FRONT
                        *(uint *)(byteptr_t + 0x11C) = *(uintptr_t + 47); // _DAMAGE0_FRONTLEFT
                        *(uint *)(byteptr_t + 0x120) = *(uintptr_t + 48); // _DAMAGE0_FRONTRIGHT
                        *(uint *)(byteptr_t + 0x124) = *(uintptr_t + 49); // _DAMAGE0_REAR
                        *(uint *)(byteptr_t + 0x128) = *(uintptr_t + 50); // _DAMAGE0_REARLEFT
                        *(uint *)(byteptr_t + 0x12C) = *(uintptr_t + 51); // _DAMAGE0_REARRIGHT
                        *(uint *)(byteptr_t + 0x158) = *(uintptr_t + 62); // ROOF_STYLE
                        *(uint *)(byteptr_t + 0x15C) = *(uintptr_t + 63); // _HOOD
                        *(uint *)(byteptr_t + 0x168) = *(uintptr_t + 64); // _WHEEL
                        *(uint *)(byteptr_t + 0x190) = *(uintptr_t + 72); // PAINT
                        *(uint *)(byteptr_t + 0x194) = *(uintptr_t + 73); // VINYL_LAYER
                        *(uint *)(byteptr_t + 0x198) = *(uintptr_t + 74); // RIM_PAINT
                        *(uint *)(byteptr_t + 0x19C) = *(uintptr_t + 75); // SWATCH[0]
                        *(uint *)(byteptr_t + 0x1A0) = *(uintptr_t + 76); // SWATCH[1]
                        *(uint *)(byteptr_t + 0x1A4) = *(uintptr_t + 77); // SWATCH[2]
                        *(uint *)(byteptr_t + 0x1A8) = *(uintptr_t + 78); // SWATCH[3]
                        *(uint *)(byteptr_t + 0x26C) = *(uintptr_t + 79); // WINDOW_TINT
                    }
                }

                // If the model was changed or if the preset car is new, either overwrite existing file completely
                // or create a new one for the new car
                else
                {
                    // Write ModelName
                    for (int a1 = 0; a1 < 0x20; ++a1)
                    {
                        *(byteptr_t + 8 + a1) = (byte)0;
                    }
                    for (int a1 = 0; a1 < this.MODEL.Length; ++a1)
                        *(byteptr_t + 8 + a1) = (byte)this.MODEL[a1];

                    // Write all keys
                    fixed(uint *uintptr_t = &keys[0])
                    {
                        for (int a1 = 0; a1 < 64; ++a1)
                        {
                            *(uint *)(byteptr_t + 0x60 + a1 * 4) = *(uintptr_t + a1);
                        }

                        *(uint *)(byteptr_t + 0x168) = *(uintptr_t + 64);

                        for (int a1 = 0; a1 < 14; ++a1)
                        {
                            *(uint *)(byteptr_t + 0x174 + a1 * 4) = *(uintptr_t + 65 + a1);
                        }

                        *(uint *)(byteptr_t + 0x26C) = *(uintptr_t + 79);
                        if (!this.Exists)
                        {
                            *(uint *)(byteptr_t + 0x270) = Bin.Hash(parts.HUD);
                            *(uint *)(byteptr_t + 0x274) = Bin.Hash(parts.HUD_BACKING);
                            *(uint *)(byteptr_t + 0x278) = Bin.Hash(parts.HUD_NEEDLE);
                            *(uint *)(byteptr_t + 0x27C) = Bin.Hash(parts.HUD_CHARS);
                        }
                    }
                }

                // Read Decals
                this.DECALS_FRONT_WINDOW.Write(byteptr_t + 0x1AC);
                this.DECALS_REAR_WINDOW.Write(byteptr_t + 0x1CC);
                this.DECALS_LEFT_DOOR.Write(byteptr_t + 0x1EC);
                this.DECALS_RIGHT_DOOR.Write(byteptr_t + 0x20C);
                this.DECALS_LEFT_QUARTER.Write(byteptr_t + 0x22C);
                this.DECALS_RIGHT_QUARTER.Write(byteptr_t + 0x24C);
            }

            return(result);
        }
Beispiel #4
0
        protected override unsafe void Disassemble(byte *byteptr_t)
        {
            // Copy array into the memory
            for (int x = 0; x < 0x290; ++x)
            {
                this.data[x] = *(byteptr_t + x);
            }

            string MODEL = "";               // for Model of the car
            string hex   = "0x";             // for hex representations
            string v1    = "";               // main for class strings
            string v2    = "";               // main for system strings
            string v3    = "";               // extra for strings
            string v4    = "";               // extra for strings
            uint   a1    = 0;                // only if one hash at a time
            uint   a2    = 0;                // read hash from file only
            uint   a3    = 0;                // extra for hashes, loops
            uint   a4    = 0;                // extra for hashes, loops

            var parts  = new Concatenator(); // assign actual concatenator
            var add_on = new Add_On();       // assign actual add_on

            // Get the model name
            for (int x = 8; *(byteptr_t + x) != 0; ++x)
            {
                MODEL += ((char)*(byteptr_t + x)).ToString();
            }

            // Assign MODEL string
            this.MODEL         = MODEL;
            this.OriginalModel = MODEL;

            // Frontend hash
            a1 = *(uint *)(byteptr_t + 0x48);
            if (Map.VltKeys.TryGetValue(a1, out v1))
            {
                this.Frontend = v1;
            }
            else
            {
                this.Frontend = $"{hex}{a1:X8}";
            }

            // Pvehicle hash
            a1 = *(uint *)(byteptr_t + 0x50);
            if (Map.VltKeys.TryGetValue(a1, out v1))
            {
                this.Pvehicle = v1;
            }
            else
            {
                this.Pvehicle = $"{hex}{a1:X8}";
            }

            a1 = Bin.Hash(MODEL + parts._BASE); // for RaiderKeys

            // try to match _BODY
            a2 = *(uint *)(byteptr_t + 0xBC);
            if (a2 == 0)
            {
                this._aftermarket_bodykit = -1; // basically no difference between this one and next one
                goto LABEL_SPOILER;
            }
            a1 = Bin.Hash(MODEL + parts._BASE_KIT);
            if (a1 == a2)
            {
                this._aftermarket_bodykit = -1;
                goto LABEL_SPOILER;
            }
            else // (MODEL)_BODY_KIT(00-05)
            {
                for (int x1 = 0; x1 < 6; ++x1) // 5 bodykits max
                {
                    a1 = Bin.Hash(MODEL + parts._BASE_KIT + add_on._KIT + x1.ToString());
                    if (a1 == a2)
                    {
                        this._aftermarket_bodykit = (sbyte)x1;
                        goto LABEL_SPOILER;
                    }
                }
            }

LABEL_SPOILER:
            // Try match spoiler
            // (MODEL)_SPOILER[SPOILER_STYLE(01 - 44)(TYPE)(_CF)]
            a2 = *(uint *)(byteptr_t + 0x110);
            if (a2 == 0)
            {
                this._spoiler_style = 0;
                this._spoiler_type  = eSTypes.NULL; // means spoiler is nulled
                goto LABEL_ROOF;
            }
            a1 = Bin.Hash(MODEL + parts._SPOILER);
            if (a1 == a2) // stock spoiler
            {
                this._spoiler_style = 0;
                this._spoiler_type  = eSTypes.STOCK;
            }
            else
            {
                for (byte x1 = 0; x1 < 4; ++x1)      // all 4 spoiler types
                {
                    for (byte x2 = 1; x2 < 45; ++x2) // all 44 spoiler styles
                    {
                        v3 = add_on.SPOILER + add_on._STYLE + x2.ToString("00") + add_on._CSTYPE[x1];
                        a3 = Bin.Hash(v3);
                        if (a3 == a2)
                        {
                            this._spoiler_style = x2;
                            v4 = add_on._CSTYPE[x1];
                            goto LABEL_ROOF; // break the whole loop
                        }
                        else // try carbonfibre
                        {
                            a3 = Bin.Hash(v3 + add_on._CF);
                            if (a3 == a2)
                            {
                                this._spoiler_style = x2;
                                v4 = add_on._CSTYPE[x1];
                                this._is_carbonfibre_spoiler = eBoolean.True;
                                goto LABEL_ROOF; // break the whole loop
                            }
                        }
                    }
                }
            }

            // escape from a really big spoiler loop
LABEL_ROOF:
            // fix spoiler settings first
            if (v4 == string.Empty)
            {
                this._spoiler_type = eSTypes.BASE; // use BASE to make it clearer
            }
            else
            {
                System.Enum.TryParse(v4, out this._spoiler_type);
            }

            // Try to match ROOF_STYLE
            a2 = *(uint *)(byteptr_t + 0x158);
            a1 = Bin.Hash(parts.ROOF_STYLE + add_on._0 + add_on._0);
            if (a2 == 0 || a1 == a2)
            {
                this._roofscoop_style = 0;
                goto LABEL_HOOD; // skip the rest of the statements
            }
            else
            {
                for (byte x1 = 1; x1 < 19; ++x1) // all 18 roof scoop styles
                {
                    var x1pad = x1.ToString("00");
                    v1 = parts.ROOF_STYLE + x1pad;
                    v3 = parts.ROOF_STYLE + x1pad + add_on._OFFSET;
                    v4 = parts.ROOF_STYLE + x1pad + add_on._DUAL;
                    a1 = Bin.Hash(v1);
                    a3 = Bin.Hash(v3);
                    a4 = Bin.Hash(v4);
                    if (a1 == a2)
                    {
                        this._roofscoop_style = x1;
                        goto LABEL_HOOD;
                    }
                    else if (a3 == a2)
                    {
                        this._roofscoop_style     = x1;
                        this._is_offset_roofscoop = eBoolean.True;
                        goto LABEL_HOOD;
                    }
                    else if (a4 == a2)
                    {
                        this._roofscoop_style   = x1;
                        this._is_dual_roofscoop = eBoolean.True;
                        goto LABEL_HOOD;
                    }
                    else
                    {
                        a1 = Bin.Hash(v1 + add_on._CF);
                        a3 = Bin.Hash(v3 + add_on._CF);
                        a4 = Bin.Hash(v4 + add_on._CF);
                        if (a1 == a2)
                        {
                            this._roofscoop_style          = x1;
                            this._is_carbonfibre_roofscoop = eBoolean.True;
                            goto LABEL_HOOD;
                        }
                        else if (a3 == a2)
                        {
                            this._roofscoop_style          = x1;
                            this._is_offset_roofscoop      = eBoolean.True;
                            this._is_carbonfibre_roofscoop = eBoolean.True;
                            goto LABEL_HOOD;
                        }
                        else if (a4 == a2)
                        {
                            this._roofscoop_style          = x1;
                            this._is_dual_roofscoop        = eBoolean.True;
                            this._is_carbonfibre_roofscoop = eBoolean.True;
                            goto LABEL_HOOD;
                        }
                    }
                }
            }

            // escape from a really big roofscoop loop
LABEL_HOOD:
            // Try match _HOOD
            a2 = *(uint *)(byteptr_t + 0x15C);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._HOOD);
            if (a2 == 0 || a1 == a2)
            {
                this._hood_style = 0;
                goto LABEL_RIM;
            }
            else
            {
                for (byte x1 = 1; x1 < 33; ++x1) // 33 hood styles
                {
                    v1 = MODEL + add_on._STYLE + x1.ToString("00") + parts._HOOD;
                    a1 = Bin.Hash(v1);
                    if (a1 == a2)
                    {
                        this._hood_style = x1;
                        goto LABEL_RIM;
                    }
                    else // try carbonfibre
                    {
                        a1 = Bin.Hash(v1 + add_on._CF);
                        if (a3 == a2)
                        {
                            this._hood_style          = x1;
                            this._is_carbonfibre_hood = eBoolean.True;
                            goto LABEL_RIM;
                        }
                    }
                }
            }

            // Escape from a really big hood loop
LABEL_RIM:
            a2 = *(uint *)(byteptr_t + 0x168);
            if (a2 == 0)
            {
                this._rim_brand = BaseArguments.NULL;
                goto LABEL_PRECOMPVINYL;
            }
            a1 = Bin.Hash(MODEL + parts._WHEEL);
            if (a1 == a2)
            {
                this._rim_brand = BaseArguments.STOCK;
                goto LABEL_PRECOMPVINYL;
            }
            else
            {
                for (byte x1 = 1; x1 < Map.RimBrands.Count; ++x1) // else try match aftermarket wheels
                {
                    for (byte x2 = 1; x2 < 7; ++x2)               // 3 loops: 18 manufacturers, 6 styles, 4 sizes
                    {
                        for (byte x3 = 17; x3 < 21; ++x3)
                        {
                            a1 = Bin.Hash(Map.RimBrands[x1] + add_on._STYLE + add_on._0 + x2.ToString() + "_" + x3.ToString() + add_on._25);
                            if (a1 == a2)
                            {
                                this._rim_brand = Map.RimBrands[x1];
                                this._rim_style = x2;
                                this._rim_size  = x3;
                                goto LABEL_PRECOMPVINYL;
                            }
                        }
                    }
                }
            }

LABEL_PRECOMPVINYL:
            // Try find Body Paint
            a2             = *(uint *)(byteptr_t + 0x190);
            this.BodyPaint = Map.Lookup(a2, true) ?? BaseArguments.BPAINT;

            // Try find Vinyl Name
            a2             = *(uint *)(byteptr_t + 0x194);
            this.VinylName = Map.Lookup(a2, true) ?? (hex + a2.ToString("X8"));

            // Try find Rim Paint
            a2            = *(uint *)(byteptr_t + 0x198);
            this.RimPaint = Map.Lookup(a2, true) ?? BaseArguments.NULL;

            // Try find swatches
            this._vinylcolor1 = Resolve.GetSwatchIndex(Map.Lookup(*(uint *)(byteptr_t + 0x19C), false));
            this._vinylcolor2 = Resolve.GetSwatchIndex(Map.Lookup(*(uint *)(byteptr_t + 0x1A0), false));
            this._vinylcolor3 = Resolve.GetSwatchIndex(Map.Lookup(*(uint *)(byteptr_t + 0x1A4), false));
            this._vinylcolor4 = Resolve.GetSwatchIndex(Map.Lookup(*(uint *)(byteptr_t + 0x1A8), false));

            // Read Decals
            this.DECALS_FRONT_WINDOW.Read(byteptr_t + 0x1AC);
            this.DECALS_REAR_WINDOW.Read(byteptr_t + 0x1CC);
            this.DECALS_LEFT_DOOR.Read(byteptr_t + 0x1EC);
            this.DECALS_RIGHT_DOOR.Read(byteptr_t + 0x20C);
            this.DECALS_LEFT_QUARTER.Read(byteptr_t + 0x22C);
            this.DECALS_RIGHT_QUARTER.Read(byteptr_t + 0x24C);

            // _WINDOW_TINT
            a2 = *(uint *)(byteptr_t + 0x26C);
            a1 = Bin.Hash(parts.WINDOW_TINT_STOCK);
            if (a2 == 0 || a1 == a2)
            {
                this._window_tint_type = BaseArguments.STOCK;
            }
            else
            {
                v2 = Map.Lookup(a2, false);
                this._window_tint_type = Map.WindowTintMap.Contains(v2) ? v2 : BaseArguments.STOCK;
            }
        }
Beispiel #5
0
        /// <summary>
        /// Disassembles preset ride array into separate properties.
        /// </summary>
        /// <param name="byteptr_t">Pointer to the preset ride array.</param>
        protected override unsafe void Disassemble(byte *byteptr_t)
        {
            // Copy array into the memory
            for (int x = 0; x < 0x600; ++x)
            {
                this.data[x] = *(byteptr_t + x);
            }

            string MODEL = "";               // MODEL of the car
            string hex   = "0x";             // for hex representations
            string v1    = "";               // main for class strings
            string v2    = "";               // main for system strings
            string v3    = "";               // extra for strings
            string v4    = "";               // extra for strings
            uint   a1    = 0;                // only if one hash at a time
            uint   a2    = 0;                // read hash from file only
            uint   a3    = 0;                // extra for hashes, loops
            uint   a4    = 0;                // extra for hashes, loops

            var parts  = new Concatenator(); // assign actual concatenator
            var add_on = new Add_On();       // assign actual add_on

            // Get the model name
            for (int x = 8; *(byteptr_t + x) != 0; ++x)
            {
                MODEL += ((char)*(byteptr_t + x)).ToString();
            }

            // Assign MODEL string
            this.MODEL         = MODEL;
            this.OriginalModel = MODEL;

            // Frontend hash
            a1 = *(uint *)(byteptr_t + 0x48);
            if (Map.VltKeys.TryGetValue(a1, out v1))
            {
                this.Frontend = v1;
            }
            else
            {
                this.Frontend = $"{hex}{a1:X8}";
            }

            // Pvehicle hash
            a1 = *(uint *)(byteptr_t + 0x50);
            if (Map.VltKeys.TryGetValue(a1, out v1))
            {
                this.Pvehicle = v1;
            }
            else
            {
                this.Pvehicle = $"{hex}{a1:X8}";
            }

            a1 = Bin.Hash(MODEL + parts._BASE); // for RaiderKeys

            // try to match _BODY
            a2 = *(uint *)(byteptr_t + 0xBC);
            if (a2 == 0)
            {
                this._aftermarket_bodykit = -1; // basically no difference between this one and next one
                goto LABEL_LIGHTS;
            }
            a1 = Bin.Hash(MODEL + parts._BASE_KIT);
            if (a1 == a2)
            {
                this._aftermarket_bodykit = -1;
                goto LABEL_LIGHTS;
            }
            a1 = Bin.Hash(MODEL + parts._BASE_KIT + add_on._KIT + add_on._0); // (MODEL)_BODY_KIT00
            if (a1 == a2)
            {
                this._aftermarket_bodykit = 0;
            }
            else
            {
                for (int x1 = 0; x1 < 6; ++x1) // 5 bodykits max
                {
                    a1 = Bin.Hash(MODEL + parts._BASE_KIT + add_on._KITW + x1.ToString());
                    if (a1 == a2)
                    {
                        this._aftermarket_bodykit = (sbyte)x1;
                        goto LABEL_LIGHTS;
                    }
                }
            }

LABEL_LIGHTS:
            // Try match popup lights
            a2 = *(uint *)(byteptr_t + 0xE0);
            a1 = Bin.Hash(MODEL + parts._LEFT_HEADLIGHT + add_on._ON);
            this._popup_headlights_exist = (a2 == 0) ? eBoolean.False : eBoolean.True;  // either this
            this._popup_headlights_exist = (a1 == a2) ? eBoolean.True : eBoolean.False; // or this
            a2 = *(uint *)(byteptr_t + 0xE4);
            if (a2 == 0)
            {
                goto LABEL_EXHAUST; // skip if statements if null
            }
            if (this._popup_headlights_exist == eBoolean.True)
            {
                a1 = Bin.Hash(MODEL + parts._LEFT_HEADLIGHT_GLASS + add_on._OFF);
                this._popup_heaglights_on = (a1 == a2) ? eBoolean.False : eBoolean.True;
            }
            else
            {
                this._popup_heaglights_on = eBoolean.False;
            }

LABEL_EXHAUST:
            // Try exhaust match
            a2 = *(uint *)(byteptr_t + 0x11C);
            if (a2 == 0)
            {
                this._exhaust_style = -1;
                goto LABEL_SPOILER;                      // skip the rest of statements
            }
            a1 = Bin.Hash(MODEL + parts._KIT00_EXHAUST); // stock exhaust
            if (a1 == a2)
            {
                this._exhaust_style = 0;
            }
            else
            {
                for (sbyte x1 = 0; x1 < 18; ++x1) // 17 exhaust styles
                {
                    a1 = Bin.Hash(add_on.EXHAUST + add_on._STYLE + x1.ToString("00") + add_on._LEVEL1);
                    if (a1 == a2)
                    {
                        this._exhaust_style = x1;
                        goto LABEL_SPOILER;
                    }
                    else
                    {
                        a1 = Bin.Hash(add_on.EXHAUST + add_on._STYLE + x1.ToString("00") + add_on._CENTER + add_on._LEVEL1);
                        if (a1 == a2)
                        {
                            this._exhaust_style     = x1;
                            this._is_center_exhaust = eBoolean.True;
                            goto LABEL_SPOILER;
                        }
                    }
                }
            } // this._exhaust_size (size of exhaust) is the autosculpt value later on

LABEL_SPOILER:
            // Try match spoiler
            // (MODEL)_SPOILER[SPOILER_STYLE(01 - 29)(TYPE)(_CF)]
            a2 = *(uint *)(byteptr_t + 0x120);
            if (a2 == 0)
            {
                this._spoiler_style = 0;
                this._spoiler_type  = eSTypes.NULL; // means spoiler is nulled
                goto LABEL_FRONT_BUMPER;
            }
            a1 = Bin.Hash(MODEL + parts._SPOILER);
            if (a1 == a2)
            {   // stock spoiler
                this._spoiler_style = 0;
                this._spoiler_type  = eSTypes.STOCK;
            }
            else
            {
                for (byte x1 = 0; x1 < 4; ++x1)      // all 4 spoiler types
                {
                    for (byte x2 = 1; x2 < 30; ++x2) // all 29 spoiler styles
                    {
                        v3 = add_on.SPOILER + add_on._STYLE + x2.ToString("00") + add_on._CSTYPE[x1];
                        v4 = add_on.AS_SPOILER + add_on._STYLE + x2.ToString("00") + add_on._CSTYPE[x1];
                        a3 = Bin.Hash(v3);
                        a4 = Bin.Hash(v4);
                        if (a3 == a2)
                        {
                            this._spoiler_style = x2;
                            v1 = add_on._CSTYPE[x1];
                            goto LABEL_FRONT_BUMPER; // break the whole loop
                        }
                        else if (a4 == a2)
                        {
                            this._spoiler_style = x2;
                            v1 = add_on._CSTYPE[x1];
                            this._is_autosculpt_spoiler = eBoolean.True;
                            goto LABEL_FRONT_BUMPER; // break the whole loop
                        }
                        else // try carbonfibre
                        {
                            a3 = Bin.Hash(v3 + add_on._CF);
                            a4 = Bin.Hash(v4 + add_on._CF);
                            if (a3 == a2)
                            {
                                this._spoiler_style = x2;
                                v1 = add_on._CSTYPE[x1];
                                this._is_carbonfibre_spoiler = eBoolean.True;
                                goto LABEL_FRONT_BUMPER; // break the whole loop
                            }
                            else if (a4 == a2)
                            {
                                this._spoiler_style = x2;
                                v1 = add_on._CSTYPE[x1];
                                this._is_autosculpt_spoiler  = eBoolean.True;
                                this._is_carbonfibre_spoiler = eBoolean.True;
                                goto LABEL_FRONT_BUMPER; // break the whole loop
                            }
                        }
                    }
                }
            }

            // escape from a really big spoiler loop
LABEL_FRONT_BUMPER:
            // fix spoiler settings first
            if (v1 == "")
            {
                this._spoiler_type = eSTypes.BASE; // use BASE to make it clearer
            }
            else
            {
                System.Enum.TryParse(v1, out this._spoiler_type);
            }

            // try to match _FRONT_BUMPER
            a2 = *(uint *)(byteptr_t + 0x180);
            if (a2 == 0)
            {
                this._autosculpt_frontbumper = -1;
                goto LABEL_REAR_BUMPER;
            }
            for (a3 = 0; a3 < 10; ++a3)
            {
                a1 = Bin.Hash(MODEL + add_on._K10 + a3.ToString("00") + parts._FRONT_BUMPER);
                if (a1 == a2)
                {
                    this._autosculpt_frontbumper = (sbyte)a3;
                    goto LABEL_REAR_BUMPER;
                }
            }

LABEL_REAR_BUMPER:
            // Try to match _REAR_BUMPER
            a2 = *(uint *)(byteptr_t + 0x188);
            if (a2 == 0)
            {
                this._autosculpt_rearbumper = -1;
                goto LABEL_ROOF;
            }
            for (a3 = 0; a3 < 10; ++a3) // 10 rear bumper styles
            {
                a1 = Bin.Hash(MODEL + add_on._K10 + a3.ToString("00") + parts._REAR_BUMPER);
                if (a1 == a2)
                {
                    this._autosculpt_rearbumper = (sbyte)a3;
                    goto LABEL_ROOF;
                }
            }

LABEL_ROOF:
            // Try to match _ROOF
            a2 = *(uint *)(byteptr_t + 0x190);
            if (a2 == 0 || Bin.Hash(MODEL + parts._ROOF) == a2)
            {
                this._choptop_is_on = eBoolean.False; // means no roof at all
            }
            else
            {
                a1 = Bin.Hash(MODEL + parts._ROOF + "_CHOP_TOP");
                if (a1 == a2)
                {
                    this._choptop_is_on = eBoolean.True;
                }
            }

            // Try to match ROOF_STYLE
            a2 = *(uint *)(byteptr_t + 0x194);
            a1 = Bin.Hash(parts.ROOF_STYLE + add_on._0 + add_on._0);
            if (a2 == 0 || a1 == a2)
            {
                this._roofscoop_style = 0;
                goto LABEL_HOOD; // skip the rest of the statements
            }
            else
            {
                for (byte x1 = 1; x1 < 19; ++x1) // all 18 roof scoop styles
                {
                    var x1pad = x1.ToString("00");
                    v1 = parts.ROOF_STYLE + x1pad;
                    v3 = parts.ROOF_STYLE + x1pad + add_on._AUTOSCULPT;
                    v4 = parts.ROOF_STYLE + x1pad + add_on._DUAL;
                    a1 = Bin.Hash(v1);
                    a3 = Bin.Hash(v3);
                    a4 = Bin.Hash(v4);
                    if (a1 == a2)
                    {
                        this._roofscoop_style = x1;
                        goto LABEL_HOOD;
                    }
                    else if (a3 == a2)
                    {
                        this._roofscoop_style         = x1;
                        this._is_autosculpt_roofscoop = eBoolean.True;
                        goto LABEL_HOOD;
                    }
                    else if (a4 == a2)
                    {
                        this._roofscoop_style   = x1;
                        this._is_dual_roofscoop = eBoolean.True;
                        goto LABEL_HOOD;
                    }
                    else
                    {
                        a1 = Bin.Hash(v1 + add_on._CF);
                        a3 = Bin.Hash(v3 + add_on._CF);
                        a4 = Bin.Hash(v4 + add_on._CF);
                        if (a1 == a2)
                        {
                            this._roofscoop_style          = x1;
                            this._is_carbonfibre_roofscoop = eBoolean.True;
                            goto LABEL_HOOD;
                        }
                        else if (a3 == a2)
                        {
                            this._roofscoop_style          = x1;
                            this._is_autosculpt_roofscoop  = eBoolean.True;
                            this._is_carbonfibre_roofscoop = eBoolean.True;
                            goto LABEL_HOOD;
                        }
                        else if (a4 == a2)
                        {
                            this._roofscoop_style          = x1;
                            this._is_dual_roofscoop        = eBoolean.True;
                            this._is_carbonfibre_roofscoop = eBoolean.True;
                            goto LABEL_HOOD;
                        }
                    }
                }
            }

            // escape from a really big roofscoop loop
LABEL_HOOD:
            // Try match _HOOD
            a2 = *(uint *)(byteptr_t + 0x198);
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._HOOD);
            if (a2 == 0 || a1 == a2)
            {
                this._hood_style = 0; // means no hood
                goto LABEL_SKIRT;
            }
            else
            {
                for (byte x1 = 1; x1 < 9; ++x1) // 8 styles max
                {
                    v3 = MODEL + add_on._STYLE + add_on._0 + x1.ToString() + parts._HOOD;
                    v4 = MODEL + add_on._STYLE + add_on._0 + x1.ToString() + parts._HOOD + add_on._AS;
                    a3 = Bin.Hash(v3);
                    a4 = Bin.Hash(v4);
                    if (a3 == a2)
                    {
                        this._hood_style = x1;
                        goto LABEL_SKIRT;
                    }
                    else if (a4 == a2)
                    {
                        this._hood_style         = x1;
                        this._is_autosculpt_hood = eBoolean.True;
                        goto LABEL_SKIRT;
                    }
                    else
                    {
                        a3 = Bin.Hash(v3 + add_on._CF);
                        a4 = Bin.Hash(v4 + add_on._CF);
                        if (a3 == a2)
                        {
                            this._hood_style          = x1;
                            this._is_carbonfibre_hood = eBoolean.True;
                            goto LABEL_SKIRT;
                        }
                        else if (a4 == a2)
                        {
                            this._hood_style          = x1;
                            this._is_autosculpt_hood  = eBoolean.True;
                            this._is_carbonfibre_hood = eBoolean.True;
                            goto LABEL_SKIRT;
                        }
                    }
                }
            }

            // escape from a really big hood loop
LABEL_SKIRT:
            // Try to match _SKIRT
            a2 = *(uint *)(byteptr_t + 0x19C);
            if (a2 == 0)
            {
                this._autosculpt_skirt = -1;
                goto LABEL_RIM;
            }
            a1 = Bin.Hash(MODEL + add_on._KIT + add_on._0 + parts._SKIRT + "_CAPPED");
            if (a1 == a2)
            {
                this._autosculpt_skirt = -2;
                goto LABEL_RIM;
            }
            for (a3 = 0; a3 < 15; ++a3) // basically 14 styles max
            {
                a1 = Bin.Hash(MODEL + add_on._K10 + a3.ToString("00") + parts._SKIRT);
                if (a1 == a2)
                {
                    this._autosculpt_skirt = (sbyte)a3;
                    goto LABEL_RIM;
                }
            }

LABEL_RIM:
            a2 = *(uint *)(byteptr_t + 0x1B0);
            a1 = Bin.Hash(MODEL + parts._WHEEL);
            if (a2 == 0)
            {
                this._rim_brand = BaseArguments.NULL;
                goto LABEL_PRECOMPVINYL;
            }
            else if (a1 == a2)
            {
                this._rim_brand = BaseArguments.STOCK;
                goto LABEL_PRECOMPVINYL;
            }
            else
            {
                for (byte x1 = 1; x1 < 11; ++x1) // try autosculpt wheels
                {
                    a1 = Bin.Hash(Map.RimBrands[0] + add_on._STYLE + x1.ToString("00") + "_17" + add_on._25);
                    if (a1 == a2)
                    {
                        this._rim_brand = Map.RimBrands[0];
                        this._rim_style = x1;
                        this._rim_size  = 17;
                        goto LABEL_PRECOMPVINYL;
                    }
                }
                for (byte x1 = 1; x1 < Map.RimBrands.Count; ++x1) // else try match aftermarket wheels
                {
                    for (byte x2 = 1; x2 < 7; ++x2)               // 3 loops: max manufacturers, 6 styles, 5 sizes
                    {
                        for (byte x3 = 17; x3 < 22; ++x3)
                        {
                            a1 = Bin.Hash(Map.RimBrands[x1] + add_on._STYLE + add_on._0 + x2.ToString() + "_" + x3.ToString() + add_on._25);
                            if (a1 == a2)
                            {
                                this._rim_brand = Map.RimBrands[x1];
                                this._rim_style = x2;
                                this._rim_size  = x3;
                                goto LABEL_PRECOMPVINYL;
                            }
                        }
                    }
                }
            }

LABEL_PRECOMPVINYL:
            a2 = *(uint *)(byteptr_t + 0x1D4);
            this._specific_vinyl = Map.Lookup(a2, true) ?? $"{hex}{a2:X8}";
            a2 = *(uint *)(byteptr_t + 0x1D8);
            this._generic_vinyl = Map.Lookup(a2, true) ?? $"{hex}{a2:X8}";

            // _WINDOW_TINT
            a2 = *(uint *)(byteptr_t + 0x1F8);
            a1 = Bin.Hash(parts.WINDOW_TINT_STOCK);
            if (a2 == 0 || a1 == a2)
            {
                this._window_tint_type = BaseArguments.STOCK;
            }
            else
            {
                v2 = Map.Lookup(a2, false);
                this._window_tint_type = Map.WindowTintMap.Contains(v2) ? v2 : BaseArguments.STOCK;
            }

            // COLOR TYPE
            a2 = *(uint *)(byteptr_t + 0x20C);
            if (Enum.IsDefined(typeof(eCarbonPaint), a2))
            {
                this._paint_type = (eCarbonPaint)a2;
            }
            else
            {
                this._paint_type = eCarbonPaint.GLOSS;
            }

            // Paint Swatch
            this._paint_swatch = Resolve.GetSwatchIndex(Map.Lookup(*(uint *)(byteptr_t + 0x210), false));

            // Saturation and Brightness
            this._saturation = *(float *)(byteptr_t + 0x214);
            this._brightness = *(float *)(byteptr_t + 0x218);

            // Front Bumper Autosculpt
            this.FRONTBUMPER.AutosculptZone1 = *(byteptr_t + 0x22C);
            this.FRONTBUMPER.AutosculptZone2 = *(byteptr_t + 0x22D);
            this.FRONTBUMPER.AutosculptZone3 = *(byteptr_t + 0x22E);
            this.FRONTBUMPER.AutosculptZone4 = *(byteptr_t + 0x22F);
            this.FRONTBUMPER.AutosculptZone5 = *(byteptr_t + 0x230);
            this.FRONTBUMPER.AutosculptZone6 = *(byteptr_t + 0x231);
            this.FRONTBUMPER.AutosculptZone7 = *(byteptr_t + 0x232);
            this.FRONTBUMPER.AutosculptZone8 = *(byteptr_t + 0x233);
            this.FRONTBUMPER.AutosculptZone9 = *(byteptr_t + 0x234);

            // Rear Bumper Autosculpt
            this.REARBUMPER.AutosculptZone1 = *(byteptr_t + 0x237);
            this.REARBUMPER.AutosculptZone2 = *(byteptr_t + 0x238);
            this.REARBUMPER.AutosculptZone3 = *(byteptr_t + 0x239);
            this.REARBUMPER.AutosculptZone4 = *(byteptr_t + 0x23A);
            this.REARBUMPER.AutosculptZone5 = *(byteptr_t + 0x23B);
            this.REARBUMPER.AutosculptZone6 = *(byteptr_t + 0x23C);
            this.REARBUMPER.AutosculptZone7 = *(byteptr_t + 0x23D);
            this.REARBUMPER.AutosculptZone8 = *(byteptr_t + 0x23E);
            this.REARBUMPER.AutosculptZone9 = *(byteptr_t + 0x23F);

            // Skirt Autosculpt
            this.SKIRT.AutosculptZone1 = *(byteptr_t + 0x242);
            this.SKIRT.AutosculptZone2 = *(byteptr_t + 0x243);
            this.SKIRT.AutosculptZone3 = *(byteptr_t + 0x244);
            this.SKIRT.AutosculptZone4 = *(byteptr_t + 0x245);
            this.SKIRT.AutosculptZone5 = *(byteptr_t + 0x246);
            this.SKIRT.AutosculptZone6 = *(byteptr_t + 0x247);
            this.SKIRT.AutosculptZone7 = *(byteptr_t + 0x248);
            this.SKIRT.AutosculptZone8 = *(byteptr_t + 0x249);
            this.SKIRT.AutosculptZone9 = *(byteptr_t + 0x24A);

            // Wheels Autosculpt
            this.WHEELS.AutosculptZone1 = *(byteptr_t + 0x24D);
            this.WHEELS.AutosculptZone2 = *(byteptr_t + 0x24E);
            this.WHEELS.AutosculptZone3 = *(byteptr_t + 0x24F);
            this.WHEELS.AutosculptZone4 = *(byteptr_t + 0x250);
            this.WHEELS.AutosculptZone5 = *(byteptr_t + 0x251);
            this.WHEELS.AutosculptZone6 = *(byteptr_t + 0x252);
            this.WHEELS.AutosculptZone7 = *(byteptr_t + 0x253);
            this.WHEELS.AutosculptZone8 = *(byteptr_t + 0x254);
            this.WHEELS.AutosculptZone9 = *(byteptr_t + 0x255);

            // Hood Bumper Autosculpt
            this.HOOD.AutosculptZone1 = *(byteptr_t + 0x258);
            this.HOOD.AutosculptZone2 = *(byteptr_t + 0x259);
            this.HOOD.AutosculptZone3 = *(byteptr_t + 0x25A);
            this.HOOD.AutosculptZone4 = *(byteptr_t + 0x25B);
            this.HOOD.AutosculptZone5 = *(byteptr_t + 0x25C);
            this.HOOD.AutosculptZone6 = *(byteptr_t + 0x25D);
            this.HOOD.AutosculptZone7 = *(byteptr_t + 0x25E);
            this.HOOD.AutosculptZone8 = *(byteptr_t + 0x25F);
            this.HOOD.AutosculptZone9 = *(byteptr_t + 0x260);

            // Spoiler Autosculpt
            this.SPOILER.AutosculptZone1 = *(byteptr_t + 0x263);
            this.SPOILER.AutosculptZone2 = *(byteptr_t + 0x264);
            this.SPOILER.AutosculptZone3 = *(byteptr_t + 0x265);
            this.SPOILER.AutosculptZone4 = *(byteptr_t + 0x266);
            this.SPOILER.AutosculptZone5 = *(byteptr_t + 0x267);
            this.SPOILER.AutosculptZone6 = *(byteptr_t + 0x268);
            this.SPOILER.AutosculptZone7 = *(byteptr_t + 0x269);
            this.SPOILER.AutosculptZone8 = *(byteptr_t + 0x26A);
            this.SPOILER.AutosculptZone9 = *(byteptr_t + 0x26B);

            // RoofScoop Autosculpt
            this.ROOFSCOOP.AutosculptZone1 = *(byteptr_t + 0x26E);
            this.ROOFSCOOP.AutosculptZone2 = *(byteptr_t + 0x26F);
            this.ROOFSCOOP.AutosculptZone3 = *(byteptr_t + 0x270);
            this.ROOFSCOOP.AutosculptZone4 = *(byteptr_t + 0x271);
            this.ROOFSCOOP.AutosculptZone5 = *(byteptr_t + 0x272);
            this.ROOFSCOOP.AutosculptZone6 = *(byteptr_t + 0x273);
            this.ROOFSCOOP.AutosculptZone7 = *(byteptr_t + 0x274);
            this.ROOFSCOOP.AutosculptZone8 = *(byteptr_t + 0x275);
            this.ROOFSCOOP.AutosculptZone9 = *(byteptr_t + 0x276);

            // Chop top and Exhaust Autosculpt
            this.ChopTopSize = *(byteptr_t + 0x279);
            this.ExhaustSize = *(byteptr_t + 0x284);

            // 20 vinyls
            this.VINYL01.Read(byteptr_t + 0x290 + 0x2C * 0);
            this.VINYL02.Read(byteptr_t + 0x290 + 0x2C * 1);
            this.VINYL03.Read(byteptr_t + 0x290 + 0x2C * 2);
            this.VINYL04.Read(byteptr_t + 0x290 + 0x2C * 3);
            this.VINYL05.Read(byteptr_t + 0x290 + 0x2C * 4);
            this.VINYL06.Read(byteptr_t + 0x290 + 0x2C * 5);
            this.VINYL07.Read(byteptr_t + 0x290 + 0x2C * 6);
            this.VINYL08.Read(byteptr_t + 0x290 + 0x2C * 7);
            this.VINYL09.Read(byteptr_t + 0x290 + 0x2C * 8);
            this.VINYL10.Read(byteptr_t + 0x290 + 0x2C * 9);
            this.VINYL11.Read(byteptr_t + 0x290 + 0x2C * 10);
            this.VINYL12.Read(byteptr_t + 0x290 + 0x2C * 11);
            this.VINYL13.Read(byteptr_t + 0x290 + 0x2C * 12);
            this.VINYL14.Read(byteptr_t + 0x290 + 0x2C * 13);
            this.VINYL15.Read(byteptr_t + 0x290 + 0x2C * 14);
            this.VINYL16.Read(byteptr_t + 0x290 + 0x2C * 15);
            this.VINYL17.Read(byteptr_t + 0x290 + 0x2C * 16);
            this.VINYL18.Read(byteptr_t + 0x290 + 0x2C * 17);
            this.VINYL19.Read(byteptr_t + 0x290 + 0x2C * 18);
            this.VINYL20.Read(byteptr_t + 0x290 + 0x2C * 19);
        }
Beispiel #6
0
        /// <summary>
        /// Assembles preset ride into a byte array.
        /// </summary>
        /// <returns>Byte array of the preset ride.</returns>
        public override unsafe byte[] Assemble()
        {
            var result = new byte[this.data.Length];

            Buffer.BlockCopy(this.data, 0, result, 0, this.data.Length);
            fixed(byte *byteptr_t = &result[0])
            {
                var parts  = new Concatenator();
                var add_on = new Add_On();

                // Frontend and Pvehicle
                this._Frontend_Hash = Vlt.SmartHash(this.Frontend);
                this._Pvehicle_Hash = Vlt.SmartHash(this.Pvehicle);

                // _BASE
                parts._BASE = MODEL + parts._BASE;

                // _BASE_KIT
                if (this._aftermarket_bodykit == -1)
                {
                    parts._BASE_KIT = MODEL + parts._BASE_KIT;
                }
                else if (this._aftermarket_bodykit == 0)
                {
                    parts._BASE_KIT = MODEL + parts._BASE_KIT + add_on._KIT + add_on._0;
                }
                else
                {
                    parts._BASE_KIT = MODEL + parts._BASE_KIT + add_on._KITW + _aftermarket_bodykit.ToString();
                }

                // Bunch of stuff
                parts._FRONT_BRAKE           = MODEL + parts._FRONT_BRAKE;
                parts._FRONT_ROTOR           = MODEL + parts._FRONT_ROTOR;
                parts._FRONT_LEFT_WINDOW     = MODEL + parts._FRONT_LEFT_WINDOW;
                parts._FRONT_RIGHT_WINDOW    = MODEL + parts._FRONT_RIGHT_WINDOW;
                parts._FRONT_WINDOW          = MODEL + parts._FRONT_WINDOW;
                parts._INTERIOR              = MODEL + parts._INTERIOR;
                parts._LEFT_BRAKELIGHT       = MODEL + parts._LEFT_BRAKELIGHT;
                parts._LEFT_BRAKELIGHT_GLASS = MODEL + parts._LEFT_BRAKELIGHT_GLASS;

                // _LEFT_HEADLIGHT
                if (this._popup_headlights_exist == eBoolean.False)
                {
                    parts._LEFT_HEADLIGHT = MODEL + parts._LEFT_HEADLIGHT;
                }
                else
                {
                    parts._LEFT_HEADLIGHT = (this._popup_heaglights_on == eBoolean.True)
                        ? MODEL + parts._LEFT_HEADLIGHT + add_on._ON
                        : MODEL + parts._LEFT_HEADLIGHT + add_on._OFF;
                }

                // _LEFT_HEADLIGHT_GLASS
                parts._LEFT_HEADLIGHT_GLASS = MODEL + parts._LEFT_HEADLIGHT_GLASS;

                // Bunch of stuff
                parts._LEFT_SIDE_MIRROR       = MODEL + parts._LEFT_SIDE_MIRROR;
                parts._REAR_BRAKE             = MODEL + parts._REAR_BRAKE;
                parts._REAR_ROTOR             = MODEL + parts._REAR_ROTOR;
                parts._REAR_LEFT_WINDOW       = MODEL + parts._REAR_LEFT_WINDOW;
                parts._REAR_RIGHT_WINDOW      = MODEL + parts._REAR_RIGHT_WINDOW;
                parts._REAR_WINDOW            = MODEL + parts._REAR_WINDOW;
                parts._RIGHT_BRAKELIGHT       = MODEL + parts._RIGHT_BRAKELIGHT;
                parts._RIGHT_BRAKELIGHT_GLASS = MODEL + parts._RIGHT_BRAKELIGHT_GLASS;

                // _RIGHT_HEADLIGHT
                if (this._popup_headlights_exist == eBoolean.False)
                {
                    parts._RIGHT_HEADLIGHT = MODEL + parts._RIGHT_HEADLIGHT;
                }
                else
                {
                    parts._RIGHT_HEADLIGHT = (this._popup_heaglights_on == eBoolean.True)
                        ? MODEL + parts._RIGHT_HEADLIGHT + add_on._ON
                        : MODEL + parts._RIGHT_HEADLIGHT + add_on._OFF;
                }

                // _RIGHT_HEADLIGHT_GLASS
                parts._RIGHT_HEADLIGHT_GLASS = MODEL + parts._RIGHT_HEADLIGHT_GLASS;

                // Bunch of stuff
                parts._RIGHT_SIDE_MIRROR = MODEL + parts._RIGHT_SIDE_MIRROR;
                parts._DRIVER            = MODEL + parts._DRIVER;
                parts._STEERINGWHEEL     = MODEL + parts._STEERINGWHEEL;

                // _KIT00_EXHAUST
                if (this._exhaust_style == -1)
                {
                    parts._KIT00_EXHAUST = string.Empty;
                }
                else if (this._exhaust_style == 0 || this._aftermarket_bodykit >= 1)
                {
                    parts._KIT00_EXHAUST = MODEL + parts._KIT00_EXHAUST;
                }
                else
                {
                    parts._KIT00_EXHAUST = add_on.EXHAUST + add_on._STYLE + this._exhaust_style.ToString("00");
                    if (this._is_center_exhaust == eBoolean.True)
                    {
                        parts._KIT00_EXHAUST += add_on._CENTER;
                    }
                    parts._KIT00_EXHAUST += add_on._LEVEL1;
                }

                // _SPOILER
                if (this._spoiler_type == eSTypes.NULL)
                {
                    parts._SPOILER = "";
                }
                else if (this._spoiler_type == eSTypes.STOCK || this._spoiler_style == 0)
                {
                    parts._SPOILER = MODEL + parts._SPOILER;
                }
                else
                {
                    parts._SPOILER = (this._is_autosculpt_spoiler == eBoolean.True)
                        ? add_on.AS_SPOILER
                        : add_on.SPOILER;
                    parts._SPOILER += add_on._STYLE + this._spoiler_style.ToString("00");
                    if (this._spoiler_type != eSTypes.BASE)
                    {
                        parts._SPOILER += this._spoiler_type.ToString();
                    }
                    if (this._is_carbonfibre_spoiler == eBoolean.True)
                    {
                        parts._SPOILER += add_on._CF;
                    }
                }

                // _UNIVERSAL_SPOILER_BASE
                parts._UNIVERSAL_SPOILER_BASE = MODEL + parts._UNIVERSAL_SPOILER_BASE;

                // _DAMAGE0_FRONT and _DAMAGE0_REAR
                if (this._aftermarket_bodykit <= 0)
                {
                    goto LABEL_AUTOSCULPT_DAMAGE;
                }
                else
                {
                    goto LABEL_AFTERMARKET_DAMAGE;
                }

LABEL_AUTOSCULPT_DAMAGE:
                // _FRONT_DAMAGE0 + FRONT_BUMPER
                if (this._autosculpt_frontbumper == -1)
                {
                    parts._DAMAGE0_FRONT            = string.Empty;
                    parts._DAMAGE0_FRONTLEFT        = string.Empty;
                    parts._DAMAGE0_FRONTRIGHT       = string.Empty;
                    parts._FRONT_BUMPER             = string.Empty;
                    parts._FRONT_BUMPER_BADGING_SET = string.Empty;
                }
                else
                {
                    string autofpad = this._autosculpt_frontbumper.ToString("00");
                    parts._DAMAGE0_FRONT            = MODEL + add_on._K10 + autofpad + parts._DAMAGE0_FRONT;
                    parts._DAMAGE0_FRONTLEFT        = MODEL + add_on._K10 + autofpad + parts._DAMAGE0_FRONTLEFT;
                    parts._DAMAGE0_FRONTRIGHT       = MODEL + add_on._K10 + autofpad + parts._DAMAGE0_FRONTRIGHT;
                    parts._FRONT_BUMPER             = MODEL + add_on._K10 + autofpad + parts._FRONT_BUMPER;
                    parts._FRONT_BUMPER_BADGING_SET = MODEL + add_on._KIT + (this._autosculpt_frontbumper % 9).ToString() + parts._FRONT_BUMPER_BADGING_SET;
                }

                // REAR_DAMAGE0 + REAR_BUMPER
                if (this._autosculpt_rearbumper == -1)
                {
                    parts._DAMAGE0_REAR            = string.Empty;
                    parts._DAMAGE0_REARLEFT        = string.Empty;
                    parts._DAMAGE0_REARRIGHT       = string.Empty;
                    parts._REAR_BUMPER             = string.Empty;
                    parts._REAR_BUMPER_BADGING_SET = string.Empty;
                }
                else
                {
                    var autorpad = this._autosculpt_rearbumper.ToString("00");
                    parts._DAMAGE0_REAR            = MODEL + add_on._K10 + autorpad + parts._DAMAGE0_REAR;
                    parts._DAMAGE0_REARLEFT        = MODEL + add_on._K10 + autorpad + parts._DAMAGE0_REARLEFT;
                    parts._DAMAGE0_REARRIGHT       = MODEL + add_on._K10 + autorpad + parts._DAMAGE0_REARRIGHT;
                    parts._REAR_BUMPER             = MODEL + add_on._K10 + autorpad + parts._REAR_BUMPER;
                    parts._REAR_BUMPER_BADGING_SET = MODEL + add_on._KIT + (this._autosculpt_rearbumper % 9).ToString() + parts._REAR_BUMPER_BADGING_SET;
                }
                goto LABEL_NEXT;

LABEL_AFTERMARKET_DAMAGE:
                // FRONT_DAMAGE0 + REAR_DAMAGE0
                parts._DAMAGE0_FRONT            = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_FRONT;
                parts._DAMAGE0_FRONTLEFT        = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_FRONTLEFT;
                parts._DAMAGE0_FRONTRIGHT       = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_FRONTRIGHT;
                parts._DAMAGE0_REAR             = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_REAR;
                parts._DAMAGE0_REARLEFT         = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_REARLEFT;
                parts._DAMAGE0_REARRIGHT        = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString() + parts._DAMAGE0_REARRIGHT;
                parts._FRONT_BUMPER             = "";
                parts._FRONT_BUMPER_BADGING_SET = "";
                parts._REAR_BUMPER             = "";
                parts._REAR_BUMPER_BADGING_SET = "";
                goto LABEL_NEXT;

LABEL_NEXT:
                // _ROOF (_CHOP_TOP)
                parts._ROOF = (this._choptop_is_on == eBoolean.True)
                    ? MODEL + parts._ROOF + "_CHOP_TOP"
                    : MODEL + parts._ROOF;

                // ROOF_STYLE
                if (this._roofscoop_style == 0)
                {
                    parts.ROOF_STYLE += add_on._0 + add_on._0;
                }
                else
                {
                    parts.ROOF_STYLE += this._roofscoop_style.ToString("00");
                    if (this._is_dual_roofscoop == eBoolean.True)
                    {
                        parts.ROOF_STYLE += add_on._DUAL;
                    }
                    if ((this._is_autosculpt_roofscoop == eBoolean.True) && (this._is_dual_roofscoop == eBoolean.False))
                    {
                        parts.ROOF_STYLE += add_on._AUTOSCULPT;
                    }
                    if (this._is_carbonfibre_roofscoop == eBoolean.True)
                    {
                        parts.ROOF_STYLE += add_on._CF;
                    }
                }

                // _HOOD
                if (this._hood_style == 0)
                {
                    parts._HOOD = MODEL + add_on._KIT + add_on._0 + parts._HOOD;
                }
                else
                {
                    parts._HOOD = MODEL + add_on._STYLE + add_on._0 + this._hood_style.ToString() + parts._HOOD;
                    if (this._is_autosculpt_hood == eBoolean.True)
                    {
                        parts._HOOD += add_on._AS;
                    }
                    if (this._is_carbonfibre_hood == eBoolean.True)
                    {
                        parts._HOOD += add_on._CF;
                    }
                }

                // _SKIRT
                if (this._autosculpt_skirt == -1)
                {
                    parts._SKIRT = "";
                }
                else if (this._autosculpt_skirt == -2)
                {
                    parts._SKIRT = MODEL + add_on._KIT + add_on._0 + parts._SKIRT + "_CAPPED";
                }
                else
                {
                    parts._SKIRT = MODEL + add_on._K10 + this._autosculpt_skirt.ToString("00");
                }

                // _DOOR_LEFT and _DOOR_RIGHT
                if (this._aftermarket_bodykit == 0)
                {
                    parts._DOOR_LEFT  = MODEL + parts._DOOR_LEFT;
                    parts._DOOR_RIGHT = MODEL + parts._DOOR_RIGHT;
                }
                else
                {
                    parts._DOOR_LEFT  = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString() + parts._DOOR_LEFT;
                    parts._DOOR_RIGHT = MODEL + add_on._KITW + this._aftermarket_bodykit.ToString() + parts._DOOR_RIGHT;
                }

                // _WHEEL
                switch (this._rim_brand)
                {
                case BaseArguments.NULL:
                case BaseArguments.STOCK:
                    parts._WHEEL = MODEL + parts._WHEEL;     // null, empty, NULL or STOCK
                    break;

                case "AUTOSCLPT":
                    parts._WHEEL = $"{this._rim_brand}{add_on._STYLE}{this._rim_style:00}_17{add_on._25}";
                    break;

                default:
                    parts._WHEEL = $"{this._rim_brand}{add_on._STYLE}{this._rim_style:00}_{this._rim_size}{add_on._25}";
                    break;
                }

                // _KIT00_DOORLINE
                parts._KIT00_DOORLINE = (this._aftermarket_bodykit <= 0)
                    ? MODEL + parts._KIT00_DOORLINE
                    : string.Empty;

                // WINDOW_TINT
                if (this._window_tint_type != BaseArguments.STOCK)
                {
                    parts.WINDOW_TINT_STOCK = this._window_tint_type;
                }

                // Carpaint
                parts.PAINT        = this._paint_type.ToString();
                parts.SWATCH_COLOR = Resolve.GetSwatchString(this._paint_swatch);

                // Hash all strings to keys
                var keys = this.StringToKey(parts);

                // If the preset already existed, it is better to internally modify its main values
                // rather than overwriting it, to avoid changing some other values; also, if the model
                // was not changed, it skips bunch of other conversions and hashing stages
                if (this.Exists && this.MODEL == this.OriginalModel)
                {
                    if (!this.Modified) // if exists and not modified, return original array
                        goto LABEL_FINAL;

                    // Write settings that could have been changed
                    fixed(uint *uintptr_t = &keys[0])
                    {
                        *(uint *)(byteptr_t + 0x60)  = *(uintptr_t + 0);  // _BASE
                        *(uint *)(byteptr_t + 0xBC)  = *(uintptr_t + 1);  // _BASE_KIT
                        *(uint *)(byteptr_t + 0xE0)  = *(uintptr_t + 10); // _LEFT_HEADLIGHT
                        *(uint *)(byteptr_t + 0xE4)  = *(uintptr_t + 11); // _LEFT_HEADLIGHT_GLASS
                        *(uint *)(byteptr_t + 0x108) = *(uintptr_t + 20); // _RIGHT_HEADLIGHT
                        *(uint *)(byteptr_t + 0x10C) = *(uintptr_t + 21); // _RIGHT_HEADLIGHT_GLASS
                        *(uint *)(byteptr_t + 0x11C) = *(uintptr_t + 25); // _EXHAUST
                        *(uint *)(byteptr_t + 0x120) = *(uintptr_t + 26); // _SPOILER
                        *(uint *)(byteptr_t + 0x128) = *(uintptr_t + 28); // _DAMAGE0_FRONT
                        *(uint *)(byteptr_t + 0x12C) = *(uintptr_t + 29); // _DAMAGE0_FRONTLEFT
                        *(uint *)(byteptr_t + 0x130) = *(uintptr_t + 30); // _DAMAGE0_FRONTRIGHT
                        *(uint *)(byteptr_t + 0x134) = *(uintptr_t + 31); // _DAMAGE0_REAR
                        *(uint *)(byteptr_t + 0x138) = *(uintptr_t + 32); // _DAMAGE0_REARLEFT
                        *(uint *)(byteptr_t + 0x13C) = *(uintptr_t + 33); // _DAMAGE0_REARRIGHT
                        *(uint *)(byteptr_t + 0x180) = *(uintptr_t + 34); // _FRONT_BUMPER
                        *(uint *)(byteptr_t + 0x184) = *(uintptr_t + 35); // _FRONT_BUMPER_BADGING_SET
                        *(uint *)(byteptr_t + 0x188) = *(uintptr_t + 36); // _REAR_BUMPER
                        *(uint *)(byteptr_t + 0x18C) = *(uintptr_t + 37); // _REAR_BUMPER_BADGING_SET
                        *(uint *)(byteptr_t + 0x190) = *(uintptr_t + 38); // _ROOF
                        *(uint *)(byteptr_t + 0x194) = *(uintptr_t + 39); // _ROOF_STYLE
                        *(uint *)(byteptr_t + 0x198) = *(uintptr_t + 40); // _HOOD
                        *(uint *)(byteptr_t + 0x19C) = *(uintptr_t + 41); // _SKIRT
                        *(uint *)(byteptr_t + 0x1A8) = *(uintptr_t + 42); // _DOOR_LEFT
                        *(uint *)(byteptr_t + 0x1AC) = *(uintptr_t + 43); // _DOOR_RIGHT
                        *(uint *)(byteptr_t + 0x1B0) = *(uintptr_t + 44); // _WHEEL
                        *(uint *)(byteptr_t + 0x1BC) = *(uintptr_t + 46); // _KIT00_DOORLINE
                        *(uint *)(byteptr_t + 0x1D4) = *(uintptr_t + 47); // SPECIFIC
                        *(uint *)(byteptr_t + 0x1D8) = *(uintptr_t + 48); // GENERIC
                        *(uint *)(byteptr_t + 0x1F8) = *(uintptr_t + 49); // WINDOW_TINT
                        *(uint *)(byteptr_t + 0x20C) = *(uintptr_t + 50); // PAINT_TYPE
                        *(uint *)(byteptr_t + 0x210) = *(uintptr_t + 51); // SWATCH_COLOR
                    }
                }

                // If the model was changed or if the preset car is new, either overwrite existing file completely
                // or create a new one for the new car
                else
                {
                    // Write ModelName
                    for (int a1 = 0; a1 < 0x20; ++a1)
                    {
                        *(byteptr_t + 8 + a1) = (byte)0;
                    }
                    for (int a1 = 0; a1 < this.MODEL.Length; ++a1)
                        *(byteptr_t + 8 + a1) = (byte)this.MODEL[a1];

                    // Write all keys
                    fixed(uint *uintptr_t = &keys[0])
                    {
                        *(uint *)(byteptr_t + 0x60) = *uintptr_t;

                        for (int a1 = 0; a1 < 33; ++a1)
                        {
                            *(uint *)(byteptr_t + 0xBC + a1 * 4) = *(uintptr_t + 1 + a1);
                        }

                        for (int a1 = 0; a1 < 8; ++a1)
                        {
                            *(uint *)(byteptr_t + 0x180 + a1 * 4) = *(uintptr_t + 34 + a1);
                        }

                        *(uint *)(byteptr_t + 0x1A8) = *(uintptr_t + 42);
                        *(uint *)(byteptr_t + 0x1AC) = *(uintptr_t + 43);
                        *(uint *)(byteptr_t + 0x1B0) = *(uintptr_t + 44);
                        *(uint *)(byteptr_t + 0x1B8) = *(uintptr_t + 45);
                        *(uint *)(byteptr_t + 0x1BC) = *(uintptr_t + 46);
                        *(uint *)(byteptr_t + 0x1D4) = *(uintptr_t + 47);
                        *(uint *)(byteptr_t + 0x1D8) = *(uintptr_t + 48);
                        *(uint *)(byteptr_t + 0x1F8) = *(uintptr_t + 49);
                        *(uint *)(byteptr_t + 0x20C) = *(uintptr_t + 50);
                        *(uint *)(byteptr_t + 0x210) = *(uintptr_t + 51);
                    }
                }

LABEL_FINAL:
                // Write CollectionName
                for (int a1 = 0; a1 < 0x20; ++a1)
                {
                    *(byteptr_t + 0x28 + a1) = (byte)0;
                }
                for (int a1 = 0; a1 < this.CollectionName.Length; ++a1)
                {
                    *(byteptr_t + 0x28 + a1) = (byte)this.CollectionName[a1];
                }

                // Write Fronend and Pvehicle
                *(uint *)(byteptr_t + 0x48) = this._Frontend_Hash;
                *(uint *)(byteptr_t + 0x50) = this._Pvehicle_Hash;

                // Write Colors
                *(int *)(byteptr_t + 0x208)   = 1;
                *(float *)(byteptr_t + 0x214) = this._saturation;
                *(float *)(byteptr_t + 0x218) = this._brightness;

                *(byteptr_t + 0x22C) = this.FRONTBUMPER.AutosculptZone1;
                *(byteptr_t + 0x22D) = this.FRONTBUMPER.AutosculptZone2;
                *(byteptr_t + 0x22E) = this.FRONTBUMPER.AutosculptZone3;
                *(byteptr_t + 0x22F) = this.FRONTBUMPER.AutosculptZone4;
                *(byteptr_t + 0x230) = this.FRONTBUMPER.AutosculptZone5;
                *(byteptr_t + 0x231) = this.FRONTBUMPER.AutosculptZone6;
                *(byteptr_t + 0x232) = this.FRONTBUMPER.AutosculptZone7;
                *(byteptr_t + 0x233) = this.FRONTBUMPER.AutosculptZone8;
                *(byteptr_t + 0x234) = this.FRONTBUMPER.AutosculptZone9;

                *(byteptr_t + 0x237) = this.REARBUMPER.AutosculptZone1;
                *(byteptr_t + 0x238) = this.REARBUMPER.AutosculptZone2;
                *(byteptr_t + 0x239) = this.REARBUMPER.AutosculptZone3;
                *(byteptr_t + 0x23A) = this.REARBUMPER.AutosculptZone4;
                *(byteptr_t + 0x23B) = this.REARBUMPER.AutosculptZone5;
                *(byteptr_t + 0x23C) = this.REARBUMPER.AutosculptZone6;
                *(byteptr_t + 0x23D) = this.REARBUMPER.AutosculptZone7;
                *(byteptr_t + 0x23E) = this.REARBUMPER.AutosculptZone8;
                *(byteptr_t + 0x23F) = this.REARBUMPER.AutosculptZone9;
                if (this._autosculpt_rearbumper >= 1 && this._autosculpt_rearbumper <= 10)
                {
                    *(byteptr_t + 0x237 + Zones.ExhPos[this._autosculpt_rearbumper]) = this._exhaust_size;
                }

                *(byteptr_t + 0x242) = this.SKIRT.AutosculptZone1;
                *(byteptr_t + 0x243) = this.SKIRT.AutosculptZone2;
                *(byteptr_t + 0x244) = this.SKIRT.AutosculptZone3;
                *(byteptr_t + 0x245) = this.SKIRT.AutosculptZone4;
                *(byteptr_t + 0x246) = this.SKIRT.AutosculptZone5;
                *(byteptr_t + 0x247) = this.SKIRT.AutosculptZone6;
                *(byteptr_t + 0x248) = this.SKIRT.AutosculptZone7;
                *(byteptr_t + 0x249) = this.SKIRT.AutosculptZone8;
                *(byteptr_t + 0x24A) = this.SKIRT.AutosculptZone9;

                *(byteptr_t + 0x24D) = this.WHEELS.AutosculptZone1;
                *(byteptr_t + 0x24E) = this.WHEELS.AutosculptZone2;
                *(byteptr_t + 0x24F) = this.WHEELS.AutosculptZone3;
                *(byteptr_t + 0x250) = this.WHEELS.AutosculptZone4;
                *(byteptr_t + 0x251) = this.WHEELS.AutosculptZone5;
                *(byteptr_t + 0x252) = this.WHEELS.AutosculptZone6;
                *(byteptr_t + 0x253) = this.WHEELS.AutosculptZone7;
                *(byteptr_t + 0x254) = this.WHEELS.AutosculptZone8;
                *(byteptr_t + 0x255) = this.WHEELS.AutosculptZone9;

                *(byteptr_t + 0x258) = this.HOOD.AutosculptZone1;
                *(byteptr_t + 0x259) = this.HOOD.AutosculptZone2;
                *(byteptr_t + 0x25A) = this.HOOD.AutosculptZone3;
                *(byteptr_t + 0x25B) = this.HOOD.AutosculptZone4;
                *(byteptr_t + 0x25C) = this.HOOD.AutosculptZone5;
                *(byteptr_t + 0x25D) = this.HOOD.AutosculptZone6;
                *(byteptr_t + 0x25E) = this.HOOD.AutosculptZone7;
                *(byteptr_t + 0x25F) = this.HOOD.AutosculptZone8;
                *(byteptr_t + 0x260) = this.HOOD.AutosculptZone9;

                *(byteptr_t + 0x263) = this.SPOILER.AutosculptZone1;
                *(byteptr_t + 0x264) = this.SPOILER.AutosculptZone2;
                *(byteptr_t + 0x265) = this.SPOILER.AutosculptZone3;
                *(byteptr_t + 0x266) = this.SPOILER.AutosculptZone4;
                *(byteptr_t + 0x267) = this.SPOILER.AutosculptZone5;
                *(byteptr_t + 0x268) = this.SPOILER.AutosculptZone6;
                *(byteptr_t + 0x269) = this.SPOILER.AutosculptZone7;
                *(byteptr_t + 0x26A) = this.SPOILER.AutosculptZone8;
                *(byteptr_t + 0x26B) = this.SPOILER.AutosculptZone9;

                *(byteptr_t + 0x26E) = this.ROOFSCOOP.AutosculptZone1;
                *(byteptr_t + 0x26F) = this.ROOFSCOOP.AutosculptZone2;
                *(byteptr_t + 0x270) = this.ROOFSCOOP.AutosculptZone3;
                *(byteptr_t + 0x271) = this.ROOFSCOOP.AutosculptZone4;
                *(byteptr_t + 0x272) = this.ROOFSCOOP.AutosculptZone5;
                *(byteptr_t + 0x273) = this.ROOFSCOOP.AutosculptZone6;
                *(byteptr_t + 0x274) = this.ROOFSCOOP.AutosculptZone7;
                *(byteptr_t + 0x275) = this.ROOFSCOOP.AutosculptZone8;
                *(byteptr_t + 0x276) = this.ROOFSCOOP.AutosculptZone9;

                *(byteptr_t + 0x279) = this._choptop_size;
                *(byteptr_t + 0x284) = this._exhaust_size;

                this.VINYL01.Write(byteptr_t + 0x290 + 0x2C * 0);
                this.VINYL02.Write(byteptr_t + 0x290 + 0x2C * 1);
                this.VINYL03.Write(byteptr_t + 0x290 + 0x2C * 2);
                this.VINYL04.Write(byteptr_t + 0x290 + 0x2C * 3);
                this.VINYL05.Write(byteptr_t + 0x290 + 0x2C * 4);
                this.VINYL06.Write(byteptr_t + 0x290 + 0x2C * 5);
                this.VINYL07.Write(byteptr_t + 0x290 + 0x2C * 6);
                this.VINYL08.Write(byteptr_t + 0x290 + 0x2C * 7);
                this.VINYL09.Write(byteptr_t + 0x290 + 0x2C * 8);
                this.VINYL10.Write(byteptr_t + 0x290 + 0x2C * 9);
                this.VINYL11.Write(byteptr_t + 0x290 + 0x2C * 10);
                this.VINYL12.Write(byteptr_t + 0x290 + 0x2C * 11);
                this.VINYL13.Write(byteptr_t + 0x290 + 0x2C * 12);
                this.VINYL14.Write(byteptr_t + 0x290 + 0x2C * 13);
                this.VINYL15.Write(byteptr_t + 0x290 + 0x2C * 14);
                this.VINYL16.Write(byteptr_t + 0x290 + 0x2C * 15);
                this.VINYL17.Write(byteptr_t + 0x290 + 0x2C * 16);
                this.VINYL18.Write(byteptr_t + 0x290 + 0x2C * 17);
                this.VINYL19.Write(byteptr_t + 0x290 + 0x2C * 18);
                this.VINYL20.Write(byteptr_t + 0x290 + 0x2C * 19);
            }

            return(result);
        }