diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..336e394 --- /dev/null +++ b/install.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +installpath=$(dirname "$0") +version="1.0.0" +if ! [ -d "$installpath/nwjs" ]; then +echo "Can't find nwjs folder" +exit 1; +fi +echo "Installing rpgmaker-linux v$version" + +mainfd="$HOME/desktopapps/nwjs" +localapplicationsfd="$HOME/.local/share/applications/" +localbin="$HOME/.local/bin" + +arch=$(uname -m) +archcheckmessage=$(echo "$arch" | sed -e 's@x86_64@pie executable, x86-64,@g' -e 's@aarch64@pie executable, ARM aarch64,@g' -e 's@i386@pie executable, Intel 80386,@g' -e 's@armhf@pie executable, ARM,@g') + +rm -rf "$mainfd" + +createfd() { +if ! [ -d "$1" ]; then +echo "Missing $1 creating one" +mkdir -p "$1" +fi; +} + +lnnew() { +if ! [ -f "$1" ]; then +echo "Can't find the $1 file" +fi + +if [ -h "$2" ]; then +rm "$2" +fi +ln -s "$1" "$2" + +} + +checkthebinaryarch() { +if ! [ -f "$1" ]; then +echo "Missing file $1" +fi + +if ! file "$1" | grep -q "$archcheckmessage" ; then +# Use $ wget -qO- installscript.sh | bash +file "$1" +echo "Wrong architecture!! +Download the correct version of the program with the name rpgmakerlinux-$arch-v1.0.0.tar.gz" +exit 1; +fi +} + +createfd "$mainfd" +createfd "$localapplicationsfd" +createfd "$localbin" + +checkthebinaryarch "$installpath/nwjs/cicpoffs" +cp "$installpath/install.sh" "$mainfd" +cp -r "$installpath/nwjs/" "$mainfd" + +# echo "Making a desktop file" +echo "[Desktop Entry] +Name=RPG Maker MV/MZ (cicpoffs mount) +Exec=$mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh --latest +Type=Application +Categories=Game +StartupNotify=true +MimeType=application/x-ms-dos-executable;application/x-wine-extension-msp; +Icon=$mainfd/nwjs/packagefiles/nwjs128.png +Terminal=true +NoDisplay=true" > "$localapplicationsfd/nwjstest.desktop" +chmod +x "$localapplicationsfd/nwjstest.desktop" + + +lnnew "$mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh" "$localbin/rpgmaker-linux" + + +echo "Installation Done" diff --git a/nwjs/cicpoffs b/nwjs/cicpoffs new file mode 100644 index 0000000..184f990 Binary files /dev/null and b/nwjs/cicpoffs differ diff --git a/nwjs/dwnwjs.sh b/nwjs/dwnwjs.sh new file mode 100644 index 0000000..2a71315 --- /dev/null +++ b/nwjs/dwnwjs.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +gitlink="https://github.com/nwjs/nw.js" +defp="$HOME/desktopapps/nwjs/nwjs" +versioninstalledlist=$(ls "$defp/nwjs") +arch=$(uname -m | sed -e 's@i386@ia32@g' -e 's@x86_64@x64@g' -e 's@armhf@arm@g' -e 's@aarch64@arm64@g') + + + +downloadandextract() { + +if [ -n "$nwjslinktar" ]; then +tar -xf "$defp/nwjs-$version-linux-$arch.tar.gz" -C "$defp/nwjs" +rm "$defp/nwjs-$version-linux-$arch.tar.gz" +echo Finished +fi + +} + + +if [ "$arch" = "arm" ]; then +nwjslinktar="https://github.com/bakustarver/rpgmakermlinux-cicpoffs/releases/download/libraries/nwjs-v0.60.1-linux-arm.tar.gz" +downloadandextract +elif [ "$arch" = "arm" ]; then +nwjslinktar="https://github.com/bakustarver/rpgmakermlinux-cicpoffs/releases/download/libraries/nwjs-v0.60.1-linux-arm64.tar.gz" +downloadandextract +fi +#get latest nwjs version info +if [ "$arch" = "x64" ] || [ "$arch" = "ia32" ]; then + +if [ -z "$@" ]; then +version=$(wget --user-agent 'Mozilla/5.0 (Windows NT 10.0; rv:123.0) Gecko/20100101 Firefox/123.0' -qO- "https://github.com/nwjs/nw.js/tags" | grep 'Link--primary Link' | head -n 1 | sed -e 's@.*">@@g' -e 's@<.*@@g' -e 's@nw-@@g') +else +if echo "$@" | grep -q "v[0-1].[0-9][0-9].[0]"; then +version="$@" +elif echo "$@" | grep -q "[0-1].[0-9][0-9].[0]"; then +version="v$@" +else +echo "Incorrect version name - $@" +exit 1; +fi + +if echo "$versioninstalledlist" | grep -q "$version" && [ "$skipdownloadifexist" = "true" ]; then +export nwjsversion="nwjs-$version-linux-$arch/" +fi +fi + + + +# echo "$latestlocal $version" +if [ -n "$latestlocal" ] && [ "$latestlocal" = "$version" ]; then +echo Your nwjs version is latest +echo Reinstall? y/n +read +if [ "$REPLY" = "y" ] || [ "$REPLY" = "yes" ]; then +rm -rf "$defp/nwjs/nwjs-$version-linux-x64/" +echo Reinstalling "$latestlocal"; +else +exit +fi +fi + + +# uname -p + +if [ "$skipdownloadifexist" = "true" ]; then + +echo skipping download; +else +wget -P "$defp" https://dl.nwjs.io/$version/nwjs-$version-linux-$arch.tar.gz + + +tar -xf "$defp/nwjs-$version-linux-$arch.tar.gz" -C "$defp/nwjs" +rm "$defp/nwjs-$version-linux-$arch.tar.gz" +fi +echo Finished +fi diff --git a/nwjs/packagefiles/nwjs128.png b/nwjs/packagefiles/nwjs128.png new file mode 100644 index 0000000..3a0eabe Binary files /dev/null and b/nwjs/packagefiles/nwjs128.png differ diff --git a/nwjs/packagefiles/nwjsstart-cicpoffs.sh b/nwjs/packagefiles/nwjsstart-cicpoffs.sh new file mode 100644 index 0000000..c58e1ed --- /dev/null +++ b/nwjs/packagefiles/nwjsstart-cicpoffs.sh @@ -0,0 +1,397 @@ +#!/bin/bash + + +# curdesktop=$(echo "$XDG_CURRENT_DESKTOP") +# defp="$HOME/deskappbin/nwjs/nwjs/" +nwjsfm="$HOME/desktopapps/nwjs/nwjs" + +defp="$nwjsfm/nwjs" + +arch=$(uname -m) +archcheckmessage=$(echo "$arch" | sed -e 's@x86_64@pie executable, x86-64,@g' -e 's@aarch64@pie executable, ARM aarch64,@g' -e 's@i386@pie executable, Intel 80386,@g' -e 's@armhf@pie executable, ARM,@g') +version="1.0.0" +latestinstallednwjsfd=$(ls -p "$defp" | grep / | sort -V | tail -n 1 ) + +checkthebinaryarch() { +if ! [ -f "$1" ]; then +echo "Missing file $1" +fi + +if ! file "$1" | grep -q "$archcheckmessage" ; then +# Use $ wget -qO- installscript.sh | bash +file "$1" +echo "Wrong architecture!! +Download corrent archive with $arch" +exit 1; +fi +} + +checkthebinariesarch() { +"$cicpoffs" +# - ask for download? +# - set custom path +"$nwjstestpath/nw" +# cicpoffspath + +} + + +sourcelinks() { + +echo "Github page +https://github.com/bakustarver/rpgmakermlinux-cicpoffs + +Patreon page +https://www.patreon.com/user/about?u=121421184 + +Buymeacoffe page +https://www.buymeacoffee.com/rpgmakerlinux" +} + +incompletefeaturefunc() { +echo "$arg" in development, wait for it on this site. +echo "https://github.com/bakustarver/rpgmakermlinux-cicpoffs" +} + + +updatenwjs() { +export latestlocal=$(echo "$latestinstallednwjsfd" | sed -e 's@nwjs-@@g' -e 's@-linux.*@@g') +"$nwjsfm/dwnwjs.sh" +} + +nwjsversionfunc() { +export skipdownloadifexist=true +. "$nwjsfm/dwnwjs.sh" "$1" +# nwjsversion=(echo "$nwjsversion" +} + +checkgamepath() { +# path="$1" +echo "$1" + +if [ -f "$1" ]; then +path=$(readlink -f "$1") +elif [ -d "$1" ]; then +path=$(echo "$1") +else +echo "Use "$arg' "/path/rpggame/"' +exit 1 +fi + +if [ -d "$path/www" ] && [ -e "$path/package.json" ] && [ -e "$path/www/js/plugins.js" ]; then +mountpath="$path/www" +found=true +gamepath=true +elif [ -d "$path/data" ] && [ -e "$path/package.json" ] && [ -e "$path/js/plugins.js" ]; then +mountpath="$path" +gamepath=true +found=true +else +echo "Can't find game with $arg" +exit 1 +fi +} + +if [ -z "$gamepath" ]; then +if [ -d ./www ] && [ -f ./package.json ]; then +mountpath="$PWD/www" +found=true +elif [ -d ./js ] && [ -f ./package.json ] && [ -d ./data ]; then +mountpath="$PWD" +found=true +fi +fi + +checknwjspath() { +path="$1" +if [ -d "$path/lib" ] && [ -e "$path/nw" ]; then +NWJSPATH="$path" +else +echo "Can't find NWJS" +exit 1 +fi +} + +checkcicpoffspath() { +path="$1" +if [ -e "$path" ]; then +cicpoffs="$path" +cicpoffspath="true" +else +echo "Can't find cicpoff" +exit 1 +fi +} + + +while [ $# -ne 0 ] +do + arg="$1" + arg2="$2" + case "$arg" in + --help) + help=true + info=true + ;; + --version) + showversion=true + info=true + ;; + --checkreleaseupdates) + info=true + incompletefeaturefunc + ;; + --checkbetaupdates) + info=true + incompletefeaturefunc + ;; + --chooselatestnwjs) + latestnwjs=true + ;; + --choosenwjsversion) + nwjsversionfunc "$2" + ;; + --clearoldnwjs) + clearoldnwjs=true + incompletefeaturefunc + ;; + --updatenwjs) + updatenwjs + ;; + --updatescripts) + disableCopperBld=true + incompletefeaturefunc + ;; + --unmount) + case "$arg2" in + false) + unmount=false + ;; + *) + echo -e "Use --unmount false + --unmount true" + info=true + ;; + esac + ;; + --gamepath) + checkgamepath "$2" + ;; + --usegamepackagejson) + usegamepackagejson=true + ;; + --nwjspath) + checknwjspath $2 + ;; + --cicpoffspath) + checkcicpoffspath "$2" + ;; + --printrpgmakerlibversions) + printrpgmakerlibversions=true + info=true + ;; + --forceaarch) + incompletefeaturefunc + case "$arg2" in + x86_64) + forceaarch="x86_64" + ;; + i386) + forceaarch="i386" + ;; + ia32) + forceaarch="i386" + ;; + aarch64) + forceaarch="arm64" + ;; + arm64) + forceaarch="arm64" + ;; + armhf) + forceaarch="armhf" + ;; + *) +# nothing="true" + echo -e " +Available architectures are +x86_64 +i386 +arm64 +armhf" + info=true + ;; + + esac + ;; + --jpnlocale) + LANG="ja_JP.utf8" + ;; + --sourcelinks) + sourcelinks + info=true + ;; + *) + nothing="true" + ;; + esac + shift +done + + +# --chooselatestnwjs --choosenwjsversion --nwjspath +#latestnwjs=true $nwjsversion #NWJSPATH +if [ "$latestnwjs" = "true" ] && [ -n "$nwjsversion" ] || [ "$latestnwjs" = "true" ] && [ -n "$NWJSPATH" ] || [ -n "$nwjsversion" ] && [ -n "$NWJSPATH" ]; then +echo "You can't use those arguments together --chooselatestnwjs --choosenwjsversion --nwjspath" +exit 1; +fi + +if [ "$showversion" = true ]; then +echo -e "$version" +fi + + + +if [ "$help" = true ]; then +echo -e "RPGMaker MV/MZ linux $version + +https://github.com/bakustarver/rpgmakermlinux-cicpoffs + +--help +--version +--updatenwjs +--chooselatestnwjs +--nwjsversion +--clearoldnwjs +--unmount +--gamepath +--usegamepackagejson +--nwjspath +--cicpoffspath +--printrpgmakerlibversions +--forceaarch +--jpnlocale +--checkreleaseupdates +--checkbetaupdates +--updatescripts +--sourcelinks" +fi + + + + +if [ "$printrpgmakerlibversions" = "true" ]; then +if [ "$found" = "true" ]; then + +if [ "$gamepath" = "true" ]; then +nwdllpath="$path/nw.dll" +nodedllpath="$path/node.dll" +else +nwdllpath="nw.dll" +nodedllpath="node.dll" +fi + +nwdlltext=$(strings "$nwdllpath") +nodeversion=$(strings "$nodedllpath" | grep '/win-.*/node.lib' | sed -e 's@https://nodejs.org/download/release/@@g' -e 's@/win-.*/node.lib@@g') +nwjsversiondll=$(echo "$nwdlltext" | sed -n "s/process.versions\['nw'\] = '//p" | sed -e "s@'.*@@g") +chromiumversion=$(echo "$nwdlltext" | grep -B 4 '::SHGetSpecialFolderPathW' | grep '\.[0-9]\.[0-9]' | sed -e 's@.*\.\$@@g') + +echo "NWJS version - $nwjsversiondll +Chromium version - $chromiumversion +Node version - $nodeversion + +ffmpeg prebuild link +https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt/releases/tag/$nwjsversion" +else +echo "Can't find the game path" +fi +fi + + +if [ "$info" = true ]; then +exit; +fi +# echo "$forceaarch" + + +if [ -z "$cicpoffspath" ]; then +cicpoffs="$HOME/desktopapps/nwjs/nwjs/cicpoffs" +fi +packagejson="$HOME/desktopapps/nwjs/nwjs/packagefiles/package.json" + +if [ "$latestnwjs" = "true" ]; then +nwjsf="$latestinstallednwjsfd" +else +nwjsf=$(ls -tp "$defp" | grep / | head -n 1) +fi +if [ -n "$nwjsversion" ]; then +nwjstestpath="$defp/nwjs/$nwjsversion" +else +nwjstestpath="$defp/$nwjsf" +fi + +# wwwsavesymlink.sh "$@" +# echo "$nwjstestpath" + + + + + +startnw() { +if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then +echo "wayland detected" +"$nwjstestpath/nw" --ozone-platform=wayland +else +echo "wayland not detected, starting in x11" +"$nwjstestpath/nw" --ozone-platform=x11 +fi +} + + + +#Unmount folder + +checkandunmount() { +if [ -z "$unmount" ]; then +testf=$(findmnt "$nwjstestpath/www"); +if [ -n "$testf" ]; then +fusermount -u "$nwjstestpath/www" +fi +fi +} + + +rmsymlinks () { +# rm "$nwjstestpath/package.json"; +rm "$nwjstestpath/www" +} + +mountwww() { +ln -s "$packagejson" "$nwjstestpath" +if ! [ -d "$nwjstestpath/www" ]; then +mkdir -p "$nwjstestpath/www" +fi; + +"$cicpoffs" "$mountpath" "$nwjstestpath/www" + +SECONDS=0; +while ! [ -d "$nwjstestpath/www/js" ]; do + +sleep 1 +echo Mounting the folder: Time passed $SECONDS seconds; +done +echo -e "Mounting done. +Total time: $SECONDS seconds" + +} + +checkandunmount +checkthebinaryarch "$cicpoffs" +checkthebinaryarch "$nwjstestpath/nw" + +if [ "$found" = "true" ]; then +# rmsymlinks +mountwww +startnw +checkandunmount +fi diff --git a/nwjs/packagefiles/package.json b/nwjs/packagefiles/package.json new file mode 100644 index 0000000..071016a --- /dev/null +++ b/nwjs/packagefiles/package.json @@ -0,0 +1,13 @@ +{ + "name": "summer_memories_plus", + "main": "www/index.html", + "js-flags": "--expose-gc", + "chromium-args": "--disable-setuid-sandbox-enable --force-gpu-rasterization --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers --enable-zero-copy --enable-gpu-async-worker-context", + "window": { + "title": "Summer Memories+ v2.03.10", + "toolbar": false, + "width": 745, + "height": 400, + "icon": "www/icon/icon.png" + } +}