public void HaloReachRebuildUnicTags()
        {
            BlamVersion game = BlamVersion.HaloReach_Xbox;

            CacheFileOutputInfoArgs.TestMethodSerial(TestContext,
                                                     CacheRebuildUnicTagsMethod,
                                                     game, kDirectoryXbox, @"Retail\maps\mainmenu.map");
            CacheFileOutputInfoArgs.TestMethodSerial(TestContext,
                                                     CacheRebuildUnicTagsMethod,
                                                     game, kDirectoryXbox, @"Retail\dlc_noble\dlc_invasion.map");

            string results_path = BuildResultPath(kTagDumpPath, game, "", "settings", "xml");
            var    xml_settings = new System.Xml.XmlWriterSettings();

            xml_settings.Indent      = true;
            xml_settings.IndentChars = "  ";
            xml_settings.Encoding    = System.Text.Encoding.ASCII;
            using (var s = System.Xml.XmlTextWriter.Create(results_path, xml_settings))
            {
                s.WriteStartDocument(true);
                s.WriteStartElement("settingsDefinitions");
                s.WriteAttributeString("game", game.ToString());

                s.WriteStartElement("options");
                foreach (var kv in Blam.HaloReach.Tags.text_value_pair_definition_group.SettingParameters)
                {
                    s.WriteStartElement("entry");
                    s.WriteAttributeString("key", kv.Key.ToString());
                    s.WriteAttributeString("value", Path.GetFileName(kv.Value));
                    s.WriteAttributeString("tagName", kv.Value);
                    s.WriteEndElement();
                }
                s.WriteEndElement();

                s.WriteStartElement("categories");
                foreach (var kv in Blam.HaloReach.Tags.multiplayer_variant_settings_interface_definition_group.SettingCategories)
                {
                    s.WriteStartElement("entry");
                    s.WriteAttributeString("key", kv.Key.ToString());
                    s.WriteAttributeString("value", Path.GetFileName(kv.Value.TagName));
                    s.WriteAttributeString("title", kv.Value.Title);
                    s.WriteAttributeString("tagName", kv.Value.TagName);
                    s.WriteEndElement();
                }
                s.WriteEndElement();


                s.WriteEndElement();
                s.WriteEndDocument();
            }
        }
Example #2
0
        protected static string BuildResultPath(string test_results_root, BlamVersion engine,
                                                string map_name, string file_name, string file_ext)
        {
            string format = !string.IsNullOrEmpty(map_name) ?
                            "{0}_{1}" : "{1}";

            format += !string.IsNullOrEmpty(file_name) ?
                      "_{2}.{3}" : ".{3}";

            return(System.IO.Path.Combine(test_results_root, string.Format(
                                              format,
                                              map_name,
                                              engine.ToString(),
                                              file_name, file_ext)));
        }
Example #3
0
        static ExitCode UnlockBlamGames(params string[] args)
        {
            const string kModifcationName     = "OpenSauce";
            const string kSupportedExeVersion = "1.09";

            if (args.Length < 4)
            {
                Console.WriteLine("error: invalid command argument count");
                return(ExitCode.InvalidArgsCount);
            }

            BlamVersion version = BlamVersion.Unknown;

            switch (args[0])
            {
            case "Halo1_CE": version = BlamVersion.Halo1_CE; break;

            //case "Halo2_PC": version = BlamVersion.Halo2_PC; break;
            default:
                Console.WriteLine("error: unsupported engine version - {0}", version.ToString());
                return(ExitCode.InvalidArgs);
            }
            ;

            Console.WriteLine("Applying {0} modifications...", kModifcationName);
            DumpArguments(1, args);

            Exception exception = null;

            OpenSauceIDE.GameInterface.UnlockGameBase unlocker = null;
            switch (version)
            {
            case BlamVersion.Halo1_CE:
                try                                     { unlocker = new OpenSauceIDE.GameInterface.UnlockH1(args[3], args[1], args[2]); }
                catch (Exception ex) { exception = ex; }
                break;
//              case BlamVersion.Halo2_PC:
//                  try					{ unlocker = new OpenSauceIDE.GameInterface.UnlockH2(args[3], args[1], args[2]); }
//                  catch (Exception ex){ exception = ex; }
//                  break;
            }

            if (unlocker != null)             // If the unlocker api was initialized OK, run the unlocking operations
            {
                try
                {
                    unlocker.Unlock(false);
                    unlocker.Close();
                }
                catch (Exception ex)    { exception = ex; }
            }

            DumpModificationException(kModifcationName, exception);

            ExitCode exit_code = ExitCode.Success;
            string   msg;

            if (exception == null)
            {
                msg = kModifcationName + " successfully applied!";
            }
            else if (unlocker.EncounteredInvalidExe)
            {
                msg       = kModifcationName + " couldn't be applied to some or all of the exes. Check the debug log for more details";
                exit_code = ExitCode.InvalidInput;
            }
            else
            {
                msg = "There was an error while trying to apply " + kModifcationName + ". Validate that you selected original copies of the " +
                      "v" + kSupportedExeVersion + " exe(s) and try again.";
                exit_code = ExitCode.Failure;
            }

            Console.WriteLine(msg);

            return(exit_code);
        }
