mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
Raspberry 4 suppot. Refactor code.
This commit is contained in:
parent
3178c165c2
commit
bd237c0456
1 changed files with 26 additions and 22 deletions
46
pisetup.sh
46
pisetup.sh
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# Super Mario 64 PC on Raspberry Pi
|
||||
# Find latest updates and code on https://www.github.com/sm64pc/sm64pc
|
||||
# NOTE: If you clone the repo, source must be copied in ~/src/sm64pi/sm64pc/
|
||||
# ToDo: Test on more Pi models with fresh Raspbian and allow existing src folders to be updated.
|
||||
#
|
||||
clear
|
||||
|
@ -11,11 +12,11 @@ lowmem=0
|
|||
pi=0
|
||||
pimodel=$(uname -m 2>/dev/null || echo unknown)
|
||||
pitype=$(tr -d '\0' < /sys/firmware/devicetree/base/model)
|
||||
repo_url="https://github.com/sm64pc/sm64pc"
|
||||
|
||||
if [[ $pimodel =~ "armv6" ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Raspberry Pi Model 1/0(W) detected (LOWMEM)"
|
||||
echo -e "\nRaspberry Pi Model 1/0(W) detected (LOWMEM)"
|
||||
echo "Warning: Additional steps may be required to safely compile and maximize performance"
|
||||
pi=1;
|
||||
lowmem=1;
|
||||
|
@ -24,16 +25,14 @@ fi
|
|||
|
||||
if [[ $pimodel =~ "armv7" ]]
|
||||
then
|
||||
echo
|
||||
echo "Raspberry Pi Model 2/3 detected (32bit)"
|
||||
echo -e "\nRaspberry Pi Model 2/3/4 detected (32bit)"
|
||||
pi=2;
|
||||
lowmem=0;
|
||||
fi
|
||||
|
||||
if [[ $pimodel =~ "aarch64" && $pitype =~ "4" ]]
|
||||
then
|
||||
echo
|
||||
echo "Raspberry Pi Model 4 detected"
|
||||
echo -e "\nRaspberry Pi Model 4 (64 bits) detected"
|
||||
echo "Audio errors reported"
|
||||
echo "Fixing audio config, reboot after compilation completes to activate"
|
||||
sudo sed -i 's/load-module module-udev-detect/load-module module-udev-detect tsched=0/' /etc/pulse/default.pa
|
||||
|
@ -51,14 +50,14 @@ then
|
|||
echo "Further steps may be required and software / driver compatibility is not guaranteed."
|
||||
read -p "Continue setup & compilation (Y/N): " exp
|
||||
|
||||
if [[ $exp =~ "Y" ]]
|
||||
if [[ $exp =~ [Yy] ]]
|
||||
then
|
||||
echo ""
|
||||
else
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Please report any problems encountered to https://github.com/sm64pc/sm64pc issue tracker."
|
||||
echo "Please report any problems encountered to ${repo_url} issue tracker."
|
||||
echo ""
|
||||
sleep 7
|
||||
fi
|
||||
|
@ -79,7 +78,7 @@ if [[ $inxinf =~ "not found" ]]
|
|||
then
|
||||
echo "Error: inxi not installed. Installing..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install inxi
|
||||
sudo apt-get install -y inxi
|
||||
inxi=$(inxi -Gx)
|
||||
|
||||
if [[ $inxinf =~ "not found" ]]
|
||||
|
@ -130,7 +129,7 @@ fixmem=$(cat /boot/cmdline.txt | grep cma=128M)
|
|||
echo ""
|
||||
read -p "Fix mem? (Y/N): " fixmem
|
||||
|
||||
if [[ $fixmem =~ "Y" ]]
|
||||
if [[ $fixmem =~ [Yy] ]]
|
||||
then
|
||||
sudo sh -c "echo 'gpu_mem=48' >> /boot/config.txt"
|
||||
sudo sh -c "echo 'cma=128M' >> /boot/cmdline.txt"
|
||||
|
@ -146,12 +145,12 @@ fixmem=$(cat /boot/cmdline.txt | grep cma=128M)
|
|||
fi
|
||||
fi
|
||||
|
||||
if [[ $fixmem =~ "Y" || $vc4add =~ "vc4" ]]
|
||||
if [[ $fixmem =~ [Yy] || $vc4add =~ "vc4" ]]
|
||||
then
|
||||
clear
|
||||
echo "System configuration has changed!"
|
||||
read -p "Reboot to enable changes? (Y/N): " fixstart
|
||||
if [[ $fixstart =~ "Y" ]]
|
||||
if [[ $fixstart =~ [Yy] ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Rebooting RasPi in 4 seconds! Press Control-C to cancel."
|
||||
|
@ -170,11 +169,11 @@ echo "Step 1. Installing latest dependencies"
|
|||
echo "Allow installation & checking of Super Mario 64 compile dependencies?"
|
||||
read -p "Install? (Y/N): " instdep
|
||||
|
||||
if [[ $instdep =~ "Y" ]]
|
||||
if [[ $instdep =~ [Yy] ]]
|
||||
then
|
||||
echo ""
|
||||
sudo apt-get update
|
||||
sudo apt install build-essential git python3 libaudiofile-dev libglew-dev libsdl2-dev
|
||||
sudo apt install -y build-essential git python3 libaudiofile-dev libglew-dev libsdl2-dev
|
||||
sync
|
||||
else
|
||||
echo ""
|
||||
|
@ -193,14 +192,14 @@ echo ""
|
|||
echo "Warning: Compile could take up to an hour on older Raspberry Pi models"
|
||||
read -p "Proceed? (Y/N): " sdlcomp
|
||||
|
||||
if [[ $sdlcomp =~ "Y" ]]
|
||||
if [[ $sdlcomp =~ [Yy] ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Installing dependencies for SDL2 compilation"
|
||||
|
||||
sudo sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list"
|
||||
sudo apt build-dep libsdl2
|
||||
sudo apt install libdrm-dev libgbm-dev
|
||||
sudo apt install -y libdrm-dev libgbm-dev
|
||||
sync
|
||||
|
||||
echo ""
|
||||
|
@ -265,13 +264,13 @@ fi
|
|||
#------------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [[ $sm64git =~ "Y" || $sm64dir == 0 || $curdir == 0 ]] #If user wants to redownload or NOT git-zip execution
|
||||
if [[ $sm64git =~ [Yy] || $sm64dir == 0 || $curdir == 0 ]] #If user wants to redownload or NOT git-zip execution
|
||||
then
|
||||
echo "Step 2. Super Mario 64 PC-Port will now be downloaded from github"
|
||||
echo "Current folder will NOT be compiled."
|
||||
read -p "Proceed? (Y/N): " gitins
|
||||
|
||||
if [[ $gitins =~ "Y" ]]
|
||||
if [[ $gitins =~ [Yy] ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Creating directory "$HOME"/src/sm64pi"
|
||||
|
@ -282,7 +281,7 @@ cd $HOME/src/sm64pi
|
|||
|
||||
echo ""
|
||||
echo "Downloading latest Super Mario 64 PC-port code"
|
||||
git clone https://github.com/sm64pc/sm64pc
|
||||
git clone ${repo_url}
|
||||
cd $HOME/src/sm64pi/sm64pc/
|
||||
echo "Download complete"
|
||||
echo ""
|
||||
|
@ -358,7 +357,12 @@ echo "At least 300MB of free storage AND RAM is recommended"
|
|||
echo ""
|
||||
make clean
|
||||
sync
|
||||
if [[ $pimodel =~ "armv6" ]]
|
||||
then
|
||||
make TARGET_RPI=1
|
||||
else
|
||||
make TARGET_RPI=1 -j4
|
||||
fi
|
||||
sync
|
||||
|
||||
|
||||
|
@ -391,7 +395,7 @@ echo ""
|
|||
echo "Execute compiled Super Mario 64 RasPi?"
|
||||
read -p "Run game (Y/N): " sm64run
|
||||
|
||||
if [[ $sm64run =~ "Y" ]]
|
||||
if [[ $sm64run =~ [Yy] ]]
|
||||
then
|
||||
cd
|
||||
chmod +x $sm64loc
|
||||
|
@ -402,7 +406,7 @@ fi
|
|||
else
|
||||
echo "Cannot find compiled sm64*.arm binary..."
|
||||
echo "Please note of any errors during compilation process and report them to"
|
||||
echo "https://github.com/sm64pc/sm64pc"
|
||||
echo "${repo_url}"
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue