Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,170 @@
#!/bin/bash
# Copyright (C) 2022 Giovanni Cascione <ing.cascione@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -e
function get_firmware_entry(){
echo "
firmware$1_desc = \"$2\"
firmware$1_path = \"$3/$2\"
firmware$1_opt = \"true\"
"
}
function process_group(){
local dirname="$1"
shift
local target="$1"
shift
local arr=("$@")
for item in "${arr[@]}"; do
[ $target = "bundle" ] && cp $item "${TMP_PATH}/${dirname}/"
fragment=$(get_firmware_entry $count $(echo "$item" | sed "s|^.*/||g") "$dirname")
CORE_INFO_DATS="${CORE_INFO_DATS}${fragment}"
count=$(expr $count + 1)
done
}
# Externally passed variables shall be:
# $1 [REQ] BUILD_PATH
# $2 [REQ] SCUMMVM_PATH
# $3 [REQ] target build ("bundle" to build scummvm.zip, any other string to build core info file)
# $4 [OPT] target name (prefix for core info file)
# $5 [OPT] displayed core name (shown in frontend)
# $6 [OPT] allowed extensions - backup if ScummVM.dat is not available
# $7 [OPT] target scummvm folder name in frontend system folder
# $8 [OPT] target extra folder name in scummvm system folder
# $9 [OPT] target theme folder name in scummvm system folder
# Exit if in parameters are not provided
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] ; then
exit 1
fi
[ -z $4 ] && INFO_FILE_PRE=scummvm || INFO_FILE_PRE=$4
[ -z $5 ] && NICE_NAME=ScummVM || NICE_NAME=$5
[ -z $6 ] && ALLOWED_EXT=scummvm || ALLOWED_EXT=$6
[ -z $7 ] && BUNDLE_DIR=scummvm || BUNDLE_DIR="$7"
[ -z $8 ] && BUNDLE_DATAFILES_DIR="${BUNDLE_DIR}/extra" || BUNDLE_DATAFILES_DIR="${BUNDLE_DIR}/$8"
[ -z $9 ] && BUNDLE_THEME_DIR="${BUNDLE_DIR}/theme" || BUNDLE_THEME_DIR="${BUNDLE_DIR}/$9"
# Set variables
BUILD_PATH="$1"
SCUMMVM_PATH="$2"
TMP_PATH="${BUILD_PATH}/tmp_data"
TARGET_PATH="${BUILD_PATH}"
BUNDLE_ZIP_FILE="${BUNDLE_DIR}.zip"
BUNDLE_LOCAL_DATAFILES_DIR="${BUILD_PATH}/dist"
# Retrieve data file info from ScummVM source
THEMES_LIST=$(cat "${SCUMMVM_PATH}/dists/scummvm.rc" 2>/dev/null | grep FILE.*gui/themes.*\* | sed "s|.*\"\(.*\)\"|${SCUMMVM_PATH}/\1|g")
DATAFILES_LIST_DATA=$(cat "${SCUMMVM_PATH}/dists/engine-data/engine_data.mk" 2>/dev/null| grep DIST_FILES_LIST | sed "s|DIST_FILES_LIST += \(.*\)|${SCUMMVM_PATH}/\1|g")
DATAFILES_LIST_DATA_BIG=$(cat "${SCUMMVM_PATH}/dists/engine-data/engine_data_big.mk" 2>/dev/null| grep DIST_FILES_LIST | sed "s|DIST_FILES_LIST += \(.*\)|${SCUMMVM_PATH}/\1|g")
DATAFILES_LIST_DATA_CORE=$(cat "${SCUMMVM_PATH}/dists/engine-data/engine_data_core.mk" 2>/dev/null| grep DIST_FILES_LIST | sed "s|DIST_FILES_LIST += \(.*\)|${SCUMMVM_PATH}/\1|g")
SOUNDFONTS_LIST=$(cat "${SCUMMVM_PATH}/dists/scummvm.rc" 2>/dev/null| grep FILE.*dists/soundfonts | sed "s|.*\"\(.*\)\"|${SCUMMVM_PATH}/\1|g")
SHADERS_LIST=$(cat "${SCUMMVM_PATH}/dists/scummvm.rc" 2>/dev/null| grep FILE.*/shaders/ | sed "s|.*\"\(.*\)\"|${SCUMMVM_PATH}/\1|g")
# Put retrieved data into arrays
set +e
read -a THEME_ARRAY -d '' -r <<< "${THEMES_LIST}"
read -a DATAFILES_ARRAY -d '' -r <<< "$DATAFILES_LIST_DATA $DATAFILES_LIST_DATA_BIG $DATAFILES_LIST_DATA_CORE"
read -a SOUNDFONTS_ARRAY -d '' -r <<< "$SOUNDFONTS_LIST"
read -a SHADERS_ARRAY -d '' -r <<< "$SHADERS_LIST"
set -e
# Add specific data files
DATAFILES_ARRAY[${#DATAFILES_ARRAY[@]}]="${SCUMMVM_PATH}"/backends/vkeybd/packs/vkeybd_default.zip
# Make sure target folders exist
[ $3 = "bundle" ] && mkdir -p "${TMP_PATH}/${BUNDLE_THEME_DIR}/"
[ $3 = "bundle" ] && mkdir -p "${TMP_PATH}/${BUNDLE_DATAFILES_DIR}/"
[ $3 = "bundle" ] && mkdir -p "${TMP_PATH}/${BUNDLE_DATAFILES_DIR}/shaders"
count=0
# Process themes
process_group "$BUNDLE_THEME_DIR" $3 ${THEME_ARRAY[@]}
# Process datafiles
process_group "$BUNDLE_DATAFILES_DIR" $3 ${DATAFILES_ARRAY[@]}
process_group "$BUNDLE_DATAFILES_DIR" $3 ${SOUNDFONTS_ARRAY[@]}
process_group "$BUNDLE_DATAFILES_DIR/shaders" $3 ${SHADERS_ARRAY[@]}
# Process additional local bundle files
if [ -d "$BUNDLE_LOCAL_DATAFILES_DIR" -a ! -z "$(ls -A ${BUNDLE_LOCAL_DATAFILES_DIR} 2>/dev/null)" ] ; then
for item in $BUNDLE_LOCAL_DATAFILES_DIR/*; do
[ ! $(echo "$item" | sed "s|^.*/||g") = "README.md" ] && LOCAL_EXTRA_ARRAY+=("$item")
done
process_group "$BUNDLE_DATAFILES_DIR" $3 ${LOCAL_EXTRA_ARRAY[@]}
fi
if [ ! $3 = "bundle" ]; then
# Create core.info file
set +e
read -d '' CORE_INFO_CONTENT <<EOF
# Software Information
display_name = "$NICE_NAME"
authors = "ScummVM Team"
supported_extensions = "$ALLOWED_EXT"
corename = "$NICE_NAME"
categories = "Game"
license = "GPLv3"
permissions = ""
display_version = $(cat $SCUMMVM_PATH/base/internal_version.h 2>/dev/null | grep SCUMMVM_VERSION | sed "s|^.*SCUMMVM_VERSION *||g")
# Hardware Information
manufacturer = "Various"
systemname = "Game engine"
systemid = "scummvm"
# Libretro Features
database = "ScummVM"
supports_no_game = "true"
savestate = "false"
savestate_features = "null"
cheats = "false"
input_descriptors = "true"
memory_descriptors = "false"
libretro_saves = "false"
core_options = "true"
core_options_version = "1.3"
load_subsystem = "false"
hw_render = "false"
needs_fullpath = "true"
disk_control = "false"
is_experimental = "false"
# Firmware / BIOS
firmware_count = $count
EOF
set -e
CORE_INFO_CONTENT="${CORE_INFO_CONTENT}${CORE_INFO_DATS}
description = \"The ScummVM official port to libretro core.\""
echo "$CORE_INFO_CONTENT" > "${TARGET_PATH}/${INFO_FILE_PRE}_libretro.info"
echo "${INFO_FILE_PRE}_libretro.info created successfully"
else
# Create archive
rm -f "${TARGET_PATH}/$BUNDLE_ZIP_FILE"
cd "${TMP_PATH}"
zip -rq "${TARGET_PATH}/$BUNDLE_ZIP_FILE" "${BUNDLE_DIR}" > /dev/null 2>&1
cd - > /dev/null
# Remove temporary directories
rm -rf "$TMP_PATH"
echo "$BUNDLE_ZIP_FILE created successfully"
fi

View File

@@ -0,0 +1,119 @@
#!/bin/bash
# Copyright (C) 2022 Giovanni Cascione <ing.cascione@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Externally passed variables shall be:
# $1 [REQ] BUILD_PATH
# $2 [REQ] SCUMMVM_PATH
# $3 [REQ] NO_WIP [0,1]
# $4 [REQ] STATIC_LINKING [0,1]
# $5 [REQ] LITE [0,1,2]
# $[...] [OPT] Engines dependencies/components not available
set -e
# Exit if in parameters are not provided
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ] || [ -z $5 ] ; then
exit 1
fi
# Get parameters
BUILD_PATH="$1"
shift
SCUMMVM_PATH="$1"
shift
NO_WIP=$1
shift
STATIC_LINKING=$1
shift
LITE=$1
shift
no_deps_comps=$@
cd "${SCUMMVM_PATH}"
# Retrieve all configure functions
sed -i.bak -e "s/exit 0/return 0/g" configure
. configure -h > /dev/null 2>&1
mv configure.bak configure > /dev/null 2>&1
_parent_engines_list=""
tot_deps=""
# Separate unavailable dependencies from components
for item in $no_deps_comps ; do
case $item in
component_*)
append_var no_comps "${item#component_}"
;;
*)
append_var no_deps "${item}"
;;
esac
done
# Test NO_WIP
[ $NO_WIP -ne 1 ] && engine_enable_all
# Test LITE
[ $LITE -ne 0 ] && engine_disable_all
if [ $LITE -eq 1 ] ; then
for eng in $(cat "${BUILD_PATH}"/lite_engines.list) ; do
engine_enable "$eng"
done
fi
# Define engines list
for a in $_engines ; do
# Collect all default engines dependencies and force to yes
for dep in $(get_var _engine_${a}_deps) ; do
found=0
for rec_dep in $tot_deps ; do
[ $dep = $rec_dep ] && found=1
done
[ $found -eq 0 ] && append_var tot_deps "$dep"
done
done
# Set all deps to yes then set no for the one in no_deps list. Engines will be disabled in engines.awk if needed
for dep in $tot_deps ; do
set_var _$dep yes
done
for dep in $no_deps ; do
set_var _$dep no
done
# Disable unavailable components
for comp in $(get_var _components); do
for dep in $no_comps ; do
if [ $comp = $dep ] ; then
set_var _feature_${comp}_settings no
break
fi
done
done
# Create needed engines build files
awk -f "./engines.awk" < /dev/null > /dev/null 2>&1
mkdir -p "engines"
copy_if_changed engines/engines.mk.new "engines/engines.mk"
copy_if_changed engines/detection_table.h.new "engines/detection_table.h"
copy_if_changed engines/plugins_table.h.new "engines/plugins_table.h"
echo 0

