Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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;
		}