diff --git a/nwjs/nwjs/packagefiles/nwjsstart-cicpoffs.sh b/nwjs/nwjs/packagefiles/nwjsstart-cicpoffs.sh index f83048f..795ac85 100644 --- a/nwjs/nwjs/packagefiles/nwjsstart-cicpoffs.sh +++ b/nwjs/nwjs/packagefiles/nwjsstart-cicpoffs.sh @@ -1,21 +1,26 @@ #!/bin/bash -export LD_LIBRARY_PATH="$HOME/desktopapps/nwjs/nwjs/packagefiles/:$LD_LIBRARY_PATH" # kdialog --msgbox "$CPATH" # curdesktop=$(echo "$XDG_CURRENT_DESKTOP") # defp="$HOME/deskappbin/nwjs/nwjs/" -version='1.0.7' +version='1.0.8' - -nwjsfm="$HOME/desktopapps/nwjs/nwjs" +mainfd="$HOME/desktopapps" +nwjsfm="$mainfd/nwjs/nwjs" +export LD_LIBRARY_PATH="$mainfd/nwjs/nwjs/packagefiles/:$LD_LIBRARY_PATH" yadp="$nwjsfm/packagefiles/yad" +tyranounpacker="$nwjsfm/packagefiles/tyranodataextract" +electronfd="$mainfd/electron-tyrano" +mkxpzp="$mainfd/mkxp-z" +evbunpack="$nwjsfm/packagefiles/evbunpack" +ndmodulesfd="$nwjsfm/packagefiles/tyranobuilder/node_modules" defp="$nwjsfm/nwjs" export defpn="$nwjsfm" - +export DWNWJSNODEBUG=true nwjslist=$(ls -p "$defp" | grep /) @@ -90,24 +95,14 @@ geticonpath=$(sed -n 's/.*"icon": "//p' "$nwjstestpath/package.json" | sed -e 's if [ "$engine" = "mz" ] && [ -z "$PACKAGEJSONPATH" ]; then geticonpath=$(echo "$geticonpath" | sed -e 's@www/@@g'); fi -bmountpath=$(basename "$mountpath") -if [ "$engine" = "mv" ]; then -ndirname=$(dirname "$mountpath") -# echo 1 -else -ndirname="$mountpath" -# echo 2 -fi +ndirname="$npath" + ndrbasen=$(basename "$ndirname") iconpath="$ndirname/$geticonpath" -# kdialog --msgbox "$mountpath-$bmountpath\n$ndirname\n$iconpath" - if [ -z "$dsavepath" ]; then dsavepath="$ndirname" fi -getgamename="Your game" #$(basename "$mountpath") -# kdialog --msgbox "$iconpath" if ! [ -f "$dsavepath/$ndrbasen.desktop" ]; then echo "[Desktop Entry] Name=$ndrbasen @@ -153,18 +148,20 @@ fi #pixi func } -texthookerplugininstall() { -echo "Installing the text hooker plugin" -texthookerpligin="$nwjsfm/packagefiles/plugins/Clipboard_llule.js" -pluginsfile="$mountpath/js/plugins.js" -if grep -q 'Clipboard_llule","status":true,' "$pluginsfile"; then -echo "The texthooker plugin is already installed" +plugininstallfunc() { +# echo "Installing the text hooker plugin" +yourplugin="$1" +bnpl=$(basename "$1" | sed -e 's@.js@@g') +pluginslistfile="$mountpath/js/plugins.js" + +if grep -q "$bnpl\",\"status\":true," "$pluginslistfile"; then +echo "The $bnpl plugin is already installed" else -cp "$pluginsfile" "$pluginsfile.bk" -sed -e 's@^\[$@[\n{"name":"Clipboard_llule","status":true,"description":"","parameters":{}},@g' -i "$pluginsfile" -cp "$texthookerpligin" "$mountpath/js/plugins/"; +cp "$pluginslistfile" "$pluginslistfile.bk" +sed -e "s@^\[@[\n$pluginset@g" -i "$pluginslistfile" +cp "$yourplugin" "$mountpath/js/plugins/"; fi } @@ -182,6 +179,19 @@ fi } +fivehundredslotsplugininstall() { +pluginset='{"name":"CustomizeMaxSaveFile","status":true,"description":"Customize max save file number","parameters":{"SaveFileNumber":"500"}},' +plugininstallfunc "$nwjsfm/packagefiles/plugins/CustomizeMaxSaveFile.js" + +} + +texthookerplugininstall() { +pluginset='{"name":"Clipboard_llule","status":true,"description":"","parameters":{}},' +plugininstallfunc "$nwjsfm/packagefiles/plugins/Clipboard_llule.js" + +} + + sourcelinks() { @@ -205,6 +215,151 @@ fullupdatereinstall() { echo "$githubscriptwget" | bash } +unpackexe() { +gameexe="$1" +gameexefd="$1-extracted" +originalexe=$(echo "$1" | sed -e 's@\.exe@@g' -e 's@$@_original.exe-extracted@g') +"$evbunpack" "$gameexe" "$gameexefd" +# find "$gameexefd" -type f \( -name "*.exe" \) -delete +cp -r "$gameexefd"/* "$npath" +mkdir "$originalexe" +} + +tyranoextractv4exe() { +if [ -n "$exenpath" ]; then +# kdialog --msgbox "hhhcc" +"$tyranounpacker" exe "$exenpath" "$npath" +else +exen=$(ls -p "$npath" | grep -v "/$" | grep "\.exe$") +"$tyranounpacker" exe "$exenpath" "$npath" +fi +} + +tyranolndatafd() { +rm "$mainfd/nwjs/nwjs/packagefiles/tyranobuilder/tyranoeng/data" +if [ "$npath/data/others/translate/main.js" ]; then +cat "$mainfd/nwjs/nwjs/packagefiles/tyranobuilder/pathches/tf/main.js" > "$npath/data/others/translate/main.js" +fi +ln -fs "$npath/data" "$mainfd/nwjs/nwjs/packagefiles/tyranobuilder/tyranoeng" +} + + +mkxpzdownload() { +if [ "$arch" = "x86_64" ]; then +link="https://github.com/bakustarver/rpgmakermlinux-cicpoffs/releases/download/libraries/mkxp-z.$arch.zip" +wget -O /tmp/mkxp-z.zip "$link" +unzip -d "$mkxpzp" /tmp/mkxp-z.zip +sed -e "s@\"RGSS@\"$mkxpzp/RGSS@g" -i "$mkxpzp/mkxp.json" +rm /tmp/mkxp-z.zip +else +echo For this release, supported x86_64 only +fi +} + +mkxpzdialog() { +$yadp --image="dialog-question" \ + --title "Rpg Maker VX Ace / VX/ XP Launcher: $line" \ + --text "Mkxp-z module is not installed\nWould you like to download it?\n+292 mb" \ + --button="Yes:0" \ + --button="No:1" \ +retmkxpz=$? + +if [[ $retmkxpz -eq 1 ]]; then +exit; +elif [[ $retmkxpz -eq 0 ]]; then +mkxpzdownload; +fi + +} + + +electron-tyrano-downloader() { +yarch=$(echo "$arch" | sed -e 's@x86_64@x64@g' -e 's@i686@ia32@g' -e 's@aarch64@arm64@g') +link="https://github.com/electron/electron/releases/download/v9.4.4/electron-v9.4.4-linux-$yarch.zip" +wget -O /tmp/electron-tyrano.zip "$link" +unzip -d "$electronfd" /tmp/electron-tyrano.zip +rm /tmp/electron-tyrano.zip +} + +tyranocheckelectron() { +$yadp --image="dialog-question" \ + --title "Tyranobuilder Launcher: $line" \ + --text "Founded electron game $line!\nHow would you like to open it?" \ + --button="Electron (Recomended):0" \ + --button="NWJS:1" \ + --button="Exit:2" +rettyranoelectron=$? +if [ -n "$asarpath" ]; then +"$tyranounpacker" asarapp "$asarpath" "$npath/resources/app" +fi + + +if [[ $rettyranoelectron -eq 0 ]]; then + + +if ! [ -f "$electronfd/electron" ]; then +electron-tyrano-downloader +fi + +rm "$electronfd/resources/app" +sed '/$.userenv = function/,/};/c\ + $.userenv = function () {\ + return "pc";\ + };' -i "$npath/resources/app/tyrano/libs.js" +ln -fs "$npath/resources/app" "$electronfd/resources/" +usetyranoelectron=true +elif [[ $rettyranoelectron -eq 1 ]]; then +rm "$mainfd/nwjs/nwjs/packagefiles/tyranobuilder/tyranoeng/data" +ln -fs "$npath/resources/app/data" "$mainfd/nwjs/nwjs/packagefiles/tyranobuilder/tyranoeng" +elif [[ $rettyranoelectron -eq 2 ]]; then +exit; +fi +} + +tyranoelectron() { +if [ -n "$asarpath" ]; then +"$tyranounpacker" asarapp "$asarpath" "$npath/resources/app" +fi +rm "$electronfd/resources/app" +sed '/$.userenv = function/,/};/c\ + $.userenv = function () {\ + return "pc";\ + };' -i "$npath/resources/app/tyrano/libs.js" +ln -fs "$npath/resources/app" "$electronfd/resources/" +usetyranoelectron=true +} + + +searchforpackedexe() { +local gfexe=$(ls -p "$1" | grep -v "/$" | grep "\.exe$") +npath="$1" +while IFS= read -r line; do +# check=$() +if ! [ -d "$npath/$line-extracted" ]; then + +if strings "$npath/$line" | grep -m 1 -q "\.enigma"; then +$yadp --image="dialog-question" \ + --title "RPG Maker linux: $line" \ + --text "Detected game files in $line!\nWould you like to unpack it?" \ + --button="Yes:0" \ + --button="No:1" +ret=$? +# ret=1; +# fi +name=$(echo "$line") + + +if [[ $ret -eq 1 ]]; then +mkdir "$npath/$line-extracted"; +elif [[ $ret -eq 0 ]]; then +unpackexe "$npath/$line" +fi +fi +# echo "$name" +# echo "$check" +fi +done <<< "$gfexe" +} updatenwjs() { @@ -242,13 +397,25 @@ fi # fi } +electronch2() { +if [ -f "$electronfd/electron" ]; then +tyranoelectron +tyranoeng=electron +else +tyranocheckelectron +fi +} + checkgamefilesfd() { npath=$(echo "$1" | sed -e 's@rpgmakermp:///@@g') if echo "$npath" | grep ".exe"; then +exenpath="$npath" npath=$(dirname "$npath" | sed -e "s@^'@@g"); else npath="$npath" fi +# kdialog --msgbox "$npath" +searchforpackedexe "$npath" # zenity --title "$gamef" --warning --text="$npath" if [ -d "$npath/www" ] && [ -e "$npath/package.json" ] && [ -e "$npath/www/js/plugins.js" ]; then mountpath="$npath/www" @@ -260,6 +427,36 @@ mountpath="$npath" gamepath=true found=true engine=mz +elif [ -e "$npath/Game.ini" ] && [ -e "$npath/Game.exe" ]; then + +if ! [ -f $mkxpzp/mkxp-z.x86_64 ]; then +mkxpzdialog +fi + +sed -e "s@.*.gameFolder.*@ \"gameFolder\": \"$npath\",@g" -i "$mkxpzp/mkxp.json" +"$mkxpzp/mkxp-z.x86_64" + +elif [ -e "$npath/ffmpegsumo.dll" ] && [ -e "$npath/nw.pak" ] && [ -e "$npath/d3dcompiler_47.dll" ] && [ -e "$npath/nw.pak" ]; then +mountpath="$npath" +# gamepath=true +# found=true +engine=tyrano +tyranoeng=nwjs + +if [ -d "$npath/data" ] && [ -e "$npath/data/system/Config.tjs" ]; then +tyranolndatafd +else +tyranoextractv4exe +tyranolndatafd +fi +elif [ -d "$npath/resources" ] && [ -d "$npath/locales" ] && [ -e "$npath/chrome_100_percent.pak" ] && [ -e "$npath/natives_blob.bin" ] && [ -e "$npath/chrome_200_percent.pak" ]; then +engine=tyrano +if [ -d "$npath/resources/app/data" ] && [ -f "$npath/resources/app/index.html" ] && [ -f "$npath/resources/app/main.js" ] && [ -d "$npath/resources/app/tyrano" ]; then +electronch2 +elif [ -f "$npath/resources/app.asar" ]; then +asarpath="$npath/resources/app.asar" +electronch2 +fi else echo "Can't find game with $npath" exit 1 @@ -282,21 +479,27 @@ checkgamefilesfd "$path" } if [ -z "$gamepath" ]; then +searchforpackedexe "$PWD" if [ -d ./www ] && [ -f ./package.json ]; then mountpath="$PWD/www" found=true engine=mv +npath="$PWD" elif [ -d ./js ] && [ -f ./package.json ] && [ -d ./data ]; then mountpath="$PWD" found=true engine=mz +npath="$PWD" fi fi +# fi # -if [ -z "$found" ] && [ -n "$gamef" ] ; then -kdialog --msgbox "$gamef" +if [ -z "$found" ]; then +if [ -n "$gamef" ]; then +# kdialog --msgbox "$gamef" checkgamefilesfd "$gamef" fi +fi @@ -579,16 +782,16 @@ updatenwjsvar=$(echo "$@" | awk '{print $1}') pixiupdatevar=$(echo "$@" | awk '{print $2}') localshortcutvar=$(echo "$@" | awk '{print $3}') nwjsguivar=$(echo "$@" | awk '{print $4}') -jpnlocalevar=$(echo "$@" | awk '{print $5}') +fivehundredsaveslotspluginvar=$(echo "$@" | awk '{print $5}') texthookerset=$(echo "$@" | awk '{print $6}') desktopshortcut=$(echo "$@" | awk '{print $7}') addtomenuvar=$(echo "$@" | awk '{print $8}') sdkvar=$(echo "$@" | awk '{print $9}') -# kdialog --msgbox "$updatenwjsvar $pixiupdate $localshortcut $texthookerset dc $desktopshortcut $addtomenuvar $sdkvar $nwjsguivar" +# kdialog --msgbox "$updatenwjsvar $pixiupdate $localshortcut $texthookerset dc $desktopshortcut $addtomenuvar $sdkvar $nwjsguivar hh $fivehundredsaveslotspluginvar" } -if [ "$GUIMENU" = "true" ]; then +guirpgmakermfn() { configgp="$HOME/desktopapps/rpgmaker-guiconfig.txt" if [ -f "$configgp" ]; then configgdata=$(cat "$configgp") @@ -598,9 +801,9 @@ if [ -z "$newversionlist" ]; then newversionlist="$allversionsnwjs" fi # kdialog --msgbox "$nwjsguivar\n--$newversionlist" -guim=$("$yadp" --title "RPG Maker MV/MZ Options" --text="Please choose your options:" --image="$HOME/desktopapps/nwjs/nwjs/packagefiles/nwjs128.png" --columns=5 --field "Update NWJS":chk $updatenwjsvar --form --field "Pixi5 Update":chk "$pixiupdatevar" --field="Shorcut Options::LBL" false --field "Local Shortcut":chk "$localshortcutvar" --form --separator=" " --item-separator="\n" --field="Versions::"CBE "$newversionlist" --field "Japanese Locale":chk "$jpnlocalevar" --field "Texthooker Plugin":chk "$texthookerset" --field=" :LBL" false --field "Desktop Shortcut":chk "$desktopshortcut" --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field "Show in the Menu":chk "$addtomenuvar" --field "Use SDK version":chk "$sdkvar" --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false) +guim=$("$yadp" --title "RPG Maker MV/MZ Options" --text="Please choose your options:" --image="$HOME/desktopapps/nwjs/nwjs/packagefiles/nwjs128.png" --columns=5 --field "Update NWJS":chk $updatenwjsvar --form --field "Pixi5 Update":chk "$pixiupdatevar" --field="Shorcut Options::LBL" false --field "Local Shortcut":chk "$localshortcutvar" --form --separator=" " --item-separator="\n" --field="Versions::"CBE "$newversionlist" --field "500 Save Slots Plugin":chk "$fivehundredsaveslotspluginvar" --field "Texthooker Plugin":chk "$texthookerset" --field=" :LBL" false --field "Desktop Shortcut":chk "$desktopshortcut" --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field "Show in the Menu":chk "$addtomenuvar" --field "Use SDK version":chk "$sdkvar" --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false) else -guim=$("$yadp" --title "RPG Maker MV/MZ Options" --text="Please choose your options:" --image="$HOME/desktopapps/nwjs/nwjs/packagefiles/nwjs128.png" --columns=5 --field "Update NWJS":chk true --form --field "Pixi5 Update":chk false --field="Shorcut Options::LBL" false --field "Local Shortcut":chk true --form --separator=" " --item-separator="\n" --field="Versions::"CBE "$allversionsnwjs" --field "Japanese Locale":chk false --field "Texthooker Plugin":chk false --field=" :LBL" false --field "Desktop Shortcut":chk false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field "Show in the Menu":chk false --field "Use SDK version":chk false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false) +guim=$("$yadp" --title "RPG Maker MV/MZ Options" --text="Please choose your options:" --image="$HOME/desktopapps/nwjs/nwjs/packagefiles/nwjs128.png" --columns=5 --field "Update NWJS":chk true --form --field "Pixi5 Update":chk false --field="Shorcut Options::LBL" false --field "Local Shortcut":chk true --form --separator=" " --item-separator="\n" --field="Versions::"CBE "$allversionsnwjs" --field "500 Save Slots PSlugin":chk false --field "Texthooker Plugin":chk false --field=" :LBL" false --field "Desktop Shortcut":chk false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field "Show in the Menu":chk false --field "Use SDK version":chk false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false) fi if [ -n "$guim" ] ; then @@ -612,8 +815,9 @@ yaddata "$guim" echo "$guim" # exit; -if [ "$jpnlocalevar" = "TRUE" ]; then -export LANG="ja_JP.utf8" +if [ "$fivehundredsaveslotspluginvar" = "TRUE" ]; then +# export LANG="ja_JP.utf8" +export FIVEHUNDREDSAVESLOTSPLUGIN=true fi if [ "$updatenwjsvar" = "TRUE" ]; then @@ -660,6 +864,15 @@ export checkversionnwjs=false . "$nwjsfm/dwnwjs.sh" "$nwjsguivar" fi +} + + +if [ "$GUIMENU" = "true" ]; then +if [ "$engine" = "tyrano" ]; then +echo tyrano; +else +guirpgmakermfn +fi fi # exit; @@ -758,6 +971,9 @@ nwjstestpath=$(echo "$nwjstestpath" | sed -e 's@/$@@g') + + + startnw() { if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then echo "wayland detected" @@ -792,6 +1008,9 @@ rm "$nwjstestpath/www" mountwww() { packagejsonfunc +if [ -h "$nwjstestpath/www" ]; then +rm "$nwjstestpath/www" +fi if ! [ -d "$nwjstestpath/www" ]; then mkdir -p "$nwjstestpath/www" fi; @@ -814,6 +1033,10 @@ if [ "$INSTALLPIXI5" = "true" ]; then pixi5install; fi +if [ "$FIVEHUNDREDSAVESLOTSPLUGIN" = "true" ]; then +fivehundredslotsplugininstall; +fi + if [ "$INSTALLTHPL" = "true" ]; then texthookerplugininstall; elif [ "$INSTALLTHPL" = "false" ]; then @@ -829,7 +1052,19 @@ checkthebinaryarch "$cicpoffs" checkthebinaryarch "$nwjstestpath/nw" -if [ "$found" = "true" ]; then +if [ "$engine" = "tyrano" ]; then +if [ "$usetyranoelectron" = "true" ]; then +"$electronfd/electron" +else +ln -s "$ndmodulesfd" "$nwjstestpath" +ln -s "$mainfd/nwjs/nwjs/packagefiles/tyranobuilder/tyranoeng" "$nwjstestpath" +cat "$mainfd/nwjs/nwjs/packagefiles/tyranobuilder/package.json" > "$nwjstestpath/package.json" +startnw +fi + + + +elif [ "$found" = "true" ]; then # rmsymlinks mountwww if [ -n "$MAKELOCALSHORTCUT" ]; then @@ -845,3 +1080,5 @@ startnw # sleep 60; checkandunmount fi + + diff --git a/nwjs/nwjs/packagefiles/tyranodataextract b/nwjs/nwjs/packagefiles/tyranodataextract new file mode 100644 index 0000000..850ac7c Binary files /dev/null and b/nwjs/nwjs/packagefiles/tyranodataextract differ