示例#1
0
        // public virtual bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy)
        public override bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy)
        {
            string ApplicationIconPath = Path.Combine(ProjectDirectory, "Build/Windows/Application.ico");

            // Does a Project icon exist?
            if (!File.Exists(ApplicationIconPath))
            {
                // Also check for legacy location
                ApplicationIconPath = Path.Combine(ProjectDirectory, "Source", ProjectName, "Resources", "Windows", ProjectName + ".ico");
                if (!File.Exists(ApplicationIconPath))
                {
                    // point to the default UE4 icon instead
                    ApplicationIconPath = Path.Combine(EngineDirectory, "Source/Runtime/Launch/Resources/Windows/UE4.ico");
                }
            }
            // sets the icon on the original exe this will be used in the task bar when the bootstrap exe runs
            if (File.Exists(ApplicationIconPath))
            {
                GroupIconResource GroupIcon = null;
                GroupIcon = GroupIconResource.FromIco(ApplicationIconPath);

                // Update the icon on the original exe because this will be used when the game is running in the task bar
                using (ModuleResourceUpdate Update = new ModuleResourceUpdate(ExecutablePath, false))
                {
                    const int IconResourceId = 123; // As defined in Engine\Source\Runtime\Launch\Resources\Windows\resource.h
                    if (GroupIcon != null)
                    {
                        Update.SetIcons(IconResourceId, GroupIcon);
                    }
                }
            }
            return(true);
        }
示例#2
0
    public override void Package(ProjectParams Params, DeploymentContext SC, int WorkingCL)
    {
        // If this is a content-only project and there's a custom icon, update the executable
        if (!Params.HasDLCName && !Params.IsCodeBasedProject)
        {
            FileReference IconFile = FileReference.Combine(Params.RawProjectPath.Directory, "Build", "Windows", "Application.ico");
            if (FileReference.Exists(IconFile))
            {
                CommandUtils.LogInformation("Updating executable with custom icon from {0}", IconFile);

                GroupIconResource GroupIcon = GroupIconResource.FromIco(IconFile.FullName);

                List <FileReference> ExecutablePaths = GetExecutableNames(SC);
                foreach (FileReference ExecutablePath in ExecutablePaths)
                {
                    using (ModuleResourceUpdate Update = new ModuleResourceUpdate(ExecutablePath.FullName, false))
                    {
                        const int IconResourceId = 123;                         // As defined in Engine\Source\Runtime\Launch\Resources\Windows\resource.h
                        if (GroupIcon != null)
                        {
                            Update.SetIcons(IconResourceId, GroupIcon);
                        }
                    }
                }
            }
        }

        PrintRunTime();
    }
    void StageBootstrapExecutable(DeploymentContext SC, string ExeName, string TargetFile, string StagedRelativeTargetPath, string StagedArguments)
    {
        string InputFile = CombinePaths(SC.LocalRoot, "Engine", "Binaries", SC.PlatformDir, String.Format("BootstrapPackagedGame-{0}-Shipping.exe", SC.PlatformDir));

        if (InternalUtils.SafeFileExists(InputFile))
        {
            // Create the new bootstrap program
            string IntermediateDir = CombinePaths(SC.ProjectRoot, "Intermediate", "Staging");
            InternalUtils.SafeCreateDirectory(IntermediateDir);

            string IntermediateFile = CombinePaths(IntermediateDir, ExeName);
            CommandUtils.CopyFile(InputFile, IntermediateFile);
            CommandUtils.SetFileAttributes(IntermediateFile, ReadOnly: false);

            // currently the icon updating doesn't run under mono
            if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 ||
                UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win32)
            {
                // Get the icon from the build directory if possible
                GroupIconResource GroupIcon = null;
                if (InternalUtils.SafeFileExists(CombinePaths(SC.ProjectRoot, "Build/Windows/Application.ico")))
                {
                    GroupIcon = GroupIconResource.FromIco(CombinePaths(SC.ProjectRoot, "Build/Windows/Application.ico"));
                }
                if (GroupIcon == null)
                {
                    GroupIcon = GroupIconResource.FromExe(TargetFile);
                }

                // Update the resources in the new file
                using (ModuleResourceUpdate Update = new ModuleResourceUpdate(IntermediateFile, true))
                {
                    const int IconResourceId = 101;
                    if (GroupIcon != null)
                    {
                        Update.SetIcons(IconResourceId, GroupIcon);
                    }

                    const int ExecFileResourceId = 201;
                    Update.SetData(ExecFileResourceId, ResourceType.RawData, Encoding.Unicode.GetBytes(StagedRelativeTargetPath + "\0"));

                    const int ExecArgsResourceId = 202;
                    Update.SetData(ExecArgsResourceId, ResourceType.RawData, Encoding.Unicode.GetBytes(StagedArguments + "\0"));
                }
            }

            // Copy it to the staging directory
            SC.StageFiles(StagedFileType.NonUFS, IntermediateDir, ExeName, false, null, "");
        }
    }
