PageRenderTime 37ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/BlamLib/BlamLib/Blam/Halo3/Tags/Trace/ResourcesOutput.cs

https://code.google.com/p/open-sauce/
C# | 290 lines | 256 code | 28 blank | 6 comment | 2 complexity | 52db9c386e60639419fedd3a53844feb MD5 | raw file
Possible License(s): GPL-3.0
  1. /*
  2. BlamLib: .NET SDK for the Blam Engine
  3. See license\BlamLib\BlamLib for specific license information
  4. */
  5. #pragma warning disable 1591 // "Missing XML comment for publicly visible type or member"
  6. using System;
  7. using TI = BlamLib.TagInterface;
  8. using CT = BlamLib.Blam.Cache.Tags;
  9. namespace BlamLib.Blam.Halo3.Tags
  10. {
  11. #region cache_file_resource_gestalt
  12. partial class cache_file_resource_gestalt_group
  13. {
  14. #region cache_file_resource_gestalt_64_block
  15. partial class cache_file_resource_gestalt_64_block
  16. {
  17. [System.Diagnostics.Conditional("DEBUG")]
  18. public static void Output(System.IO.StreamWriter s, TI.Block<cache_file_resource_gestalt_64_block> block, string name)
  19. {
  20. if (block.Count == 0) return;
  21. const string format =
  22. "\t{0}\t\t{1}" + Program.NewLine + // Unknown044
  23. "\t\t\t{2}\t{3}\t{4}\t{5}\t{6}" // Unknown030-Unknown040
  24. ;
  25. s.WriteLine("{0}\tcache_file_resource_gestalt_64_block\t({1})", block.Count, name);
  26. int x = 0;
  27. foreach (cache_file_resource_gestalt_64_block def in block)
  28. {
  29. s.WriteLine(format, (x++).ToString(),
  30. def.Unknown044.ToString(),
  31. def.Unknown030.Value.ToString("X8"), def.Unknown034.Value.ToString("X8"),
  32. def.Unknown038.Value.ToString("X8"), def.Unknown03C.Value.ToString("X8"),
  33. def.Unknown040.Value.ToString("X8"));
  34. s.WriteLine();
  35. }
  36. }
  37. };
  38. #endregion
  39. [System.Diagnostics.Conditional("DEBUG")]
  40. static void Output(System.IO.StreamWriter s, TI.Block<field_block<TI.LongInteger>> block)
  41. {
  42. const string format = "\t{0}\t\t{1}";
  43. s.WriteLine("{0}\tcache_file_resource_gestalt_1D0_block", block.Count);
  44. int x = 0;
  45. foreach (field_block<TI.LongInteger> def in block)
  46. {
  47. s.WriteLine(format, (x++).ToString(), def.Value.Value.ToString("X8"));
  48. }
  49. }
  50. [System.Diagnostics.Conditional("DEBUG")]
  51. public static void Output(Blam.Halo3.CacheFileBase c, System.IO.StreamWriter s, cache_file_resource_gestalt_group def)
  52. {
  53. resource_type_block.Output(s, def.ResourceTypes);
  54. s.WriteLine();
  55. resource_structure_type_block.Output(s, def.ResourceStructureTypes);
  56. s.WriteLine();
  57. cache_file_resource_gestalt_tag_resource_block.Output(s, def.TagResources);
  58. s.WriteLine();
  59. cache_file_resource_gestalt_64_block.Output(s, def.Block64, "64-general");
  60. cache_file_resource_gestalt_64_block.Output(s, def.Block70, "70-global");
  61. cache_file_resource_gestalt_64_block.Output(s, def.Block7C, "7C-attached?");
  62. cache_file_resource_gestalt_64_block.Output(s, def.Block88, "88-unattached");
  63. cache_file_resource_gestalt_64_block.Output(s, def.Block94, "94-dvd_forbidden");
  64. cache_file_resource_gestalt_64_block.Output(s, def.BlockA0, "A0-dvd_always_streaming");
  65. cache_file_resource_gestalt_64_block.Output(s, def.BlockAC, "AC-bsp zones-1");
  66. cache_file_resource_gestalt_64_block.Output(s, def.BlockB8, "B8-bsp zones-2");
  67. cache_file_resource_gestalt_64_block.Output(s, def.BlockC4, "C4-bsp zones-3");
  68. cache_file_resource_gestalt_64_block.Output(s, def.BlockD0, "D0-?");
  69. cache_file_resource_gestalt_64_block.Output(s, def.BlockDC, "DC-zone sets");
  70. cache_file_resource_gestalt_100_block.Output(s, def.Block100);
  71. cache_file_resource_gestalt_164_block.Output(s, def.Block164);
  72. Output(s, def.Block1D0);
  73. s.WriteLine();
  74. cache_file_resource_gestalt_1DC_block.Output(s, def.Block1DC);
  75. s.WriteLine();
  76. cache_file_resource_gestalt_1E8_block.Output(s, def.Block1E8);
  77. s.WriteLine();
  78. cache_file_resource_gestalt_1F4_block.Output(s, def.Block1F4);
  79. s.WriteLine();
  80. cache_file_resource_gestalt_200_block.Output(c, s, def.Block200);
  81. s.WriteLine();
  82. }
  83. };
  84. #endregion
  85. #region cache_file_sound
  86. partial class cache_file_sound_group
  87. {
  88. [System.Diagnostics.Conditional("DEBUG")]
  89. public static void Output(System.IO.StreamWriter s, cache_file_sound_group def)
  90. {
  91. s.WriteLine(
  92. "\t\t{0}\t{1}\t{2}" + Program.NewLine + // Flags,SoundClass,SampleRate
  93. "\t\t{3}\t{4}\t{5}" + Program.NewLine + // Encoding,CodecIndex,PlaybackIndex
  94. "\t\t{6}\t{7}" + Program.NewLine + // 08,0A
  95. "\t\t{8}\t{9}\t{10}" + Program.NewLine + // FirstPitchRangeIndex,PitchRangeIndex,ScaleIndex
  96. "\t\t{11}\t{12}\t{13}" + Program.NewLine + // PromotionIndex,CustomPlaybackIndex,ExtraInfoIndex
  97. "\t\t{14}\t{15}\t{16}", // 14,ResourceIndex,MaximumPlayTime
  98. def.Flags.Value.ToString("X4"),def.SoundClass.Value.ToString("X2"), def.SampleRate.Value.ToString("X2"),
  99. def.Encoding.Value.ToString("X2"), def.CodecIndex.Value.ToString("X2"), def.PlaybackIndex.Value.ToString("X4"),
  100. def.Unknown08.Value.ToString("X4"), def.Unknown0A.Value.ToString("X4"),
  101. def.FirstPitchRangeIndex.Value.ToString("X4"), def.PitchRangeIndex.Value.ToString("X2"), def.ScaleIndex.Value.ToString("X2"),
  102. def.PromotionIndex.Value.ToString("X2"), def.CustomPlaybackIndex.Value.ToString("X2"), def.ExtraInfoIndex.Value.ToString("X4"),
  103. def.Unknown14.Value.ToString("X8"), def.ResourceIndex.Value.ToString("X8"), def.MaximumPlayTime.Value.ToString("X8")
  104. );
  105. }
  106. [System.Diagnostics.Conditional("DEBUG")]
  107. public static void Output(System.Collections.Generic.Dictionary<int, System.Collections.Generic.List<string>> dic,
  108. cache_file_sound_group def,
  109. string header)
  110. {
  111. System.Text.StringBuilder sb = new System.Text.StringBuilder();
  112. sb.AppendFormat("\t\t{0}" + Program.NewLine, header);
  113. sb.AppendFormat(
  114. "\t\t\t{0}\t{1}\t{2}" + Program.NewLine + // Flags,SoundClass,SampleRate
  115. "\t\t\t{3}\t{4}\t{5}" + Program.NewLine + // Encoding,CodecIndex,PlaybackIndex
  116. "\t\t\t{6}\t{7}" + Program.NewLine + // 08,0A
  117. "\t\t\t{8}\t{9}\t{10}" + Program.NewLine + // FirstPitchRangeIndex,PitchRangeIndex,ScaleIndex
  118. "\t\t\t{11}\t{12}\t{13}" + Program.NewLine + // PromotionIndex,CustomPlaybackIndex,ExtraInfoIndex
  119. "\t\t\t{14}\t{15}\t{16}", // 14,ResourceIndex,MaximumPlayTime
  120. def.Flags.Value.ToString("X4"),def.SoundClass.Value.ToString("X2"), def.SampleRate.Value.ToString("X2"),
  121. def.Encoding.Value.ToString("X2"), def.CodecIndex.Value.ToString("X2"), def.PlaybackIndex.Value.ToString("X4"),
  122. def.Unknown08.Value.ToString("X4"), def.Unknown0A.Value.ToString("X4"),
  123. def.FirstPitchRangeIndex.Value.ToString("X4"), def.PitchRangeIndex.Value.ToString("X2"), def.ScaleIndex.Value.ToString("X2"),
  124. def.PromotionIndex.Value.ToString("X2"), def.CustomPlaybackIndex.Value.ToString("X2"), def.ExtraInfoIndex.Value.ToString("X4"),
  125. def.Unknown14.Value.ToString("X8"), def.ResourceIndex.Value.ToString("X8"), def.MaximumPlayTime.Value.ToString("X8")
  126. );
  127. dic[def.CodecIndex.Value].Add(sb.ToString());
  128. //dic[def.SampleRate.Value].Add(sb.ToString());
  129. }
  130. };
  131. #endregion
  132. #region sound_permutation_chunk_block
  133. partial class sound_permutation_chunk_block
  134. {
  135. [System.Diagnostics.Conditional("DEBUG")]
  136. public static void Output(System.IO.StreamWriter s, TI.Block<sound_permutation_chunk_block> block)
  137. {
  138. const string format = "\t{0}\t\t{1}\t{2}" + "\t{3}\t{4}\t{5}";
  139. s.WriteLine("{0}\tsound_permutation_chunk_block", block.Count);
  140. int x = 0;
  141. foreach (sound_permutation_chunk_block def in block)
  142. {
  143. s.WriteLine(format, (x++).ToString(),
  144. def.FileOffset.Value.ToString("X8"), def.GetSize().ToString("X7"),
  145. def.GetFlags().ToString("X2"), def.Unknown0C.Value.ToString("X4"), def.Unknown10.Value.ToString("X8"));
  146. }
  147. }
  148. };
  149. #endregion
  150. #region sound_gestalt
  151. #region sound_gestalt_pitch_ranges_block
  152. partial class sound_gestalt_pitch_ranges_block
  153. {
  154. [System.Diagnostics.Conditional("DEBUG")]
  155. public static void Output(CacheFileBase c, System.IO.StreamWriter s, sound_cache_file_gestalt_group owner, TI.Block<sound_gestalt_pitch_ranges_block> block)
  156. {
  157. const string format = "\t{0}\t\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}";
  158. s.WriteLine("{0}\tsound_gestalt_pitch_ranges_block", block.Count);
  159. int x = 0;
  160. foreach (sound_gestalt_pitch_ranges_block def in block)
  161. {
  162. int name_index = def.Name.Value;
  163. Blam.StringID name = name_index >= 0 ? owner.ImportNames[name_index].ImportName.Handle : Blam.StringID.Null;
  164. s.WriteLine(format, (x++).ToString(),
  165. def.Parameters.Value.ToString(), def.Unknown04.Value.ToString(),
  166. def.EncodedPermutationData.Value.ToString("X4"), def.FirstPermutation.Value.ToString(),
  167. def.GetPermutationCount().ToString(),
  168. c.StringIds.GetStringIdValue(name));
  169. }
  170. }
  171. };
  172. #endregion
  173. #region sound_gestalt_permutations_block
  174. partial class sound_gestalt_permutations_block
  175. {
  176. [System.Diagnostics.Conditional("DEBUG")]
  177. public static void Output(CacheFileBase c, System.IO.StreamWriter s, sound_cache_file_gestalt_group owner, TI.Block<sound_gestalt_permutations_block> block)
  178. {
  179. const string format = "\t{0}\t\t{1}\t{2}\t{3}\t{4}\t{5}";
  180. s.WriteLine("{0}\tsound_gestalt_permutations_block", block.Count);
  181. int x = 0;
  182. foreach (sound_gestalt_permutations_block def in block)
  183. {
  184. int name_index = def.Name.Value;
  185. Blam.StringID name = name_index >= 0 ? owner.ImportNames[name_index].ImportName.Handle : Blam.StringID.Null;
  186. s.WriteLine(format, (x++).ToString(),
  187. def.PermutationInfoIndex.ToString(), def.FirstChunk.Value.ToString(), def.ChunkCount.Value.ToString(), def.GetPermutationIndex().ToString(),
  188. c.StringIds.GetStringIdValue(name));
  189. }
  190. }
  191. };
  192. #endregion
  193. #region sound_cache_file_gestalt
  194. partial class sound_cache_file_gestalt_group
  195. {
  196. #region sound_gestalt_60_block
  197. partial class sound_gestalt_60_block
  198. {
  199. [System.Diagnostics.Conditional("DEBUG")]
  200. static void Output(System.IO.StreamWriter s, TI.Block<field_block<TI.ShortInteger>> block)
  201. {
  202. const string format = "\t\t\t{0}\t\t{1}";
  203. s.WriteLine("\t\t{0}\tblock_4", block.Count);
  204. int x = 0;
  205. foreach (field_block<TI.ShortInteger> def in block)
  206. {
  207. s.WriteLine(format, (x++).ToString(), def.Value.Value.ToString("X4"));
  208. }
  209. }
  210. #region block_10
  211. partial class block_10
  212. {
  213. [System.Diagnostics.Conditional("DEBUG")]
  214. public static void Output(System.IO.StreamWriter s, TI.Block<block_10> block)
  215. {
  216. const string format = "\t\t\t{0}\t\t{1}\t{2}";
  217. s.WriteLine("\t\t{0}\tblock_10", block.Count);
  218. int x = 0;
  219. foreach (block_10 def in block)
  220. {
  221. s.WriteLine(format, (x++).ToString(), def.Start.Value.ToString("X4"), def.Length.Value.ToString("X4"));
  222. }
  223. }
  224. };
  225. #endregion
  226. [System.Diagnostics.Conditional("DEBUG")]
  227. public static void Output(System.IO.StreamWriter s, TI.Block<sound_gestalt_60_block> block)
  228. {
  229. const string format = "\t{0}\t\t{1}";
  230. s.WriteLine("{0}\tsound_gestalt_60_block", block.Count);
  231. int x = 0;
  232. foreach (sound_gestalt_60_block def in block)
  233. {
  234. s.WriteLine(format, (x++).ToString(), def.Unknown00.Value.ToString("X8"));
  235. Output(s, def.Unknown04);
  236. block_10.Output(s, def.Unknown10);
  237. }
  238. }
  239. };
  240. #endregion
  241. [System.Diagnostics.Conditional("DEBUG")]
  242. public static void Output(CacheFileBase c, System.IO.StreamWriter s, sound_cache_file_gestalt_group def)
  243. {
  244. CT.sound_gestalt_platform_codec_block.Output(s, def.PlatformCodecs);
  245. s.WriteLine("{0}\tsound_gestalt_playback_block", def.Playbacks.Count);
  246. s.WriteLine("{0}\tsound_gestalt_scale_block", def.Scales.Count);
  247. s.WriteLine("{0}\tsound_gestalt_import_names_block", def.ImportNames.Count);
  248. s.WriteLine("{0}\tsound_gestalt_pitch_range_parameters_block", def.PitchRangeParameters.Count);
  249. sound_gestalt_pitch_ranges_block.Output(c, s, def, def.PitchRanges);
  250. sound_gestalt_permutations_block.Output(c, s, def, def.Permutations);
  251. s.WriteLine("{0}\tsound_gestalt_custom_playback_block", def.CustomPlaybacks.Count);
  252. sound_gestalt_60_block.Output(s, def.Unknown60);
  253. s.WriteLine("{0}\tsound_gestalt_runtime_permutation_bit_vector_block", def.RuntimePermutationFlags.Count);
  254. sound_permutation_chunk_block.Output(s, def.Chunks);
  255. s.WriteLine("{0}\tsound_gestalt_promotions_block", def.Promotions.Count);
  256. s.WriteLine("{0}\tsound_gestalt_extra_info_block", def.ExtraInfos.Count);
  257. }
  258. }
  259. #endregion
  260. #endregion
  261. }