공부중

[UE]프로젝트 패키지를 하고 나온 exe파일 속성 변경 본문

Programing/UnrealEngine

[UE]프로젝트 패키지를 하고 나온 exe파일 속성 변경

곤란 2022. 8. 29. 00:11
반응형

뭐라고 제목을 해야하나 하다가 저렇게 지었는데...

아래 스샷을 보면 된다.

패키지를 통해서 나온 exe파일의 속성-자세히 란에 저 정보들을 바꾸는 것에 대해서 적어보려고 한다.

 

변경하는 방법은 쉬웠다. 아래와 같이 따라하면 된다.

편집 - 프로젝트 세팅 으로 들어간다.

여기서 올바르게 값을 입력하면 된다.

임시로 위와 같이 입력을 했었고 패키징을 진행했다.

결과는 위와 같았고 변경이 잘 된것을 확인할 수가 있었다.

하지만 파일 버전과 제품버전은 변경할 수가 없었는데 이것은 변경할 수 없는것인가를 찾아보다가 방법을 찾기는 했었다.

언리얼 샘플중에서 슈팅 게임이 있는데 이것을 살펴보면

Source > [Project Name] > Resources > Windows

위의 경로로 들어가면 rc파일이 존재하는데 이걸 살펴보자

// Copyright Epic Games, Inc. All Rights Reserved.

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
#include "Runtime/Launch/Resources/Version.h"
#include "Runtime/Launch/Resources/Windows/resource.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS


/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION ENGINE_MAJOR_VERSION,ENGINE_MINOR_VERSION,ENGINE_PATCH_VERSION,0
 PRODUCTVERSION ENGINE_MAJOR_VERSION,ENGINE_MINOR_VERSION,ENGINE_PATCH_VERSION,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "CompanyName", EPIC_COMPANY_NAME
            VALUE "LegalCopyright", EPIC_COPYRIGHT_STRING
			VALUE "ProductName", EPIC_PRODUCT_NAME
            VALUE "ProductVersion", ENGINE_VERSION_STRING
			VALUE "FileDescription", "ShooterGame"
            VALUE "InternalName", "ShooterGame"
            VALUE "OriginalFilename", "ShooterGame.exe"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDICON_UE4Game          ICON                    "ShooterGame.ico"

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



//#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
//#endif    // not APSTUDIO_INVOKED

rc파일의 코드인데 중간에 보면 아래와 같은 내용이 있다.

VS_VERSION_INFO VERSIONINFO
 FILEVERSION ENGINE_MAJOR_VERSION,ENGINE_MINOR_VERSION,ENGINE_PATCH_VERSION,0
 PRODUCTVERSION ENGINE_MAJOR_VERSION,ENGINE_MINOR_VERSION,ENGINE_PATCH_VERSION,0
 FILEFLAGSMASK 0x17L

FILEVERSION 을 "ENGINE_MAJOR_VERSION,ENGINE_MINOR_VERSION,ENGINE_PATCH_VERSION,0" 으로 쓴다는 내용이고 이것은 어디에 정의되어있냐 하면

 

위의 코드에서 include된 엔진코드쪽에서 찾을수 있다.

C:\Program Files\Epic Games\UE_5.0\Engine\Source\Runtime\Launch\Resources\Version.h

// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

/*
 주석 생략
*/

// These numbers define the banner UE version, and are the most significant numbers when ordering two engine versions (that is, a 5.12.* version is always 
// newer than a 5.11.* version, regardless of the changelist that it was built with)
#define ENGINE_MAJOR_VERSION	5
#define ENGINE_MINOR_VERSION	0
#define ENGINE_PATCH_VERSION	3

// Macros for encoding strings
#define VERSION_TEXT(x) TEXT(x)
#define VERSION_STRINGIFY_2(x) VERSION_TEXT(#x)
#define VERSION_STRINGIFY(x) VERSION_STRINGIFY_2(x)

