sm64ex-coop
Android PortThis is a port of the sm64ex-coop
multiplayer mod for Super Mario 64 to Android using SDL2 with OpenGL ES 2.0.
To compile only libmain.so
(the minimum required) and use precompiled libSDL2.so
, classes.dex
, AndroidManifest.xml
, etc, follow the guide here!
[The section below is for advanced users - beginners should choose one of the other build methods, like minimal from Android or full from Windows]:
To compile fully on Android, including Java and SDL2 components, first follow the instructions here up to and including step 16, then clone this repository and perform a partial build, whose binaries will not be used in your complete build, but which has the side effect of extracting the assets and generating some required source files from them, steps not currently called from the gradle
+ ndk-build
build system:
git clone --recursive https://github.com/robertkirkman/sm64ex-coop-android-base.git
cd sm64ex-coop-android-base/app/jni/src
cp /storage/emulated/0/baserom.us.z64 .
make -j$(nproc)
Then, use this guide on this repository. Tips:
Requires Android 9+
Ignore references to cmake
in that guide, since this project uses ndk-build
instead of cmake
Make sure to keep track of what files you extract to which places, and edit the paths in the configuration files and commands you copy from the guide to match where you placed the files
In addition to the "Replace the aapt2" step as described in that guide, I also have to replace another cached copy of aapt2
with the same binary that had to be inserted into aapt2-7.1.0-7984345-linux.jar
. Example:
cp ~/opt/aarch64/build-tools/aapt2 /data/data/com.termux/files/home/.gradle/caches/transforms-3/e2966ab490263982a29d42a1b79481d9/transformed/aapt2-7.1.0-7984345-linux/aapt2
gradle assembleDebug
instead of gradle build
. Your .apk
will be in app/build/outputs/apk/debug/
when the full build completes.You will need at least 12 GB of free space on your
C:\
drive to install all the dependencies needed here
msys2-x86_64-XXXXXXXX.exe
":pacman -Syuu --noconfirm
If the MSYS2 window closes, repeat steps 5 and 6 until it no longer closes. Then, run this command in the MSYS2 window to install native build dependencies:
pacman -S --noconfirm unzip make git mingw-w64-x86_64-gcc python3
Next, run these commands to create a new folder (C:\g\
) and change working directory to it (IMPORTANT: it must be in this exact folder), clone the repository, and navigate to the sm64ex-coop-android-base/app/jni/src
directory:
cd /c
mkdir g
cd g
git clone --recursive https://github.com/robertkirkman/sm64ex-coop-android-base.git
cd sm64ex-coop-android-base/app/jni/src
Leave the MSYS2 window open for now and open a File Explorer window, then click "This PC" in the left column:
C:
and navigate to C:\g\sm64ex-coop-android-base\app\jni\src
:baserom.us.z64
into this folder. If you don't already have a baserom.us.z64
, here's the guide to obtain one:If you get an error like
Error reading codebook
orYou should specify a coefficient codebook
, just usemake clean
and keep trying again until it works, that only happens sometimes on Windows and I don't know what causes it
HEADLESS=1 TOUCH_CONTROLS=1 TARGET_FOSS=0 make
C:\g\sm64ex-coop-android-base
, then click "OK":.apk
to your device over MTP later:C:\g\sm64ex-coop-android-base\app\build\outputs\apk\debug
. If the build was successful, the app-debug.apk
will be here, and you can copy it to your Android device and install it there. Do not share, remember the .apk
contains assets! Treat it the same way you would a sm64.us.f3dex2e.exe
!For more information and follow-up steps for what to do on-device after obtaining the
.apk
, check out the submodule repository READMEs.
Assumes general Arch Linux experience,
sudo
, an AUR helper, andmultilib
enabled.
Install dependencies:
yay -S base-devel jdk17-openjdk android-sdk-cmdline-tools-latest android-sdk-build-tools android-sdk-platform-tools android-platform python sdl2 glew readline
Source /etc/profile
to set ANDROID_SDK_ROOT
:
source /etc/profile
Set default JDK to java-17-openjdk
:
sudo archlinux-java status
sudo archlinux-java set java-17-openjdk
Make Android SDK installation path writable and accept all SDK licenses:
sudo -E chmod -R 777 $ANDROID_SDK_ROOT
sdkmanager --licenses
Clone the repository:
git clone --recursive https://github.com/robertkirkman/sm64ex-coop-android-base.git
cd sm64ex-coop-android-base
Copy in your baserom.us.z64
:
cp /path/to/your/baserom.us.z64 app/jni/src/baserom.us.z64
Perform native build:
cd app/jni/src
TOUCH_CONTROLS=1 make -j$(nproc)
cd -
Perform Android build:
./gradlew assembleDebug
Enjoy your apk:
ls -la app/build/outputs/apk/debug/app-debug.apk
Clone the repository:
git clone --recursive https://github.com/robertkirkman/sm64ex-coop-android-base.git
cd sm64ex-coop-android-base
Build Docker image:
docker build . -t sm64_android
Copy in your baserom.us.z64
:
cp /path/to/your/baserom.us.z64 app/jni/src/baserom.us.z64
Perform native build:
docker run --rm -v $(pwd):/sm64 sm64_android sh -c "cd /sm64/app/jni/src && TOUCH_CONTROLS=1 make -j$(nproc)"
Perform Android build:
docker run --rm -v $(pwd):/sm64 sm64_android sh -c "./gradlew assembleDebug"
Enjoy your apk:
ls -la app/build/outputs/apk/debug/app-debug.apk
If you want to customize the build with build options, you should make the native build with those options first (put them after the make
command like on normal repos), then before performing the Android build, edit app/jni/src/Android.mk
and enable the options you'd like.