Example #1
0
		public override void Read(BlamLib.IO.EndianReader s)
		{
			int pos = 0;

			Blam.CacheFile.ValidateHeaderAdjustEndian(s, 0x800);
			s.Seek(4);

			Halo1.Version ver = (Halo1.Version)(version = s.ReadInt32());
			fileLength = s.ReadInt32();
			if (fileLength < s.Length) throw new Debug.ExceptionLog("Compressed map editing not available yet!");

			s.ReadInt32();

			if (ver == Halo1.Version.PC_Demo)
			{
				pos = s.Position;
				s.Position = 0x5EC;
				offsetToIndex = s.ReadInt32();
				s.Position = pos;
			}
			else
				offsetToIndex = s.ReadInt32();

			tagBufferSize = s.ReadInt32();

			s.ReadInt32(); s.ReadInt32();

			if (ver == Halo1.Version.PC_Demo)
			{
				pos = s.Position;
				s.Position = 0x5E8;
				name = s.ReadTagString();
				s.Position = pos;
			}
			else
				name = s.ReadTagString();

			build = s.ReadTagString();
			cacheType = (CacheType)s.ReadInt16();
			s.ReadInt16();
			s.ReadInt32(); // CRC

			s.ReadInt32();
			s.Seek((484 * sizeof(int)) + sizeof(uint), System.IO.SeekOrigin.Current);

			CacheFile cache = s.Owner as CacheFile;
			if (ver == Halo1.Version.Xbox)										cache.EngineVersion = BlamVersion.Halo1_Xbox;
			else if (ver == Halo1.Version.PC || ver == Halo1.Version.PC_Demo)
			{
				if(s.State == IO.EndianState.Big)								cache.EngineVersion = BlamVersion.Halo1_XboxX;
				else
				{
					// Interestingly, HaloPC is build 01.00.00.0564, HA10 is build 01.00.01.0563
																				// Little
					if(build == "01.00.01.0563")								cache.EngineVersion = BlamVersion.Halo1_PCX;
					else														cache.EngineVersion = BlamVersion.Halo1_PC;
				}
			}
			else if (ver == Halo1.Version.CE)									cache.EngineVersion = BlamVersion.Halo1_CE;
		}
Example #2
0
		public override void Read(BlamLib.IO.EndianReader s)
		{
			Blam.CacheFile.ValidateHeader(s, 0x800);
			
			s.Seek(4);
			version = s.ReadInt32();
			if (version != 5) throw new InvalidCacheFileException(s.FileName);

			fileLength = s.ReadInt32();

			int xbox = s.ReadInt32(); // Xbox only field

			offsetToIndex = s.ReadInt32();
			s.ReadInt32(); // stream size

			s.ReadInt32(); s.ReadInt32();

			name = s.ReadTagString();

			build = s.ReadTagString(); // Xbox only field. Always '400'
			cacheType = (CacheType)s.ReadInt16();
			s.ReadInt16();
			s.ReadInt32(); // CRC

			s.Seek((485 * sizeof(int)) + sizeof(uint), System.IO.SeekOrigin.Current);


			CacheFile cf = s.Owner as CacheFile;
			if (xbox != 0)
				cf.EngineVersion = BlamVersion.Stubbs_Xbox;
			else // no way to tell when it's mac, which just seems to use PC maps anyway (byte swaps everything when map is loaded)
				cf.EngineVersion = BlamVersion.Stubbs_PC;
		}
Example #3
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					Flags = s.ReadUInt32();
					ScoreToWin = s.ReadInt16();
					MovingHill = s.ReadByte();
					MovingHillOrder = s.ReadByte();
					InsideHillPoints = s.ReadByte();
					OutsideHillPoints = s.ReadByte();
					UncontestedHillBonus = s.ReadByte();
					KillPoints = s.ReadByte();
					HillTraits.Read(s);
				}
