From dc49e9b3257244861ac566b8138627e1e2060ec3 Mon Sep 17 00:00:00 2001 From: BetaRays Date: Sat, 16 Feb 2019 18:45:38 +0100 Subject: [PATCH 1/7] =?UTF-8?q?Touhou=20Youyoumu=20~=20Perfect=20Cherry=20?= =?UTF-8?q?Blossom=20-=20Demo=20=E2=80=93=20New=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ou-youyoumu-perfect-cherry-blossom-demo.sh | 179 ++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100755 play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh diff --git a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh new file mode 100755 index 00000000..7028cc8c --- /dev/null +++ b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh @@ -0,0 +1,179 @@ +#!/bin/sh -e +set -o errexit + +### +# Copyright (c) 2015-2019, Antoine Le Gonidec +# Copyright (c) 2018-2019, BetaRays +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# This software is provided by the copyright holders and contributors "as is" +# and any express or implied warranties, including, but not limited to, the +# implied warranties of merchantability and fitness for a particular purpose +# are disclaimed. In no event shall the copyright holder or contributors be +# liable for any direct, indirect, incidental, special, exemplary, or +# consequential damages (including, but not limited to, procurement of +# substitute goods or services; loss of use, data, or profits; or business +# interruption) however caused and on any theory of liability, whether in +# contract, strict liability, or tort (including negligence or otherwise) +# arising in any way out of the use of this software, even if advised of the +# possibility of such damage. +### + +### +# Touhou Youyoumu ~ Perfect Cherry Blossom - Demo +# build native packages from the original installers +# send your bug reports to vv221@dotslashplay.it +### + +script_version=20190216.1 + +# Set game-specific variables + +GAME_ID='touhou-youyoumu-perfect-cherry-blossom-demo' +GAME_NAME='Touhou Youyoumu ~ Perfect Cherry Blossom - Demo' + +SCRIPT_DEPS='iconv convmv' + +ARCHIVE_ZUN='youmu_tr011.lzh' +ARCHIVE_ZUN_URL='http://www16.big.or.jp/~zun/html/th07_update.html' +ARCHIVE_ZUN_MD5='05360e859c1a3ca173b9d57d96a45b9b' +ARCHIVE_ZUN_VERSION='0.11-zun' +ARCHIVE_ZUN_SIZE='11000' +ARCHIVE_ZUN_TYPE='lzh' + +ARCHIVE_DOC_DATA_PATH='youmu' +ARCHIVE_DOC_DATA_FILES='*.txt マニュアル' + +ARCHIVE_GAME_BIN_PATH='youmu' +ARCHIVE_GAME_BIN_FILES='*.exe' + +ARCHIVE_GAME_DATA_PATH='youmu' +ARCHIVE_GAME_DATA_FILES='*.dat' + +CONFIG_FILES='th07.cfg' +DATA_DIRS='./userdata' + +APP_MAIN_TYPE='wine' +APP_MAIN_EXE='th07.exe' +APP_MAIN_ICON='th07.exe' + +APP_CONFIG_ID="${GAME_ID}_config" +APP_CONFIG_TYPE='wine' +APP_CONFIG_PRERUN='export LC_ALL=ja_JP.UTF-8' +APP_CONFIG_EXE='custom.exe' +APP_CONFIG_ICON='custom.exe' +APP_CONFIG_NAME="$GAME_NAME - configuration" +APP_CONFIG_CAT='Settings' + +PACKAGES_LIST='PKG_BIN PKG_DATA' + +PKG_DATA_ID="${GAME_ID}-data" +PKG_DATA_DESCRIPTION='data' + +PKG_BIN_ARCH='32' +PKG_BIN_DEPS="$PKG_DATA_ID wine" +PKG_BIN_DEPS_DEB='fonts-wqy-microhei' +PKG_BIN_DEPS_ARCH='wqy-microhei' +PKG_BIN_DEPS_GENTOO='media-fonts/wqy-microhei' +PKG_BIN_POSTINST_WARN='You may need to generate the ja_JP.UTF-8 locale for the configuration program to run +You need a MIDI synthetiser for music to play in the game (you can use timidity++ or fluidsynth if you don’t have a hardware synthetiser)' + +# Load common functions + +target_version='2.10' + +if [ -z "$PLAYIT_LIB2" ]; then + : "${XDG_DATA_HOME:="$HOME/.local/share"}" + for path in\ + "$PWD"\ + "$XDG_DATA_HOME/play.it"\ + '/usr/local/share/games/play.it'\ + '/usr/local/share/play.it'\ + '/usr/share/games/play.it'\ + '/usr/share/play.it' + do + if [ -e "$path/libplayit2.sh" ]; then + PLAYIT_LIB2="$path/libplayit2.sh" + break + fi + done +fi +if [ -z "$PLAYIT_LIB2" ]; then + printf '\n\033[1;31mError:\033[0m\n' + printf 'libplayit2.sh not found.\n' + exit 1 +fi +#shellcheck source=play.it-2/lib/libplayit2.sh +. "$PLAYIT_LIB2" + +# Extract game data + +extract_data_from "$SOURCE_ARCHIVE" + +# Convert the file names to UTF-8 encoding + +find "$PLAYIT_WORKDIR/gamedata" -exec convmv --notest -f SHIFT-JIS -t UTF-8 {} + + +prepare_package_layout +rm --recursive "$PLAYIT_WORKDIR/gamedata" + +# Convert the text files to UTF-8 encoding + +for file in "${PKG_DATA_PATH}${PATH_DOC}"/*.txt; do + contents="$(iconv --from-code SHIFT-JIS "$file")" + printf '%s' "$contents" > "$file" +done + +# Fix website link + +pattern='s|http://www16\.big\.or\.jp/.zun/|http://www16.big.or.jp/~zun/|' +file="${PKG_DATA_PATH}${PATH_DOC}/readme.txt" +sed --in-place "$pattern" "$file" + +# Extract game icons + +PKG='PKG_BIN' +icons_get_from_package 'APP_MAIN' 'APP_CONFIG' +icons_move_to 'PKG_DATA' + +# Write launchers + +PKG='PKG_BIN' +write_launcher 'APP_MAIN' 'APP_CONFIG' + +# Store saved games and settings outside of WINE prefix + +# shellcheck disable=SC2016 +saves_path='$WINEPREFIX/drive_c/users/$(whoami)/Application Data/ShanghaiAlice/th07tr' #TODO: check this +# shellcheck disable=SC2016 +pattern='s#init_prefix_dirs "$PATH_DATA" "$DATA_DIRS"#&' +pattern="$pattern\\nif [ ! -e \"$saves_path\" ]; then" +pattern="$pattern\\n\\tmkdir --parents \"${saves_path%/*}\"" +pattern="$pattern\\n\\tln --symbolic \"\$PATH_DATA/userdata\" \"$saves_path\"" +pattern="$pattern\\nfi#" +sed --in-place "$pattern" "${PKG_BIN_PATH}${PATH_BIN}"/* + +# Build package + +write_metadata +build_pkg + +# Clean up + +rm --recursive "$PLAYIT_WORKDIR" + +# Print instructions + +print_instructions + +exit 0 -- GitLab From ec8c8b44ad5e8d93201635e2d08fa9acf15c749c Mon Sep 17 00:00:00 2001 From: BetaRays Date: Sat, 16 Feb 2019 18:57:03 +0100 Subject: [PATCH 2/7] =?UTF-8?q?Touhou=20Youyoumu=20~=20Perfect=20Cherry=20?= =?UTF-8?q?Blossom=20-=20Demo=20=E2=80=93=20Fix=20shellcheck=20false=20pos?= =?UTF-8?q?itives?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh index 7028cc8c..fdbdfb1c 100755 --- a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh +++ b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh @@ -85,6 +85,7 @@ PKG_BIN_DEPS="$PKG_DATA_ID wine" PKG_BIN_DEPS_DEB='fonts-wqy-microhei' PKG_BIN_DEPS_ARCH='wqy-microhei' PKG_BIN_DEPS_GENTOO='media-fonts/wqy-microhei' +#shellcheck disable=SC1112 PKG_BIN_POSTINST_WARN='You may need to generate the ja_JP.UTF-8 locale for the configuration program to run You need a MIDI synthetiser for music to play in the game (you can use timidity++ or fluidsynth if you don’t have a hardware synthetiser)' -- GitLab From 27b03301260617bdc314da86ec7b05c031c24875 Mon Sep 17 00:00:00 2001 From: BetaRays Date: Fri, 19 Apr 2019 18:48:06 +0200 Subject: [PATCH 3/7] =?UTF-8?q?Touhou=20Youyoumu=20~=20Perfect=20Cherry=20?= =?UTF-8?q?Blossom=20-=20Demo=20=E2=80=94=20Specify=20destination=20encodi?= =?UTF-8?q?ng=20for=20iconv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way the conversion will use the same encoding with every locale --- .../games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh index fdbdfb1c..510958f8 100755 --- a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh +++ b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh @@ -35,7 +35,7 @@ set -o errexit # send your bug reports to vv221@dotslashplay.it ### -script_version=20190216.1 +script_version=20190419.1 # Set game-specific variables @@ -131,7 +131,7 @@ rm --recursive "$PLAYIT_WORKDIR/gamedata" # Convert the text files to UTF-8 encoding for file in "${PKG_DATA_PATH}${PATH_DOC}"/*.txt; do - contents="$(iconv --from-code SHIFT-JIS "$file")" + contents="$(iconv --from-code SHIFT-JIS --to-code UTF-8 "$file")" printf '%s' "$contents" > "$file" done -- GitLab From 2a0deadfaa310a4973eeba1f7155f13e1aa577f3 Mon Sep 17 00:00:00 2001 From: BetaRays Date: Wed, 5 Jun 2019 20:05:58 +0200 Subject: [PATCH 4/7] =?UTF-8?q?Touhou=20Youyoumu=20~=20Perfect=20Cherry=20?= =?UTF-8?q?Blossom=20-=20Demo=20=E2=80=94=20Silence=20convmv=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh index 510958f8..fbb5ca0d 100755 --- a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh +++ b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh @@ -123,7 +123,7 @@ extract_data_from "$SOURCE_ARCHIVE" # Convert the file names to UTF-8 encoding -find "$PLAYIT_WORKDIR/gamedata" -exec convmv --notest -f SHIFT-JIS -t UTF-8 {} + +find "$PLAYIT_WORKDIR/gamedata" -exec convmv --notest -f SHIFT-JIS -t UTF-8 {} + >/dev/null 2>&1 prepare_package_layout rm --recursive "$PLAYIT_WORKDIR/gamedata" -- GitLab From c8ad642e39e37cc7c7c255950f436fed4c96f508 Mon Sep 17 00:00:00 2001 From: BetaRays Date: Thu, 6 Jun 2019 11:59:15 +0200 Subject: [PATCH 5/7] =?UTF-8?q?Touhou=20Youyoumu=20~=20Perfect=20Cherry=20?= =?UTF-8?q?Blossom=20-=20Demo=20=E2=80=94=20Fix=20saves=20paths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...touhou-youyoumu-perfect-cherry-blossom-demo.sh | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh index fbb5ca0d..5f831dce 100755 --- a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh +++ b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh @@ -61,7 +61,8 @@ ARCHIVE_GAME_DATA_PATH='youmu' ARCHIVE_GAME_DATA_FILES='*.dat' CONFIG_FILES='th07.cfg' -DATA_DIRS='./userdata' +DATA_FILES='./log.txt ./score.dat' +DATA_DIRS='./replay' APP_MAIN_TYPE='wine' APP_MAIN_EXE='th07.exe' @@ -152,18 +153,6 @@ icons_move_to 'PKG_DATA' PKG='PKG_BIN' write_launcher 'APP_MAIN' 'APP_CONFIG' -# Store saved games and settings outside of WINE prefix - -# shellcheck disable=SC2016 -saves_path='$WINEPREFIX/drive_c/users/$(whoami)/Application Data/ShanghaiAlice/th07tr' #TODO: check this -# shellcheck disable=SC2016 -pattern='s#init_prefix_dirs "$PATH_DATA" "$DATA_DIRS"#&' -pattern="$pattern\\nif [ ! -e \"$saves_path\" ]; then" -pattern="$pattern\\n\\tmkdir --parents \"${saves_path%/*}\"" -pattern="$pattern\\n\\tln --symbolic \"\$PATH_DATA/userdata\" \"$saves_path\"" -pattern="$pattern\\nfi#" -sed --in-place "$pattern" "${PKG_BIN_PATH}${PATH_BIN}"/* - # Build package write_metadata -- GitLab From 49d99eb7508dcb349473fbdbd7af5cf59b42943a Mon Sep 17 00:00:00 2001 From: BetaRays Date: Thu, 6 Jun 2019 12:02:30 +0200 Subject: [PATCH 6/7] =?UTF-8?q?Touhou=20Youyoumu=20~=20Perfect=20Cherry=20?= =?UTF-8?q?Blossom=20=E2=80=94=20Update=20script=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh index 5f831dce..73d84c17 100755 --- a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh +++ b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh @@ -35,7 +35,7 @@ set -o errexit # send your bug reports to vv221@dotslashplay.it ### -script_version=20190419.1 +script_version=20190606.1 # Set game-specific variables -- GitLab From 3458d5df873e84a35b7fd8c8bcae3ac7d5cf7d14 Mon Sep 17 00:00:00 2001 From: BetaRays Date: Thu, 6 Jun 2019 12:04:20 +0200 Subject: [PATCH 7/7] =?UTF-8?q?Touhou=20Youyoumu=20~=20Perfect=20Cherry=20?= =?UTF-8?q?Blossom=20=E2=80=94=20Change=20source=20encoding=20to=20CP932?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems to be used instead of “SHIFT-JIS”. --- ...play-touhou-youyoumu-perfect-cherry-blossom-demo.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh index 73d84c17..36598ce6 100755 --- a/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh +++ b/play.it-2/games/play-touhou-youyoumu-perfect-cherry-blossom-demo.sh @@ -35,7 +35,7 @@ set -o errexit # send your bug reports to vv221@dotslashplay.it ### -script_version=20190606.1 +script_version=20190606.2 # Set game-specific variables @@ -132,16 +132,10 @@ rm --recursive "$PLAYIT_WORKDIR/gamedata" # Convert the text files to UTF-8 encoding for file in "${PKG_DATA_PATH}${PATH_DOC}"/*.txt; do - contents="$(iconv --from-code SHIFT-JIS --to-code UTF-8 "$file")" + contents="$(iconv --from-code CP932 --to-code UTF-8 "$file")" printf '%s' "$contents" > "$file" done -# Fix website link - -pattern='s|http://www16\.big\.or\.jp/.zun/|http://www16.big.or.jp/~zun/|' -file="${PKG_DATA_PATH}${PATH_DOC}/readme.txt" -sed --in-place "$pattern" "$file" - # Extract game icons PKG='PKG_BIN' -- GitLab