Skip to content

Latest commit

 

History

History
108 lines (75 loc) · 3.92 KB

README.md

File metadata and controls

108 lines (75 loc) · 3.92 KB

gd-mod-example-android

Basic Geometry Dash android mod example meant for beginners or as a template. A port of gd-mod-example for Android featuring a new modloader.

screenshot screenshot

Usage

Build

  • Clone the repo

  • To build this project you will need the version r16b of the Native Development Kit for Android.

Windows 32-bit Windows 64-bit

  • Edit the paths inside Build.bat and run it
  • The compiled files should be in gd-mod-example-android/libs/armeabi-v7a

Inject the shared libraries into the APK

To make the mod work we need to edit the java source code of the APK to load the compiled .so files

  • Have a Geometry Dash APK ready
  • Get an APK Editor that supports smali

There are many APK Edit tools available, personally I recommend APK Editor Studio

  • Decompile the APK with smali

To enable smali on APK Editor Studio: Settings -> Options (CTRL + P) -> Apktool -> Decompile source code (smali)

  • Open the contents of the APK

  • Go to this path/smali/com/robtopx/geometryjump and open GeometryJump.smali

  • Copy + Paste this code 3 times

  • Change the string to match our .so file names. Note: names are without lib and without .so

    .line 70
    const-string v0, "cocos2dcpp"

    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

In the Geometry dash 2.11 APK the method should look like this

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 69
    const-string v0, "fmod"

    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

    .line 70
    const-string v0, "cocos2dcpp"

    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

    .line 70
    const-string v0, "dobby"

    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

    .line 70
    const-string v0, "hooking"

    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

    .line 70
    const-string v0, "game"

    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

    .line 85
    return-void
.end method
  • Last, move the .so files to the /lib/armeabi-v7a folder
  • Compile the APK and if sign it manually if necessary (APK Editor Sutdio signs it for you)
  • Install APK

After this one-time setup you only need to update the libgame.so file inside the lib/armeabi-v7a/ folder.

All the source files contain a lot of comments which you should definitely read if you're just starting out :) (i recommend starting from main.cpp

Resources

  • Ghidra - A free reverse engineering tool, which is almost mandatory for GD modding
  • GD Programming - A discord server where you can ask a lot of questions :D
  • Awesome ADB - Everything there's to know about how to use ADB to speed up development
  • ADB Logcat - Powerful ADB command to print debug messages to console or to obtain crash logs
  • cocos2dx - Documentation for the version of cocos robtop uses as a base (with robtop modifications documented)

Credits