Example #4
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					ScoreToWin = s.ReadInt16();
					KillPoints = s.ReadInt16();
					AssistPoints = s.ReadByte();
					DeathPoints = s.ReadByte();
					SuicidePoints = s.ReadByte();
					BetrayalPoints = s.ReadByte();
					LeaderKilledPoints = s.ReadByte();
					EliminationPoints = s.ReadByte();
					AssassinationPoints = s.ReadByte();
					HeadshotPoints = s.ReadByte();
					MeleePoints = s.ReadByte();
					StickyPoints = s.ReadByte();
					SplatterPoints = s.ReadByte();
					KillingSpreePoints = s.ReadByte();
					LeaderTraits.Read(s);
				}
Example #5
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					Flags = s.ReadUInt32();
					ScoreToWin = s.ReadInt16();
					CarryingPoints = s.ReadInt16();
					KillPoints = s.ReadByte();
					BallKillPoints = s.ReadByte();
					CarrierKillPoints = s.ReadByte();
					BallCount = s.ReadByte();
					BallSpawnDelay = s.ReadInt16();
					BallInactiveRespawnDelay = s.ReadInt16();
					CarrierTraits.Read(s);
				}
Example #6
0
				//PAD16

				#region IStreamable Members
				public virtual void Read(BlamLib.IO.EndianReader s)
				{
					MiscOptions.Read(s);
					RespawnOptions.Read(s);
					SocialFlags = s.ReadUInt16();
					SocialTeamChanging = s.ReadInt16();
					MapOverrides.Read(s);
					Unknown0A8 = s.ReadUInt16();
					TeamScoringMethod = s.ReadInt16();
					Unknown0AC = s.ReadUInt16();
					s.Seek(2, System.IO.SeekOrigin.Current);
				}
Example #7
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					Flags = s.ReadByte();
					HomeFlagWaypoint = s.ReadByte();
					GameType = s.ReadByte();
					Respawn = s.ReadByte();
					TouchReturnTime = s.ReadInt16();
					SuddenDeathTime = s.ReadInt16();
					ScoreToWin = s.ReadInt16();
					FlagResetTime = s.ReadInt16();
					CarrierTraits.Read(s);
				}
Example #8
0
			public void Read(BlamLib.IO.EndianReader s, IO.ITagStream ts)
			{
				bool upgrade = ts.Flags.Test(IO.ITagStreamFlags.Halo2OldFormat_Fieldset);

				GroupTag = s.ReadTagUInt();
				if(!upgrade)
				{
					Index = s.ReadInt32();
					Count = s.ReadInt32();
				}
				else
				{
					Index = s.ReadInt16();
					Count = s.ReadInt16();
				}
				Size = s.ReadInt32();

				++Index;
			}
Example #9
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					Flags = s.ReadUInt16();
					Respawn = s.ReadInt16();
					GameType = s.ReadInt16();
					EnemyBombWaypoint = s.ReadInt16();
					ScoreToWin = s.ReadInt16();
					SuddenDeathTime = s.ReadInt16();
					BombResetTime = s.ReadInt16();
					BombArmingTime = s.ReadInt16();
					BombDisarmingTime = s.ReadInt16();
					BombFuseTime = s.ReadInt16();
					CarrierTraits.Read(s);
					ArmingTraits.Read(s);
				}