View File

@@ -0,0 +1,76 @@
#!/bin/bash
# Copyright (C) 2022 Giovanni Cascione <ing.cascione@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Externally passed variables shall be:
# $1 [REQ] repository URL
# $2 [REQ] target commit
# $3 [REQ] submodules folder
# $4 [REQ] allow dirty submodules [0,1]
# $5 [OPT] submodule folder (if not specified will be the same name of the repository)
# Any error response will interrupt the script and will not reach the "0" output, to be used for success test upstream
set -e
TARGET_URL=$1
TARGET_COMMIT=$2
SUBMODULES_PATH=$3
[ -z $4 ] && ALLOW_DIRTY=0 || ALLOW_DIRTY=$4
[ -z $5 ] && SUBMODULE_FOLDER=$(echo $TARGET_URL | sed "s|.*/||") || SUBMODULE_FOLDER=$5
clone=0
reset=0
# Exit if in parameters are not provided
if [ -z $TARGET_URL ] || [ -z $TARGET_COMMIT ] || [ -z $SUBMODULES_PATH ] || [ -z $SUBMODULE_FOLDER ] ; then
exit 1
fi
# Create submodules folder if does not exist and move into it
[ ! -d $SUBMODULES_PATH ] && mkdir -p $SUBMODULES_PATH
cd $SUBMODULES_PATH
# Folder exists
if [ -d $SUBMODULE_FOLDER ]; then
# Folder is not our repo, not our commit or not git repo at all, remove and clone (no history) again
if [ ! $(cd $SUBMODULE_FOLDER && git config --get remote.origin.url 2>/dev/null) = $TARGET_URL ] || [ ! $(cd $SUBMODULE_FOLDER && git rev-parse HEAD 2>/dev/null) = $TARGET_COMMIT ] ; then
rm -rf ${SUBMODULE_FOLDER} && clone=1
fi
# Dirty repo in folder, reset hard
[ $ALLOW_DIRTY -ne 1 ] && [ $clone -ne 1 ] && [ ! -z "$(cd $SUBMODULE_FOLDER && git diff --shortstat 2>/dev/null)" ] && reset=1
# Folder does not exist
else
clone=1
fi
# Apply collected actions
if [ $clone -eq 1 ] ; then
mkdir -p $SUBMODULE_FOLDER
git -C $SUBMODULE_FOLDER init > /dev/null 2>&1
git -C $SUBMODULE_FOLDER remote add origin $TARGET_URL > /dev/null 2>&1
git -C $SUBMODULE_FOLDER fetch --depth 1 origin $TARGET_COMMIT > /dev/null 2>&1
git -C $SUBMODULE_FOLDER checkout FETCH_HEAD > /dev/null 2>&1
git -C $SUBMODULE_FOLDER submodule update --init --recursive --depth 1 > /dev/null 2>&1
fi
cd $SUBMODULE_FOLDER
[ $reset -eq 1 ] && git reset --hard > /dev/null 2>&1
# Success
echo 0

View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Copyright (C) 2022 Giovanni Cascione <ing.cascione@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This script is to extract shared modules definitions from ScummVM
# Makefile.common, in order to be in sync with modifications upstream
# Externally passed variables shall be:
# $1 [REQ] ScummVM Makefile.common full path
if [ -f "$1" ] ; then
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/§/g' -e 's|.*-include engines/engines.mk||' -e 's/###.*//' -e 's/§/\n/g' -e 's|MODULES|SHARED_MODULES|g' "$1"
else
printf "\$(error Error retrieving shared modules definitions from main Makefile.common)"
fi