Skip to content

robertkirkman/sm64ex-coop-android-base

 
 

Repository files navigation

sm64ex-coop Android Port

This is a port of the sm64ex-coop multiplayer mod for Super Mario 64 to Android using SDL2 with OpenGL ES 2.0.

Build Instructions

Android

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
  • Use gradle assembleDebug instead of gradle build. Your .apk will be in app/build/outputs/apk/debug/ when the full build completes.

Windows

You will need at least 12 GB of free space on your C:\ drive to install all the dependencies needed here

  1. Go to the MSYS2 Releases page, click "Assets" under the newest release, and click the link that looks like "msys2-x86_64-XXXXXXXX.exe":

image

  1. Click the file in your browser's downloads popup when it finishes downloading:

image

  1. Click "More info" in the Windows Defender SmartScreen popup, then click "Run anyway":

image

image

  1. Click "Next" twice in the MSYS2 installer, then click "Install", wait for the installation to complete, then click "Next", then uncheck "Run MSYS2 Now", then click "Finish":

image

image

  1. Open the Start Menu and search "MSYS2 MINGW64", then click on it. This is the MSYS2 with the BLUE icon.

image

  1. Run the following command in the MSYS2 window. You can use the button in the right side of the code block to copy it from GitHub, then right click in the MSYS2 window and click "Paste" to paste it, then press Enter to run it:
pacman -Syuu --noconfirm

image

  1. 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
  1. 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
  1. Leave the MSYS2 window open for now and open a File Explorer window, then click "This PC" in the left column:

image

image

  1. Open drive C: and navigate to C:\g\sm64ex-coop-android-base\app\jni\src:

image

image

  1. Copy your baserom.us.z64 into this folder. If you don't already have a baserom.us.z64, here's the guide to obtain one:

image

  1. Go back to the MSYS2 window and execute a native build using this command. This will take a long time:

If you get an error like Error reading codebook or You should specify a coefficient codebook, just use make 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
  1. Go to the Android Studio website and click "Download Android Studio":

image

  1. Check the box to agree to the terms and conditions, then click the download link:

image

  1. Repeat step 2 but for the Android Studio installer, then click "Next" 3 times and "Install" once, and wait for the installation to complete:

image

  1. Click "Next", then "Finish", then click "OK" when this box appears:

image

  1. When this window appears, click "Don't send", then click "Next" four times:

image

  1. When you see this, click "Accept", then click either one of the "Intel" buttons to the left and click "Accept" again, then click "Finish" and wait for the installation to complete:

image

  1. When the "Finish" button becomes clickable again, click it:

image

  1. Then, click "Open" when you see this window:

image

  1. Navigate to C:\g\sm64ex-coop-android-base, then click "OK":

image

  1. Click "Trust Project" when you see this, then wait for the project to open:

image

  1. When you see the Windows Defender Firewall popup, click anything because you do not need to use ADB just to build - you can copy the .apk to your device over MTP later:

image

  1. Wait for this progress bar in the bottom right to stop loading. This will take a long time:

image

  1. When the progress bar disappears, the hammer icon in the top center will turn green. Click it, then wait for a progress bar in the same place as step 24 to finish loading again. This will take a long time:

image

  1. Open File Explorer and navigate to 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!

image

For more information and follow-up steps for what to do on-device after obtaining the .apk, check out the submodule repository READMEs.

Arch Linux

Assumes general Arch Linux experience, sudo, an AUR helper, and multilib 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

Docker

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

Configuration

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.

About

A fork of sm64-port-android-base for sm64ex-coop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.3%
  • Other 0.7%