Example #10
0
				public void Read(BlamLib.IO.EndianReader s)
				{
					GameMode = s.ReadInt32();
					GameSimulation = (GameSimulation)s.ReadByte();
					GameNetworkType = s.ReadByte();
					GameTickRate = s.ReadInt16();
					GameInstance = s.ReadUInt64();
					Unknown010 = s.ReadInt32();
					Language = s.ReadInt32();
					DeterminismVersion = s.ReadInt32();
					MapId.Read(s);
					CachePath = s.ReadAsciiString(260);
					InitialZoneSetIndex = s.ReadInt16();
					Unknown12A = s.ReadBool();
					DumpMachineIndex = s.ReadByte();
					Unknown12C = s.ReadBool();
					Unknown12D = s.ReadBool();
					Unknown12E = s.ReadBool();
					s.Seek(1, System.IO.SeekOrigin.Current);
					GamePlayback = (GamePlayback)s.ReadInt16();
					Unknown132 = s.ReadBool();
					s.Seek(1, System.IO.SeekOrigin.Current);
					Unknown134 = s.ReadInt32();
					Unknown138 = s.ReadInt32();
					CampaignDifficulty = s.ReadInt16();
					CampaignInsertionPoint = s.ReadInt16();
					CampaignMetagameScoring = s.ReadInt16();
					Unknown142 = s.ReadBool();
					Unknown143 = s.ReadBool();
					PrimarySkulls = s.ReadInt32();
					SecondarySkulls = s.ReadInt32();
					for (int x = 0; x < Unknown14C.Length; x++) Unknown14C[x] = s.ReadBytes(30);
					Unknown1C4 = s.ReadBool();
					s.Seek(3 + 4, System.IO.SeekOrigin.Current);
					Unknown1CC = s.ReadBytes(92);
					EngineVariant.Read(s);
					s.Seek(4, System.IO.SeekOrigin.Current);
					MapVariant.Read(s);
					Game.Read(s);
				}
Example #11
0
				public void Read(BlamLib.IO.EndianReader s)
				{
					Unknown000 = s.ReadInt16();
					Unknown002 = s.ReadInt16();
					Unknown004 = s.ReadInt32();
					Unknown008 = s.ReadInt32();
					Names.Read(s);
					Descriptions.Read(s);
				}
Example #12
0
				public void Read(BlamLib.IO.EndianReader s)
				{
					Valid = s.ReadInt16() > 0;
					HopperIdentifier = s.ReadInt16();
					Unknown004 = s.ReadInt32();
					Unknown008 = s.ReadInt32();
					OldSkill = s.ReadInt32();
					GamesPlayed = s.ReadInt32();
					GamesCompleted = s.ReadInt32();
					GamesWon = s.ReadInt32();
				}
Example #13
0
				public void Read(BlamLib.IO.EndianReader s)
				{
					Valid = s.ReadBool();
					LeftGame = s.ReadBool();
					UserIndex = s.ReadInt16();
					ControllerIndex = s.ReadInt16();
					s.Seek(2, System.IO.SeekOrigin.Current);
					MachineId = s.ReadBytes(6);
					Unknown000E = s.ReadUInt64();
					s.Seek(2, System.IO.SeekOrigin.Current);
					Data.Read(s);
					MatchData.Read(s);
				}
Example #14
0
			public virtual void Read(BlamLib.IO.EndianReader s)
			{
				uint tag = s.ReadUInt32();// if (tag != GroupTag.ID) throw new Debug.ExceptionLog("blam file entry tag mismatch. {0} {1}", s.FileName, GroupTag.Name);
				if ((BlockSize = s.ReadUInt32()) != SizeOf && SizeOf != uint.MaxValue) throw new Debug.ExceptionLog("blam file entry size mismatch. {0} {1}: {2:X}", s.FileName, GroupTag.Name, BlockSize);
				Unknown1 = s.ReadInt16();
				Unknown2 = s.ReadInt16();
			}