// Various strings used for engine resources
#define EPIC_COMPANY_NAME  "Epic Games, Inc."
#define EPIC_COPYRIGHT_STRING "Copyright Epic Games, Inc. All Rights Reserved."
#define EPIC_PRODUCT_NAME "Unreal Engine"
#define EPIC_PRODUCT_IDENTIFIER "UnrealEngine"

#if defined(BUILT_FROM_CHANGELIST) && defined(BRANCH_NAME)
#define ENGINE_VERSION_STRING \
	VERSION_STRINGIFY(ENGINE_MAJOR_VERSION) \
	VERSION_TEXT(".") \
	VERSION_STRINGIFY(ENGINE_MINOR_VERSION) \
	VERSION_TEXT(".") \
	VERSION_STRINGIFY(ENGINE_PATCH_VERSION) \
	VERSION_TEXT("-") \
	VERSION_STRINGIFY(BUILT_FROM_CHANGELIST) \
	VERSION_TEXT("+") \
	VERSION_TEXT(BRANCH_NAME)
#else
#define ENGINE_VERSION_STRING \
	VERSION_STRINGIFY(ENGINE_MAJOR_VERSION) \
	VERSION_TEXT(".") \
	VERSION_STRINGIFY(ENGINE_MINOR_VERSION) \
	VERSION_TEXT(".") \
	VERSION_STRINGIFY(ENGINE_PATCH_VERSION)
#endif

이와 같이 define되어있는것을 확인 할 수 있다.

그렇기 때문에 rc파일을 프로젝트에 위의 경로처럼 만들어서 재정의(?) 해주면 된다.

재정의라고 말한것은 새로운 프로젝트를 만들고 빌드해보면 아래와 같은 출력문을 볼 수 있다.

블록 친 내용을 보면 만들어 놓지 않은 리소스 파일을 어디선가 가져와 쓰고 있는걸 볼 수 있는데 이 Default.rc2파일은...

C:\Program Files\Epic Games\UE_5.0\Engine\Build\Windows\Resources 경로에서 찾을 수 있다.

여기서 Default.rc2를 열어보면....

더보기

Default.rc2 전체 내용

// Copyright Epic Games, Inc. All Rights Reserved.
//
// This file contains resources which are edited by hand, and cannot be loaded/saved by the Visual Studio resource editor.

#include "../../../Source/Runtime/Launch/Resources/Windows/resource.h"
#include "../../../Source/Runtime/Core/Public/Misc/CoreMiscDefines.h"
#include "../../../Source/Runtime/Launch/Resources/Version.h"

#define APSTUDIO_READONLY_SYMBOLS
#include <windows.h>
#undef APSTUDIO_READONLY_SYMBOLS

// Various strings used for project resources
#ifdef PROJECT_COMPANY_NAME
	#define BUILD_PROJECT_COMPANY_NAME PREPROCESSOR_TO_STRING(PROJECT_COMPANY_NAME)
#else
	#define BUILD_PROJECT_COMPANY_NAME EPIC_COMPANY_NAME
#endif

#ifdef PROJECT_COPYRIGHT_STRING
	#define BUILD_PROJECT_COPYRIGHT_STRING PREPROCESSOR_TO_STRING(PROJECT_COPYRIGHT_STRING)
#else
	#define BUILD_PROJECT_COPYRIGHT_STRING EPIC_COPYRIGHT_STRING
#endif

#ifdef PROJECT_PRODUCT_NAME
	#define BUILD_PROJECT_PRODUCT_NAME PREPROCESSOR_TO_STRING(PROJECT_PRODUCT_NAME)
#else
	#define BUILD_PROJECT_PRODUCT_NAME PREPROCESSOR_TO_STRING(UE_APP_NAME)
#endif

#ifdef PROJECT_PRODUCT_IDENTIFIER
	#define BUILD_PROJECT_PRODUCT_IDENTIFIER PREPROCESSOR_TO_STRING(PROJECT_PRODUCT_IDENTIFIER)
