# Unreal Engine 4 - Print the Unreal Engine 4 name for the current game
# This function should not fail if no Unreal Engine 4 name is set for the current game,
# so it can be used to automatically detect games using the "unrealengine4" type variant.
# USAGE: unrealengine4_name
# RETURN: the Unreal Engine 4 name, a string that can include spaces,
#         or an empty string if none is set
unrealengine4_name() {
	context_value 'UNREALENGINE4_NAME'
}

# Unreal Engine 4 - Print the list of files to include from the archive for a given identifier
# USAGE: unrealengine4_content_files_default $content_id
# RETURN: a list of paths relative to the path for the given identifier,
#         line breaks are used as separator between each item,
#         this list can include globbing patterns,
#         this list can be empty
unrealengine4_content_files_default() {
	local content_id
	content_id="$1"

	local unrealengine4_name
	unrealengine4_name=$(unrealengine4_name)

	local application_type
	application_type=$(application_default_type)

	local content_files
	case "$content_id" in
		('GAME_BIN')
			case "$application_type" in
				('native')
					content_files="
					Engine
					${unrealengine4_name}/Binaries
					${unrealengine4_name}/Plugins"
				;;
				('wine')
					content_files="
					Engine
					${unrealengine4_name}/Binaries
					${unrealengine4_name}/Plugins
					${unrealengine4_name}.exe"
				;;
			esac
		;;
		('GAME_DATA')
			case "$application_type" in
				('native')
					content_files="
					${unrealengine4_name}/Content"
				;;
				('wine')
					content_files="
					${unrealengine4_name}/Content"
				;;
			esac
		;;
	esac

	printf '%s' "${content_files:-}"
}