Example #15
0
			public void Read(BlamLib.IO.EndianReader s)
			{
				Valid = s.ReadInt32() > 0;
				Header.Read(s);
				Version = s.ReadInt16();
				NumberOfScenarioObjects = s.ReadInt16();
				NumberOfVariantObjects = s.ReadInt16();
				NumberOfPlaceableObjectQuotas = s.ReadInt16();
				MapId = s.ReadInt32();
				WorldBoundsXMin = s.ReadSingle(); WorldBoundsXMax = s.ReadSingle();
				WorldBoundsYMin = s.ReadSingle(); WorldBoundsYMax = s.ReadSingle();
				WorldBoundsZMin = s.ReadSingle(); WorldBoundsZMax = s.ReadSingle();
				GameEngineSubtype = s.ReadInt32();
				BudgetTotal = s.ReadSingle();
				BudgetUsed = s.ReadSingle();
				Unknown5 = s.ReadUInt32(); Unknown6 = s.ReadUInt32();
				for (int x = 0; x < Properties.Length; x++) (Properties[x] = new ObjectProperties()).Read(s);
				for (int x = 0; x < ObjectTypeMap.Length; x++) ObjectTypeMap[x] = s.ReadInt16();
				for (int x = 0; x < Quotas.Length; x++) (Quotas[x] = new ObjectQuotas()).Read(s);
			}
Example #16
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					Flags = s.ReadByte();
					SafeHavens = s.ReadByte();
					NextZombie = s.ReadByte();
					InitialZombieCount = s.ReadByte();
					SafeHavenMovementTime = s.ReadInt16();
					ZombieKillPoints = s.ReadByte();
					InfectionPoints = s.ReadByte();
					SafeHavenArrivalPoints = s.ReadByte();
					SuicidePoints = s.ReadByte();
					BetrayalPoints = s.ReadByte();
					LastManBonusPoints = s.ReadByte();
					ZombieTraits.Read(s);
					AlphaTraits.Read(s);
					LastManTraits.Read(s);
					SafeHavenTraits.Read(s);
				}
Example #17
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					Flags = s.ReadByte();
					EditMode = s.ReadByte();
					RespawnTime = s.ReadInt16();
					EditorTraits.Read(s);
				}
