|
| 1 | +# Bogodroid |
| 2 | + |
| 3 | +### **WARNING: VERY EARLY IN DEVELOPMENT, VERY NON-FUNCTIONAL, CODE QUALITY QUESTIONABLE** |
| 4 | + |
| 5 | +This is an experimental project attempting to create a wrapper environment around native libraries (armeabi) from Android Apps, with the intent of running the libraries (or entire apps and games) on ARM Linux (armhf and arm64) handhelds. |
| 6 | + |
| 7 | +The project is heavily based on [JohnnyOnFlame/droidports](https://github.com/JohnnyonFlame/droidports) and [ChristopherHX/libjnivm](https://github.com/ChristopherHX/libjnivm). |
| 8 | + |
| 9 | +The idea is to: |
| 10 | +- load the libraries, patch them at runtime |
| 11 | +- wrap, bridge or stub any required symbols from Android system libraries |
| 12 | +- Provide a JNI interface for communication with placeholder "java" classes |
| 13 | +- Provide implementations and stubs for common java and android classes |
| 14 | +- Ultimately wrap Audio, GLES and Input to host interfaces and libraries. |
| 15 | + |
| 16 | +This project does not aim to be able to run your App out of the box. It is meant as a framework or starting point for your own porting project. For existing porting projects, check the "Ports in progress" table and the projects folder. |
| 17 | + |
| 18 | +# How to Build (Debug) |
| 19 | + |
| 20 | +(This process will be simplified later on) |
| 21 | + |
| 22 | +1. Create a armhf chroot environment for building and testing. I recommend [this VM](https://forum.odroid.com/viewtopic.php?p=306185#p306185) image as a starting point. |
| 23 | +2. Clone the repository into your chroot |
| 24 | +3. Create the folder "./libjnivm/build" inside the repository and enter it |
| 25 | +4. `cmake .. --build -DJNIVM_ENABLE_TRACE=ON -DJNIVM_ENABLE_GC=ON -DJNIVM_ENABLE_DEBUG=ON -DJNIVM_USE_FAKE_JNI_CODEGEN=ON ` |
| 26 | +5. Create the folder "./build" inside the repository and enter it |
| 27 | +6. `cmake .. --build` |
| 28 | + |
| 29 | +By default this will build the `unityloader` project. If you want to build a different project, you can specify the project in step 6 with `cmake .. --build -DPROJ=<project name>` |
| 30 | + |
| 31 | +# Running |
| 32 | + |
| 33 | +Currently, the `unityloader` and `hexagonloader` expect a commandline argument to a folder where you extracted the apk of your target. one folder above that should contain the folder `support_files` from the `gamefiles` directory. The easiest way is to extract your apk in the `gamefiles` folder, and run directly from the build directory, like this: |
| 34 | + |
| 35 | +`./unityloader ../gamefiles/testgame/` |
| 36 | + |
| 37 | +# Debugging with QEMU and GDB-multiarch |
| 38 | + |
| 39 | +(This expects the chroot environment as provided by [this VM](https://forum.odroid.com/viewtopic.php?p=306185#p306185)) |
| 40 | + |
| 41 | +1. Exit your chroot, we will call the binary directly |
| 42 | +2. Enter the build directory |
| 43 | +3. Start the binary with: |
| 44 | +`QEMU_LD_PREFIX=/mnt/data/armhf/ qemu-arm-static -g 5 ./unityloader ../gamefiles/testgame/` |
| 45 | +4. Open another terminal and type in `gdb-multiarch` |
| 46 | +5. Enter the location of your chroot: `set sysroot /mnt/data/armhf` |
| 47 | +6. Enter the location of your binary: `file /mnt/data/armhf/root/bogodroid/build/unityloader` |
| 48 | +7. Connect to the open GDB session in QEMU: `target remote :5` |
| 49 | +6. "c" to run the program, "si" to step a single instruction, "bt" to read stack trace, "break" to set breakpoint. ***Refer to the GDB manpage and internet resources on how to debug*** |
| 50 | + |
| 51 | +# JNI Tracing your App |
| 52 | + |
| 53 | +(This requires a rooted Android device and a computer with ADB and Python installed) |
| 54 | + |
| 55 | +1. [Install a Frida server on your Android device](https://frida.re/docs/android/) |
| 56 | +2. Install jnitrace on your computer: `pip install jnitrace` |
| 57 | +3. Run the trace: `jnitrace -o jnitrace.json com.example.myapplication` |
| 58 | +4. Press CTRL-C to finish aquiring data |
| 59 | +5. `jnitrace.json` will contain all JNI calls made by the application |
| 60 | +6. `python tools/jnitrace_parse.py <input_json_file> <output_json_file>` will give you a consolidated tree of all classes, methods and fields (and their signatures) accessed during the tracing period. |
| 61 | + |
| 62 | +See `tools/unity_traces` for a trace of a minimal Unity game starting up |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +# Ports in Progress |
| 69 | + |
| 70 | +| Name | Arch | Status | Notes | |
| 71 | +|-----------------------------------|-------|---------------|--------------------------------------------------------------------------------------------------------------------| |
| 72 | +| Unity (Mono) | ARMv7 | Not Booting | Makes it 70% through initialization. Crashes when Mono creates first thread. Pthread bridge needs to be reworked. | |
| 73 | +| Super Hexagon | ARMv7 | Not Booting | Crashes very early during init while writing first log message. Issue with libc++_shared.so | |
| 74 | +| Crazy Taxi Classic | ARMv7 | Investigated | Requires better file handling for loading the big OBB files, before it can be attempted. | |
| 75 | +| Limbo | ARMv7 | Not attempted | | |
| 76 | +| Terraria | ARMv7 | Not attempted | (Engine: FNA, Monogame port might be easier) | |
| 77 | +| Baba is you | ARMv7 | Not attempted | | |
| 78 | +| Super Meat Boy Forever | ARMv7 | Not attempted | | |
| 79 | +| Streets of rage 4 | ARMv7 | Not attempted | (Engine: FNA, Monogame port might be easier) | |
| 80 | +| Chrono Trigger | ARMv7 | Not attempted | (Engine: cocos2d-x) | |
| 81 | +| Dead Cells | ARMv7 | Not attempted | | |
| 82 | +| Brotato | ARMv7 | Not attempted | | |
| 83 | +| Castlevania Symphony of the Night | ARMv7 | Not attempted | | |
| 84 | +| Five Nights At Freddy | ARMv7 | Not attempted | | |
| 85 | +| Gris | ARMv7 | Not attempted | | |
| 86 | +| The way home | ARMv7 | Not attempted | | |
| 87 | +| Vampire Survivors | ARMv7 | Not attempted | | |
| 88 | +| Scourgebringer | ARMv7 | Not attempted | | |
| 89 | +| Haak | ARMv7 | Not attempted | | |
| 90 | + |
| 91 | + |
| 92 | + |
0 commit comments