Patching - Lauriethefish/QuestPatcher GitHub Wiki

Patching

This page is for information related to how QuestPatcher patches APKs.

What APKs can be patched?

QuestPatcher can patch il2cpp unity Android applications that use 2018.x or 2019.x unity. However, QP only supports arm64-v8a and armeabi-v7a apps.

Since the Oculus Store (now) requires apps to be 64 bit, QuestPatcher can patch any Unity app on the Quest. Unity Android Mono is only armeabi-v7a so all new Quest apps use il2cpp.

Some older apps may use Mono, and QuestPatcher is not able to patch these.

How does QuestPatcher patch the APK?

When QuestPatcher starts the APK is pulled from the quest to check if it is modded.

Once the user presses Patch my App! the below happens:

  1. Decompile the APK using apktool.
  2. Replace lib/arm64-v8a/libmain.so (or lib/armeabi-v7a/libmain.so) with either libmain64.so if v8a, or libmain32.so if v7a. These files are from the latest QuestLoader Release.
  3. Add libmodloader64.so to lib/arm64-v8a/ or libmodloader32.so to lib/armeabi-v7a. Make sure to rename it to just libmodloader.so.
  4. Scan the unstripped unity repository for an unstripped libunity.so for the version of the app. If one is available, copy it to lib/arm64-v8a/libunity.so (or lib/armeabi-v7a/libunity.so).
  5. Add the following permissions to the AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

If you want hand tracking, add: <uses-permission android:name="oculus.permission.handtracking"/> <uses-permission android:name="com.oculus.permission.HAND_TRACKING"/> <uses-feature android:name="oculus.software.handtracking" android:required="false"/>

  1. In the <application tag of the manifest, add android:requestLegacyExternalStorage = "true" (and android:debuggable = "true" if you want debugging support).
  2. Save the manfiest.
  3. Recompile the APK using apktool.
  4. Sign the APK using uber-apk-signer.

The unpatched APK is then uninstalled and the patched APK installed.