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

###
# Citizen Sleeper
# send your bug reports to bugs@dotslashplay.it
###

script_version=20260709.1

PLAYIT_COMPATIBILITY_LEVEL=2.35

GAME_ID=citizen-sleeper
GAME_NAME='Citizen Sleeper'

ARCHIVE_BASE_2_NAME='setup_citizen_sleeper_1.4.9_(75233).exe'
ARCHIVE_BASE_2_MD5=87a23767b623863d85a640892bff03f7
ARCHIVE_BASE_2_TYPE=innosetup
ARCHIVE_BASE_2_SIZE=1202756
ARCHIVE_BASE_2_VERSION=1.4.9-1

ARCHIVE_BASE_1_NAME='setup_citizen_sleeper_1.4.6_(69854).exe'
ARCHIVE_BASE_1_MD5=ac9b59f393ca34a89a42ba510bbba4ab
ARCHIVE_BASE_1_TYPE=innosetup
ARCHIVE_BASE_1_SIZE=1170957
ARCHIVE_BASE_1_VERSION=1.4.6-1

ARCHIVE_BASE_0_NAME='setup_citizen_sleeper_1.3.9_(65533).exe'
ARCHIVE_BASE_0_MD5=50b240a6cd4fb79096d6d5252daac6b7
ARCHIVE_BASE_0_TYPE=innosetup
ARCHIVE_BASE_0_SIZE=973177
ARCHIVE_BASE_0_VERSION=1.3.9-1

UNITY3D_NAME='Citizen Sleeper'
# TODO: Include an explicit list of Unity3D plugins.

CONTENT_PATH_DEFAULT='.'

WINE_PERSISTENT_DIRECTORIES='
users/${USER}/AppData/LocalLow/Jump Over the Age/Citizen Sleeper'

PACKAGES_LIST='
PKG_BIN
PKG_DATA'

PKG_BIN_ARCH=64
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
. "$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