Example #18
0
		public override void Read(BlamLib.IO.EndianReader s)
		{
			bool is_beta = false;
			bool is_odst = !((s.Owner as Blam.CacheFile).EngineVersion == BlamVersion.Halo3);
			Blam.CacheFile.ValidateHeader(s, kSizeOf);

			s.Seek(4);
			version = s.ReadInt32(); is_beta = version == 9;
			if (version != 9 && version != 11) throw new InvalidCacheFileException(s.FileName);
			fileLength = s.ReadInt32();
			s.ReadInt32();
			tagIndexAddress = s.ReadUInt32();
			memoryBufferOffset = s.ReadInt32();
			memoryBufferSize = s.ReadInt32();

			sourceFile = s.ReadAsciiString(256);
			build = s.ReadTagString();
			cacheType = (Blam.CacheType)s.ReadInt16();

			if (is_beta)
			{
				s.ReadInt16(); sharedType = Cache.SharedType.Beta;
				ReadBeta(s);
				return;
			}
			else
				sharedType = (Cache.SharedType)s.ReadInt16();

			s.ReadBool();
			s.ReadBool(); // false if it belongs to a untracked build
			s.ReadBool();
			s.ReadByte(); // appears to be an ODST-only field

			s.ReadInt32(); s.ReadInt32();
			s.ReadInt32(); s.ReadInt32(); s.ReadInt32();

			#region string id table
			// 0x158
			// old 128 byte aligned string table not used after the Delta builds of Halo 3

			stringIdsCount = s.ReadInt32();
			stringIdsBufferSize = s.ReadInt32(); // cstring buffer total size in bytes
			stringIdIndicesOffset = s.ReadInt32();
			stringIdsBufferOffset = s.ReadInt32(); // cstring buffer
			#endregion

			#region filetimes?
			// pretty sure this is a flags field
			// used to tell which of the following 64bit values
			// are used. Damn sure this are FILETIME structures, but
			// hex workshop doesn't like them so I can't be for sure...
			needsShared = s.ReadInt32() != 0; // just a little 'hack' if you will. if zero, the map is self reliant, so no worries
			Filetime.dwHighDateTime = s.ReadInt32();
			Filetime.dwLowDateTime = s.ReadInt32();
			if (s.ReadInt32() != 0) flags.Add(CacheHeaderFlags.DependsOnMainMenu); s.ReadInt32();
			if (s.ReadInt32() != 0) flags.Add(CacheHeaderFlags.DependsOnShared); s.ReadInt32();
			if (s.ReadInt32() != 0) flags.Add(CacheHeaderFlags.DependsOnCampaign); s.ReadInt32();
			#endregion

			name = s.ReadTagString();
			s.ReadInt32();
			scenarioPath = s.ReadAsciiString(256);
			s.ReadInt32(); // minor version, normally not used

			#region tag names
			tagNamesCount = s.ReadInt32();
			tagNamesBufferOffset = s.ReadInt32(); // cstring buffer
			tagNamesBufferSize = s.ReadInt32(); // cstring buffer total size in bytes
			tagNameIndicesOffset = s.ReadInt32();
			#endregion

			checksum = s.ReadUInt32(); // 0x2C4
			s.Seek(32, System.IO.SeekOrigin.Current); // these bytes are always the same

			baseAddress = s.ReadUInt32(); // expected base address
			xdkVersion = s.ReadInt32(); // xdk version

			#region memory partitions
			// 0x2E8

			// memory partitions
			memoryPartitions = new Partition[6];
			memoryPartitions[0].BaseAddress = s.ReadUInt32(); // cache resource buffer
			memoryPartitions[0].Size = s.ReadInt32();

			// readonly
			memoryPartitions[1].BaseAddress = s.ReadUInt32(); // sound cache resource buffer
			memoryPartitions[1].Size = s.ReadInt32();

			memoryPartitions[2].BaseAddress = s.ReadUInt32(); // global tags buffer
			memoryPartitions[2].Size = s.ReadInt32();
			memoryPartitions[3].BaseAddress = s.ReadUInt32(); // shared tag blocks?
			memoryPartitions[3].Size = s.ReadInt32();
			memoryPartitions[4].BaseAddress = s.ReadUInt32(); // address
			memoryPartitions[4].Size = s.ReadInt32();

			// readonly
			memoryPartitions[5].BaseAddress = s.ReadUInt32(); // map tags buffer
			memoryPartitions[5].Size = s.ReadInt32();
			#endregion

			int count = s.ReadInt32();
			s.Seek(12, System.IO.SeekOrigin.Current); // these bytes are always the same
			// if there is a hash in the header, this is the ONLY
			// place where it can be
			s.Seek(20 /*SHA1*/ + 40 + 256 /*RSA*/, System.IO.SeekOrigin.Current); // ???

			// 0x46C
			cacheInterop.Read(s);
			cacheInterop.PostprocessForCacheRead(kSizeOf);

			s.Seek(16, System.IO.SeekOrigin.Current); // GUID?, these bytes are always the same. ODST is different from Halo 3

			#region blah 1
			// 0x4AC

			// campaign has a shit load of these
			// but shared doesn't nor mainmenu
			// I compared the sc110 french and english and both have the SAME counts and element data. So 
			// I don't think this is a hash or something. At least, if it is, it's not runtime relative so 
			// nothing we have to worry about

			s.ReadInt16(); // I've only seen this be two different values (besides zero).
			count = s.ReadInt16();
			s.ReadInt32(); // seems to always be zero
			CompressionGuid = new Guid(s.ReadBytes(16));

			s.Seek(count * 28, System.IO.SeekOrigin.Current); // seek past the elements
			// dword
			// long
			// buffer [0x14] (probably a sha1 hash)
			s.Seek((320 - count) * 28, System.IO.SeekOrigin.Current); // seek past the unused elements
			#endregion

			#region blah 2
			{
				// 0x27C4
				// This on the other hand, sc110 french and english had MINOR differences. Those differences were in 
				// DWORDs @ 0x4 and 0x8

				// 005 - 1
				// 010 - 3
				// 020 - 3
				// 030 - 2
				// 040 - 2
				// 050 - 2
				// 070 - 3
				// 100 - 3
				// 110 - 2
				// 120 - 2
				// 130 - 1

				// c100  - 1
				// c200  - 1
				// h100  - 9
				// l200  - 7
				// l300  - 8
				// sc100 - 5
				// sc110 - 5
				// sc120 - 6
				// sc130 - 6
				// sc140 - 6
				// sc150 - 6

				// going to punt and just assume there is a max count of 10 of these possible

				// maybe related to bsp\'zones'?
				int blah2_sizeof = !is_odst ? 172 : 180;

				count = (int)(s.ReadUInt32() >> 24); // did someone forget to f*****g byte swap something?
				s.Seek(count * blah2_sizeof, System.IO.SeekOrigin.Current); // seek past the elements
				s.Seek((10 - count) * blah2_sizeof, System.IO.SeekOrigin.Current); // seek past the unused elements
			}
			#endregion

			s.Seek((!is_odst ? 380 : 300) + sizeof(uint), System.IO.SeekOrigin.Current); // zero


			ReadPostprocessForInterop();

			ReadPostprocessForBaseAddresses(s);
		}
