Compilation - LemonLoader/MelonLoader GitHub Wiki
- Compile both
MelonProxy
andBootstrap
using thecargo ndk
command. They should compile at the same time as they are part of the same workspace. - Copy the following files into the decompiled APK's arm64 library folder
libmain.so
(compiled; replaces the original)libBootstrap.so
(compiled)libdobby.so
(available here)libssl.so
andlibcrypto.so
(both available inside this repo'sBaseLibs/openssl
folder; can also be compiled manually from the OpenSSL source code)
- Download the .NET runtime for Android here and extract it's contents into
assets/dotnet
inside the decompiled APK. - Take the files from
BaseLibs/dotnet_fixed_gc
and replace the files indotnet/shared/Microsoft.NETCore.App/8.0.6
with them.- This fixes a bug where Mono and IL2CPP fight each other's garbage collector, causing freezes and/or crashes. If you want to compile this fix manually (available in LemonLoader/runtime's
il2cpp-patch
branch), the Docker command I used is below.
- This fixes a bug where Mono and IL2CPP fight each other's garbage collector, causing freezes and/or crashes. If you want to compile this fix manually (available in LemonLoader/runtime's
- Compile the MelonLoader solution and copy the resulting output into your APK's
assets
folder. - Take the
BaseLibs/net6
folder inside this repo and copy it's files into theMelonLoader\net8
folder. This adds a functional version of Newtonsoft.Json, as well as Il2Cpp stripping workarounds. - Download your app's corresponding Unity dependencies from here and replace the APK's
libunity.so
with the one from the downloaded zip.- Be sure to match the architecture correctly or the app will not function.
- Add the following permissions to your APK's manifest.
android.permission.INTERNET
- [Optional] Create the file
lemon_patch_date.txt
inside your APK'sassets
folder and add the current time in RFC 3339 format.- This makes it so the Bootstrap both won't copy all of MelonLoader and dotnet every single startup and allows MelonLoader files to be replaced without the Bootstrap overriding changes.
- If this file does not exist, all MelonLoader and dotnet files will be copied on every game launch.
.NET Runtime fork compilation command (ran on Ubuntu 18.04 x86_64 in a VM)
sudo docker run --rm \
-v ~/runtime:/runtime \
-v ~/android-ndk-r26d:/ndk \
-w /runtime \
-e ANDROID_NDK_ROOT=/ndk \
-e ROOTFS_DIR=/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/ \
mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-android-amd64 \
/bin/bash -c \
"./build.sh --subset Mono.Runtime --os 'linux-bionic' --cross --arch arm64"