-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
360 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
#!/bin/bash | ||
# Minecraft: Pi Edition: Reborn Bash Launcher | ||
# Copyright (C) 2022 bsX | ||
# | ||
# 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 <https://www.gnu.org/licenses/>. | ||
|
||
echo "" | ||
echo "Minecraft: Pi Edition: Reborn Bash Launcher | ||
Copyright (C) 2022 bsX | ||
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 <https://www.gnu.org/licenses/>." | ||
bld=$(tput bold) # Bold | ||
red=$(tput setaf 1) # Red | ||
grn=$(tput setaf 2) # Green | ||
ylw=$(tput setaf 3) # Yellow | ||
blu=$(tput setaf 4) # Blue | ||
pur=$(tput setaf 5) # Purple | ||
cyn=$(tput setaf 6) # Cyan | ||
wht=$(tput setaf 7) # White | ||
rst=$(tput sgr0) # Text reset | ||
echo "" | ||
echo "====================" | ||
echo "${bld}bMCPIL Configuration${rst}" | ||
echo "====================" | ||
echo "" | ||
# Make sure the user doesn't accidentally overwrite their config | ||
if [ "$cfg_new" != "1" ] | ||
then | ||
echo "Are you sure you want to re-configure BMCPIL?" | ||
echo "" | ||
read -p "Press [Enter] to continue, and Ctrl+C to exit. " | ||
echo "" | ||
fi | ||
|
||
# Replace the current contents of the config file with a shebang, followed by the copyright notice | ||
echo '#!/bin/bash | ||
# Minecraft: Pi Edition: Reborn Bash Launcher | ||
# Copyright (C) 2022 bsX | ||
# | ||
# 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 <https://www.gnu.org/licenses/>.' > config.bcfg | ||
# Print modification date | ||
echo -n '# Generated by bMCPIL on ' >> config.bcfg | ||
echo -n `date +%D` >> config.bcfg | ||
echo -n " " >> config.bcfg | ||
echo `date +%T` >> config.bcfg | ||
# Print the comments preceding the actual configuration | ||
|
||
echo ' | ||
# Config file for the bMCPIL launcher | ||
# Game Preferences | ||
# Render Distance | ||
# - Options are: Far, Normal, Short, and Tiny' >> config.bcfg | ||
# Write the real configurations | ||
echo -n 'renderdistance="' >> config.bcfg | ||
# Ask the user their render distance preference | ||
echo "" | ||
echo "Game Preferences:" | ||
echo "" | ||
read -p "Choose your Render Distance: Tiny, Short, Normal, or Far: " renderdistance | ||
# Make sure it's valid, otherwise print an error and default to Normal | ||
if [[ "$renderdistance" == "Tiny" || "$renderdistance" == "Short" || "$renderdistance" == "Normal" || "$renderdistance" == "Far" ]]; | ||
then | ||
echo -n $renderdistance >> config.bcfg | ||
else | ||
echo -n "Normal" >> config.bcfg | ||
echo "${red}[Error] Unknown value. Defaulting to Normal.${rst}" | ||
fi | ||
|
||
echo '"' >> config.bcfg | ||
|
||
# Print the comments preceding the actual configuration | ||
echo ' | ||
# Username | ||
# - Player name used on Multiplayer servers' >> config.bcfg | ||
# Write the real configurations | ||
echo -n 'username="' >> config.bcfg | ||
# Ask the user for their playername | ||
read -p "Choose your in-game name: " username | ||
echo -n $username >> config.bcfg | ||
echo '"' >> config.bcfg | ||
|
||
|
||
# Print the comments preceding the actual configuration | ||
echo ' | ||
# Launcher Preferences | ||
# EnableUpdater | ||
# - Whether the launcher should automatically update the game' >> config.bcfg | ||
# Write the real configurations | ||
echo -n 'enableupdater="' >> config.bcfg | ||
# Print stuff | ||
echo "" | ||
echo "Launcher Preferences:" | ||
echo "" | ||
# Ask the user for their preference | ||
read -p "Enable the MCPI Updater (Set to true unless you're using custom AppImages): (true/false) " enableupdater | ||
# Make sure it's valid, otherwise print an error and default to true | ||
if [[ "$enableupdater" == "true" || "$enableupdater" == "false" ]]; | ||
then | ||
echo -n $enableupdater >> config.bcfg | ||
else | ||
echo -n "true" >> config.bcfg | ||
echo "${red}[Error] Unknown value. Defaulting to true.${rst}" | ||
fi | ||
echo '"' >> config.bcfg | ||
echo "" | ||
|
||
# Print the comments preceding the actual configuration | ||
echo ' | ||
# Preset | ||
# - Which flag preset should the game use?' >> config.bcfg | ||
# Write the real configurations | ||
echo -n 'presetsel="' >> config.bcfg | ||
# Ask the user for their preference | ||
presetopt=`ls ./presets/` | ||
presetopt=`echo "$presetopt" | tr '\n' ' '` | ||
read -p "Select a launch flag preset: ( $presetopt) " presetsel | ||
# Make sure it's valid, otherwise print an error and default to true | ||
echo -n $presetsel >> config.bcfg | ||
echo '"' >> config.bcfg | ||
echo "" | ||
|
||
# Print the comments preceding the actual configuration | ||
echo ' | ||
# AskToExit | ||
# - Whether the launcher should ask to close the program if the game closes/crashes' >> config.bcfg | ||
# Write the real configurations | ||
echo -n 'asktoexit="' >> config.bcfg | ||
# Ask the user for their preference | ||
read -p "Should the launcher should ask to close the program if the game closes/crashes: (true/false) " asktoexit | ||
# Make sure it's valid, otherwise print an error and default to true | ||
if [[ "$asktoexit" == "true" || "$asktoexit" == "false" ]]; | ||
then | ||
echo -n $asktoexit >> config.bcfg | ||
else | ||
echo -n "true" >> config.bcfg | ||
echo "${red}[Error] Unknown value. Defaulting to true.${rst}" | ||
fi | ||
echo '"' >> config.bcfg | ||
echo "" | ||
|
||
# Print the comments preceding the actual configuration | ||
echo ' | ||
# CpuArch | ||
# - CPU architecture for auto-update' >> config.bcfg | ||
# Get the CPU architecture | ||
arch=$(uname -i) | ||
if [ "$arch" == 'x86_64' ]; | ||
then | ||
cpuarch="amd64" | ||
elif [ "$arch" == i*86 ]; | ||
then | ||
echo "CPU Architecture not supported [$arch]." | ||
exit | ||
elif [ "$arch" == armv* ]; | ||
then | ||
cpuarch="armhf" | ||
elif [ "$arch" == aarch64 ]; | ||
then | ||
cpuarch="aarch64" | ||
else | ||
echo "CPU Architecture not detected [$arch]. Please enter it." | ||
read -p "[arm64, armhf, amd64] " cpuarch | ||
fi | ||
echo -n 'cpuarch="' >> config.bcfg | ||
echo -n $cpuarch >> config.bcfg | ||
echo '"' >> config.bcfg | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
#!/bin/bash | ||
# Minecraft: Pi Edition: Reborn Bash Launcher | ||
# Copyright (C) 2022 bsX | ||
# | ||
# 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 <https://www.gnu.org/licenses/>. | ||
launcherversion="1.01" | ||
launcherPformat="1" | ||
bld=$(tput bold) # Bold | ||
red=$(tput setaf 1) # Red | ||
grn=$(tput setaf 2) # Green | ||
ylw=$(tput setaf 3) # Yellow | ||
blu=$(tput setaf 4) # Blue | ||
pur=$(tput setaf 5) # Purple | ||
cyn=$(tput setaf 6) # Cyan | ||
wht=$(tput setaf 7) # White | ||
rst=$(tput sgr0) # Text reset | ||
function updater() { | ||
# Download the ZSYNC file from TheBrokenRail's servers | ||
wget -q -O mcpi.zsync "https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/master/lastSuccessfulBuild/artifact/out/minecraft-pi-reborn-client-latest-$cpuarch.AppImage.zsync" | ||
|
||
# Retrieve the first 2 lines of data from the zsync file. | ||
zsync_out=`grep -a -A1 zsync mcpi.zsync` | ||
# For reference: -a tells it to output binary data like it's a text file, since only part of a zsync file contains actual text information (and that's all we need) | ||
# -A1 zsync tells it to find the line with "zsync" in it, and output that line and the next line of data | ||
# We're excluding the rest of the lines since this is only needed to get the current release of mcpi-r | ||
|
||
# Remove our ZSYNC file | ||
rm -rf mcpi.zsync | ||
|
||
# Cut the first line out of the string, we don't need it | ||
zsync_out=$(echo "$zsync_out" | sed 1d) | ||
|
||
# Strip the Zsync variable identifier | ||
zsync_out=${zsync_out//Filename: /} | ||
|
||
# Check if we already have this game version | ||
ver_check=`ls $zsync_out` | ||
if [ "$ver_check" != "$zsync_out" ] | ||
then | ||
# Tell the user what we're doing | ||
echo "" | ||
echo "Your MCPI-Reborn version is outdated. Updating..." | ||
echo "" | ||
# Move any existing mcpi AppImages to a temporary folder | ||
mkdir -p "old" | ||
mv -i minecraft-pi-reborn-client-*.AppImage "old" | ||
# Download the game AppImage | ||
wget -q "https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/master/lastSuccessfulBuild/artifact/out/$zsync_out" | ||
|
||
# Set the game AppImage executable | ||
chmod +x $zsync_out | ||
fi | ||
} | ||
echo "" | ||
echo "Minecraft: Pi Edition: Reborn Bash Launcher | ||
Copyright (C) 2022 bsX | ||
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 <https://www.gnu.org/licenses/>." | ||
echo "" | ||
# Open the configuration script if the user hasn't configured their game yet | ||
cfg_check=`ls config.bcfg` | ||
if [ "$cfg_check" != "config.bcfg" ] | ||
then | ||
# Set a variable so that the configuration script doesn't bark at the user for resetting their configuration (which is nonexistant) | ||
cfg_new="1" | ||
. configure.sh | ||
fi | ||
. config.bcfg | ||
|
||
# Check for command-line arguments | ||
if [[ "$1" == "--help" || "$1" == "-h" ]]; | ||
then | ||
echo "bMCPIL Help:" | ||
echo "" | ||
echo "Arguments: ./launch.sh [preset]" | ||
echo "" | ||
exit | ||
elif [ ! -z "$1" ]; # If a non-null, none flag argument was passed, treat it as a preset | ||
then | ||
preset_check=`ls ./presets/$1` | ||
if [ "$preset_check" != "./presets/$1" ] # Make sure the preset specified actually exists | ||
then | ||
echo "${red}[Error] Unknown preset specified from the command line [$1]. Loading from default.${rst}" | ||
. ./presets/default | ||
else | ||
presetsel="$1" # Overwrite the preset set in the config | ||
fi | ||
fi | ||
|
||
# Check if the user's selected preset actually exists. If not, load the default | ||
preset_check=`ls ./presets/$presetsel` | ||
if [ "$preset_check" != "./presets/$presetsel" ] | ||
then | ||
echo "${red}[Error] Unknown preset [$presetsel], please reconfigure your game. Loading from default.${rst}" | ||
. ./presets/default | ||
else | ||
. ./presets/$presetsel | ||
fi | ||
|
||
if [[ "$usedefaultflags" == "true" ]]; | ||
then | ||
MCPI_RENDER_DISTANCE="$renderdistance" MCPI_USERNAME="$username" ./minecraft-pi-reborn-client-*.AppImage --default --no-cache | ||
else | ||
MCPI_FEATURE_FLAGS="$preset" MCPI_RENDER_DISTANCE="$renderdistance" MCPI_USERNAME="$username" ./minecraft-pi-reborn-client-*.AppImage --no-cache | ||
fi | ||
|
||
|
||
echo "" | ||
if [[ "$asktoexit" == "true" ]]; | ||
then | ||
read -p "Press [Enter] to close the program." | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
preset="" | ||
usedefaultflags="true" | ||
presetformat="1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
preset="Allow Joining Survival Servers|Animated Water|Bind \"Q\" Key To Item Dropping|Bind Common Toggleable Options To Function Keys|Close Current Screen On Death|Disable Autojump By Default|Disable V-Sync|Display Nametags By Default|Expand Creative Inventory|External Server Support|Fix Attacking|Fix Bow & Arrow|Fix Camera Rendering|Fix Furnace Not Checking Item Auxiliary|Improved Classic Title Screen|Fix Pause Menu|Fix Sign Placement|Force Touch GUI Button Behavior|Force Touch GUI Inventory|Implement Chat|Implement Create World Dialog|Implement Death Messages|Implement Game-Mode Switching|Implement Sound Engine|Improved Button Hover Behavior|Improved Cursor Rendering|Improved Title Background|Load Language Files|Miscellaneous Input Fixes|Remove Invalid Item Background|Render Selected Item Text|Show Block Outlines|Translucent Toolbar|Disable Creative Mode Mining Delay|Full Touch GUI" | ||
usedefaultflags="false" | ||
presetversion="1.01" | ||
presetformat="1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
preset="" | ||
usedefaultflags="true" | ||
presetversion="1.01" | ||
presetformat="1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
preset="" | ||
usedefaultflags="false" | ||
presetversion="1.01" | ||
presetformat="1" |