#else
	#define BUILD_PROJECT_PRODUCT_IDENTIFIER EPIC_PRODUCT_IDENTIFIER
#endif

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION ENGINE_MAJOR_VERSION,ENGINE_MINOR_VERSION,ENGINE_PATCH_VERSION,0
 PRODUCTVERSION ENGINE_MAJOR_VERSION,ENGINE_MINOR_VERSION,ENGINE_PATCH_VERSION,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
	BLOCK "StringFileInfo"
	BEGIN
		BLOCK "040904b0"
		BEGIN
			VALUE "CompanyName", BUILD_PROJECT_COMPANY_NAME
			VALUE "LegalCopyright", BUILD_PROJECT_COPYRIGHT_STRING
			VALUE "ProductName", BUILD_PROJECT_PRODUCT_NAME
#ifdef BUILD_VERSION
			VALUE "ProductVersion", PREPROCESSOR_TO_STRING(BUILD_VERSION)
#endif
			VALUE "FileDescription", BUILD_PROJECT_PRODUCT_NAME
			VALUE "InternalName", BUILD_PROJECT_PRODUCT_IDENTIFIER
#ifdef ORIGINAL_FILE_NAME
			VALUE "OriginalFilename", PREPROCESSOR_TO_STRING(ORIGINAL_FILE_NAME)
#endif
		END
	END
	BLOCK "VarFileInfo"
	BEGIN
		VALUE "Translation", 0x409, 1200
	END
END

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.

#ifdef BUILD_ICON_FILE_NAME
IDICON_UEGame          ICON                    BUILD_ICON_FILE_NAME
#endif

#endif    // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION ENGINE_MAJOR_VERSION,ENGINE_MINOR_VERSION,ENGINE_PATCH_VERSION,0
 PRODUCTVERSION ENGINE_MAJOR_VERSION,ENGINE_MINOR_VERSION,ENGINE_PATCH_VERSION,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG

위의 슈팅게임 프로젝트에서 본것과 똑같이 되어있다.

rc파일을 프로젝트 내에 생성하지 않으면 이 Default.rc2파일을 가져와 적용하는것이라고 볼 수 있다.

-> 이 내용은 아래에 추가로 언리얼 빌드 툴 코드를 좀 적어놓았다.

 

윈도우는 이렇게 되어있고 mac은 plist를 사용해서 적용하면 된다.

 


위의 내용은 언리얼 빌드 툴을 보면 rc파일들을 찾아서 컴파일을 하는 내용의 코드가 존재한다.

