#!/bin/sh
# SPDX-License-Identifier: ACSL
# SPDX-FileCopyrightText: © 2017 Mopi
# SPDX-FileCopyrightText: © 2022 Antoine Le Gonidec <vv221@dotslashplay.it>
set -o errexit

###
# A Story About My Uncle
# send your bug reports to bugs@dotslashplay.it
###

script_version=20260519.6

PLAYIT_COMPATIBILITY_LEVEL='2.35'

GAME_ID='a-story-about-my-uncle'
GAME_NAME='A Story About My Uncle'

# This DRM-free archive is no longer sold by humblebundle.com,
# they currently sell only Steam keys for this game.
ARCHIVE_BASE_0_NAME='Linux-NoDRM-ASAMU_5188.zip'
ARCHIVE_BASE_0_MD5='71f9f3add29a733c4a1a7d18d738d3d6'
ARCHIVE_BASE_0_SIZE='1300000'
ARCHIVE_BASE_0_VERSION='5188-humble170516'

ARCHIVE_OPTIONAL_ICONS_NAME='a-story-about-my-uncle_icons.tar.gz'
ARCHIVE_OPTIONAL_ICONS_MD5='db4eb7ab666e61ea5fc983102099ab31'
ARCHIVE_OPTIONAL_ICONS_URL='http://downloads.dotslashplay.it/games/a-story-about-my-uncle/'
CONTENT_ICONS_PATH='.'
CONTENT_ICONS_FILES='
32x32'

# The following has no effect on Linux native games yet.
# (./play.it 2.35)
GAME_ENGINE='unrealengine3'

CONTENT_PATH_DEFAULT='.'
# ASAMU dependencies
CONTENT_LIBS_BIN_PATH='Binaries/linux-amd64'
CONTENT_LIBS_BIN_FILES='
libPhysXExtensions.so.1
libPhysXLoader.so.1
libsteam_api.so'
# Extra required dependencies, their absence leads to a crash.
CONTENT_LIBS0_BIN_PATH='Binaries/linux-amd64'
CONTENT_LIBS0_BIN_FILES='
libPhysXCooking.so
libPhysXCore.so
PhysXUpdateLoader.so'
CONTENT_GAME_BIN_FILES='
Binaries/linux-amd64/ASAMU'
CONTENT_GAME_DATA_FILES='
ASAMU
Engine'

APP_MAIN_EXE='Binaries/linux-amd64/ASAMU'

USER_PERSISTENT_DIRECTORIES='
ASAMU/Cloud
ASAMU/Config
ASAMU/Saves'

PACKAGES_LIST='
PKG_BIN
PKG_DATA'

PKG_BIN_ARCH='64'
PKG_BIN_DEPENDENCIES_SIBLINGS='
PKG_DATA'
PKG_BIN_DEPENDENCIES_LIBRARIES='
libc.so.6
libdl.so.2
libgcc_s.so.1
libGL.so.1
libm.so.6
libopenal.so.1
libpthread.so.0
libSDL2-2.0.so.0
libstdc++.so.6'

PKG_DATA_ID="${GAME_ID}-data"
PKG_DATA_DESCRIPTION='data'

# Load common functions.

if [ -z "$PLAYIT_LIB2" ]; then
	for playit_lib_dir in \
		"$PWD" \
		"${HOME}/.local/lib/play.it" \
		'/usr/local/lib/play.it' \
		'/usr/lib/play.it'
	do
		playit_lib_path="${playit_lib_dir}/libplayit.sh.2"
		if [ -e "$playit_lib_path" ]; then
			PLAYIT_LIB2="$playit_lib_path"
			break
		fi
	done
fi
if [ -z "$PLAYIT_LIB2" ]; then
	printf '\n\033[1;31mError:\033[0m\n'
	printf 'libplayit.sh.2 not found.\n'
	exit 1
fi
# shellcheck source=libplayit.sh.2
. "$PLAYIT_LIB2"

# Run default initialisation actions.

initialization_default "$@"

# Extract game data.

archive_extraction_default

# Include game data.

content_inclusion_icons 'PKG_DATA'
content_inclusion_default

# Write launchers.

launchers_generation

# Build packages.

packages_generation
print_instructions

# Clean up.

working_directory_cleanup

exit 0
