mirror of
https://github.com/izzy2lost/sm64-izzys-port-android.git
synced 2026-07-05 15:19:31 -07:00
Merge branch 'master' into skipintro
This commit is contained in:
@@ -27,6 +27,8 @@ COMPILER ?= ido
|
||||
|
||||
# Disable better camera by default
|
||||
BETTERCAMERA ?= 0
|
||||
# Disable no drawing distance by default
|
||||
NODRAWINGDISTANCE ?= 0
|
||||
|
||||
# Build for Emscripten/WebGL
|
||||
TARGET_WEB ?= 0
|
||||
@@ -424,14 +426,15 @@ else
|
||||
LD := $(CC)
|
||||
endif
|
||||
|
||||
CPP := cpp -P
|
||||
OBJDUMP := objdump
|
||||
OBJCOPY := objcopy
|
||||
CPP := $(CROSS)cpp -P
|
||||
OBJDUMP := $(CROSS)objdump
|
||||
OBJCOPY := $(CROSS)objcopy
|
||||
PYTHON := python3
|
||||
SDLCONFIG := $(CROSS)sdl2-config
|
||||
|
||||
ifeq ($(WINDOWS_BUILD),1)
|
||||
CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) `$(CROSS)sdl2-config --cflags`
|
||||
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv `$(CROSS)sdl2-config --cflags`
|
||||
CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) `$(SDLCONFIG) --cflags`
|
||||
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv `$(SDLCONFIG) --cflags`
|
||||
|
||||
else ifeq ($(TARGET_WEB),1)
|
||||
CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -s USE_SDL=2
|
||||
@@ -439,8 +442,8 @@ CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fn
|
||||
|
||||
# Linux / Other builds below
|
||||
else
|
||||
CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) `$(CROSS)sdl2-config --cflags`
|
||||
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv `$(CROSS)sdl2-config --cflags`
|
||||
CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) `$(SDLCONFIG) --cflags`
|
||||
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv `$(SDLCONFIG) --cflags`
|
||||
endif
|
||||
|
||||
# Check for better camera option
|
||||
@@ -449,6 +452,12 @@ CC_CHECK += -DBETTERCAMERA
|
||||
CFLAGS += -DBETTERCAMERA
|
||||
endif
|
||||
|
||||
# Check for no drawing distance option
|
||||
ifeq ($(NODRAWINGDISTANCE),1)
|
||||
CC_CHECK += -DNODRAWINGDISTANCE
|
||||
CFLAGS += -DNODRAWINGDISTANCE
|
||||
endif
|
||||
|
||||
ASFLAGS := -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS)
|
||||
|
||||
ifeq ($(TARGET_WEB),1)
|
||||
@@ -456,14 +465,17 @@ LDFLAGS := -lm -lGL -lSDL2 -no-pie -s TOTAL_MEMORY=20MB -g4 --source-map-base ht
|
||||
else
|
||||
|
||||
ifeq ($(WINDOWS_BUILD),1)
|
||||
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -Llib -lpthread -lglew32 `$(CROSS)sdl2-config --static-libs` -lm -lglu32 -lsetupapi -ldinput8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -no-pie -static
|
||||
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -Llib -lpthread -lglew32 `$(SDLCONFIG) --static-libs` -lm -lglu32 -lsetupapi -ldinput8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -no-pie -static
|
||||
ifeq ($(WINDOWS_CONSOLE),1)
|
||||
LDFLAGS += -mconsole
|
||||
endif
|
||||
else
|
||||
|
||||
# Linux / Other builds below
|
||||
ifeq ($(TARGET_RPI),1)
|
||||
LDFLAGS := $(OPT_FLAGS) -lm -lGLESv2 `$(CROSS)sdl2-config --libs` -no-pie
|
||||
LDFLAGS := $(OPT_FLAGS) -lm -lGLESv2 `$(SDLCONFIG) --libs` -no-pie
|
||||
else
|
||||
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm -lGL `$(CROSS)sdl2-config --libs` -no-pie -lpthread
|
||||
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm -lGL `$(SDLCONFIG) --libs` -no-pie -lpthread
|
||||
endif
|
||||
endif
|
||||
endif #Added for Pi ifeq
|
||||
|
||||
@@ -10,7 +10,9 @@ Run `./extract-assets.py --clean && make clean` or `make distclean` to remove RO
|
||||
* Variable aspect ratio and resolution. The game can now correctly render at basically any window size.
|
||||
* Native xinput controller support. On Linux, DualShock 4 has been confirmed to work plug-and-play.
|
||||
* Analog camera control and mouse look. (Activate with `make BETTERCAMERA=1`.)
|
||||
* Option to skip the Peach/Lakitu new file intro.
|
||||
* An option to disable drawing distances. (Activate with `make NODRAWINGDISTANCE=1`.)
|
||||
* In-game control binding, currently available on the `testing` branch.
|
||||
* Skip introductory Peach & Lakitu cutscenes with the `--skip-intro` CLI option
|
||||
|
||||
## Building
|
||||
For building instructions, please refer to the [wiki](https://github.com/sm64pc/sm64pc/wiki).
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include "pc/gfx/gfx_pc.h"
|
||||
#define GFX_DIMENSIONS_FROM_LEFT_EDGE(v) (SCREEN_WIDTH / 2 - SCREEN_HEIGHT / 2 * gfx_current_dimensions.aspect_ratio + (v))
|
||||
#define GFX_DIMENSIONS_FROM_RIGHT_EDGE(v) (SCREEN_WIDTH / 2 + SCREEN_HEIGHT / 2 * gfx_current_dimensions.aspect_ratio - (v))
|
||||
#define GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v) floorf(GFX_DIMENSIONS_FROM_LEFT_EDGE(v))
|
||||
#define GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v) ceilf(GFX_DIMENSIONS_FROM_RIGHT_EDGE(v))
|
||||
#define GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v) ((int)floorf(GFX_DIMENSIONS_FROM_LEFT_EDGE(v)))
|
||||
#define GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v) ((int)ceilf(GFX_DIMENSIONS_FROM_RIGHT_EDGE(v)))
|
||||
#define GFX_DIMENSIONS_ASPECT_RATIO (gfx_current_dimensions.aspect_ratio)
|
||||
#else
|
||||
#define GFX_DIMENSIONS_FROM_LEFT_EDGE(v) (v)
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#define NC_CAMC _("Camera Centre Aggression")
|
||||
#define NC_CAMP _("Camera Pan Level")
|
||||
#define NC_ENABLED _("Enabled")
|
||||
#define NC_DISABLED _("Disabled")
|
||||
#define NC_DISABLED _("Disabled")
|
||||
#define NC_BUTTON _("[R]: Options")
|
||||
#define NC_BUTTON2 _("[R]: Return")
|
||||
#define NC_OPTION _("OPTIONS")
|
||||
#define NC_HIGHLIGHT _("O")
|
||||
#define NC_HIGHLIGHT _("O")
|
||||
#define NC_ANALOGUE _("Analogue Camera")
|
||||
#define NC_MOUSE _("Mouse Look")
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
#define TEXT_COURSE _("コース")
|
||||
#define TEXT_MYSCORE _("マイスコア")
|
||||
#define TEXT_CONTINUE _("つづけて マリオする?")
|
||||
#define TEXT_EXIT_GAME _("ゲームをしゅうりょうする?")
|
||||
#define TEXT_EXIT_COURSE _("コースからでる?")
|
||||
#define TEXT_CAMERA_ANGLE_R _("Rボタンのカメラきりかえ")
|
||||
|
||||
@@ -122,6 +123,7 @@
|
||||
// Save Options
|
||||
#define TEXT_SAVE_AND_CONTINUE _("セーブしてつづける?")
|
||||
#define TEXT_SAVE_AND_QUIT _("セーブしておわる?")
|
||||
#define TEXT_SAVE_EXIT_GAME _("ゲームをやめる?")
|
||||
#define TEXT_CONTINUE_WITHOUT_SAVING _("セーブしないでつづける?")
|
||||
|
||||
/**
|
||||
@@ -204,6 +206,7 @@
|
||||
#define TEXT_MYSCORE _("MYSCORE")
|
||||
#define TEXT_CONTINUE _("CONTINUE")
|
||||
#define TEXT_EXIT_COURSE _("EXIT COURSE")
|
||||
#define TEXT_EXIT_GAME _("EXIT GAME")
|
||||
#ifndef VERSION_EU // "R" text is different in EU
|
||||
#define TEXT_CAMERA_ANGLE_R _("SET CAMERA ANGLE WITH R")
|
||||
#endif
|
||||
@@ -222,6 +225,7 @@
|
||||
// Save Options
|
||||
#define TEXT_SAVE_AND_CONTINUE _("SAVE & CONTINUE")
|
||||
#define TEXT_SAVE_AND_QUIT _("SAVE & QUIT")
|
||||
#define TEXT_SAVE_EXIT_GAME _("SAVE & EXIT GAME")
|
||||
#define TEXT_CONTINUE_WITHOUT_SAVING _("CONTINUE, DON'T SAVE")
|
||||
|
||||
/**
|
||||
@@ -348,12 +352,14 @@
|
||||
#define TEXT_MY_SCORE_FR _("MON SCORE")
|
||||
#define TEXT_CONTINUE_FR _("CONTINUER")
|
||||
#define TEXT_EXIT_COURSE_FR _("QUITTER NIVEAU")
|
||||
#define TEXT_EXIT_GAME_FR _("QUITTER JEU")
|
||||
#define TEXT_CAMERA_ANGLE_R_FR _("RÉGLAGE CAMÉRA AVEC [R]")
|
||||
// German
|
||||
#define TEXT_COURSE_DE _("KURS")
|
||||
#define TEXT_MY_SCORE_DE _("LEISTUNG")
|
||||
#define TEXT_CONTINUE_DE _("WEITER")
|
||||
#define TEXT_EXIT_COURSE_DE _("KURS VERLASSEN")
|
||||
#define TEXT_EXIT_GAME_DE _("SPIEL VERLASSEN")
|
||||
#define TEXT_CAMERA_ANGLE_R_DE _("KAMERA MIT [R] VERSTELLEN")
|
||||
|
||||
// Camera Options
|
||||
@@ -376,10 +382,12 @@
|
||||
// French
|
||||
#define TEXT_SAVE_AND_CONTINUE_FR _("SAUVEGARDER & CONTINUER")
|
||||
#define TEXT_SAVE_AND_QUIT_FR _("SAUVEGARDER & QUITTER")
|
||||
#define TEXT_SAVE_EXIT_GAME_FR _("SAUVEGARDER & QUITTER JEU")
|
||||
#define TEXT_CONTINUE_WITHOUT_SAVING_FR _("CONTINUER SANS SAUVEGARDER")
|
||||
// German
|
||||
#define TEXT_SAVE_AND_CONTINUE_DE _("SPEICHERN & WEITER")
|
||||
#define TEXT_SAVE_AND_QUIT_DE _("SPEICHERN & ENDE")
|
||||
#define TEXT_SAVE_EXIT_GAME_DE _("SPEICHERN & SPIEL VERLASSEN")
|
||||
#define TEXT_CONTINUE_WITHOUT_SAVING_DE _("WEITER OHNE ZU SPEICHERN")
|
||||
|
||||
/**
|
||||
|
||||
Executable
+409
@@ -0,0 +1,409 @@
|
||||
#!/bin/bash
|
||||
# Super Mario 64 PC on Raspberry Pi
|
||||
# Find latest updates and code on https://www.github.com/sm64pc/sm64pc
|
||||
# ToDo: Test on more Pi models with fresh Raspbian and allow existing src folders to be updated.
|
||||
#
|
||||
clear
|
||||
echo "This script will assist with compiling Super Mario 64 on Raspbian 10"
|
||||
echo "Note that accelerated OpenGL (vc4_drm) is required for maximum performance"
|
||||
echo "Checking Raspberry Pi model..."
|
||||
lowmem=0
|
||||
pi=0
|
||||
pimodel=$(uname -m 2>/dev/null || echo unknown)
|
||||
pitype=$(tr -d '\0' < /sys/firmware/devicetree/base/model)
|
||||
|
||||
if [[ $pimodel =~ "armv6" ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Raspberry Pi Model 1/0(W) detected (LOWMEM)"
|
||||
echo "Warning: Additional steps may be required to safely compile and maximize performance"
|
||||
pi=1;
|
||||
lowmem=1;
|
||||
exp=1;
|
||||
fi
|
||||
|
||||
if [[ $pimodel =~ "armv7" ]]
|
||||
then
|
||||
echo
|
||||
echo "Raspberry Pi Model 2/3 detected (32bit)"
|
||||
pi=2;
|
||||
lowmem=0;
|
||||
fi
|
||||
|
||||
if [[ $pimodel =~ "aarch64" && $pitype =~ "4" ]]
|
||||
then
|
||||
echo
|
||||
echo "Raspberry Pi Model 4 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
|
||||
#load-module module-udev-detect tsched=0
|
||||
pi=4;
|
||||
lowmem=0;
|
||||
exp=1;
|
||||
fi
|
||||
|
||||
|
||||
if [[ $exp == 1 ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Notice: Due to detected Pi version, compilation and execution of Super Mario 64 (RPi) is experimental."
|
||||
echo "Further steps may be required and software / driver compatibility is not guaranteed."
|
||||
read -p "Continue setup & compilation (Y/N): " exp
|
||||
|
||||
if [[ $exp =~ "Y" ]]
|
||||
then
|
||||
echo ""
|
||||
else
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Please report any problems encountered to https://github.com/sm64pc/sm64pc issue tracker."
|
||||
echo ""
|
||||
sleep 7
|
||||
fi
|
||||
|
||||
#//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
clear
|
||||
echo "Super Mario 64 RPi Initial Setup"
|
||||
|
||||
if [[ $pi != 4 ]]
|
||||
then #Dumb idea, but quick hack.
|
||||
#We CANNOT enable VC4 for Pi4 as it uses VC6
|
||||
|
||||
inxinf=$(inxi -Gx)
|
||||
echo "Checking for pre-enabled VC4 acceleration (inxi -Gx)"
|
||||
|
||||
if [[ $inxinf =~ "not found" ]]
|
||||
then
|
||||
echo "Error: inxi not installed. Installing..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install inxi
|
||||
inxi=$(inxi -Gx)
|
||||
|
||||
if [[ $inxinf =~ "not found" ]]
|
||||
then
|
||||
echo "Warning: Setup will not continue unless inxi is installed"
|
||||
echo "Please ensure your Pi is in a state to download and install packages"
|
||||
sleep 3
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $inxinf =~ "vc4_drm" ]]
|
||||
then
|
||||
echo "Success: VC4 OpenGL acceleration found!"
|
||||
echo ""
|
||||
sleep 4
|
||||
|
||||
else
|
||||
echo ""
|
||||
echo "OpenGL driver not found. opening Raspi-Config..."
|
||||
echo "Please enable raspi-config -> ADV Opt -> OpenGL -> Enable FullKMS Renderer"
|
||||
echo ""
|
||||
sleep 5
|
||||
sudo raspi-config
|
||||
vc4add=$(cat /boot/config.txt | grep -e "dtoverlay=vc4-kms-v3d")
|
||||
|
||||
if [[ $vc4add =~ "vc4" ]]
|
||||
then
|
||||
echo "OGL driver now enabled on reboot"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $lowmem == 1 ]]
|
||||
then
|
||||
fixmem=$(cat /boot/cmdline.txt | grep cma=128M)
|
||||
|
||||
if [[ $fixmem =~ "cma=128M" ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Notice: Low-RAM RasPi model detected, BUT fixes already applied."
|
||||
echo "Continuing setup."
|
||||
|
||||
else
|
||||
echo ""
|
||||
echo "Warning: VC4 enabled, but your RasPi has 512MB or less RAM"
|
||||
echo "To ensure VC4_DRM and game compilation is succesful, video memory will be reduced"
|
||||
echo "gpu_mem=48M (config.txt) | cma=128M (cmdline.txt) will be written to /boot "
|
||||
echo ""
|
||||
read -p "Fix mem? (Y/N): " fixmem
|
||||
|
||||
if [[ $fixmem =~ "Y" ]]
|
||||
then
|
||||
sudo sh -c "echo 'gpu_mem=48' >> /boot/config.txt"
|
||||
sudo sh -c "echo 'cma=128M' >> /boot/cmdline.txt"
|
||||
sync
|
||||
echo "Wrote configuration changes to SD card."
|
||||
sleep 2
|
||||
else
|
||||
echo ""
|
||||
echo "Warning: Compilation freezes & errors are likely to occur on your Pi"
|
||||
echo ""
|
||||
sleep 3
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $fixmem =~ "Y" || $vc4add =~ "vc4" ]]
|
||||
then
|
||||
clear
|
||||
echo "System configuration has changed!"
|
||||
read -p "Reboot to enable changes? (Y/N): " fixstart
|
||||
if [[ $fixstart =~ "Y" ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Rebooting RasPi in 4 seconds! Press Control-C to cancel."
|
||||
sleep 4
|
||||
sudo reboot
|
||||
fi
|
||||
fi
|
||||
fi # "Should never run on a Pi 4" part ends here
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
clear
|
||||
echo "Beginning installation"
|
||||
echo ""
|
||||
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" ]]
|
||||
then
|
||||
echo ""
|
||||
sudo apt-get update
|
||||
sudo apt install build-essential git python3 libaudiofile-dev libglew-dev libsdl2-dev
|
||||
sync
|
||||
else
|
||||
echo ""
|
||||
echo "Super Mario 64 dependencies not installed."
|
||||
echo "Please manually install if Raspbian is modified from stock"
|
||||
echo ""
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------------
|
||||
clear
|
||||
echo "Optional: Compile SDL2 with 'KMSDRM' for enhanced performance?"
|
||||
echo "KMSDRM allows Super Mario 64 to be run without GUI/Desktop (Xorg) enabled on boot"
|
||||
echo ""
|
||||
echo "Warning: Compile could take up to an hour on older Raspberry Pi models"
|
||||
read -p "Proceed? (Y/N): " sdlcomp
|
||||
|
||||
if [[ $sdlcomp =~ "Y" ]]
|
||||
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
|
||||
sync
|
||||
|
||||
echo ""
|
||||
echo "Creating folder src in HOME directory for compile"
|
||||
echo ""
|
||||
|
||||
mkdir $HOME/src
|
||||
cd $HOME/src
|
||||
mkdir $HOME/src/sdl2
|
||||
cd $HOME/src/sdl2
|
||||
sleep 2
|
||||
|
||||
echo "Downloading SDL2 from libsdl.org and unzipping to HOME/src/sdl2/SDL2"
|
||||
wget https://www.libsdl.org/release/SDL2-2.0.10.tar.gz
|
||||
sync
|
||||
tar xzf ./SDL2*.gz
|
||||
sync
|
||||
cd ./SDL2*
|
||||
|
||||
echo "Configuring SDL2 library to enable KMSDRM (Xorg free rendering)"
|
||||
./configure --enable-video-kmsdrm
|
||||
echo "Compiling modified SDL2 and installing."
|
||||
make
|
||||
sudo make install
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------
|
||||
sleep 2
|
||||
clear
|
||||
echo "Super Mario 64 RPi preparation & downloader"
|
||||
echo ""
|
||||
echo "Checking in current directory and"
|
||||
echo "checking in "$HOME"/src/sm64pi/sm64pc/ for existing Super Mario 64 PC files"
|
||||
echo ""
|
||||
sm64dircur=$(ls ./Makefile)
|
||||
sm64dir=$(ls $HOME/src/sm64pi/sm64pc/Makefile)
|
||||
|
||||
if [[ $sm64dircur =~ "Makefile" ]] #If current directory has a makefile
|
||||
then
|
||||
sm64dir=$sm64dircur
|
||||
curdir=1; #If current directory has a Makefile or is git zip
|
||||
fi
|
||||
|
||||
if [[ $sm64dir =~ "Makefile" ]];
|
||||
then
|
||||
echo "Existing Super Mario 64 PC port files found!"
|
||||
echo "Redownload files (fresh compile)?"
|
||||
read -p "Redownload? (Y/N): " sm64git
|
||||
|
||||
if [[ $sm64git =~ "N" ]] # Do NOT redownload, USE current directory for compile
|
||||
then
|
||||
sm64dir=1; # Don't redownload files , use current directory (has sm64 files)
|
||||
curdir=1
|
||||
fi
|
||||
|
||||
else #Do a fresh compile in HOME/src/sm64pi/sm64pc/
|
||||
sm64dir=0;
|
||||
curdir=0;
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [[ $sm64git =~ "Y" || $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" ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Creating directory "$HOME"/src/sm64pi"
|
||||
mkdir $HOME/src/
|
||||
cd $HOME/src/
|
||||
mkdir $HOME/src/sm64pi
|
||||
cd $HOME/src/sm64pi
|
||||
|
||||
echo ""
|
||||
echo "Downloading latest Super Mario 64 PC-port code"
|
||||
git clone https://github.com/sm64pc/sm64pc
|
||||
cd $HOME/src/sm64pi/sm64pc/
|
||||
echo "Download complete"
|
||||
echo ""
|
||||
sleep 2
|
||||
fi #End of downloader
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
#------------------------------------------------------------------
|
||||
clear
|
||||
echo "Super Mario 64 RPi compilation"
|
||||
echo ""
|
||||
echo "Step 3. Compiling Super Mario 64 for the Raspberry Pi"
|
||||
echo ""
|
||||
echo "Warning: Super Mario 64 assets are required in order to compile"
|
||||
if [[ $curdir ==1 ]]
|
||||
then
|
||||
echo "Assets will be extracted from "$PWD" "
|
||||
else
|
||||
echo "Assets will be extracted from $HOME/src/sm64pi/sm64pc/baserom.(us/eu/jp).z64 "
|
||||
fi
|
||||
|
||||
if [[ $curdir == 1 ]]
|
||||
then
|
||||
sm64z64=$(find ./* | grep baserom) #See if current directory is prepped
|
||||
else
|
||||
sm64z64=$(find $HOME/src/sm64pi/sm64pc/* | grep baserom) #see if fresh compile directory is prepped
|
||||
fi
|
||||
|
||||
if [[ $sm64z64 =~ "baserom" ]]
|
||||
then
|
||||
echo ""
|
||||
echo "Super Mario 64 assets found in compilation directory"
|
||||
echo "Continuing with compilation"
|
||||
|
||||
else
|
||||
echo ""
|
||||
echo "Please satisfy this requirement before continuing."
|
||||
echo "Exiting Super Mario 64 RasPi setup and compilation script."
|
||||
echo ""
|
||||
echo "Note: Re-run script once baserom(s) are inserted into"
|
||||
|
||||
if [[ $curdir == 1 ]]
|
||||
then
|
||||
echo $PWD
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo $HOME/src/sm64pi/sm64pc/
|
||||
fi
|
||||
|
||||
sleep 5
|
||||
exit
|
||||
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
sleep 3
|
||||
clear
|
||||
echo ""
|
||||
|
||||
if [[ $curdir != 1 ]] # If we're not compiling from a git zip / random directory
|
||||
then
|
||||
cd $HOME/src/sm64pi/sm64pc/
|
||||
fi
|
||||
|
||||
echo "Beginning Super Mario 64 RasPi compilation!"
|
||||
echo ""
|
||||
echo "Warning: Compilation may take up to an hour on weaker hardware"
|
||||
echo "At least 300MB of free storage AND RAM is recommended"
|
||||
echo ""
|
||||
make clean
|
||||
sync
|
||||
make TARGET_RPI=1
|
||||
sync
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
if [[ $curdir == 1 ]]
|
||||
then
|
||||
sm64done=$(find ./build/*/* | grep .arm)
|
||||
else
|
||||
sm64done=$(find $HOME/src/sm64pi/sm64pc/build/*/* | grep .arm)
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if [[ $sm64done =~ ".arm" ]]
|
||||
then
|
||||
echo "Super Mario 64 RasPi compilation successful!"
|
||||
echo "You may find it in"
|
||||
|
||||
if [[ $curdir == 1 ]]
|
||||
then
|
||||
$sm64loc=$(ls ./build/*pc/*.arm)
|
||||
else
|
||||
$sm64loc=$(ls $HOME/src/sm64pi/sm64pc/build/*pc/*.arm)
|
||||
fi
|
||||
|
||||
echo $sm64loc
|
||||
|
||||
echo ""
|
||||
echo "Execute compiled Super Mario 64 RasPi?"
|
||||
read -p "Run game (Y/N): " sm64run
|
||||
|
||||
if [[ $sm64run =~ "Y" ]]
|
||||
then
|
||||
cd
|
||||
chmod +x $sm64loc
|
||||
bash $sm64loc
|
||||
sleep 1
|
||||
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"
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
exit
|
||||
@@ -987,11 +987,15 @@ void cur_obj_update(void) {
|
||||
} else if ((objFlags & OBJ_FLAG_COMPUTE_DIST_TO_MARIO) && gCurrentObject->collisionData == NULL) {
|
||||
if (!(objFlags & OBJ_FLAG_ACTIVE_FROM_AFAR)) {
|
||||
// If the object has a render distance, check if it should be shown.
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (distanceFromMario > gCurrentObject->oDrawingDistance) {
|
||||
// Out of render distance, hide the object.
|
||||
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||
gCurrentObject->activeFlags |= ACTIVE_FLAG_FAR_AWAY;
|
||||
} else if (gCurrentObject->oHeldState == HELD_FREE) {
|
||||
#else
|
||||
if (distanceFromMario <= gCurrentObject->oDrawingDistance && gCurrentObject->oHeldState == HELD_FREE) {
|
||||
#endif
|
||||
// In render distance (and not being held), show the object.
|
||||
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
|
||||
gCurrentObject->activeFlags &= ~ACTIVE_FLAG_FAR_AWAY;
|
||||
|
||||
@@ -789,9 +789,13 @@ void load_object_collision_model(void) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (marioDist < gCurrentObject->oDrawingDistance) {
|
||||
#endif
|
||||
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
} else {
|
||||
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -8,11 +8,15 @@
|
||||
void bub_spawner_act_0(void) {
|
||||
s32 i;
|
||||
s32 sp18 = o->oBirdChirpChirpUnkF4;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 1500.0f) {
|
||||
#endif
|
||||
for (i = 0; i < sp18; i++)
|
||||
spawn_object(o, MODEL_BUB, bhvBub);
|
||||
o->oAction = 1;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void bub_spawner_act_1(void) {
|
||||
|
||||
@@ -53,7 +53,9 @@ static void chain_chomp_act_uninitialized(void) {
|
||||
struct ChainSegment *segments;
|
||||
s32 i;
|
||||
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 3000.0f) {
|
||||
#endif
|
||||
segments = mem_pool_alloc(gObjectMemoryPool, 5 * sizeof(struct ChainSegment));
|
||||
if (segments != NULL) {
|
||||
// Each segment represents the offset of a chain part to the pivot.
|
||||
@@ -81,7 +83,9 @@ static void chain_chomp_act_uninitialized(void) {
|
||||
cur_obj_unhide();
|
||||
}
|
||||
}
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -359,10 +363,12 @@ static void chain_chomp_act_move(void) {
|
||||
f32 maxDistToPivot;
|
||||
|
||||
// Unload chain if mario is far enough
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oChainChompReleaseStatus == CHAIN_CHOMP_NOT_RELEASED && o->oDistanceToMario > 4000.0f) {
|
||||
o->oAction = CHAIN_CHOMP_ACT_UNLOAD_CHAIN;
|
||||
o->oForwardVel = o->oVelY = 0.0f;
|
||||
} else {
|
||||
#endif
|
||||
cur_obj_update_floor_and_walls();
|
||||
|
||||
switch (o->oChainChompReleaseStatus) {
|
||||
@@ -446,7 +452,9 @@ static void chain_chomp_act_move(void) {
|
||||
o->oGravity = -4.0f;
|
||||
o->oChainChompTargetPitch = -0x3000;
|
||||
}
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,10 +47,14 @@ static void cloud_act_spawn_parts(void) {
|
||||
* Wait for mario to approach, then unhide and enter the spawn parts action.
|
||||
*/
|
||||
static void cloud_act_fwoosh_hidden(void) {
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 2000.0f) {
|
||||
#endif
|
||||
cur_obj_unhide();
|
||||
o->oAction = CLOUD_ACT_SPAWN_PARTS;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,9 +62,11 @@ static void cloud_act_fwoosh_hidden(void) {
|
||||
* long enough, blow wind at him.
|
||||
*/
|
||||
static void cloud_fwoosh_update(void) {
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario > 2500.0f) {
|
||||
o->oAction = CLOUD_ACT_UNLOAD;
|
||||
} else {
|
||||
#endif
|
||||
if (o->oCloudBlowing) {
|
||||
o->header.gfx.scale[0] += o->oCloudGrowSpeed;
|
||||
|
||||
@@ -95,7 +101,9 @@ static void cloud_fwoosh_update(void) {
|
||||
}
|
||||
|
||||
cur_obj_scale(o->header.gfx.scale[0]);
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -184,17 +184,23 @@ void bhv_coin_formation_loop(void) {
|
||||
s32 bitIndex;
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 2000.0f) {
|
||||
#endif
|
||||
for (bitIndex = 0; bitIndex < 8; bitIndex++) {
|
||||
if (!(o->oCoinUnkF4 & (1 << bitIndex)))
|
||||
spawn_coin_in_formation(bitIndex, o->oBehParams2ndByte);
|
||||
}
|
||||
o->oAction++;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario > 2100.0f)
|
||||
o->oAction++;
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
o->oAction = 0;
|
||||
|
||||
@@ -24,12 +24,16 @@ static struct ObjectHitbox sEnemyLakituHitbox = {
|
||||
* Wait for mario to approach, then spawn the cloud and become visible.
|
||||
*/
|
||||
static void enemy_lakitu_act_uninitialized(void) {
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 2000.0f) {
|
||||
#endif
|
||||
spawn_object_relative_with_scale(CLOUD_BP_LAKITU_CLOUD, 0, 0, 0, 2.0f, o, MODEL_MIST, bhvCloud);
|
||||
|
||||
cur_obj_unhide();
|
||||
o->oAction = ENEMY_LAKITU_ACT_MAIN;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,7 +42,9 @@ void fish_act_spawn(void) {
|
||||
* If the current level is Secret Aquarium, ignore this requirement.
|
||||
* Fish moves at random with a max-range of 700.0f.
|
||||
*/
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < minDistToMario || gCurrLevelNum == LEVEL_SA) {
|
||||
#endif
|
||||
for (i = 0; i < schoolQuantity; i++) {
|
||||
fishObject = spawn_object(o, model, bhvFish);
|
||||
fishObject->oBehParams2ndByte = o->oBehParams2ndByte;
|
||||
@@ -50,7 +52,9 @@ void fish_act_spawn(void) {
|
||||
obj_translate_xyz_random(fishObject, 700.0f);
|
||||
}
|
||||
o->oAction = FISH_ACT_ACTIVE;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,7 +78,9 @@ void bhv_goomba_triplet_spawner_update(void) {
|
||||
// If mario is close enough and the goombas aren't currently loaded, then
|
||||
// spawn them
|
||||
if (o->oAction == GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED) {
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 3000.0f) {
|
||||
#endif
|
||||
// The spawner is capable of spawning more than 3 goombas, but this
|
||||
// is not used in the game
|
||||
dAngle =
|
||||
@@ -98,11 +100,13 @@ void bhv_goomba_triplet_spawner_update(void) {
|
||||
}
|
||||
|
||||
o->oAction += 1;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
} else if (o->oDistanceToMario > 4000.0f) {
|
||||
// If mario is too far away, enter the unloaded action. The goombas
|
||||
// will detect this and unload themselves
|
||||
o->oAction = GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,8 +72,12 @@ void heave_ho_act_3(void) {
|
||||
}
|
||||
|
||||
void heave_ho_act_0(void) {
|
||||
cur_obj_set_pos_to_home();
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (find_water_level(o->oPosX, o->oPosZ) < o->oPosY && o->oDistanceToMario < 4000.0f) {
|
||||
#else
|
||||
if (find_water_level(o->oPosX, o->oPosZ) < (o->oPosY - 50.0f)) {
|
||||
#endif
|
||||
cur_obj_set_pos_to_home();
|
||||
cur_obj_become_tangible();
|
||||
cur_obj_unhide();
|
||||
o->oAction = 1;
|
||||
|
||||
@@ -295,10 +295,14 @@ void king_bobomb_move(void) {
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
cur_obj_call_action_function(sKingBobombActions);
|
||||
exec_anim_sound_state(sKingBobombSoundStates);
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 5000.0f)
|
||||
#endif
|
||||
cur_obj_enable_rendering();
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
else
|
||||
cur_obj_disable_rendering();
|
||||
#endif
|
||||
}
|
||||
|
||||
void bhv_king_bobomb_loop(void) {
|
||||
|
||||
@@ -14,18 +14,24 @@ void bhv_lll_floating_wood_bridge_loop(void) {
|
||||
s32 i;
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 2500.0f) {
|
||||
#endif
|
||||
for (i = 1; i < 4; i++) {
|
||||
sp3C = spawn_object_relative(0, (i - 2) * 300, 0, 0, o, MODEL_LLL_WOOD_BRIDGE,
|
||||
bhvLllWoodPiece);
|
||||
sp3C->oLllWoodPieceUnkF4 = i * 4096;
|
||||
}
|
||||
o->oAction = 1;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario > 2600.0f)
|
||||
o->oAction = 2;
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
o->oAction = 0;
|
||||
|
||||
@@ -30,7 +30,9 @@ void fire_bar_spawn_flames(s16 a0) {
|
||||
}
|
||||
|
||||
void fire_bar_act_0(void) {
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 3000.0f)
|
||||
#endif
|
||||
o->oAction = 1;
|
||||
}
|
||||
|
||||
@@ -45,8 +47,10 @@ void fire_bar_act_1(void) {
|
||||
void fire_bar_act_2(void) {
|
||||
o->oAngleVelYaw = -0x100;
|
||||
o->oMoveAngleYaw += o->oAngleVelYaw;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario > 3200.0f)
|
||||
o->oAction = 3;
|
||||
#endif
|
||||
}
|
||||
|
||||
void fire_bar_act_3(void) {
|
||||
|
||||
@@ -151,7 +151,9 @@ static void pokey_act_uninitialized(void) {
|
||||
s32 i;
|
||||
s16 partModel;
|
||||
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
if (o->oDistanceToMario < 2000.0f) {
|
||||
#endif
|
||||
partModel = MODEL_POKEY_HEAD;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
@@ -170,7 +172,9 @@ static void pokey_act_uninitialized(void) {
|
||||
o->oPokeyNumAliveBodyParts = 5;
|
||||
o->oPokeyBottomBodyPartSize = 1.0f;
|
||||
o->oAction = POKEY_ACT_WANDER;
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,9 +189,11 @@ static void pokey_act_wander(void) {
|
||||
|
||||
if (o->oPokeyNumAliveBodyParts == 0) {
|
||||
obj_mark_for_deletion(o);
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
} else if (o->oDistanceToMario > 2500.0f) {
|
||||
o->oAction = POKEY_ACT_UNLOAD_PARTS;
|
||||
o->oForwardVel = 0.0f;
|
||||
#endif
|
||||
} else {
|
||||
treat_far_home_as_mario(1000.0f);
|
||||
cur_obj_update_floor_and_walls();
|
||||
|
||||
@@ -180,7 +180,11 @@ void bhv_snufit_loop(void) {
|
||||
void bhv_snufit_balls_loop(void) {
|
||||
// If far from Mario or in a different room, despawn.
|
||||
if ((o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM)
|
||||
#ifndef NODRAWINGDISTANCE
|
||||
|| (o->oTimer != 0 && o->oDistanceToMario > 1500.0f)) {
|
||||
#else
|
||||
|| (o->oTimer != 0)) {
|
||||
#endif
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user