// UnrealBuildTool - UEBuildModuleCPP.cs
static FileItem[] FindInputFilesFromDirectory(DirectoryItem BaseDirectory, InputFileCollection InputFiles)
{
	List<FileItem> SourceFiles = new List<FileItem>();
	foreach(FileItem InputFile in BaseDirectory.EnumerateFiles())
	{
    	// ... 생략 ...
        else if (InputFile.HasExtension(".rc"))
		{
			SourceFiles.Add(InputFile);
			InputFiles.RCFiles.Add(InputFile);
		}
		// ... 생략 ...
// UnrealBuildTool - UEBuildModuleCPP.cs
public override List<FileItem> Compile(ReadOnlyTargetRules Target, UEToolChain ToolChain, CppCompileEnvironment BinaryCompileEnvironment, List<FileReference> SpecificFilesToCompile, ISourceFileWorkingSet WorkingSet, IActionGraphBuilder Graph)
{
	// ... 생략 ...
    // Compile RC files. The resource compiler does not work with response files, and using the regular compile environment can easily result in the 
	// command line length exceeding the OS limit. Use the binary compile environment to keep the size down, and require that all include paths
	// must be specified relative to the resource file itself or Engine/Source.
	if(InputFiles.RCFiles.Count > 0)
	{
		CppCompileEnvironment ResourceCompileEnvironment = new CppCompileEnvironment(BinaryCompileEnvironment);
		if(Binary != null)
		{
			// @todo: This should be in some Windows code somewhere...
			ResourceCompileEnvironment.Definitions.Add("ORIGINAL_FILE_NAME=\"" + Binary.OutputFilePaths[0].GetFileName() + "\"");
		}
		LinkInputFiles.AddRange(ToolChain.CompileRCFiles(ResourceCompileEnvironment, InputFiles.RCFiles, IntermediateDirectory, Graph).ObjectFiles);
	}
    // ... 생략 ...
// UnrealBuildTool - VCToolChain.cs
public override CPPOutput CompileRCFiles(CppCompileEnvironment CompileEnvironment, List<FileItem> InputFiles, DirectoryReference OutputDir, IActionGraphBuilder Graph)
// UnrealBuildTool - UEBuildBinary.cs
private LinkEnvironment SetupBinaryLinkEnvironment(ReadOnlyTargetRules Target, UEToolChain ToolChain, LinkEnvironment LinkEnvironment, CppCompileEnvironment CompileEnvironment, List<FileReference> SpecificFilesToCompile, ISourceFileWorkingSet WorkingSet, DirectoryReference ExeDir, IActionGraphBuilder Graph)
{
	// ... 생략 ...
    // If we don't have any resource file, use the default or compile a custom one for this module
    if(BinaryLinkEnvironment.Platform == UnrealTargetPlatform.Win64)
    {
        // Figure out if this binary has any custom resource files. Hacky check to ignore the resource file in the Launch module, since it contains dialogs that the engine needs and always needs to be included.
        FileItem[] CustomResourceFiles = BinaryLinkEnvironment.InputFiles.Where(x => x.Location.HasExtension(".res") && !x.Location.FullName.EndsWith("\\Launch\\PCLaunch.rc.res", StringComparison.OrdinalIgnoreCase)).ToArray();
        if(CustomResourceFiles.Length == 0)
        {
            if(BinaryLinkEnvironment.DefaultResourceFiles.Count > 0)
            {
                // Use the default resource file if possible
                BinaryLinkEnvironment.InputFiles.AddRange(BinaryLinkEnvironment.DefaultResourceFiles);
            }
            else
            {
                // Get the intermediate directory
                DirectoryReference ResourceIntermediateDirectory = BinaryLinkEnvironment.IntermediateDirectory;

                // Create a compile environment for resource files
                CppCompileEnvironment ResourceCompileEnvironment = new CppCompileEnvironment(BinaryCompileEnvironment);

                // @todo: This should be in some Windows code somewhere...
                // Set the original file name macro; used in Default.rc2 to set the binary metadata fields.
                ResourceCompileEnvironment.Definitions.Add("ORIGINAL_FILE_NAME=\"" + OutputFilePaths[0].GetFileName() + "\"");

                // Set the other version fields
                ResourceCompileEnvironment.Definitions.Add(String.Format("BUILT_FROM_CHANGELIST={0}", Target.Version.Changelist));
                ResourceCompileEnvironment.Definitions.Add(String.Format("BUILD_VERSION={0}", Target.BuildVersion));

                // Otherwise compile the default resource file per-binary, so that it gets the correct ORIGINAL_FILE_NAME macro.
                FileItem DefaultResourceFile = FileItem.GetItemByFileReference(FileReference.Combine(Unreal.EngineDirectory, "Build", "Windows", "Resources", "Default.rc2"));
                CPPOutput DefaultResourceOutput = ToolChain.CompileRCFiles(ResourceCompileEnvironment, new List<FileItem> { DefaultResourceFile }, ResourceIntermediateDirectory, Graph);
                BinaryLinkEnvironment.InputFiles.AddRange(DefaultResourceOutput.ObjectFiles);
            }
        }
    }
    // ... 생략 ...

 

자세한 내용은 직접 코드를 보는것으로...

MAC은 plist를 사용하는 내용을 봤었다. 

반응형