Example #4
0
        static void GetAesParameters(BlamVersion game, CacheSectionType type, out byte[] key, out byte[] iv)
        {
            switch (game)
            {
            case BlamVersion.HaloReach_Beta:
                key = kAesBeta.Key;
                iv  = kAesBeta.Iv;
                break;

            case BlamVersion.HaloReach_Xbox:
                if (type == CacheSectionType.Localization)
                {
                    key = kAesRetail[0].Key;
                    iv  = kAesRetail[0].Iv;
                }
                else if (type == CacheSectionType.Debug)
                {
                    key = kAesRetail[1].Key;
                    iv  = kAesRetail[1].Iv;
                }
                else if (type == CacheSectionType.Tag)
                {
                    key = kAesRetail[2].Key;
                    iv  = kAesRetail[2].Iv;
                }
                else
                {
                    goto default;
                }
                break;

            default: throw new Debug.Exceptions.UnreachableException(string.Format("{0}/{1}", game.ToString(), type.ToString()));
            }
        }
Example #5
0
 void SetDialogName(BlamVersion version)
 {
     this.Text = string.Format("{0} - [{1}]", kDlgName, version.ToString());
 }
        /// <summary>
        /// Create a new builder tag index
        /// </summary>
        /// <param name="version">Engine version for the tags</param>
        /// <param name="source_index"></param>
        /// <remarks>
        /// Must call <see cref="DataArraySet"/> in inheriting object's ctor
        /// </remarks>
        protected BuilderTagIndexBase(BlamVersion version, Managers.ITagIndex source_index)
        {
            Debug.Assert.If(source_index, "Couldn't create a builder tag index! Require a valid source index.");
            Debug.Assert.If(source_index.Engine == version, "Couldn't create a builder tag index! Engine mismatch: {0:X} != {1:X}.", source_index.Engine, version);
            engine      = version;
            sourceIndex = source_index;

            refManager = new Managers.ReferenceManager(version, string.Format("[BuilderTagIndex {0}]", version.ToString("X")), false);

            if (engine.UsesStringIds())
            {
                StringTableInitialize();
            }
        }
Example #7
0
		static void GetAesParameters(BlamVersion game, CacheSectionType type, out byte[] key, out byte[] iv)
		{
			switch (game)
			{
				case BlamVersion.Halo4_Xbox:
					if (type == CacheSectionType.Localization)
					{
						key = kAesRetail[0].Key;
						iv = kAesRetail[0].Iv;
					}
					else if (type == CacheSectionType.Debug)
					{
						key = kAesRetail[1].Key;
						iv = kAesRetail[1].Iv;
					}
					else if (type == CacheSectionType.Tag)
					{
						key = kAesRetail[2].Key;
						iv = kAesRetail[2].Iv;
					}
					else goto default;
					break;

				default: throw new Debug.Exceptions.UnreachableException(string.Format("{0}/{1}", game.ToString(), type.ToString()));
			}
		}
Example #8
0
        static ExitCode UnlockBlamTools(params string[] args)
        {
            if (args.Length < 5)
            {
                Console.WriteLine("error: invalid command argument count");
                return(ExitCode.InvalidArgsCount);
            }

            BlamVersion version = BlamVersion.Unknown;

            switch (args[0])
            {
            case "Halo1_CE":        version = BlamVersion.Halo1_CE; break;

            case "Halo2_PC":        version = BlamVersion.Halo2_PC; break;

            default:
                Console.WriteLine("error: unsupported engine version - {0}", version.ToString());
                return(ExitCode.InvalidArgs);
            }
            ;

            Console.WriteLine("Applying {0} modifications...", "CheApe");
            DumpArguments(1, args);

            Exception exception = null;

            OpenSauceIDE.CheApeInterface.UnlockToolsBase unlocker = null;
            switch (version)
            {
            case BlamVersion.Halo1_CE:
                try                                     { unlocker = new OpenSauceIDE.CheApeInterface.UnlockH1(args[4], args[1], args[2], args[3]); }
                catch (Exception ex) { exception = ex; }
                break;

            case BlamVersion.Halo2_PC:
                try                                     { unlocker = new OpenSauceIDE.CheApeInterface.UnlockH2(args[4], args[1], args[2], args[3]); }
                catch (Exception ex) { exception = ex; }
                break;
            }

            if (unlocker != null)             // If the unlocker api was initialized OK, run the unlocking operations
            {
                try
                {
                    unlocker.Unlock(false);
                    unlocker.Close();
                }
                catch (Exception ex)    { exception = ex; }
            }

            if (exception != null)
            {
                Console.WriteLine("error: an exception occurred when attempting to apply the {0} modifications", "CheApe");
                Console.WriteLine();
                Console.WriteLine("exception details:");
                if (exception.Message != null)
                {
                    Console.WriteLine(exception.Message);
                }
                Console.WriteLine(exception.StackTrace);
                Console.WriteLine();
            }

            ExitCode exit_code = ExitCode.Success;
            string   msg;

            if (exception == null)
            {
                msg = "CheApe successfully applied!";
            }
            else if (unlocker.EncounteredInvalidExe)
            {
                msg       = "CheApe couldn't be applied to some or all of the exes. Check the debug log for more details";
                exit_code = ExitCode.InvalidInput;
            }
            else
            {
                msg       = "There was an error while trying to apply CheApe. Validate that you selected copies of the original tools and try again.";
                exit_code = ExitCode.Failure;
            }

            Console.WriteLine(msg);

            return(exit_code);
        }
Example #9
0
		void SetDialogName(BlamVersion version)
		{
			this.Text = string.Format("{0} - [{1}]", kDlgName, version.ToString());
		}