A repository for further experimenting with elf loading and in-place patching of android native libraries on non-android operating systems.
This attempts to fix several shortcomings the previous versions of GMLoader had, offering a more compliant compatibility layer, and an elf loader that supports even more relocation types.
This repository contains a lot of incomplete, experimental and untested code, and behavior is not guaranteed to match specifications, specially when it comes to the fake JNI implementation.
Corrections, fixes, issue reports and optimizations are always welcome.
git clone <repository url> --recursive
ARCH
: Specify the architecture, e.g.:aarch64-linux-gnu
orarm-linux-gnueabihf
LLVM_FILE
: Specify the LLVM Clang library file, e.g.:/usr/lib/llvm-9/lib/libclang-9.so.1
for clang-9.LLVM_INC
: Specify the path for LLVM includes for your architecture, e.g.:aarch64-linux-gnu
.OPTM
: Specify the optimization flags, e.g.:-O3
,-Os
or-Og -ggdb
.
make -f Makefile.gmloader ARCH=aarch64-linux-gnu
Or, for a debian bullseye chroot within wsl2:
make -f Makefile.gmloader \
ARCH=aarch64-linux-gnu \
LLVM_FILE=/usr/lib/llvm-11/lib/libclang-11.so.1 \
LLVM_INC=/usr/aarch64-linux-gnu/include/c++/10/aarch64-linux-gnu \
-j$(nproc)
python3 scripts/generate_libc.py aarch64-linux-gnu --llvm-includes /usr/aarch64-linux-gnu/include/c++/10/aarch64-linux-gnu --llvm-library-file "/usr/lib/llvm-11/lib/libclang-11.so.1"
In order to deploy, you must copy the lib
redist folder in the application's folder,
those files are part of the runtime, and are required to provide the functionality needed
by the runner.
See the related documentation for reference.
The android libraries can be debugged with gdb
using a breakpoint trick - check out the provided debugging example.
For this to be possible, you must extract the libraries from the APK into the application's library folder following the same structure as you would on the APK.
gmloadernext can load a json formatted configuration file using the -c
option. For exemple ./gmloader.aarch64 -c gmloader.conf
gmloader.conf:
{
"save_dir" : "gamedata",
"apk_path" : "my_game.apk",
"show_cursor" : false,
"disable_controller" : false,
"force_platform" : "os_windows"
}
When no configuration file is present the default values are:
Parameter name | Default value |
---|---|
save_dir | ./ |
apk_path | game.apk |
show_cursor | true |
disable_controller | false |
force_platform | os_android |
Supported values for force_platform are:
- os_unknown
- os_windows
- os_macosx
- os_ios
- os_android
- os_linux
- os_psvita
- os_ps4
- os_xboxone
- os_tvos
- os_switch
This is free software. The source files in this repository are released under the GPLv2 License, see the license file for more information.