Example #19
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					ScoreToWin = s.ReadInt16();
					Flags = s.ReadUInt16();
					KillPoints = s.ReadByte();
					TakedownPoints = s.ReadByte();
					KillAsVipPoints = s.ReadByte();
					VipDeathPoints = s.ReadByte();
					DestinationArrivalPoints = s.ReadByte();
					SuicidePoints = s.ReadByte();
					BetrayalPoints = s.ReadByte();
					VipSuicidePoints = s.ReadByte();
					VipSelection = s.ReadByte();
					ZoneMovement = s.ReadByte();
					ZoneOrder = s.ReadByte();
					s.Seek(1, System.IO.SeekOrigin.Current);
					InfluenceRadius = s.ReadInt16();
					VipTraits.Read(s);
					ProximityTraits.Read(s);
					VipTeamTraits.Read(s);
				}
Example #20
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					ScoreToWinRound = s.ReadInt16();
					s.Seek(2, System.IO.SeekOrigin.Current);
					InitialJuggernaut = s.ReadByte();
					NextJuggernaut = s.ReadByte();
					Flags = s.ReadByte();
					ZoneMovement = s.ReadByte();
					ZoneOrder = s.ReadByte();
					KillPoints = s.ReadByte();
					JuggernautKillPoints = s.ReadByte();
					KillAsJuggernautPoints = s.ReadByte();
					DestinationArrivalPoints = s.ReadByte();
					SuicidePoints = s.ReadByte();
					BetrayalPoints = s.ReadByte();
					JuggernautDelay = s.ReadByte();
					JuggernautTraits.Read(s);
				}
Example #21
0
					public void Read(BlamLib.IO.EndianReader s)
					{
						MotionTracker = s.ReadInt16();
						MotionTrackerRange = s.ReadInt16();
					}
Example #22
0
				public override void Read(BlamLib.IO.EndianReader s)
				{
					base.Read(s);

					Flags = s.ReadUInt16();
					RepsawnOnCapture = s.ReadInt16();
					CaptureTime = s.ReadInt16();
					SuddenDeathTime = s.ReadInt16();
					DefenderTraits.Read(s);
					AttackerTraits.Read(s);
				}
Example #23
0
				public void Read(BlamLib.IO.EndianReader s)
				{
					Flags = s.ReadUInt32();
					BaseTraits.Read(s);
					WeaponSet = s.ReadInt16();
					VehicleSet = s.ReadInt16();
					RedPowerupTraits.Read(s);
					BluePowerupTraits.Read(s);
					YellowPowerupTraits.Read(s);
				}
Example #24
0
			public void Read(BlamLib.IO.EndianReader s)
			{
				X = s.ReadInt16();
				Y = s.ReadInt16();
				Z = s.ReadInt16();
				W = s.ReadInt16();
			}