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

###
# Doodle God
# send your bug reports to bugs@dotslashplay.it
###

script_version=20260419.4

PLAYIT_COMPATIBILITY_LEVEL='2.35'

GAME_ID='doodle-god'
GAME_NAME='Doodle God'

# This archive used to be available from freebies.indiegala.com.
ARCHIVE_BASE_0_NAME='doodle-god_win.zip'
ARCHIVE_BASE_0_MD5='cdba1abf1c909c7145da975dac82945d'
# unzip can not be used for this archive,
# because it does not treat "\" as a path separator.
ARCHIVE_BASE_0_EXTRACTOR='unar'
ARCHIVE_BASE_0_SIZE='160000'
ARCHIVE_BASE_0_VERSION='3.1.64-indiegala1'

CONTENT_PATH_DEFAULT='.'
CONTENT_GAME_BIN_FILES='
DoodleGod.exe'
# TODO: Install libraries in a standard path.
# TODO: Drop unused libraries.
CONTENT_GAME0_BIN_FILES='
fmodex.dll
fmodexL.dll
freeglut.dll
FreeImage.dll
FreeType-6.dll
RedShell.dll
Zlib.dll'
CONTENT_GAME_DATA_FILES='
data'

# Despite the misleading name, this path seems to include game progress status.
USER_PERSISTENT_DIRECTORIES='
temp'

APP_MAIN_EXE='DoodleGod.exe'

PACKAGES_LIST='
PKG_BIN
PKG_DATA'

PKG_BIN_ARCH='32'
PKG_BIN_DEPENDENCIES_SIBLINGS='
PKG_DATA'

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
