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

###
# Where is my Heart
# send your bug reports to bugs@dotslashplay.it
###

script_version=20260418.3

PLAYIT_COMPATIBILITY_LEVEL='2.35'

GAME_ID='where-is-my-heart'
GAME_NAME='Where is my Heart?'

ARCHIVE_BASE_0_NAME='setup_where_is_my_heart_1.0_(22335).exe'
ARCHIVE_BASE_0_MD5='1204a8799d050a4c49e3eac069d040db'
ARCHIVE_BASE_0_TYPE='innosetup'
ARCHIVE_BASE_0_SIZE='130000'
ARCHIVE_BASE_0_VERSION='1.0-gog223335'
ARCHIVE_BASE_0_URL='https://www.gog.com/game/where_is_my_heart'

CONTENT_PATH_DEFAULT='.'
CONTENT_GAME_MAIN_FILES='
Where is my Heart.exe'
# TODO: Install libraries in a standard path.
# TODO: Drop unused libraries.
CONTENT_GAME0_MAIN_FILES='
fmodex.dll
libgcc_s_dw2-1.dll
mingwm10.dll
msvcp100d.dll
msvcr100d.dll
QtCore4.dll
QtCored4.dll
QtGui4.dll
QtGuid4.dll
QtOpenGL4.dll
QtOpenGLd4.dll'
CONTENT_GAME1_MAIN_PATH='__support/app'
CONTENT_GAME1_MAIN_FILES='
Controls.xml
Settings.xml'
CONTENT_GAME2_MAIN_PATH='__support/save'
CONTENT_GAME2_MAIN_FILES='
Saves'

USER_PERSISTENT_DIRECTORIES='
Saves'
USER_PERSISTENT_FILES='
Controls.xml
Settings.xml'

APP_MAIN_EXE='Where is my Heart.exe'

PKG_MAIN_ARCH='32'

# 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
content_inclusion_default

# Write launchers.

launchers_generation

# Build packages.

packages_generation
print_instructions

# Clean up.

working_directory_cleanup

exit 0
