public unsafe void Assemble(byte *byteptr_t, MemoryWriter mw) { mw.WriteNullTerminated(this._collection_name); mw.WriteNullTerminated(this._shop_filename); mw.WriteNullTerminated(this._shop_trigger); for (int a1 = 0; a1 < this._collection_name.Length; ++a1) { *(byteptr_t + a1) = (byte)this._collection_name[a1]; } if (this._intro_movie != BaseArguments.NULL) { mw.WriteNullTerminated(this.IntroMovie); for (int a1 = 0; a1 < this.IntroMovie.Length; ++a1) { *(byteptr_t + 0x20 + a1) = (byte)this.IntroMovie[a1]; } } *(uint *)(byteptr_t + 0x38) = this.BinKey; *(uint *)(byteptr_t + 0x3C) = Bin.SmartHash(this._shop_trigger); for (int a1 = 0; a1 < this._shop_filename.Length; ++a1) { *(byteptr_t + 0x40 + a1) = (byte)this._shop_filename[a1]; } *(byteptr_t + 0x50) = (byte)this.ShopType; *(byteptr_t + 0x51) = (this.InitiallyHidden == eBoolean.True) ? (byte)1 : (byte)0; *(uint *)(byteptr_t + 0x74) = Bin.SmartHash(this._event_to_complete); *(byteptr_t + 0x9C) = (byte)this.RequiresEventCompleted; *(byteptr_t + 0x9D) = this.BelongsToStage; }
public unsafe void Assemble(byte *byteptr_t, MemoryWriter mw) { ushort pointer = (ushort)mw.Position; mw.WriteNullTerminated(this._collection_name); *(ushort *)byteptr_t = pointer; pointer = (ushort)mw.Position; mw.WriteNullTerminated(this._world_trigger); *(ushort *)(byteptr_t + 0x02) = pointer; *(byteptr_t + 0x04) = this.BelongsToStage; *(byteptr_t + 0x06) = (byte)((byte)this.UseOutrunsAsReqRaces * 2); *(byteptr_t + 0x07) = this.RequiredRacesWon; *(uint *)(byteptr_t + 0x08) = Bin.SmartHash(this.ChallengeSMSLabel); *(uint *)(byteptr_t + 0x0C) = Bin.SmartHash(this.ChallengeParent); *(int *)(byteptr_t + 0x10) = this.TimeLimit; *(byteptr_t + 0x14) = (byte)this.WorldChallengeType; *(byteptr_t + 0x15) = this.UnlockablePart1_Index; *(byteptr_t + 0x16) = this.UnlockablePart2_Index; *(byteptr_t + 0x17) = this.UnlockablePart3_Index; }
public unsafe void Assemble(byte *byteptr_t, MemoryWriter mw) { ushort pointer = (ushort)mw.Position; mw.WriteNullTerminated(this._collection_name); *(ushort *)byteptr_t = pointer; *(short *)(byteptr_t + 2) = this.CashValuePerWin; *(byteptr_t + 4) = (byte)this.ReqSponsorRace1; *(byteptr_t + 5) = (byte)this.ReqSponsorRace2; *(byteptr_t + 6) = (byte)this.ReqSponsorRace3; *(uint *)(byteptr_t + 8) = this.BinKey; *(short *)(byteptr_t + 12) = this.SignCashBonus; *(short *)(byteptr_t + 14) = this.PotentialCashBonus; }
public unsafe void Assemble(byte *byteptr_t, MemoryWriter mw) { mw.WriteNullTerminated(this._collection_name); for (int a1 = 0; a1 < this._collection_name.Length; ++a1) { *(byteptr_t + a1) = (byte)this._collection_name[a1]; } *(uint *)(byteptr_t + 0x20) = this.BinKey; *(byteptr_t + 0x24) = (byte)this.TakePhotoMethod; *(byteptr_t + 0x25) = this.BelongsToStage; *(short *)(byteptr_t + 0x26) = this.CashValue; *(uint *)(byteptr_t + 0x28) = Bin.SmartHash(this.DescStringLabel); *(uint *)(byteptr_t + 0x2C) = Bin.SmartHash(this.DestinationPoint); *(byteptr_t + 0x34) = this.Unknown0x34; *(byteptr_t + 0x35) = this.Unknown0x35; *(uint *)(byteptr_t + 0x38) = Bin.SmartHash(this.DescAttrib); *(float *)(byteptr_t + 0x3C) = this.RequiredVisualRating; }
public unsafe void Assemble(byte *byteptr_t, MemoryWriter mw) { mw.WriteNullTerminated(this._collection_name); for (int a1 = 0; a1 < this._collection_name.Length; ++a1) { *(byteptr_t + a1) = (byte)this._collection_name[a1]; } if (this._ingame_brand_name != BaseArguments.NULL) { for (int a1 = 0; a1 < this._ingame_brand_name.Length; ++a1) { *(byteptr_t + 0x20 + a1) = (byte)this._ingame_brand_name[a1]; } } *(uint *)(byteptr_t + 0x40) = this.BinKey; }
public unsafe void Assemble(byte *byteptr_t, MemoryWriter mw) { ushort pointer = (ushort)mw.Position; mw.WriteNullTerminated(this._collection_name); *(ushort *)byteptr_t = pointer; *(byteptr_t + 0x02) = this.b0x02; *(byteptr_t + 0x03) = this.b0x03; *(byteptr_t + 0x04) = this.b0x04; *(byteptr_t + 0x05) = this.b0x05; *(byteptr_t + 0x06) = this.b0x06; *(byteptr_t + 0x07) = this.b0x07; *(byteptr_t + 0x08) = this.b0x08; *(byteptr_t + 0x09) = this.b0x09; *(byteptr_t + 0x0A) = this.b0x0A; *(byteptr_t + 0x0B) = this.b0x0B; *(int *)(byteptr_t + 0x0C) = this.CashValue; *(uint *)(byteptr_t + 0x10) = Bin.SmartHash(this.MessageSenderLabel); }
public unsafe void Assemble(byte *byteptr_t, MemoryWriter mw) { ushort pointer = 0; // for pointers pointer = (ushort)mw.Position; mw.WriteNullTerminated(this._collection_name); *(ushort *)byteptr_t = pointer; if (this._intro_movie != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this._intro_movie); *(ushort *)(byteptr_t + 0x02) = pointer; } if (this._outro_movie != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this._outro_movie); *(ushort *)(byteptr_t + 0x04) = pointer; } if (this._event_trigger != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this._event_trigger); *(ushort *)(byteptr_t + 0x06) = pointer; } *(uint *)(byteptr_t + 0x08) = this.BinKey; *(byteptr_t + 0x0C) = (byte)this._unlock_method; *(byteptr_t + 0x0D) = (byte)this._is_suv_race; *(byteptr_t + 0x0E) = this._padding0; *(byteptr_t + 0x0F) = (byte)this._event_behavior; if (this._unlock_method == eUnlockCondition.SPECIFIC_RACE_WON) { *(uint *)(byteptr_t + 0x10) = Bin.SmartHash(this._required_spec_race_won); } else { *(byteptr_t + 0x10) = this.RequiredSpecificURLWon; *(byteptr_t + 0x11) = this.SponsorChosenToUnlock; *(byteptr_t + 0x12) = this.RequiredRacesWon; *(byteptr_t + 0x13) = this.RequiredURLWon; } *(int *)(byteptr_t + 0x14) = this.EarnableRespect; *(ushort *)(byteptr_t + 0x18) = this.TrackID_Stage1; *(ushort *)(byteptr_t + 0x1C) = this.TrackID_Stage2; *(ushort *)(byteptr_t + 0x20) = this.TrackID_Stage3; *(ushort *)(byteptr_t + 0x24) = this.TrackID_Stage4; *(byteptr_t + 0x1A) = (byte)this.InReverseDirection_Stage1; *(byteptr_t + 0x1E) = (byte)this.InReverseDirection_Stage2; *(byteptr_t + 0x22) = (byte)this.InReverseDirection_Stage3; *(byteptr_t + 0x26) = (byte)this.InReverseDirection_Stage4; *(byteptr_t + 0x1B) = this.NumLaps_Stage1; *(byteptr_t + 0x1F) = this.NumLaps_Stage2; *(byteptr_t + 0x23) = this.NumLaps_Stage3; *(byteptr_t + 0x27) = this.NumLaps_Stage4; *(uint *)(byteptr_t + 0x28) = Bin.Hash(this._event_trigger); *(uint *)(byteptr_t + 0x2C) = Bin.SmartHash(this._player_car_type); *(int *)(byteptr_t + 0x30) = this.CashValue; *(byteptr_t + 0x34) = (byte)this._event_icon_type; *(byteptr_t + 0x35) = (byte)this._is_drive_to_gps; *(byteptr_t + 0x36) = (byte)this._difficulty_level; *(byteptr_t + 0x37) = this.BelongsToStage; *(byteptr_t + 0x38) = this.NumMapItems; *(byteptr_t + 0x39) = this._padding1; *(byteptr_t + 0x3A) = this.Unknown0x3A; *(byteptr_t + 0x3B) = this.Unknown0x3B; *(uint *)(byteptr_t + 0x3C) = Bin.SmartHash(this._gps_destination); *(byteptr_t + 0x7C) = this._num_of_opponents; *(byteptr_t + 0x7D) = this.UnknownDragValue; *(byteptr_t + 0x7E) = this._num_of_stages; *(byteptr_t + 0x7F) = (byte)this._is_hidden_event; *(int *)(byteptr_t + 0x80) = this._padding2; *(int *)(byteptr_t + 0x84) = this._padding3; // Goto based on whether event is a drift downhill if (this.DriftTypeIfDriftRace == eDriftType.DOWNHILL) { goto LABEL_DRIFT_DOWNHILL; } else { goto LABEL_BASIC; } // If none of the events are drift downhill, write opponent data based on number of the opponents LABEL_BASIC: if (this._num_of_opponents > 0) { if (this.OPPONENT1.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT1.Name); *(ushort *)(byteptr_t + 0x40) = pointer; } *(ushort *)(byteptr_t + 0x42) = this.OPPONENT1.StatsMultiplier; *(uint *)(byteptr_t + 0x44) = Bin.SmartHash(this.OPPONENT1.PresetRide); *(byteptr_t + 0x48) = this.OPPONENT1.SkillEasy; *(byteptr_t + 0x49) = this.OPPONENT1.SkillMedium; *(byteptr_t + 0x4A) = this.OPPONENT1.SkillHard; *(byteptr_t + 0x4B) = this.OPPONENT1.CatchUp; } if (this._num_of_opponents > 1) { if (this.OPPONENT2.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT2.Name); *(ushort *)(byteptr_t + 0x4C) = pointer; } *(ushort *)(byteptr_t + 0x4E) = this.OPPONENT2.StatsMultiplier; *(uint *)(byteptr_t + 0x50) = Bin.SmartHash(this.OPPONENT2.PresetRide); *(byteptr_t + 0x54) = this.OPPONENT2.SkillEasy; *(byteptr_t + 0x55) = this.OPPONENT2.SkillMedium; *(byteptr_t + 0x56) = this.OPPONENT2.SkillHard; *(byteptr_t + 0x57) = this.OPPONENT2.CatchUp; } if (this._num_of_opponents > 2) { if (this.OPPONENT3.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT3.Name); *(ushort *)(byteptr_t + 0x58) = pointer; } *(ushort *)(byteptr_t + 0x5A) = this.OPPONENT3.StatsMultiplier; *(uint *)(byteptr_t + 0x5C) = Bin.SmartHash(this.OPPONENT3.PresetRide); *(byteptr_t + 0x60) = this.OPPONENT3.SkillEasy; *(byteptr_t + 0x61) = this.OPPONENT3.SkillMedium; *(byteptr_t + 0x62) = this.OPPONENT3.SkillHard; *(byteptr_t + 0x63) = this.OPPONENT3.CatchUp; } if (this._num_of_opponents > 3) { if (this.OPPONENT4.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT4.Name); *(ushort *)(byteptr_t + 0x64) = pointer; } *(ushort *)(byteptr_t + 0x66) = this.OPPONENT4.StatsMultiplier; *(uint *)(byteptr_t + 0x68) = Bin.SmartHash(this.OPPONENT4.PresetRide); *(byteptr_t + 0x6C) = this.OPPONENT4.SkillEasy; *(byteptr_t + 0x6D) = this.OPPONENT4.SkillMedium; *(byteptr_t + 0x6E) = this.OPPONENT4.SkillHard; *(byteptr_t + 0x6F) = this.OPPONENT4.CatchUp; } if (this._num_of_opponents > 4) { if (this.OPPONENT5.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT5.Name); *(ushort *)(byteptr_t + 0x70) = pointer; } *(ushort *)(byteptr_t + 0x72) = this.OPPONENT5.StatsMultiplier; *(uint *)(byteptr_t + 0x74) = Bin.SmartHash(this.OPPONENT5.PresetRide); *(byteptr_t + 0x78) = this.OPPONENT5.SkillEasy; *(byteptr_t + 0x79) = this.OPPONENT5.SkillMedium; *(byteptr_t + 0x7A) = this.OPPONENT5.SkillHard; *(byteptr_t + 0x7B) = this.OPPONENT5.CatchUp; } return; // If at least one of the events is drift downhill, write at least 3 opponents LABEL_DRIFT_DOWNHILL: if (this.OPPONENT1.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT1.Name); *(ushort *)(byteptr_t + 0x40) = pointer; } *(ushort *)(byteptr_t + 0x42) = this.OPPONENT1.StatsMultiplier; *(uint *)(byteptr_t + 0x44) = Bin.SmartHash(this.OPPONENT1.PresetRide); *(byteptr_t + 0x48) = this.OPPONENT1.SkillEasy; *(byteptr_t + 0x49) = this.OPPONENT1.SkillMedium; *(byteptr_t + 0x4A) = this.OPPONENT1.SkillHard; *(byteptr_t + 0x4B) = this.OPPONENT1.CatchUp; if (this.OPPONENT2.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT2.Name); *(ushort *)(byteptr_t + 0x4C) = pointer; } *(ushort *)(byteptr_t + 0x4E) = this.OPPONENT2.StatsMultiplier; *(uint *)(byteptr_t + 0x50) = Bin.SmartHash(this.OPPONENT2.PresetRide); *(byteptr_t + 0x54) = this.OPPONENT2.SkillEasy; *(byteptr_t + 0x55) = this.OPPONENT2.SkillMedium; *(byteptr_t + 0x56) = this.OPPONENT2.SkillHard; *(byteptr_t + 0x57) = this.OPPONENT2.CatchUp; if (this.OPPONENT3.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT3.Name); *(ushort *)(byteptr_t + 0x58) = pointer; } *(ushort *)(byteptr_t + 0x5A) = this.OPPONENT3.StatsMultiplier; *(uint *)(byteptr_t + 0x5C) = Bin.SmartHash(this.OPPONENT3.PresetRide); *(byteptr_t + 0x60) = this.OPPONENT3.SkillEasy; *(byteptr_t + 0x61) = this.OPPONENT3.SkillMedium; *(byteptr_t + 0x62) = this.OPPONENT3.SkillHard; *(byteptr_t + 0x63) = this.OPPONENT3.CatchUp; if (this._num_of_opponents > 3) { if (this.OPPONENT4.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT4.Name); *(ushort *)(byteptr_t + 0x64) = pointer; } *(ushort *)(byteptr_t + 0x66) = this.OPPONENT4.StatsMultiplier; *(uint *)(byteptr_t + 0x68) = Bin.SmartHash(this.OPPONENT4.PresetRide); *(byteptr_t + 0x6C) = this.OPPONENT4.SkillEasy; *(byteptr_t + 0x6D) = this.OPPONENT4.SkillMedium; *(byteptr_t + 0x6E) = this.OPPONENT4.SkillHard; *(byteptr_t + 0x6F) = this.OPPONENT4.CatchUp; } if (this._num_of_opponents > 4) { if (this.OPPONENT5.Name != BaseArguments.NULL) { pointer = (ushort)mw.Position; mw.WriteNullTerminated(this.OPPONENT5.Name); *(ushort *)(byteptr_t + 0x70) = pointer; } *(ushort *)(byteptr_t + 0x72) = this.OPPONENT5.StatsMultiplier; *(uint *)(byteptr_t + 0x74) = Bin.SmartHash(this.OPPONENT5.PresetRide); *(byteptr_t + 0x78) = this.OPPONENT5.SkillEasy; *(byteptr_t + 0x79) = this.OPPONENT5.SkillMedium; *(byteptr_t + 0x7A) = this.OPPONENT5.SkillHard; *(byteptr_t + 0x7B) = this.OPPONENT5.CatchUp; } return; }
public static unsafe void Assemble(BinaryWriter bw, Database.Underground2 db) { // Initialize MemoryWriter for string block to its maximum size var mw = new MemoryWriter(0xFFFF); mw.Write((byte)0); // write null-termination mw.WriteNullTerminated(Process.Watermark); // Get arrays of all blocks var GCareerRacesBlock = WriteGCareerRaces(mw, db); var WorldShopBlock = WriteWorldShops(mw, db); var GCareerBrandsBlock = WriteGCareerBrands(mw, db); var PartPerformancesBlock = WritePartPerformances(db); var GShowcasesBlock = WriteGShowcases(mw, db); var SMSMessagesBlock = WriteSMSMessages(mw, db); var SponsorsBlock = WriteSponsors(mw, db); var GCareerStagesBlock = WriteGCareerStages(db); var PerfSliderTuningsBlock = WritePerfSliderTunings(db); var WorldChallengesBlock = WriteWorldChallenges(mw, db); var PartUnlockablesBlock = WritePartUnlockables(db); var BankTriggersBlock = WriteBankTriggers(db); var GCarUnlocksBlock = WriteGCarUnlocks(db); // Compress to the position mw.Position += 4 - (mw.Position % 4); mw.CompressToPosition(); // Pre-calculate size var size = 8 + mw.Length; size += GCareerRacesBlock.Length; size += WorldShopBlock.Length; size += GCareerBrandsBlock.Length; size += PartPerformancesBlock.Length; size += GShowcasesBlock.Length; size += SMSMessagesBlock.Length; size += SponsorsBlock.Length; size += GCareerStagesBlock.Length; size += PerfSliderTuningsBlock.Length; size += WorldChallengesBlock.Length; size += PartUnlockablesBlock.Length; size += BankTriggersBlock.Length; size += GCarUnlocksBlock.Length; // Pre-calculate padding var padding = Resolve.GetPaddingArray(size + 0x50, 0x80); size += padding.Length; // Finally, write entire Career Block bw.Write(CareerInfo.MAINID); bw.Write(size); bw.Write(CareerInfo.STRING_BLOCK); bw.Write(mw.Length); bw.Write(mw.Data); bw.Write(GCareerRacesBlock); bw.Write(WorldShopBlock); bw.Write(GCareerBrandsBlock); bw.Write(PartPerformancesBlock); bw.Write(GShowcasesBlock); bw.Write(SMSMessagesBlock); bw.Write(SponsorsBlock); bw.Write(GCareerStagesBlock); bw.Write(PerfSliderTuningsBlock); bw.Write(WorldChallengesBlock); bw.Write(PartUnlockablesBlock); bw.Write(BankTriggersBlock); bw.Write(GCarUnlocksBlock); bw.Write(padding); }