示例#4
0
        // public virtual bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy)
        public override bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy)
        {
            // set the icon on the original exe this will be used in the task bar when the bootstrap exe runs
            if (File.Exists(Path.Combine(ProjectDirectory, "Build/Windows/Application.ico")))
            {
                GroupIconResource GroupIcon = null;
                GroupIcon = GroupIconResource.FromIco(Path.Combine(ProjectDirectory, "Build/Windows/Application.ico"));

                // Update the icon on the original exe because this will be used when the game is running in the task bar
                using (ModuleResourceUpdate Update = new ModuleResourceUpdate(ExecutablePath, false))
                {
                    const int IconResourceId = 101;
                    if (GroupIcon != null)
                    {
                        Update.SetIcons(IconResourceId, GroupIcon);
                    }
                }
            }
            return(true);
        }
        // public virtual bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy)
        public override bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy)
        {
            // set the icon on the original exe this will be used in the task bar when the bootstrap exe runs
            if (File.Exists(Path.Combine(ProjectDirectory, "Build/Windows/Application.ico")))
            {
                GroupIconResource GroupIcon = null;
                GroupIcon = GroupIconResource.FromIco(Path.Combine(ProjectDirectory, "Build/Windows/Application.ico"));

                // Update the icon on the original exe because this will be used when the game is running in the task bar
                using (ModuleResourceUpdate Update = new ModuleResourceUpdate(ExecutablePath, false))
                {
                    const int IconResourceId = 101;
                    if (GroupIcon != null)
                    {
                        Update.SetIcons(IconResourceId, GroupIcon);
                    }
                }
            }
            return true;
        }
示例#6
0
        public bool SetApplicationIcon(FileReference ProjectFile, string ProjectName, string ProjectDirectory, List <UnrealTargetConfiguration> TargetConfigurations, List <string> ExecutablePaths, string EngineDirectory)
        {
            string ApplicationIconPath = Path.Combine(ProjectDirectory, "Build/Windows/Application.ico");

            // Does a Project icon exist?
            if (!File.Exists(ApplicationIconPath))
            {
                // Also check for legacy location
                ApplicationIconPath = Path.Combine(ProjectDirectory, "Source", ProjectName, "Resources", "Windows", ProjectName + ".ico");
                if (!File.Exists(ApplicationIconPath))
                {
                    // point to the default UE4 icon instead
                    ApplicationIconPath = Path.Combine(EngineDirectory, "Source/Runtime/Launch/Resources/Windows/UE4.ico");
                }
            }
            // sets the icon on the original exe this will be used in the task bar when the bootstrap exe runs
            if (File.Exists(ApplicationIconPath))
            {
                GroupIconResource GroupIcon = null;
                GroupIcon = GroupIconResource.FromIco(ApplicationIconPath);

                foreach (string ExecutablePath in ExecutablePaths)
                {
                    // Update the icon on the original exe because this will be used when the game is running in the task bar
                    using (ModuleResourceUpdate Update = new ModuleResourceUpdate(ExecutablePath, false))
                    {
                        const int IconResourceId = 123;                         // As defined in Engine\Source\Runtime\Launch\Resources\Windows\resource.h
                        if (GroupIcon != null)
                        {
                            Update.SetIcons(IconResourceId, GroupIcon);
                        }
                    }
                }
            }
            return(true);
        }
	void StageBootstrapExecutable(DeploymentContext SC, string ExeName, string TargetFile, string StagedRelativeTargetPath, string StagedArguments)
	{
		string InputFile = CombinePaths(SC.LocalRoot, "Engine", "Binaries", SC.PlatformDir, String.Format("BootstrapPackagedGame-{0}-Shipping.exe", SC.PlatformDir));
		if(InternalUtils.SafeFileExists(InputFile))
		{
			// Create the new bootstrap program
			string IntermediateDir = CombinePaths(SC.ProjectRoot, "Intermediate", "Staging");
			InternalUtils.SafeCreateDirectory(IntermediateDir);

			string IntermediateFile = CombinePaths(IntermediateDir, ExeName);
			File.Copy(InputFile, IntermediateFile, true);
	
			// currently the icon updating doesn't run under mono
			if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 ||
				UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win32)
			{
				// Get the icon from the build directory if possible
				GroupIconResource GroupIcon = null;
				if(InternalUtils.SafeFileExists(CombinePaths(SC.ProjectRoot, "Build/Windows/Application.ico")))
				{
					GroupIcon = GroupIconResource.FromIco(CombinePaths(SC.ProjectRoot, "Build/Windows/Application.ico"));
				}
				if(GroupIcon == null)
				{
					GroupIcon = GroupIconResource.FromExe(TargetFile);
				}

				// Update the resources in the new file
				using(ModuleResourceUpdate Update = new ModuleResourceUpdate(IntermediateFile, true))
				{
					const int IconResourceId = 101;
					if(GroupIcon != null) Update.SetIcons(IconResourceId, GroupIcon);

					const int ExecFileResourceId = 201;
					Update.SetData(ExecFileResourceId, ResourceType.RawData, Encoding.Unicode.GetBytes(StagedRelativeTargetPath + "\0"));

					const int ExecArgsResourceId = 202;
					Update.SetData(ExecArgsResourceId, ResourceType.RawData, Encoding.Unicode.GetBytes(StagedArguments + "\0"));
				}
			}

			// Copy it to the staging directory
			SC.StageFiles(StagedFileType.NonUFS, IntermediateDir, ExeName, false, null, "");
		}
	}